lwip: Use updated autonegotiation for Zynq as well
Read specific status register for negotiated speed and return the same. The updated masks are only used for ZynqMP currently; follow the same for Zynq as well. Corrected alignment in a couple of lines. Signed-off-by: Harini Katakam <harinik@xilinx.com> Acked-by: Anirudha Sarangi <anirudh@xilinx.com>
This commit is contained in:
parent
73154541df
commit
aca7c184d4
1 changed files with 15 additions and 29 deletions
|
@ -396,8 +396,8 @@ static u32_t get_IEEE_phy_speed(XEmacPs *xemacpsp, u32_t phy_addr)
|
|||
control);
|
||||
} else {
|
||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_1000_ADVERTISE_REG_OFFSET,
|
||||
&control);
|
||||
control &= ~ADVERTISE_1000;
|
||||
&control);
|
||||
control &= ~ADVERTISE_1000;
|
||||
XEmacPs_PhyWrite(xemacpsp, phy_addr, IEEE_1000_ADVERTISE_REG_OFFSET,
|
||||
control);
|
||||
}
|
||||
|
@ -432,17 +432,11 @@ static u32_t get_IEEE_phy_speed(XEmacPs *xemacpsp, u32_t phy_addr)
|
|||
sleep(1);
|
||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_COPPER_SPECIFIC_STATUS_REG_2,
|
||||
&temp);
|
||||
if(gigeversion == 2) {
|
||||
if (temp & IEEE_AUTONEG_ERROR_MASK) {
|
||||
xil_printf("Auto negotiation error \r\n");
|
||||
}
|
||||
} else {
|
||||
timeout_counter++;
|
||||
timeout_counter++;
|
||||
|
||||
if (timeout_counter == 30) {
|
||||
xil_printf("Auto negotiation error \r\n");
|
||||
return;
|
||||
}
|
||||
if (timeout_counter == 30) {
|
||||
xil_printf("Auto negotiation error \r\n");
|
||||
return;
|
||||
}
|
||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_STATUS_REG_OFFSET,
|
||||
&status);
|
||||
|
@ -450,25 +444,17 @@ static u32_t get_IEEE_phy_speed(XEmacPs *xemacpsp, u32_t phy_addr)
|
|||
xil_printf("autonegotiation complete \r\n");
|
||||
XEmacPs_PhyRead(xemacpsp, phy_addr, IEEE_SPECIFIC_STATUS_REG, &status_speed);
|
||||
|
||||
if (gigeversion == 2) {
|
||||
if ( ((status_speed >> 14) & 3) == 2)/* 1000Mbps */
|
||||
return 1000;
|
||||
else if ( ((status_speed >> 14) & 3) == 1)/* 100Mbps */
|
||||
return 100;
|
||||
else /* 10Mbps */
|
||||
return 10;
|
||||
} else {
|
||||
if (status_speed & 0x400) {
|
||||
temp_speed = status_speed & IEEE_SPEED_MASK;
|
||||
if (status_speed & 0x400) {
|
||||
temp_speed = status_speed & IEEE_SPEED_MASK;
|
||||
|
||||
if (temp_speed == IEEE_SPEED_1000)
|
||||
return 1000;
|
||||
else if(temp_speed == IEEE_SPEED_100)
|
||||
return 100;
|
||||
else
|
||||
return 10;
|
||||
}
|
||||
if (temp_speed == IEEE_SPEED_1000)
|
||||
return 1000;
|
||||
else if(temp_speed == IEEE_SPEED_100)
|
||||
return 100;
|
||||
else
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static u32_t configure_IEEE_phy_speed(XEmacPs *xemacpsp, u32_t phy_addr, u32_t speed)
|
||||
|
|
Loading…
Add table
Reference in a new issue