summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYacine Belkadi2012-12-10 17:46:46 +0100
committerYacine Belkadi2012-12-20 11:47:14 +0100
commit49997122f5183bffcc21c66cbd3bbc5b2138f734 (patch)
tree2f4d1068d724660cee0fe8a02ced3b000264ce31
parentcacbf507307e5452d053da61e58e74dc8aebdc4f (diff)
cleo/u-boot/drv/netspcmac: for IP175, wait for link up of one sub-PHYs, refs #3519
The IP175 switch always says that it has a link up. This breaks the purpose of spcmac_phy_wait_link_up(). As a result the PHY may not be ready for the spidupdate phase, and the spidupdate packet may be missed. So, for the IP175 switch, consider there is a link up only if at least one of the sub-PHYs has a link up.
-rw-r--r--cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
index 41b1023ac7..4d81ae758f 100644
--- a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
+++ b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
@@ -418,6 +418,19 @@ static int spcmac_phy_ip175_init (const struct phy_device *phy_dev, int lp_an_ab
return spcmac_phy_gen_init (phy_dev, lp_an_able);
}
+static int spcmac_phy_ip175_is_link_up (const struct phy_device *phy_dev)
+{
+ /* This is a switch, check if any of the 4 sub-PHYs has a link up. */
+ uint phy_addr;
+ for (phy_addr = 0; phy_addr <= 4; phy_addr++)
+ {
+ uint status = spcmac_mii_read (phy_addr, MII_BMSR);
+ if (status & BMSR_LSTATUS)
+ return 1;
+ }
+ return 0;
+}
+
static int spcmac_phy_ip175_reset (const struct phy_device *phy_dev)
{
/* check if it is an IP175D */
@@ -555,6 +568,7 @@ static int spcmac_phy_init_dev (struct phy_device *phy_dev)
&& (phy_addr == 5))
{
phy_dev->init = spcmac_phy_ip175_init;
+ phy_dev->is_link_up = spcmac_phy_ip175_is_link_up;
phy_dev->reset = spcmac_phy_ip175_reset;
}
else if ((phy_oui == VITESSE_OUI) && (phy_model == VITESSE_VSC8601))