diff options
author | Eric Bénard <eric@eukrea.com> | 2010-06-21 09:41:16 +0200 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2010-07-12 00:14:29 -0700 |
commit | 409943a98961661fd93fb055a3d302184901dda5 (patch) | |
tree | 82336361cd796e7439e8ca4e3ca6e05a7315b9e4 | |
parent | cafb14fecb2085299b1b06beb93d27d46efdfe52 (diff) | |
download | u-boot-imx-409943a98961661fd93fb055a3d302184901dda5.zip u-boot-imx-409943a98961661fd93fb055a3d302184901dda5.tar.gz u-boot-imx-409943a98961661fd93fb055a3d302184901dda5.tar.bz2 |
at91_emac: Write MAC address automatically
tested on cpuat91.
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
-rw-r--r-- | drivers/net/at91_emac.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c index 2399569..fa72e2c 100644 --- a/drivers/net/at91_emac.c +++ b/drivers/net/at91_emac.c @@ -348,14 +348,6 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd) writel(1 << AT91_ID_EMAC, &pmc->pcer); writel(readl(&emac->ctl) | AT91_EMAC_CTL_CSR, &emac->ctl); - 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 %x%x \n", - readl(&emac->sa2h), readl(&emac->sa2l)); - /* Init Ethernet buffers */ for (i = 0; i < RBF_FRAMEMAX; i++) { dev->rbfdt[i].addr = (unsigned long) NetRxPackets[i]; @@ -456,6 +448,25 @@ static int at91emac_recv(struct eth_device *netdev) return 0; } +static int at91emac_write_hwaddr(struct eth_device *netdev) +{ + emac_device *dev; + at91_emac_t *emac; + at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE; + emac = (at91_emac_t *) netdev->iobase; + dev = (emac_device *) netdev->priv; + + writel(1 << AT91_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 %x%x \n", + readl(&emac->sa2h), readl(&emac->sa2l)); + return 0; +} + int at91emac_register(bd_t *bis, unsigned long iobase) { emac_device *emac; @@ -488,6 +499,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase) dev->halt = at91emac_halt; dev->send = at91emac_send; dev->recv = at91emac_recv; + dev->write_hwaddr = at91emac_write_hwaddr; eth_register(dev); |