netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: mdio: i2c: fix rollball accessors
@ 2023-05-13  8:57 Russell King (Oracle)
  2023-05-13 13:50 ` Andrew Lunn
  2023-05-15  9:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2023-05-13  8:57 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Marek Behún, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael Walle, netdev

Commit 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
separated the non-rollball bus accessors, but left the rollball
accessors as is. As rollball accessors are clause 45, this results
in the rollball protocol being completely non-functional. Fix this.

Fixes: 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/mdio/mdio-i2c.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mdio/mdio-i2c.c b/drivers/net/mdio/mdio-i2c.c
index 1e0c206d0f2e..da2001ea1f99 100644
--- a/drivers/net/mdio/mdio-i2c.c
+++ b/drivers/net/mdio/mdio-i2c.c
@@ -291,7 +291,8 @@ static int i2c_rollball_mii_cmd(struct mii_bus *bus, int bus_addr, u8 cmd,
 	return i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
 }
 
-static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
+static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int devad,
+				 int reg)
 {
 	u8 buf[4], res[6];
 	int bus_addr, ret;
@@ -302,7 +303,7 @@ static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
 		return 0xffff;
 
 	buf[0] = ROLLBALL_DATA_ADDR;
-	buf[1] = (reg >> 16) & 0x1f;
+	buf[1] = devad;
 	buf[2] = (reg >> 8) & 0xff;
 	buf[3] = reg & 0xff;
 
@@ -322,8 +323,8 @@ static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
 	return val;
 }
 
-static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
-				  u16 val)
+static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int devad,
+				  int reg, u16 val)
 {
 	int bus_addr, ret;
 	u8 buf[6];
@@ -333,7 +334,7 @@ static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
 		return 0;
 
 	buf[0] = ROLLBALL_DATA_ADDR;
-	buf[1] = (reg >> 16) & 0x1f;
+	buf[1] = devad;
 	buf[2] = (reg >> 8) & 0xff;
 	buf[3] = reg & 0xff;
 	buf[4] = val >> 8;
@@ -405,8 +406,8 @@ struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
 			return ERR_PTR(ret);
 		}
 
-		mii->read = i2c_mii_read_rollball;
-		mii->write = i2c_mii_write_rollball;
+		mii->read_c45 = i2c_mii_read_rollball;
+		mii->write_c45 = i2c_mii_write_rollball;
 		break;
 	default:
 		mii->read = i2c_mii_read_default_c22;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: mdio: i2c: fix rollball accessors
  2023-05-13  8:57 [PATCH net] net: mdio: i2c: fix rollball accessors Russell King (Oracle)
@ 2023-05-13 13:50 ` Andrew Lunn
  2023-05-15  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2023-05-13 13:50 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Marek Behún, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michael Walle, netdev

On Sat, May 13, 2023 at 09:57:27AM +0100, Russell King (Oracle) wrote:
> Commit 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
> separated the non-rollball bus accessors, but left the rollball
> accessors as is. As rollball accessors are clause 45, this results
> in the rollball protocol being completely non-functional. Fix this.
> 
> Fixes: 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Ah, sorry about that.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: mdio: i2c: fix rollball accessors
  2023-05-13  8:57 [PATCH net] net: mdio: i2c: fix rollball accessors Russell King (Oracle)
  2023-05-13 13:50 ` Andrew Lunn
@ 2023-05-15  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-15  9:20 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, hkallweit1, kabel, davem, edumazet, kuba, pabeni, michael,
	netdev

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Sat, 13 May 2023 09:57:27 +0100 you wrote:
> Commit 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
> separated the non-rollball bus accessors, but left the rollball
> accessors as is. As rollball accessors are clause 45, this results
> in the rollball protocol being completely non-functional. Fix this.
> 
> Fixes: 87e3bee0f247 ("net: mdio: i2c: Separate C22 and C45 transactions")
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> [...]

Here is the summary with links:
  - [net] net: mdio: i2c: fix rollball accessors
    https://git.kernel.org/netdev/net/c/b48a18644046

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-15  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13  8:57 [PATCH net] net: mdio: i2c: fix rollball accessors Russell King (Oracle)
2023-05-13 13:50 ` Andrew Lunn
2023-05-15  9:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).