cpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive
authorUlf Samuelsson <ulf@emagii.com>
Tue, 7 Feb 2023 08:25:27 +0000 (09:25 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 17 Feb 2023 15:49:41 +0000 (10:49 -0500)
cpsw_mdio_get_alive reads the wrong register.
See page 2316 in SPRUH73Q AM335x TRM

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
drivers/net/ti/cpsw_mdio.c

index a5ba73b73988dd8ac8880c56efb178f5e5262d97..ac791faa813d38467ce50f0bed264ad655977e5d 100644 (file)
@@ -51,7 +51,7 @@ struct cpsw_mdio_regs {
 #define USERACCESS_PHY_REG_SHIFT       (21)
 #define USERACCESS_PHY_ADDR_SHIFT      (16)
 #define USERACCESS_DATA                GENMASK(15, 0)
-       } user[0];
+       } user[2];
 };
 
 #define CPSW_MDIO_DIV_DEF      0xff
@@ -366,8 +366,8 @@ u32 cpsw_mdio_get_alive(struct mii_dev *bus)
        struct cpsw_mdio *mdio = bus->priv;
        u32 val;
 
-       val = readl(&mdio->regs->control);
-       return val & GENMASK(15, 0);
+       val = readl(&mdio->regs->alive);
+       return val & GENMASK(7, 0);
 }
 
 struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,