diff mbox series

[2/2] net: dsa: sja1105: fix device id detection

Message ID 20211204230035.4136596-3-vladimir.oltean@nxp.com
State Accepted
Commit 6372ece6e8cb46105cd12a901197fa7bdf637415
Delegated to: Ramon Fried
Headers show
Series DSA switch fixes | expand

Commit Message

Vladimir Oltean Dec. 4, 2021, 11 p.m. UTC
The sja1105_check_device_id() function contains logic to work without
changing the device tree on reworked boards, one of which I have (the
NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
resoldered SJA1105Q which is pin compatible). This logic is taken from
the Linux driver.

However this logic gets shortcircuited in U-Boot by an earlier check for
the exact device ID specified in the device tree. So the reworked board
does not probe the SJA1105Q switch. Remove this duplicated logic and let
the automatic device ID detection do its job.

Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/sja1105.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Ramon Fried Jan. 15, 2022, 4:48 p.m. UTC | #1
On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> The sja1105_check_device_id() function contains logic to work without
> changing the device tree on reworked boards, one of which I have (the
> NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
> resoldered SJA1105Q which is pin compatible). This logic is taken from
> the Linux driver.
>
> However this logic gets shortcircuited in U-Boot by an earlier check for
> the exact device ID specified in the device tree. So the reworked board
> does not probe the SJA1105Q switch. Remove this duplicated logic and let
> the automatic device ID detection do its job.
>
> Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/sja1105.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/net/sja1105.c b/drivers/net/sja1105.c
> index 17bab33eddb7..4ca8709e347c 100644
> --- a/drivers/net/sja1105.c
> +++ b/drivers/net/sja1105.c
> @@ -3276,12 +3276,6 @@ static int sja1105_check_device_id(struct sja1105_private *priv)
>         sja1105_packing(packed_buf, &device_id, 31, 0, SJA1105_SIZE_DEVICE_ID,
>                         UNPACK);
>
> -       if (device_id != priv->info->device_id) {
> -               printf("Expected device ID 0x%llx but read 0x%llx\n",
> -                      priv->info->device_id, device_id);
> -               return -ENODEV;
> -       }
> -
>         rc = sja1105_xfer_buf(priv, SPI_READ, regs->prod_id, packed_buf,
>                               SJA1105_SIZE_DEVICE_ID);
>         if (rc < 0)
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Ramon Fried Jan. 15, 2022, 4:48 p.m. UTC | #2
On Sat, Jan 15, 2022 at 6:48 PM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > The sja1105_check_device_id() function contains logic to work without
> > changing the device tree on reworked boards, one of which I have (the
> > NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
> > resoldered SJA1105Q which is pin compatible). This logic is taken from
> > the Linux driver.
> >
> > However this logic gets shortcircuited in U-Boot by an earlier check for
> > the exact device ID specified in the device tree. So the reworked board
> > does not probe the SJA1105Q switch. Remove this duplicated logic and let
> > the automatic device ID detection do its job.
> >
> > Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> >  drivers/net/sja1105.c | 6 ------
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/net/sja1105.c b/drivers/net/sja1105.c
> > index 17bab33eddb7..4ca8709e347c 100644
> > --- a/drivers/net/sja1105.c
> > +++ b/drivers/net/sja1105.c
> > @@ -3276,12 +3276,6 @@ static int sja1105_check_device_id(struct sja1105_private *priv)
> >         sja1105_packing(packed_buf, &device_id, 31, 0, SJA1105_SIZE_DEVICE_ID,
> >                         UNPACK);
> >
> > -       if (device_id != priv->info->device_id) {
> > -               printf("Expected device ID 0x%llx but read 0x%llx\n",
> > -                      priv->info->device_id, device_id);
> > -               return -ENODEV;
> > -       }
> > -
> >         rc = sja1105_xfer_buf(priv, SPI_READ, regs->prod_id, packed_buf,
> >                               SJA1105_SIZE_DEVICE_ID);
> >         if (rc < 0)
> > --
> > 2.25.1
> >
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot-net/next
Thanks !
diff mbox series

Patch

diff --git a/drivers/net/sja1105.c b/drivers/net/sja1105.c
index 17bab33eddb7..4ca8709e347c 100644
--- a/drivers/net/sja1105.c
+++ b/drivers/net/sja1105.c
@@ -3276,12 +3276,6 @@  static int sja1105_check_device_id(struct sja1105_private *priv)
 	sja1105_packing(packed_buf, &device_id, 31, 0, SJA1105_SIZE_DEVICE_ID,
 			UNPACK);
 
-	if (device_id != priv->info->device_id) {
-		printf("Expected device ID 0x%llx but read 0x%llx\n",
-		       priv->info->device_id, device_id);
-		return -ENODEV;
-	}
-
 	rc = sja1105_xfer_buf(priv, SPI_READ, regs->prod_id, packed_buf,
 			      SJA1105_SIZE_DEVICE_ID);
 	if (rc < 0)