Skip to contentSkip to conversation

net: pcs: rzn1-miic: Deassert resets on RZ/N1

PATCH In review Kyle Hendry 4 participants 8 messages Nov 27 – Nov 29

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

cover net: pcs: rzn1-miic: Deassert resets on RZ/N1

Two resets are held at boot and need to be cleared for the mii converted to work. They are in the system controller managed by the clock driver and are supported by this series:
https://lore.kernel.org/linux-renesas-soc/[email protected]

Add the reset information to the rzn1 info structure and device tree so the miic driver can clear the resets the same way the rz/t2h does.

---
Kyle Hendry (3):
dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets
net: pcs: rzn1-miic: Add resets to rzn1 info structure
ARM: dts: renesas: r9a06g032: Add resets to mii converter

 .../bindings/net/pcs/renesas,rzn1-miic.yaml        | 36 +++++++++++++++-------
 arch/arm/boot/dts/renesas/r9a06g032.dtsi           |  3 ++
 drivers/net/pcs/pcs-rzn1-miic.c                    |  7 +++++
 3 files changed, 35 insertions(+), 11 deletions(-)

---
base-commit: ccb81d5e317b0ae2cc66ca1c628c0ca907928f94
change-id: 20261126-miic-reset-consumer-1fd4999e4cd0
prerequisite-change-id: 20261027-rzn1-miic-resets-8308515aa2c0:v4
prerequisite-patch-id: be35edd6b8532456aa90c8b32fb7e1d7adbde798
prerequisite-patch-id: 077c1ad53beb244026822f9591c1808527f852db
prerequisite-patch-id: b56a4d7c0efa9bb17aa898bdc619733f30f9097c

Best regards,

Signature · 1 line
Kyle Hendry <[email protected]>
#1 lore raw

PATCH 1/3 dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets

On the rzn1, there are two resets for the miic. Add documentation for them.

---
 .../bindings/net/pcs/renesas,rzn1-miic.yaml        | 36 +++++++++++++++-------
 1 file changed, 25 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +25 -11
index f9d39114e667..5ad1f993e8bd 100644
@@ -51,14 +51,12 @@ properties:
       - const: hclk
 
   resets:
-    items:
-      - description: Converter register reset
-      - description: Converter reset
+    minItems: 2
+    maxItems: 2
 
   reset-names:
-    items:
-      - const: rst
-      - const: crst
+    minItems: 2
+    maxItems: 2
 
   renesas,miic-switch-portin:
     description: MII Switch PORTIN configuration. This value should use one of
@@ -109,8 +107,14 @@ allOf:
       properties:
         renesas,miic-switch-portin:
           enum: [1, 2]
-        resets: false
-        reset-names: false
+        resets:
+          items:
+            - description: Timestamp selector reset
+            - description: Converter reset
+        reset-names:
+          items:
+            - const: rst_ts
+            - const: rst_miic
       patternProperties:
         "^mii-conv@[0-5]$":
           properties:
@@ -161,9 +165,14 @@ allOf:
       properties:
         renesas,miic-switch-portin:
           const: 0
-      required:
-        - resets
-        - reset-names
+      resets:
+        items:
+          - description: Converter register reset
+          - description: Converter reset
+      reset-names:
+        items:
+          - const: rst
+          - const: crst
       patternProperties:
         "^mii-conv@[0-5]$":
           properties:
@@ -210,6 +219,8 @@ required:
   - reg
   - clocks
   - clock-names
+  - resets
+  - reset-names
   - power-domains
 
 additionalProperties: false
@@ -229,6 +240,9 @@ examples:
               <&sysctrl R9A06G032_CLK_RMII_REF>,
               <&sysctrl R9A06G032_HCLK_SWITCH_RG>;
       clock-names = "mii_ref", "rgmii_ref", "rmii_ref", "hclk";
+      resets = <&sysctrl R9A06G032_RST_TS>,
+               <&sysctrl R9A06G032_RST_MIIC>;
+      reset-names = "rst_ts", "rst_miic";
       renesas,miic-switch-portin = <MIIC_GMAC2_PORT>;
       power-domains = <&sysctrl>;
 
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH net-next 1/3] dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] dt-bindings: net: pcs: renesas,rzn1-miic: misindented resets under else --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] dt-bindings: net: pcs: renesas,rzn1-miic: misindented resets under else
--

commit 575b03c2d089ed2bbbd4eb3b68259490440d654a
Author: Kyle Hendry <[email protected]>

dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets

This commit documents the two reset lines for the Renesas RZ/N1 MIIC in the device tree binding schema and moves the per-variant reset definitions into the conditional allOf branches.

Quoted 4 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +0 -0
index f9d39114e6672..5ad1f993e8bd1 100644

[ ... ]

