diff options
author | Wolfgang Denk <wd@denx.de> | 2010-10-11 10:24:22 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-10-11 10:24:22 +0200 |
commit | ddf71e4cfffb4792445d3473cfc9326d07e6557c (patch) | |
tree | 304de15eacb23a55a1eae6e2fc3c9d3726d8290f /drivers/net/at91_emac.c | |
parent | e67f46286440a53fb1d693152667ea3b1a6b3060 (diff) | |
parent | c8f6d84d10d324e0b0462e09629f210b046e1018 (diff) | |
download | u-boot-imx-ddf71e4cfffb4792445d3473cfc9326d07e6557c.zip u-boot-imx-ddf71e4cfffb4792445d3473cfc9326d07e6557c.tar.gz u-boot-imx-ddf71e4cfffb4792445d3473cfc9326d07e6557c.tar.bz2 |
Merge branch 'at91' of git://git.denx.de/u-boot-atmel
Diffstat (limited to 'drivers/net/at91_emac.c')
-rw-r--r-- | drivers/net/at91_emac.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c index d82459b..ca2b16b 100644 --- a/drivers/net/at91_emac.c +++ b/drivers/net/at91_emac.c @@ -127,13 +127,19 @@ void at91emac_DisableMDIO(at91_emac_t *at91mac) int at91emac_read(at91_emac_t *at91mac, unsigned char addr, unsigned char reg, unsigned short *value) { + unsigned long netstat; at91emac_EnableMDIO(at91mac); writel(AT91_EMAC_MAN_HIGH | AT91_EMAC_MAN_RW_R | AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 | AT91_EMAC_MAN_PHYA(addr), &at91mac->man); - udelay(10000); + + do { + netstat = readl(&at91mac->sr); + DEBUG_AT91PHY("poll SR %08lx\n", netstat); + } while (!(netstat & AT91_EMAC_SR_IDLE)); + *value = readl(&at91mac->man) & AT91_EMAC_MAN_DATA_MASK; at91emac_DisableMDIO(at91mac); @@ -146,6 +152,7 @@ int at91emac_read(at91_emac_t *at91mac, unsigned char addr, int at91emac_write(at91_emac_t *at91mac, unsigned char addr, unsigned char reg, unsigned short value) { + unsigned long netstat; DEBUG_AT91PHY("AT91PHY write %x REG(%d)=%x\n", at91mac, reg, &value) at91emac_EnableMDIO(at91mac); @@ -154,9 +161,14 @@ int at91emac_write(at91_emac_t *at91mac, unsigned char addr, AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 | AT91_EMAC_MAN_PHYA(addr) | (value & AT91_EMAC_MAN_DATA_MASK), &at91mac->man); - udelay(10000); + + do { + netstat = readl(&at91mac->sr); + DEBUG_AT91PHY("poll SR %08lx\n", netstat); + } while (!(netstat & AT91_EMAC_SR_IDLE)); at91emac_DisableMDIO(at91mac); + return 0; } @@ -500,11 +512,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase) memset(emacfix, 0, sizeof(emac_device)); memset(dev, 0, sizeof(*dev)); -#ifndef CONFIG_RMII - sprintf(dev->name, "AT91 EMAC"); -#else - sprintf(dev->name, "AT91 EMAC RMII"); -#endif + sprintf(dev->name, "emac"); dev->iobase = iobase; dev->priv = emacfix; dev->init = at91emac_init; |