Thread (2 messages) 2 messages, 2 authors, 4d ago
COOLING4d

[PATCH net v3] net: pcs: rzn1-miic: Reset PRCMD state before unprotect sequence

From: Yoshihisa Yamamoto <hidden>
Date: 2026-09-18 04:30:19
Also in: linux-devicetree, linux-renesas-soc, lkml
Subsystem: ethernet phy library, networking drivers, renesas rz/n1 a5psw switch driver, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Clément Léger, Linus Torvalds

On RZ/T2H MIIC, writing 0x0000 to PRCMD resets the command state
machine to the IDLE state.

Reset PRCMD before issuing the unprotect sequence so that it always
starts from a known state, regardless of any previous PRCMD activity.

Fixes: 419747319e3a ("net: pcs: rzn1-miic: Add per-SoC control for MIIC register unlock/lock")
Signed-off-by: Yoshihisa Yamamoto <redacted>
---
v3:
- Add Fixes tag

v2: https://lore.kernel.org/all/TYCPR01MB748157ECB6B92D8E3FFD433BA4B82@TYCPR01MB7481.jpnprd01.prod.outlook.com (local)
- Fix indentation

v1: https://lore.kernel.org/all/TYCPR01MB748139F059DF2459B9813416A4B92@TYCPR01MB7481.jpnprd01.prod.outlook.com (local)

 drivers/net/pcs/pcs-rzn1-miic.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 2b72fa98d..818756bb8 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -270,6 +270,9 @@ static struct miic_port *phylink_pcs_to_miic_port(struct phylink_pcs *pcs)
 
 static void miic_unlock_regs(struct miic *miic)
 {
+	/* Reset PRCMD state before unprotect sequence */
+	writel(0x0000, miic->base + MIIC_PRCMD);
+
 	/* Unprotect register writes */
 	writel(0x00A5, miic->base + MIIC_PRCMD);
 	writel(0x0001, miic->base + MIIC_PRCMD);
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help