]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: gem: Perform phy_detection for CONFIG_PHYLIB
authorMichal Simek <monstr@monstr.eu>
Mon, 22 Oct 2012 06:30:05 +0000 (08:30 +0200)
committerMichal Simek <monstr@monstr.eu>
Thu, 1 Nov 2012 10:51:24 +0000 (11:51 +0100)
any tftp or networking operation will cause this undefined instruction
issue:
{{{
U-Boot-PetaLinux> run load_boot
undefined instruction
pc : [<3fb68900>]    lr : [<3ff9ce00>]
sp : 3fb65be8  ip : 000a0003  fp : 00000000
r10: 3fb697c8  r9 : 3fb697b0  r8 : 3fb65f68
r7 : 3fb66478  r6 : ffffffff  r5 : 00000000  r4 : 3fb66500
r3 : 3fb688c8  r2 : 3fb66478  r1 : ffffffff  r0 : 3fb66500
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
}}}
this is because the CONFIG_PHY_ADDR is not defined in Petalogix-arm-auto.

workaround is to run phy_detection for CONFIG_PHYLIB or no CONFIG_PHYLIB.

Signed-off-by: Jason Wu <huanyu@xilinx.com>
drivers/net/zynq_gem.c

index 7f29b63f4f891b9673015e6632acb85e6be8e6c5..2ab4abdefabd4947ae6187a0f10b904ff2cd1fad 100644 (file)
@@ -225,6 +225,7 @@ static int phy_rst(struct eth_device *dev)
        puts("\nPHY reset complete.\n");
        return 0;
 }
+#endif
 
 static void phy_detection(struct eth_device *dev)
 {
@@ -261,7 +262,6 @@ static void phy_detection(struct eth_device *dev)
        }
        printf("PHY is not detected\n");
 }
-#endif
 
 static int zynq_gem_setup_mac(struct eth_device *dev)
 {
@@ -345,6 +345,8 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
        /* Setup for Network Control register, MDIO, Rx and Tx enable */
        setbits_le32(&regs->nwctrl, ZYNQ_GEM_NWCTRL_MDEN_MASK );
 
+       phy_detection(dev);
+
 #ifdef CONFIG_PHYLIB
        /* interface - look at tsec */
        phydev = phy_connect(priv->bus, priv->phyaddr, dev, 0);
@@ -398,7 +400,6 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
        phywrite(dev, priv->phyaddr, 22, 0);    /* page 0 */
 #endif
        u16 tmp;
-       phy_detection(dev);
 
        /* link speed advertisement for autonegotiation */
        phyread(dev, priv->phyaddr, 4, &tmp);