diff options
author | Wolfgang Denk <wd@denx.de> | 2009-02-01 21:31:37 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-02-01 21:31:37 +0100 |
commit | ee924e00300bd1136589b2d5f8ad1f008df01bd4 (patch) | |
tree | 4f517ecc2faf55dbaa3145835eef2eac2e0a4033 /drivers/net/macb.c | |
parent | f4b6f45dcba989f5a900edc07ececae80c79abdf (diff) | |
parent | fc01ea1e27d5b124f0a1868d0ce569f156d58dfe (diff) | |
download | u-boot-imx-ee924e00300bd1136589b2d5f8ad1f008df01bd4.zip u-boot-imx-ee924e00300bd1136589b2d5f8ad1f008df01bd4.tar.gz u-boot-imx-ee924e00300bd1136589b2d5f8ad1f008df01bd4.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r-- | drivers/net/macb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 98e8c73..af0409b 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -317,6 +317,30 @@ static void macb_phy_reset(struct macb_device *macb) netdev->name, status); } +#ifdef CONFIG_MACB_SEARCH_PHY +static int macb_phy_find(struct macb_device *macb) +{ + int i; + u16 phy_id; + + /* Search for PHY... */ + for (i = 0; i < 32; i++) { + macb->phy_addr = i; + phy_id = macb_mdio_read(macb, MII_PHYSID1); + if (phy_id != 0xffff) { + printf("%s: PHY present at %d\n", macb->netdev.name, i); + return 1; + } + } + + /* PHY isn't up to snuff */ + printf("%s: PHY not found", macb->netdev.name); + + return 0; +} +#endif /* CONFIG_MACB_SEARCH_PHY */ + + static int macb_phy_init(struct macb_device *macb) { struct eth_device *netdev = &macb->netdev; @@ -325,6 +349,13 @@ static int macb_phy_init(struct macb_device *macb) int media, speed, duplex; int i; +#ifdef CONFIG_MACB_SEARCH_PHY + /* Auto-detect phy_addr */ + if (!macb_phy_find(macb)) { + return 0; + } +#endif /* CONFIG_MACB_SEARCH_PHY */ + /* Check if the PHY is up to snuff... */ phy_id = macb_mdio_read(macb, MII_PHYSID1); if (phy_id == 0xffff) { |