diff mbox series

MDIO driver bug (U-Boot:drivers/net/ti/cpsw_mdio.c)

Message ID 1ac128b2-0f38-dff7-19ee-ff7d91620431@emagii.com
State Not Applicable
Delegated to: Ryan Eatmon
Headers show
Series MDIO driver bug (U-Boot:drivers/net/ti/cpsw_mdio.c) | expand

Commit Message

Ulf Samuelsson Feb. 8, 2023, 6:45 p.m. UTC
Hi guys,

I think I found a bug in the U-Boot drivers/net/ti/cpsw_mdio.c driver

Sent the patch below to the u-boot mailing list with no response.

It has only been a day though, but I thought to highlight it here.

Best Regards
Ulf Samuelsson



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>
---
  drivers/net/ti/cpsw_mdio.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

--

Comments

Bajjuri, Praneeth Feb. 8, 2023, 7:46 p.m. UTC | #1
+Sriram,kevin

On 2/8/2023 12:45 PM, Ulf Samuelsson wrote:
> Hi guys,
> 
> I think I found a bug in the U-Boot drivers/net/ti/cpsw_mdio.c driver
> 
> Sent the patch below to the u-boot mailing list with no response.
> 
> It has only been a day though, but I thought to highlight it here.
> 

Thanks for notifying us,

I see the patch
https://patchwork.ozlabs.org/project/uboot/patch/20230207082527.2319-1-ulf@emagii.com/

Will monitor and handle accordingly with uboot and kirkstone update when 
it happens.


> Best Regards
> Ulf Samuelsson
> 
> 
> 
> 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>
> ---
>   drivers/net/ti/cpsw_mdio.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
> index a5ba73b739..ac791faa81 100644
> --- a/drivers/net/ti/cpsw_mdio.c
> +++ b/drivers/net/ti/cpsw_mdio.c
> @@ -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,
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15755): https://lists.yoctoproject.org/g/meta-ti/message/15755
> Mute This Topic: https://lists.yoctoproject.org/mt/96837011/2167429
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [praneeth@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
index a5ba73b739..ac791faa81 100644
--- a/drivers/net/ti/cpsw_mdio.c
+++ b/drivers/net/ti/cpsw_mdio.c
@@ -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,