summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2015-09-21 09:25:37 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2015-09-21 09:25:37 (GMT)
commitfa6f496e8a10b4dd711376f3212e097e949c7dba (patch)
treec794b99c76cdaeef281ef830bc648833111fece5
parent9cc830ef6383932e0e93882ca7edf70c8c1362ba (diff)
downloadbspam335x-fa6f496e8a10b4dd711376f3212e097e949c7dba.zip
bspam335x-fa6f496e8a10b4dd711376f3212e097e949c7dba.tar.gz
bspam335x-fa6f496e8a10b4dd711376f3212e097e949c7dba.tar.bz2
Fixed cpsw driver link speed bug.
-rw-r--r--SylixOS/driver/netif/am335x_cpsw.c4
-rw-r--r--SylixOS/driver/netif/cpswif.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/SylixOS/driver/netif/am335x_cpsw.c b/SylixOS/driver/netif/am335x_cpsw.c
index 72c49ad..cbabb42 100644
--- a/SylixOS/driver/netif/am335x_cpsw.c
+++ b/SylixOS/driver/netif/am335x_cpsw.c
@@ -72,7 +72,7 @@ static __AM335X_CPSW_PORTIF _G_am335xCpswPortIfs[MAX_CPSW_INST * MAX_SLAVEPO
/*********************************************************************************************************
外部函数
*********************************************************************************************************/
-extern err_t cpswif_autoneg_config(u32_t inst_num, u32_t port_num);
+extern err_t cpswif_autoneg_config(struct netif *netif, u32_t inst_num, u32_t port_num);
/*********************************************************************************************************
网络工作队列
*********************************************************************************************************/
@@ -276,7 +276,7 @@ static VOID __am335xCpswLinkStatusCheck (UINT uiInstNum, UINT uiSlavePortNum)
if (!(pCpswPortIf->flags & NETIF_FLAG_LINK_UP)) {
- if (ERR_OK == cpswif_autoneg_config(uiInstNum, uiSlavePortNum)) {
+ if (ERR_OK == cpswif_autoneg_config(pNetIf, uiInstNum, uiSlavePortNum)) {
pCpswPortIf->flags |= NETIF_FLAG_LINK_UP;
diff --git a/SylixOS/driver/netif/cpswif.c b/SylixOS/driver/netif/cpswif.c
index 912ddd2..d00eac3 100644
--- a/SylixOS/driver/netif/cpswif.c
+++ b/SylixOS/driver/netif/cpswif.c
@@ -1522,7 +1522,7 @@ static err_t
cpswif_autoneg_config(u32_t inst_num, u32_t port_num) {
#else
err_t
-cpswif_autoneg_config(u32_t inst_num, u32_t port_num) {
+cpswif_autoneg_config(struct netif *netif, u32_t inst_num, u32_t port_num) {
#endif
struct cpswinst *cpswinst = &cpsw_inst_data[inst_num];
err_t linkstat = ERR_CONN;
@@ -1580,25 +1580,32 @@ cpswif_autoneg_config(u32_t inst_num, u32_t port_num) {
if(gbps_partnr_ablty & PHY_LINK_PARTNER_1000BT_FD) {
LWIP_PRINTF("PHY %d Transfer Mode : 1000 Mbps.", port_num);
transfer_mode = CPSW_SLIVER_GIG_FULL_DUPLEX;
+ netif->link_speed = 1000 * 1000 * 1000;
} else {
if ((adv_val & partnr_ablty) & PHY_100BTX_FD) {
LWIP_PRINTF("PHY %d Transfer Mode : 100 Mbps Full Duplex.", port_num);
transfer_mode = CPSW_SLIVER_NON_GIG_FULL_DUPLEX;
+ netif->link_speed = 100 * 1000 * 1000;
} else if ((adv_val & partnr_ablty) & PHY_100BTX) {
LWIP_PRINTF("PHY %d Transfer Mode : 100 Mbps Half Duplex.", port_num);
transfer_mode = CPSW_SLIVER_NON_GIG_HALF_DUPLEX;
+ netif->link_speed = 100 * 1000 * 1000;
} else if ((adv_val & partnr_ablty) & PHY_10BT_FD) {
LWIP_PRINTF("PHY %d Transfer Mode : 10 Mbps Full Duplex.", port_num);
transfer_mode = CPSW_SLIVER_INBAND | CPSW_SLIVER_NON_GIG_FULL_DUPLEX;
+ netif->link_speed = 10 * 1000 * 1000;
} else if ((adv_val & partnr_ablty) & PHY_10BT) {
LWIP_PRINTF("PHY %d Transfer Mode : 10 Mbps Half Duplex.", port_num);
transfer_mode = CPSW_SLIVER_INBAND | CPSW_SLIVER_NON_GIG_HALF_DUPLEX;
+ netif->link_speed = 10 * 1000 * 1000;
} else {
LWIP_PRINTF("PHY %d No Valid Transfer Mode is detected.", port_num);
+ netif->link_speed = 0;
}
}
} else {
LWIP_PRINTF("PHY %d Auto-Negotiation Not Successful.", port_num);
+ netif->link_speed = 0;
linkstat = ERR_CONN;
}