Skip to contentSkip to conversation

hw/net: cadence_gem: Fix MDIO_OP_xxx values

PATCH Applied Bin Meng 4 participants 5 messages Jan 2, 2024 – Jan 3, 2024

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 hw/net: cadence_gem: Fix MDIO_OP_xxx values

Testing upstream U-Boot with 'sifive_u' machine we see:

=> dhcp
ethernet@10090000: PHY present at 0
Could not get PHY for ethernet@10090000: addr 0
phy_connect failed

This has been working till QEMU 8.1 but broken since QEMU 8.2.

Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields")

---

 hw/net/cadence_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/cadence_gem.c +2 -2
index 296bba238e..472ce9c8cf 100644
@@ -199,8 +199,8 @@ REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */
     FIELD(PHYMNTNC, PHY_ADDR, 23, 5)
     FIELD(PHYMNTNC, OP, 28, 2)
     FIELD(PHYMNTNC, ST, 30, 2)
-#define MDIO_OP_READ    0x3
-#define MDIO_OP_WRITE   0x2
+#define MDIO_OP_READ    0x2
+#define MDIO_OP_WRITE   0x1
 
 REG32(RXPAUSE, 0x38) /* RX Pause Time reg */
 REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bin Meng

Testing upstream U-Boot with 'sifive_u' machine we see:

   => dhcp
   ethernet@10090000: PHY present at 0
   Could not get PHY for ethernet@10090000: addr 0
   phy_connect failed

This has been working till QEMU 8.1 but broken since QEMU 8.2.

s/till/until/?

Quoted 14 lines
Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields")

---

  hw/net/cadence_gem.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/cadence_gem.c +0 -0
index 296bba238e..472ce9c8cf 100644

hw/net/cadence_gem.c REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ · line 206

Quoted 10 lines
hw/net/cadence_gem.c +2 -2
@@ -199,8 +199,8 @@ REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */
      FIELD(PHYMNTNC, PHY_ADDR, 23, 5)
      FIELD(PHYMNTNC, OP, 28, 2)
      FIELD(PHYMNTNC, ST, 30, 2)
-#define MDIO_OP_READ    0x3
-#define MDIO_OP_WRITE   0x2
+#define MDIO_OP_READ    0x2
+#define MDIO_OP_WRITE   0x1
 
  REG32(RXPAUSE, 0x38) /* RX Pause Time reg */
  REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */
#2 lore raw
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Bin Meng

Testing upstream U-Boot with 'sifive_u' machine we see:

   => dhcp
   ethernet@10090000: PHY present at 0 Could not get PHY for ethernet@10090000: addr 0 phy_connect failed

This has been working till QEMU 8.1 but broken since QEMU 8.2.

s/till/until/?

These are synonyms. Till is more informal. No need to change.

Quoted 11 lines
Quoted 11 lines
Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe

PHYMNTNC register fields")

---

  hw/net/cadence_gem.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 17 lines
Quoted 12 lines
hw/net/cadence_gem.c +2 -2
index 296bba238e..472ce9c8cf 100644
@@ -199,8 +199,8 @@ REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */
       FIELD(PHYMNTNC, PHY_ADDR, 23, 5)
       FIELD(PHYMNTNC, OP, 28, 2)
       FIELD(PHYMNTNC, ST, 30, 2)
-#define MDIO_OP_READ    0x3
-#define MDIO_OP_WRITE   0x2
+#define MDIO_OP_READ    0x2
+#define MDIO_OP_WRITE   0x1
Quoted 2 lines

  REG32(RXPAUSE, 0x38) /* RX Pause Time reg */
  REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */

Thank you Bin for the fix.

With the fix I was able to download a file via TFTP to U-Boot sifive_unleashed_defconfig on the emulated board. Cf. docs/system/riscv/sifive_u.rst.

#3 lore raw
Quoted 9 lines · Heinrich Schuchardt
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Bin Meng

Testing upstream U-Boot with 'sifive_u' machine we see:

   => dhcp
   ethernet@10090000: PHY present at 0 Could not get PHY for ethernet@10090000: addr 0 phy_connect failed

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

This has been working till QEMU 8.1 but broken since QEMU 8.2.

s/till/until/?

These are synonyms. Till is more informal. No need to change.

Not obvious for non-native/fluent informal English speakers.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe

PHYMNTNC register fields")

---

  hw/net/cadence_gem.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
#4 lore raw
In reply to Bin Meng

02.01.2024 17:18, Bin Meng:

Quoted 7 lines

Testing upstream U-Boot with 'sifive_u' machine we see:

   => dhcp
   ethernet@10090000: PHY present at 0
   Could not get PHY for ethernet@10090000: addr 0
   phy_connect failed
Quoted 5 lines

This has been working till QEMU 8.1 but broken since QEMU 8.2.

Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields")

Applied to trivial-patches tree, and marked to be picked up for stable.

Thanks,

/mjt