mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence
@ 2026-09-24 10:36 Yoshihisa Yamamoto
  2026-09-27 23:00 ` Lad, Prabhakar
  2026-09-30  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yoshihisa Yamamoto @ 2026-09-24 10:36 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Heiner Kallweit,
	Russell King, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Prabhakar Mahadev Lad, linux-renesas-soc, netdev, devicetree,
	linux-kernel

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")
Signed-off-by: Yoshihisa Yamamoto <yoshihisa.yamamoto.xn@renesas.com>
---
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(+)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 2b72fa98ddf1..279f709c889b 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)
 {
+	/* 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

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

* Re: [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence
  2026-09-24 10:36 [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence Yoshihisa Yamamoto
@ 2026-09-27 23:00 ` Lad, Prabhakar
  2026-09-30  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Lad, Prabhakar @ 2026-09-27 23:00 UTC (permalink / raw)
  To: Yoshihisa Yamamoto
  Cc: Clément Léger, Andrew Lunn, Heiner Kallweit,
	Russell King, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Prabhakar Mahadev Lad, linux-renesas-soc, netdev,
	devicetree, linux-kernel

On Thu, Sep 24, 2026 at 11:45 AM Yoshihisa Yamamoto
<yoshihisa.yamamoto.xn@renesas.com> 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.
>
> 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")
> Signed-off-by: Yoshihisa Yamamoto <yoshihisa.yamamoto.xn@renesas.com>
> ---
> 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(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Cheers,
Prabhakar

> diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> index 2b72fa98ddf1..279f709c889b 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)
>  {
> +       /* 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
>

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

* Re: [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence
  2026-09-24 10:36 [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence Yoshihisa Yamamoto
  2026-09-27 23:00 ` Lad, Prabhakar
@ 2026-09-30  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-30  0:30 UTC (permalink / raw)
  To: Yoshihisa Yamamoto
  Cc: clement.leger, andrew, hkallweit1, linux, davem, edumazet, kuba,
	pabeni, prabhakar.mahadev-lad.rj, linux-renesas-soc, netdev,
	devicetree, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
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:[~2026-09-30  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 10:36 [PATCH net v4] net: pcs: rzn1-miic: Clear MIIC protection state before unprotect sequence Yoshihisa Yamamoto
2026-09-27 23:00 ` Lad, Prabhakar
2026-09-30  0:30 ` 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

all inboxes | Powered by JetHome®