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 <peter.mayd...@linaro.org> Cc: Paul Brook <p...@codesourcery.com> Cc: Edgar E. Iglesias <edgar.igles...@gmail.com> Cc: Anthony Liguori <aligu...@us.ibm.com> Signed-off-by: Grant Likely <grant.lik...@secretlab.ca> --- 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