qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] net/bitbang_mdio: Never set PHY RST and ANEG_RS


From: Grant Likely
Subject: [Qemu-devel] [PATCH 2/3] net/bitbang_mdio: Never set PHY RST and ANEG_RST bits on register write
Date: Sat, 19 Jan 2013 18:28:11 -0400

The RST and ANEG_RST bits are commands, not settings. An operating
system will get confused (or at least u-boot does) if those bits remain
set after writing to them. Therefore, mask them out on write.

Cc: Peter Maydell <address@hidden>
Cc: Paul Brook <address@hidden>
Cc: Edgar E. Iglesias <address@hidden>
Cc: Anthony Liguori <address@hidden>
Signed-off-by: Grant Likely <address@hidden>
---
 hw/bitbang_mdio.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/bitbang_mdio.c b/hw/bitbang_mdio.c
index f0ee6af..28ac695 100644
--- a/hw/bitbang_mdio.c
+++ b/hw/bitbang_mdio.c
@@ -30,6 +30,10 @@
 #define D(x)
 
 /* Advertisement control register. */
+#define PHY_CNTL_REG            0
+#define PHY_CNTL_RST            0x8000 /* PHY reset command */
+#define PHY_CNTL_ANEG_RST       0x0200 /* Autonegotiation reset command */
+
 #define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
 #define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
 #define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
@@ -106,6 +110,10 @@ static void tdk_write(struct qemu_phy *phy, unsigned int 
req, unsigned int data)
     regnum = req & 0x1f;
     D(printf("%s reg[%d] = %x\n", __func__, regnum, data));
     switch (regnum) {
+    case PHY_CNTL_REG:
+        /* Don't ever store the RST or ANEG_RST bits; they are commands */
+        phy->regs[regnum] = data & ~(PHY_CNTL_RST | PHY_CNTL_ANEG_RST);
+        break;
     default:
         phy->regs[regnum] = data;
         break;
@@ -114,7 +122,7 @@ static void tdk_write(struct qemu_phy *phy, unsigned int 
req, unsigned int data)
 
 void tdk_init(struct qemu_phy *phy)
 {
-    phy->regs[0] = 0x3100;
+    phy->regs[PHY_CNTL_REG] = 0x3100;
     /* PHY Id. */
     phy->regs[2] = 0x0300;
     phy->regs[3] = 0xe400;
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]