Skip to contentSkip to conversation

hw/net/xilinx_axienet: Fix PHY register 17 link status reporting

PATCH Applied Jay Chang 3 participants 4 messages Jul 13 – Jul 22 Arm/Zynq architecture

lore
Share & tools
lore

Jay Chang

author
#0 lore raw

PATCH 1/1 hw/net/xilinx_axienet: Fix PHY register 17 link status reporting

The Marvell 88E1111 PHY register 17 (PHY Specific Status Register) bit 10 reports real-time link status. Previously, this register returned a fixed value of 0x8800 with bit 10 always cleared, causing U-Boot to always detect "No link" even when the link was up.

---
 hw/net/xilinx_axienet.c | 3 +++
 1 file changed, 3 insertions(+)
hw/net/xilinx_axienet.c +3 -0
index 970732b162..9f5f65ecfa 100644
@@ -103,6 +103,9 @@ static unsigned int tdk_read(struct PHY *phy, unsigned int req)
         case 17:
             /* Marvell PHY on many xilinx boards.  */
             r = 0x8000; /* 1000Mb  */
+            if (phy->link) {
+                r |= 0x0400; /* Link is up */
+            }
             break;
         case 18:
             {
Signature · 1 line
2.48.1
#1 lore raw
Quoted 18 lines · Jay Chang

The Marvell 88E1111 PHY register 17 (PHY Specific Status Register) bit 10 reports real-time link status. Previously, this register returned a fixed value of 0x8800 with bit 10 always cleared, causing U-Boot to always detect "No link" even when the link was up.

---
 hw/net/xilinx_axienet.c | 3 +++
 1 file changed, 3 insertions(+)
hw/net/xilinx_axienet.c +0 -0
index 970732b162..9f5f65ecfa 100644

hw/net/xilinx_axienet.c static unsigned int tdk_read(struct PHY *phy, unsigned int req) · line 109

Quoted 7 lines
hw/net/xilinx_axienet.c +3 -0
@@ -103,6 +103,9 @@ static unsigned int tdk_read(struct PHY *phy, unsigned int req)
         case 17:
             /* Marvell PHY on many xilinx boards.  */
             r = 0x8000; /* 1000Mb  */
+            if (phy->link) {
+                r |= 0x0400; /* Link is up */
+            }
             break;

This matches the Marvell PHY datasheet, so seems reasonable.

Applied to target-arm.next, thanks.

-- PMM

#2 lore raw
In reply to Jay Chang
Quoted 8 lines · Jay Chang

The Marvell 88E1111 PHY register 17 (PHY Specific Status Register) bit 10 reports real-time link status. Previously, this register returned a fixed value of 0x8800 with bit 10 always cleared, causing U-Boot to always detect "No link" even when the link was up.

I'm picking this up for qemu-stable.
Please let me know if I should not.

Quoted 9 lines
---
  hw/net/xilinx_axienet.c | 3 +++
  1 file changed, 3 insertions(+)
hw/net/xilinx_axienet.c +0 -0
index 970732b162..9f5f65ecfa 100644

hw/net/xilinx_axienet.c static unsigned int tdk_read(struct PHY *phy, unsigned int req) · line 108

Quoted 6 lines
hw/net/xilinx_axienet.c +3 -0
@@ -103,6 +103,9 @@ static unsigned int tdk_read(struct PHY *phy, unsigned int req)
          case 17:
              /* Marvell PHY on many xilinx boards.  */
              r = 0x8000; /* 1000Mb  */
+            if (phy->link) {
+                r |= 0x0400; /* Link is up */
+            }

Shouldn't we clear this bit somewhere?

Thanks,

/mjt

#3 lore raw
Quoted 18 lines · Michael Tokarev
Quoted 8 lines · Jay Chang

The Marvell 88E1111 PHY register 17 (PHY Specific Status Register) bit 10 reports real-time link status. Previously, this register returned a fixed value of 0x8800 with bit 10 always cleared, causing U-Boot to always detect "No link" even when the link was up.

I'm picking this up for qemu-stable.
Please let me know if I should not.

Quoted 4 lines
---
  hw/net/xilinx_axienet.c | 3 +++
  1 file changed, 3 insertions(+)
Quoted 13 lines

hw/net/xilinx_axienet.c static unsigned int tdk_read(struct PHY *phy, unsigned int req) · line 108

Quoted 11 lines
hw/net/xilinx_axienet.c +3 -0
index 970732b162..9f5f65ecfa 100644
@@ -103,6 +103,9 @@ static unsigned int tdk_read(struct PHY *phy, unsigned int req)
          case 17:
              /* Marvell PHY on many xilinx boards.  */
              r = 0x8000; /* 1000Mb  */
+            if (phy->link) {
+                r |= 0x0400; /* Link is up */
+            }

Shouldn't we clear this bit somewhere?

You mean phy->link ? Probably that should be controlled by the network backend. But that's a pre-existing thing (we already report phy->link in a different PHY register).

-- PMM