Skip to contentSkip to conversation

net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence

PATCH Applied Yoshihisa Yamamoto 3 participants 3 messages Sep 24 – Sep 30

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence

On RZ/T2H and RZ/N1D MIIC, writing 0x0000 to the MIIC protection register clears the protection state machine.

The initial protection state cannot be assumed to be constant, as it may be influenced by previous activity before the driver takes ownership of the hardware.

Clear the protection state before issuing the unprotect sequence so that register access always starts from a known state, regardless of any previous activity.

Fixes 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")

---
V4:
- Clarify commit message
- Point Fixes tag to 7dc54d3b8d91, as the issue also affects RZ/N1D

v3: https://lore.kernel.org/all/TYCPR01MB7481CE8351FDB2CDCA229955A4872@TYCPR01MB7481.jpnprd01.prod.outlook.com
- Add Fixes tag

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

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

 drivers/net/pcs/pcs-rzn1-miic.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/pcs/pcs-rzn1-miic.c +3 -0
index 2b72fa98ddf1..279f709c889b 100644
@@ -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)
 {
+	/* Clear protection state */
+	writel(0x0000, miic->base + MIIC_PRCMD);
+
 	/* Unprotect register writes */
 	writel(0x00A5, miic->base + MIIC_PRCMD);
 	writel(0x0001, miic->base + MIIC_PRCMD);
Signature · 1 line
2.34.1
Reviewed-by Lad Prabhakar Tested-by Lad Prabhakar on v4 1/1
#1 lore raw
Quoted 22 lines · Yoshihisa Yamamoto

On RZ/T2H and RZ/N1D MIIC, writing 0x0000 to the MIIC protection register clears the protection state machine.

The initial protection state cannot be assumed to be constant, as it may be influenced by previous activity before the driver takes ownership of the hardware.

Clear the protection state before issuing the unprotect sequence so that register access always starts from a known state, regardless of any previous activity.

Fixes 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")

---
V4:
- Clarify commit message
- Point Fixes tag to 7dc54d3b8d91, as the issue also affects RZ/N1D

v3: https://lore.kernel.org/all/TYCPR01MB7481CE8351FDB2CDCA229955A4872@TYCPR01MB7481.jpnprd01.prod.outlook.com
- Add Fixes tag

Quoted 8 lines

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

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

 drivers/net/pcs/pcs-rzn1-miic.c | 3 +++
 1 file changed, 3 insertions(+)

Cheers,
Prabhakar

Quoted 17 lines
drivers/net/pcs/pcs-rzn1-miic.c +3 -1
index 2b72fa98ddf1..279f709c889b 100644
@@ -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)
 {
+       /* Clear protection state */
+       writel(0x0000, miic->base + MIIC_PRCMD);
+
        /* Unprotect register writes */
        writel(0x00A5, miic->base + MIIC_PRCMD);
        writel(0x0001, miic->base + MIIC_PRCMD);
--

2.34.1

#2 lore raw
In reply to Yoshihisa Yamamoto
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 24 Sep 2026 10:36:57 +0000 you wrote:

On RZ/T2H and RZ/N1D MIIC, writing 0x0000 to the MIIC protection register clears the protection state machine.

The initial protection state cannot be assumed to be constant, as it may be influenced by previous activity before the driver takes ownership of the hardware.

[...]

Here is the summary with links:
- [net,v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence

    https://git.kernel.org/netdev/net/c/8b9993437429

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html