Quoted 5 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +0 -1
@@ -161,9 +165,14 @@ allOf:
       properties:
         renesas,miic-switch-portin:
           const: 0
-      required:

Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml allOf: · line 175

Quoted 10 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +8 -2
-        - resets
-        - reset-names
+      resets:
+        items:
+          - description: Converter register reset
+          - description: Converter reset
+      reset-names:
+        items:
+          - const: rst
+          - const: crst

[Severity: Medium]
Should resets and reset-names be indented under properties here? As written, they sit directly under else, which causes make dt_binding_check to fail schema validation and leaves the rst/crst reset constraints unapplied to the RZ/T2H and RZ/N2H variants.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-miic-reset-consumer-v1-0-3cab78b94e23@reliablecontrols.com?part=1
#3 lore raw

Re: [PATCH net-next 1/3] dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets

In reply to Kyle Hendry
Quoted 1 line · Kyle Hendry

On the rzn1, there are two resets for the miic. Add documentation for them.

There are two already documented.

Quoted 11 lines
---
 .../bindings/net/pcs/renesas,rzn1-miic.yaml        | 36 +++++++++++++++-------
 1 file changed, 25 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +0 -0
index f9d39114e667..5ad1f993e8bd 100644

Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml properties: · line 55

Quoted 8 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +2 -3
@@ -51,14 +51,12 @@ properties:
       - const: hclk
 
   resets:
-    items:
-      - description: Converter register reset
-      - description: Converter reset
+    minItems: 2
+    maxItems: 2

I don't undetstand what you are trying to achieve and commit msg does not help.

Quoted 14 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +2 -3
   reset-names:
-    items:
-      - const: rst
-      - const: crst
+    minItems: 2
+    maxItems: 2
 
   renesas,miic-switch-portin:
     description: MII Switch PORTIN configuration. This value should use one of
@@ -109,8 +107,14 @@ allOf:
       properties:
         renesas,miic-switch-portin:
           enum: [1, 2]

Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml allOf: · line 117

Quoted 10 lines
Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +8 -2
-        resets: false
-        reset-names: false
+        resets:
+          items:
+            - description: Timestamp selector reset
+            - description: Converter reset
+        reset-names:
+          items:
+            - const: rst_ts
+            - const: rst_miic

No, you do not get prefixes. Do you see any prefix in existing code? No. You do not get special rules.

Best regards,
Krzysztof

#4 lore raw

PATCH 2/3 net: pcs: rzn1-miic: Add resets to rzn1 info structure

In reply to Kyle Hendry

Update the rzn1 info structure to include the resets that the driver needs to deassert

---
 drivers/net/pcs/pcs-rzn1-miic.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/pcs/pcs-rzn1-miic.c +7 -0
index 682a73cf5a87..3c4eca8960bd 100644
@@ -128,6 +128,11 @@ static const char * const index_to_string[] = {
 	"CONV5",
 };
 
+static const char * const rzn1_reset_ids[] = {
+	"rst_ts",
+	"rst_miic",
+};
+
 static struct modctrl_match rzt2h_modctrl_match_table[] = {
 	{0x0, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ETHSW_PORT1,
 	       ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}},
@@ -855,6 +860,8 @@ static struct miic_of_data rzn1_miic_of_data = {
 	.miic_port_start = 1,
 	.miic_port_last = 5,
 	.sw_mode_mask = GENMASK(4, 0),
+	.reset_ids = rzn1_reset_ids,
+	.reset_count = ARRAY_SIZE(rzn1_reset_ids),
 	.init_unlock_lock_regs = true,
 	.miic_write = miic_reg_writel_unlocked,
 	.type = MIIC_TYPE_RZN1,
Signature · 1 line
2.53.0
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH net-next 2/3] net: pcs: rzn1-miic: Add resets to rzn1 info structure

Quoted 28 lines · On 11/27/26 19:14, Kyle Hendry via B4 Relay wrote:

From: Kyle Hendry <[email protected]>

Update the rzn1 info structure to include the resets that the driver needs to deassert

---
  drivers/net/pcs/pcs-rzn1-miic.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/net/pcs/pcs-rzn1-miic.c +5 -0
index 682a73cf5a87..3c4eca8960bd 100644
@@ -128,6 +128,11 @@ static const char * const index_to_string[] = {
  	"CONV5",
  };
 
+static const char * const rzn1_reset_ids[] = {
+	"rst_ts",
+	"rst_miic",
+};
+
  static struct modctrl_match rzt2h_modctrl_match_table[] = {
  	{0x0, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ETHSW_PORT1,
  	       ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}},

