diff options
author | Mahesh Mahadevan <r9aadq@freescale.com> | 2011-11-02 10:16:23 -0500 |
---|---|---|
committer | Mahesh Mahadevan <r9aadq@freescale.com> | 2011-11-02 10:16:23 -0500 |
commit | 01a080fe6c11de531f79d0a05d7a06dac1708e41 (patch) | |
tree | d1326385f95b77121d5cf015cda4df738f12314a /board | |
parent | 9aa74e691a1de2e471af837d72a5a3acc274c540 (diff) | |
download | u-boot-imx-01a080fe6c11de531f79d0a05d7a06dac1708e41.zip u-boot-imx-01a080fe6c11de531f79d0a05d7a06dac1708e41.tar.gz u-boot-imx-01a080fe6c11de531f79d0a05d7a06dac1708e41.tar.bz2 |
ENGR00161294 Update MX6 code to read MAC address from fuses
Fix the code to read the MAC address correctly from the fuses
Signed-off-by: Mahesh Mahadevan <r9aadq@freescale.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/freescale/mx6q_arm2/mx6q_arm2.c | 15 | ||||
-rw-r--r-- | board/freescale/mx6q_sabrelite/mx6q_sabrelite.c | 14 |
2 files changed, 20 insertions, 9 deletions
diff --git a/board/freescale/mx6q_arm2/mx6q_arm2.c b/board/freescale/mx6q_arm2/mx6q_arm2.c index 4e1cc73..b7853ac 100644 --- a/board/freescale/mx6q_arm2/mx6q_arm2.c +++ b/board/freescale/mx6q_arm2/mx6q_arm2.c @@ -411,12 +411,17 @@ void spi_io_init(struct imx_spi_dev_t *dev) int fec_get_mac_addr(unsigned char *mac) { - u32 *ocotp_mac_base = - (u32 *)(OCOTP_BASE_ADDR + HW_OCOTP_MACn(0)); - int i; + unsigned int value; + + value = readl(OCOTP_BASE_ADDR + HW_OCOTP_MACn(0)); + mac[0] = value & 0xff; + mac[1] = (value >> 8) & 0xff; + mac[2] = (value >> 16) & 0xff; + mac[3] = (value >> 24) & 0xff; + value = readl(OCOTP_BASE_ADDR + HW_OCOTP_MACn(1)); + mac[4] = value & 0xff; + mac[5] = (value >> 8) & 0xff; - for (i = 0; i < 6; ++i, ++ocotp_mac_base) - mac[6 - 1 - i] = readl(++ocotp_mac_base); return 0; } diff --git a/board/freescale/mx6q_sabrelite/mx6q_sabrelite.c b/board/freescale/mx6q_sabrelite/mx6q_sabrelite.c index 39cd827..9f499e7 100644 --- a/board/freescale/mx6q_sabrelite/mx6q_sabrelite.c +++ b/board/freescale/mx6q_sabrelite/mx6q_sabrelite.c @@ -302,11 +302,17 @@ void spi_io_init(struct imx_spi_dev_t *dev) int fec_get_mac_addr(unsigned char *mac) { - u32 *ocotp_mac_base = (u32 *) (OCOTP_BASE_ADDR + HW_OCOTP_MACn(0)); - int i; + unsigned int value; + + value = readl(OCOTP_BASE_ADDR + HW_OCOTP_MACn(0)); + mac[0] = value & 0xff; + mac[1] = (value >> 8) & 0xff; + mac[2] = (value >> 16) & 0xff; + mac[3] = (value >> 24) & 0xff; + value = readl(OCOTP_BASE_ADDR + HW_OCOTP_MACn(1)); + mac[4] = value & 0xff; + mac[5] = (value >> 8) & 0xff; - for (i = 0; i < 6; ++i, ++ocotp_mac_base) - mac[6 - 1 - i] = readl(++ocotp_mac_base); return 0; } |