summaryrefslogtreecommitdiff
path: root/drivers/net/at91_emac.c
diff options
context:
space:
mode:
authorandreas.devel@googlemail.com <andreas.devel@googlemail.com>2011-06-09 00:22:54 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2011-06-21 22:26:22 +0200
commit2321bfe425385494da8739d7d7e9dd3a5ca18a84 (patch)
tree7fc1a1cf40401fa9d4ddc1e4bf55b9ebbbb23865 /drivers/net/at91_emac.c
parentfd2f5658093eca72467f0104659f4826a95f948c (diff)
downloadu-boot-imx-2321bfe425385494da8739d7d7e9dd3a5ca18a84.zip
u-boot-imx-2321bfe425385494da8739d7d7e9dd3a5ca18a84.tar.gz
u-boot-imx-2321bfe425385494da8739d7d7e9dd3a5ca18a84.tar.bz2
at91_emac: fix compile warning
This patch removes the warning ---8<--- at91_emac.c: In function 'at91emac_write_hwaddr': at91_emac.c:487:2: warning: dereferencing type-punned pointer will break strict-aliasing rules --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@gmail.com>
Diffstat (limited to 'drivers/net/at91_emac.c')
-rw-r--r--drivers/net/at91_emac.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
index b09ff8c..97d2739 100644
--- a/drivers/net/at91_emac.c
+++ b/drivers/net/at91_emac.c
@@ -481,11 +481,13 @@ static int at91emac_write_hwaddr(struct eth_device *netdev)
dev = (emac_device *) netdev->priv;
writel(1 << ATMEL_ID_EMAC, &pmc->pcer);
- DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
- cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))),
- cpu_to_le32(*((u32 *)netdev->enetaddr)));
- writel(cpu_to_le32(*((u32 *)netdev->enetaddr)), &emac->sa2l);
- writel(cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))), &emac->sa2h);
+ DEBUG_AT91EMAC("init MAC-ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
+ netdev->enetaddr[5], netdev->enetaddr[4], netdev->enetaddr[3],
+ netdev->enetaddr[2], netdev->enetaddr[1], netdev->enetaddr[0]);
+ writel( (netdev->enetaddr[0] | netdev->enetaddr[1] << 8 |
+ netdev->enetaddr[2] << 16 | netdev->enetaddr[3] << 24),
+ &emac->sa2l);
+ writel((netdev->enetaddr[4] | netdev->enetaddr[5] << 8), &emac->sa2h);
DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
readl(&emac->sa2h), readl(&emac->sa2l));
return 0;