drivers/net/pcs/pcs-rzn1-miic.c static struct miic_of_data rzn1_miic_of_data = { · line 867

Quoted 8 lines
drivers/net/pcs/pcs-rzn1-miic.c +2 -0
@@ -855,6 +860,8 @@ static struct miic_of_data rzn1_miic_of_data = {
  	.miic_port_start = 1,
  	.miic_port_last = 5,
  	.sw_mode_mask = GENMASK(4, 0),
+	.reset_ids = rzn1_reset_ids,
+	.reset_count = ARRAY_SIZE(rzn1_reset_ids),
  	.init_unlock_lock_regs = true,
  	.miic_write = miic_reg_writel_unlocked,
  	.type = MIIC_TYPE_RZN1,

Hi Kyle,

LGTM,

Thanks,

Clément

#6 lore raw

Re: [PATCH net-next 2/3] net: pcs: rzn1-miic: Add resets to rzn1 info structure

In reply to Kyle Hendry
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] net: pcs: rzn1-miic: miic_reset_control_init() fails on existing RZ/N1 DTBs --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] net: pcs: rzn1-miic: miic_reset_control_init() fails on existing RZ/N1 DTBs
--

commit 3902b143c1e8eed13da6131cc0c93499f17b4052
Author: Kyle Hendry <[email protected]>

net: pcs: rzn1-miic: Add resets to rzn1 info structure

This commit populates the rst_ts and rst_miic reset IDs in rzn1_miic_of_data so the driver acquires and deasserts the resets for RZ/N1 MIIC.

Quoted 17 lines
drivers/net/pcs/pcs-rzn1-miic.c +5 -0
index 682a73cf5a87d..3c4eca8960bd9 100644
@@ -128,6 +128,11 @@ static const char * const index_to_string[] = {
 	"CONV5",
 };
 
+static const char * const rzn1_reset_ids[] = {
+	"rst_ts",
+	"rst_miic",
+};
+
 static struct modctrl_match rzt2h_modctrl_match_table[] = {
 	{0x0, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ETHSW_PORT1,
 	       ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}},

drivers/net/pcs/pcs-rzn1-miic.c static struct miic_of_data rzn1_miic_of_data = { · line 867

Quoted 8 lines
drivers/net/pcs/pcs-rzn1-miic.c +2 -0
@@ -855,6 +860,8 @@ static struct miic_of_data rzn1_miic_of_data = {
 	.miic_port_start = 1,
 	.miic_port_last = 5,
 	.sw_mode_mask = GENMASK(4, 0),
+	.reset_ids = rzn1_reset_ids,
+	.reset_count = ARRAY_SIZE(rzn1_reset_ids),
 	.init_unlock_lock_regs = true,
 	.miic_write = miic_reg_writel_unlocked,
 	.type = MIIC_TYPE_RZN1,

[Severity: High]
Does setting reset_count in rzn1_miic_of_data cause miic_probe() to fail with -ENOENT on existing RZ/N1 device trees that do not have resets and reset-names properties?

miic_reset_control_init() uses non-optional
devm_reset_control_bulk_get_exclusive():

drivers/net/pcs/pcs-rzn1-miic.c:miic_reset_control_init() {
	...
	ret = devm_reset_control_bulk_get_exclusive(dev, of_data->reset_count,
						    miic->rsts);
	if (ret)
		return dev_err_probe(dev, ret,
				     "failed to get bulk reset lines\n");
	...
}

Existing RZ/N1 DTBs (and arch/arm/boot/dts/renesas/r9a06g032.dtsi prior to commit "ARM: dts: renesas: r9a06g032: Add resets to mii converter" later in this series) omit these properties on the eth-miic node, so miic_probe() fails before calling platform_set_drvdata() and leaves consumers such as dwmac-rzn1 and rzn1_a5psw stuck on -EPROBE_DEFER.

Acquiring the resets as optional (e.g. via devm_reset_control_bulk_get_optional_exclusive()) would preserve backward compatibility with existing RZ/N1 device trees.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-miic-reset-consumer-v1-0-3cab78b94e23@reliablecontrols.com?part=2
#7 lore raw

PATCH 3/3 ARM: dts: renesas: r9a06g032: Add resets to mii converter

In reply to Kyle Hendry

Add references to the resets in the system driver that the miic needs

---
 arch/arm/boot/dts/renesas/r9a06g032.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boot/dts/renesas/r9a06g032.dtsi +3 -0
index 8645bab7ee23..12b8795797cd 100644
@@ -462,6 +462,9 @@ eth_miic: eth-miic@44030000 {
 				 <&sysctrl R9A06G032_CLK_RMII_REF>,
 				 <&sysctrl R9A06G032_HCLK_SWITCH_RG>;
 			clock-names = "mii_ref", "rgmii_ref", "rmii_ref", "hclk";
+			resets = <&sysctrl R9A06G032_RST_TS>,
+				 <&sysctrl R9A06G032_RST_MIIC>;
+			reset-names = "rst_ts", "rst_miic";
 			power-domains = <&sysctrl>;
 			status = "disabled";
 
Signature · 1 line
2.53.0