Skip to contentSkip to conversation

armv8: ls2080aqds: fix SGMII repeater settings

PATCH New shh.xie at gmail.com 4 participants 5 messages Oct 17, 2016 – Nov 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv8: ls2080aqds: fix SGMII repeater settings

From: Shaohui Xie <[email protected]>

The current value to check whether the PHY was configured has dependency on MC, it expects MC to start PCS AN, this is not true during boot up, so it should be changed to remove the dependency.

The PHY's register space should be restore to default after accessing extended space.

---
 board/freescale/ls2080aqds/eth.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
board/freescale/ls2080aqds/eth.c +8 -5
index 95ff68b..cf6791e 100644
@@ -144,8 +144,10 @@ static void sgmii_configure_repeater(int serdes_port)
 
 		mdelay(10);
 
-		if ((value & 0xfff) == 0x40f) {
+		if ((value & 0xfff) == 0x401) {
 			printf("DPMAC %d:PHY is ..... Configured\n", dpmac_id);
+			miiphy_write(dev[mii_bus], riser_phy_addr[dpmac],
+				     0x1f, 0);
 			continue;
 		}
 
@@ -181,28 +183,29 @@ static void sgmii_configure_repeater(int serdes_port)
 				if (ret > 0)
 					goto error;
 
-				mdelay(1);
+				mdelay(100);
 				ret = miiphy_read(dev[mii_bus],
 						  riser_phy_addr[dpmac],
 						  0x11, &value);
 				if (ret > 0)
 					goto error;
-				mdelay(10);
 
-				if ((value & 0xfff) == 0x40f) {
+				if ((value & 0xfff) == 0x401) {
 					printf("DPMAC %d :PHY is configured ",
 					       dpmac_id);
 					printf("after setting repeater 0x%x\n",
 					       value);
 					i = 5;
 					j = 5;
-				} else
+				} else {
 					printf("DPMAC %d :PHY is failed to ",
 					       dpmac_id);
 					printf("configure the repeater 0x%x\n",
 					       value);
 				}
+			}
 		}
+		miiphy_write(dev[mii_bus], riser_phy_addr[dpmac], 0x1f, 0);
 	}
 error:
 	if (ret)
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 1/1 armv8: ls2080aqds: fix SGMII repeater settings

Quoted 31 lines · shh.xie at gmail.com

From: Shaohui Xie <[email protected]>

The current value to check whether the PHY was configured has dependency on MC, it expects MC to start PCS AN, this is not true during boot up, so it should be changed to remove the dependency.

The PHY's register space should be restore to default after accessing extended space.

---
 board/freescale/ls2080aqds/eth.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
board/freescale/ls2080aqds/eth.c +3 -1
index 95ff68b..cf6791e 100644
@@ -144,8 +144,10 @@ static void sgmii_configure_repeater(int serdes_port)
 
 		mdelay(10);
 
-		if ((value & 0xfff) == 0x40f) {
+		if ((value & 0xfff) == 0x401) {
 			printf("DPMAC %d:PHY is ..... Configured\n", dpmac_id);
+			miiphy_write(dev[mii_bus], riser_phy_addr[dpmac],
+				     0x1f, 0);
 			continue;
 		}
 

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 186

Quoted 5 lines
board/freescale/ls2080aqds/eth.c +1 -1
@@ -181,28 +183,29 @@ static void sgmii_configure_repeater(int serdes_port)
 				if (ret > 0)
 					goto error;
 
-				mdelay(1);
+				mdelay(100);

Why change the delay?

Quoted 19 lines
board/freescale/ls2080aqds/eth.c +2 -3
 				ret = miiphy_read(dev[mii_bus],
 						  riser_phy_addr[dpmac],
 						  0x11, &value);
 				if (ret > 0)
 					goto error;
-				mdelay(10);
 
-				if ((value & 0xfff) == 0x40f) {
+				if ((value & 0xfff) == 0x401) {
 					printf("DPMAC %d :PHY is configured ",
 					       dpmac_id);
 					printf("after setting repeater 0x%x\n",
 					       value);
 					i = 5;
 					j = 5;
-				} else
+				} else {
 					printf("DPMAC %d :PHY is failed to ",

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 211

Quoted 10 lines
board/freescale/ls2080aqds/eth.c +2 -0
 					       dpmac_id);
 					printf("configure the repeater 0x%x\n",
 					       value);
 				}
+			}
 		}
+		miiphy_write(dev[mii_bus], riser_phy_addr[dpmac], 0x1f, 0);
 	}
 error:
 	if (ret)

Prabhakar,

Do these changes look correct to you?

York

#2 lore raw

PATCH 1/1 armv8: ls2080aqds: fix SGMII repeater settings

Hi York,

Quoted 82 lines

-----Original Message-----
From: york sun
Sent: Tuesday, November 08, 2016 12:12 AM
To: Prabhakar Kushwaha <[email protected]>
Cc: shh.xie at gmail.com; u-boot at lists.denx.de; S.H. Xie <[email protected]>
Subject: Re: [PATCH] armv8: ls2080aqds: fix SGMII repeater settings

Quoted 9 lines · shh.xie at gmail.com

From: Shaohui Xie <[email protected]>

