summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2016-04-29 02:27:14 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2016-04-29 02:27:14 (GMT)
commit6ea0171c9a74db301df298c13b91786e9941cbfc (patch)
tree48a328af3039e2669f6e36f2a8ffdd1239741641
parent4ec6c4253ed1243aa2334dd8caac767014947f7b (diff)
downloadbspam335x-6ea0171c9a74db301df298c13b91786e9941cbfc.zip
bspam335x-6ea0171c9a74db301df298c13b91786e9941cbfc.tar.gz
bspam335x-6ea0171c9a74db301df298c13b91786e9941cbfc.tar.bz2
Fixed cpsw netif driver dual net port bug.
-rw-r--r--SylixOS/driver/netif/cpswif.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/SylixOS/driver/netif/cpswif.c b/SylixOS/driver/netif/cpswif.c
index bf5f152..76555b5 100644
--- a/SylixOS/driver/netif/cpswif.c
+++ b/SylixOS/driver/netif/cpswif.c
@@ -2153,28 +2153,32 @@ cpswif_phylink_config(struct cpswportif * cpswif, u32_t slv_port_num) {
return ERR_CONN;
}
#else
- int i;
-
- for (i = 0; i < 32; i++) {
- if (MDIOPhyAliveStatusGet(cpswinst->mdio_base) & (1 << i)) {
- break;
+ if (0 == (MDIOPhyAliveStatusGet(cpswinst->mdio_base) &
+ (1 << cpswinst->port[slv_port_num - 1].phy_addr))) {
+
+ int i;
+
+ for (i = 0; i < 32; i++) {
+ if (MDIOPhyAliveStatusGet(cpswinst->mdio_base) & (1 << i)) {
+ break;
+ } else {
+ LWIP_PRINTF("No PHY found at address %d for Port %d of Instance %d.",
+ i, slv_port_num,
+ cpswif->inst_num);
+ }
+ }
+
+ if (i == 32) {
+ while(0 == (MDIOPhyAliveStatusGet(cpswinst->mdio_base)
+ & (1 << cpswinst->port[slv_port_num - 1].phy_addr))){
+ LWIP_PRINTF("No PHY found at address %d for Port %d of Instance %d.",
+ cpswinst->port[slv_port_num - 1].phy_addr, slv_port_num,
+ cpswif->inst_num);
+ sleep(1);
+ }
} else {
- LWIP_PRINTF("No PHY found at address %d for Port %d of Instance %d.",
- i, slv_port_num,
- cpswif->inst_num);
- }
- }
-
- if (i == 32) {
- while(0 == (MDIOPhyAliveStatusGet(cpswinst->mdio_base)
- & (1 << cpswinst->port[slv_port_num - 1].phy_addr))){
- LWIP_PRINTF("No PHY found at address %d for Port %d of Instance %d.",
- cpswinst->port[slv_port_num - 1].phy_addr, slv_port_num,
- cpswif->inst_num);
- sleep(1);
+ cpswinst->port[slv_port_num - 1].phy_addr = i;
}
- } else {
- cpswinst->port[slv_port_num - 1].phy_addr = i;
}
#endif