public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 1/3] net: dsa: microchip: lan9371/2: add 100BaseTX PHY support
@ 2024-07-01  8:53 Oleksij Rempel
  2024-07-01  8:53 ` [PATCH net-next v2 2/3] net: dsa: microchip: lan937x: disable in-band status support for RGMII interfaces Oleksij Rempel
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Oleksij Rempel @ 2024-07-01  8:53 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss
  Cc: Lucas Stach, Oleksij Rempel, kernel, linux-kernel, netdev,
	UNGLinuxDriver

From: Lucas Stach <l.stach@pengutronix.de>

On the LAN9371 and LAN9372, the 4th internal PHY is a 100BaseTX PHY
instead of a 100BaseT1 PHY. The 100BaseTX PHYs have a different base
register offset.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
changes v2:
- add LAN9371 port 4 support
---
 drivers/net/dsa/microchip/ksz_common.h   | 1 +
 drivers/net/dsa/microchip/lan937x_main.c | 4 ++++
 drivers/net/dsa/microchip/lan937x_reg.h  | 1 +
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index ee7db46e469d5..c4a4664c03859 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -22,6 +22,7 @@
 /* all KSZ switches count ports from 1 */
 #define KSZ_PORT_1 0
 #define KSZ_PORT_2 1
+#define KSZ_PORT_4 3
 
 struct ksz_device;
 struct ksz_port;
diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
index b479a628b1ae5..eaa862eb6b265 100644
--- a/drivers/net/dsa/microchip/lan937x_main.c
+++ b/drivers/net/dsa/microchip/lan937x_main.c
@@ -55,6 +55,10 @@ static int lan937x_vphy_ind_addr_wr(struct ksz_device *dev, int addr, int reg)
 	u16 addr_base = REG_PORT_T1_PHY_CTRL_BASE;
 	u16 temp;
 
+	if ((dev->info->chip_id == LAN9371_CHIP_ID ||
+	     dev->info->chip_id == LAN9372_CHIP_ID) && addr == KSZ_PORT_4)
+		addr_base = REG_PORT_TX_PHY_CTRL_BASE;
+
 	/* get register address based on the logical port */
 	temp = PORT_CTRL_ADDR(addr, (addr_base + (reg << 2)));
 
diff --git a/drivers/net/dsa/microchip/lan937x_reg.h b/drivers/net/dsa/microchip/lan937x_reg.h
index 45b606b6429f6..7ecada9240233 100644
--- a/drivers/net/dsa/microchip/lan937x_reg.h
+++ b/drivers/net/dsa/microchip/lan937x_reg.h
@@ -147,6 +147,7 @@
 
 /* 1 - Phy */
 #define REG_PORT_T1_PHY_CTRL_BASE	0x0100
+#define REG_PORT_TX_PHY_CTRL_BASE	0x0280
 
 /* 3 - xMII */
 #define PORT_SGMII_SEL			BIT(7)
-- 
2.39.2


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

end of thread, other threads:[~2024-07-03  8:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01  8:53 [PATCH net-next v2 1/3] net: dsa: microchip: lan9371/2: add 100BaseTX PHY support Oleksij Rempel
2024-07-01  8:53 ` [PATCH net-next v2 2/3] net: dsa: microchip: lan937x: disable in-band status support for RGMII interfaces Oleksij Rempel
2024-07-01 16:20   ` Vladimir Oltean
2024-07-03  3:09   ` Arun.Ramadoss
2024-07-01  8:53 ` [PATCH net-next v2 3/3] net: dsa: microchip: lan937x: disable VPHY support Oleksij Rempel
2024-07-01 16:21   ` Vladimir Oltean
2024-07-03  3:15   ` Arun.Ramadoss
2024-07-01 14:55 ` [PATCH net-next v2 1/3] net: dsa: microchip: lan9371/2: add 100BaseTX PHY support Arun.Ramadoss
2024-07-03  8: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