]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: emaclite: Fix systems without mdio bus
authorMichal Simek <monstr@monstr.eu>
Thu, 27 Sep 2012 07:10:42 +0000 (09:10 +0200)
committerMichal Simek <monstr@monstr.eu>
Thu, 27 Sep 2012 07:12:21 +0000 (09:12 +0200)
Setup phy only for system which has mdio bus.
Detection is done by writing MDIO Enable bit
and reread it back. If is not setup IP has no
MDIO support.

Signed-off-by: Michal Simek <monstr@monstr.eu>
drivers/net/xilinx_emaclite.c

index 6e84dcbb675e2dbe56223e13d287ef54e478a334..34d26e4f28ece0495906be4ee8d5d69f71c389de 100644 (file)
@@ -276,6 +276,10 @@ static int setup_phy(struct eth_device *dev)
 static int emaclite_init(struct eth_device *dev, bd_t *bis)
 {
        struct xemaclite *emaclite = dev->priv;
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
+       u32 temp;
+#endif
+
        debug("EmacLite: Initialization Started\n");
 
 /*
@@ -319,8 +323,11 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis)
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
        /* Enable MII PHY */
-       out_be32((u32 *)(dev->iobase + XEL_MDIOCTRL_OFFSET), 0x8);
-       setup_phy(dev);
+       /* Enable MII PHY */
+       out_be32((u32 *)(dev->iobase + XEL_MDIOCTRL_OFFSET), XEL_MDIOCTRL_MDIOEN_MASK);
+       temp = in_be32((u32 *)(dev->iobase + XEL_MDIOCTRL_OFFSET));
+       if (temp & XEL_MDIOCTRL_MDIOEN_MASK)
+               setup_phy(dev);
 #endif
 
        debug("EmacLite Initialization complete\n");