The current value to check whether the PHY was configured has dependency on MC, it expects MC to start PCS AN, this is not true during boot up, so it should be changed to remove the dependency.

The PHY's register space should be restore to default after accessing extended space.

Review

Quoted 6 lines
---
 board/freescale/ls2080aqds/eth.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/board/freescale/ls2080aqds/eth.c

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 148

Quoted 10 lines

index 95ff68b..cf6791e 100644

board/freescale/ls2080aqds/eth.c +1 -1
@@ -144,8 +144,10 @@ static void sgmii_configure_repeater(int serdes_port)
 
 		mdelay(10);
 
-		if ((value & 0xfff) == 0x40f) {
+		if ((value & 0xfff) == 0x401) {
 			printf("DPMAC %d:PHY is ..... Configured\n",

dpmac_id);

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int

Quoted 6 lines
board/freescale/ls2080aqds/eth.c +2 -0
+			miiphy_write(dev[mii_bus], riser_phy_addr[dpmac],
+				     0x1f, 0);
 			continue;
 		}
 
@@ -181,28 +183,29 @@ static void sgmii_configure_repeater(int

serdes_port)

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 186

Quoted 5 lines
board/freescale/ls2080aqds/eth.c +1 -1
 				if (ret > 0)
 					goto error;
 
-				mdelay(1);
+				mdelay(100);

Why change the delay?

Quoted 19 lines
board/freescale/ls2080aqds/eth.c +2 -3
 				ret = miiphy_read(dev[mii_bus],
 						  riser_phy_addr[dpmac],
 						  0x11, &value);
 				if (ret > 0)
 					goto error;
-				mdelay(10);
 
-				if ((value & 0xfff) == 0x40f) {
+				if ((value & 0xfff) == 0x401) {
 					printf("DPMAC %d :PHY is configured ",
 					       dpmac_id);
 					printf("after setting repeater 0x%x\n",
 					       value);
 					i = 5;
 					j = 5;
-				} else
+				} else {
 					printf("DPMAC %d :PHY is failed to ",

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 211

Quoted 10 lines
board/freescale/ls2080aqds/eth.c +2 -0
 					       dpmac_id);
 					printf("configure the repeater 0x%x\n",
 					       value);
 				}
+			}
 		}
+		miiphy_write(dev[mii_bus], riser_phy_addr[dpmac], 0x1f, 0);
 	}
 error:
 	if (ret)

Prabhakar,

Quoted 2 lines

Do these changes look correct to you?

These changes looks fine.
Please note with older code, sometime SGMII riser card was not getting configured. It is now more consistent.

--prabhakar

#3 lore raw

PATCH 1/1 armv8: ls2080aqds: fix SGMII repeater settings

In reply to york sun

Hi York,

Please see inline.

Quoted 40 lines

-----Original Message-----
From: york sun
Sent: Tuesday, November 08, 2016 2:42 AM
To: Prabhakar Kushwaha <[email protected]>
Cc: shh.xie at gmail.com; u-boot at lists.denx.de; S.H. Xie <[email protected]>
Subject: Re: [PATCH] armv8: ls2080aqds: fix SGMII repeater settings

Quoted 32 lines · shh.xie at gmail.com

From: Shaohui Xie <[email protected]>

The current value to check whether the PHY was configured has dependency on MC, it expects MC to start PCS AN, this is not true during boot up, so it should be changed to remove the dependency.

The PHY's register space should be restore to default after accessing extended space.

---
 board/freescale/ls2080aqds/eth.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
board/freescale/ls2080aqds/eth.c +3 -1
index 95ff68b..cf6791e 100644
@@ -144,8 +144,10 @@ static void sgmii_configure_repeater(int
 serdes_port)
 
 		mdelay(10);
 
-		if ((value & 0xfff) == 0x40f) {
+		if ((value & 0xfff) == 0x401) {
 			printf("DPMAC %d:PHY is ..... Configured\n", dpmac_id);
+			miiphy_write(dev[mii_bus], riser_phy_addr[dpmac],
+				     0x1f, 0);
 			continue;
 		}
Quoted 8 lines

board/freescale/ls2080aqds/eth.c static void sgmii_configure_repeater(int serdes_port) · line 186

Quoted 6 lines
board/freescale/ls2080aqds/eth.c +1 -1
@@ -181,28 +183,29 @@ static void sgmii_configure_repeater(int serdes_port)
 				if (ret > 0)
 					goto error;
 
-				mdelay(1);
+				mdelay(100);

Why change the delay?

[S.H] During debug I found mdelay(1) was too short for the signal to be stable, mdelay(10) worked but occasional still can see failure, so I changed it to 100 to assure it.

Thank you!
Shaohui

Applied
#4 lore raw

PATCH 1/1 armv8: ls2080aqds: fix SGMII repeater settings

In reply to shh.xie at gmail.com
Quoted 11 lines · shh.xie at gmail.com

From: Shaohui Xie <[email protected]>

The current value to check whether the PHY was configured has dependency on MC, it expects MC to start PCS AN, this is not true during boot up, so it should be changed to remove the dependency.

The PHY's register space should be restore to default after accessing extended space.

---

Applied to fsl-qoriq, awaiting upstream. Thanks.

York