* [PATCH v3 0/3] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter
@ 2026-11-25 15:53 Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kyle Hendry via B4 Relay @ 2026-11-25 15:53 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel
Cc: linux-renesas-soc, linux-clk, devicetree, linux-kernel,
Kyle Hendry, Wolfram Sang
On the rzn1, there are two resets for the mii converter in the system
controller. If they are not cleared by the bootloader then the kernel needs
to do it.
To handle this, I've added a reset controller interface to the clock
driver so the miic driver can deassert them.
---
Changes in v3:
- Move reset_controller_dev to end of priv structure
- Index resets from 0
- Link to v2: https://lore.kernel.org/r/20261120-rzn1-miic-resets-v2-0-f1cfa678615b@reliablecontrols.com
Changes in v2:
- Drop patches for pcs-rzn1-miic to be submitted separately to netdev
- Add reset_controller_dev to r9a06g032_priv fix build error
- Use designated initializers for the reset bit definitions
- Change macro for getting priv data to static inline
- Drop unnecessary reset from controller ops
- Remove debugging argument from r9a06g032_reset_set
- Remove configuration of of_reset_n_cells
- Add #reset-cells to required and example in schema
- Make r9a06g032_reset_status correctly return the active low status
- Move reset controller register earlier in probe to better handle failure
- Link to v1: https://lore.kernel.org/r/20261119-rzn1-miic-resets-v1-0-feee2bb28bb4@reliablecontrols.com
---
Kyle Hendry (3):
dt-bindings: clock: r9a06g032-sysctrl: Document reset cells
clk: renesas: r9a06g032: Add reset controller
ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node
.../bindings/clock/renesas,r9a06g032-sysctrl.yaml | 5 ++
arch/arm/boot/dts/renesas/r9a06g032.dtsi | 1 +
drivers/clk/renesas/r9a06g032-clocks.c | 59 ++++++++++++++++++++++
include/dt-bindings/clock/r9a06g032-sysctrl.h | 3 ++
4 files changed, 68 insertions(+)
---
base-commit: 7d650c5db382c8226965b01a31e16fcf2df1d096
change-id: 20261027-rzn1-miic-resets-8308515aa2c0
Best regards,
--
Kyle Hendry <khendry@reliablecontrols.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells
2026-11-25 15:53 [PATCH v3 0/3] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter Kyle Hendry via B4 Relay
@ 2026-11-25 15:53 ` Kyle Hendry via B4 Relay
2026-11-25 18:59 ` Wolfram Sang
2026-11-25 15:53 ` [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 3/3] ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node Kyle Hendry via B4 Relay
2 siblings, 1 reply; 6+ messages in thread
From: Kyle Hendry via B4 Relay @ 2026-11-25 15:53 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel
Cc: linux-renesas-soc, linux-clk, devicetree, linux-kernel, Kyle Hendry
From: Kyle Hendry <khendry@reliablecontrols.com>
Update the rzn1 system controller to indicate it can be a reset controller
and add defines for miic resets
Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
---
.../devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml | 5 +++++
include/dt-bindings/clock/r9a06g032-sysctrl.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml b/Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml
index 26d94cedc871..70ccc315a10c 100644
--- a/Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml
+++ b/Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml
@@ -36,6 +36,9 @@ properties:
'#clock-cells':
const: 1
+ '#reset-cells':
+ const: 1
+
'#power-domain-cells':
const: 0
@@ -56,6 +59,7 @@ required:
- clocks
- clock-names
- '#clock-cells'
+ - '#reset-cells'
- '#power-domain-cells'
additionalProperties: false
@@ -69,5 +73,6 @@ examples:
<&ext_rgmii_ref>;
clock-names = "mclk", "rtc", "jtag", "rgmii_ref_ext";
#clock-cells = <1>;
+ #reset-cells = <1>;
#power-domain-cells = <0>;
};
diff --git a/include/dt-bindings/clock/r9a06g032-sysctrl.h b/include/dt-bindings/clock/r9a06g032-sysctrl.h
index d9d7b8b4f426..244f5b221642 100644
--- a/include/dt-bindings/clock/r9a06g032-sysctrl.h
+++ b/include/dt-bindings/clock/r9a06g032-sysctrl.h
@@ -146,4 +146,7 @@
#define R9A06G032_CLK_UART6 152
#define R9A06G032_CLK_UART7 153
+#define R9A06G032_RST_TS 0
+#define R9A06G032_RST_MIIC 1
+
#endif /* __DT_BINDINGS_R9A06G032_SYSCTRL_H__ */
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller
2026-11-25 15:53 [PATCH v3 0/3] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry via B4 Relay
@ 2026-11-25 15:53 ` Kyle Hendry via B4 Relay
2026-11-25 19:04 ` Wolfram Sang
2026-11-25 15:53 ` [PATCH v3 3/3] ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node Kyle Hendry via B4 Relay
2 siblings, 1 reply; 6+ messages in thread
From: Kyle Hendry via B4 Relay @ 2026-11-25 15:53 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel
Cc: linux-renesas-soc, linux-clk, devicetree, linux-kernel, Kyle Hendry
From: Kyle Hendry <khendry@reliablecontrols.com>
The rzn1 system controller has two resets that need to be cleared for the
mii converter to work. They are not directly associated with any clocks
so they need a reset controller to set them.
They are documented in the PWRCTRL_SWITCHCTRL (0x4000C188) register as:
Bit 3: RSTN_CLK25 - Active low Reset for Timestamp signal selection logic
Bit 4: RSTN_ETH - Active low Reset for RGMII/RMII Converter (50 MHz).
Add a reset controller and add resets for those bits.
Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
---
drivers/clk/renesas/r9a06g032-clocks.c | 59 ++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index 3df3f2b2c6de..fc4433c3d327 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -21,6 +21,7 @@
#include <linux/pm_clock.h>
#include <linux/pm_domain.h>
#include <linux/reboot.h>
+#include <linux/reset-controller.h>
#include <linux/slab.h>
#include <linux/soc/renesas/r9a06g032-sysctrl.h>
#include <linux/spinlock.h>
@@ -675,10 +676,16 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] = {
RB(0xec, 16), RB(0xec, 17), RB(0xec, 18), RB(0xec, 19)),
};
+static const struct regbit r9a06g032_resets[] = {
+ [R9A06G032_RST_TS] = RB(0x188, 3),
+ [R9A06G032_RST_MIIC] = RB(0x188, 4),
+};
+
struct r9a06g032_priv {
struct clk_onecell_data data;
spinlock_t lock; /* protects concurrent access to gates */
void __iomem *reg;
+ struct reset_controller_dev rcdev;
};
static struct r9a06g032_priv *sysctrl_priv;
@@ -1307,6 +1314,51 @@ static void __init r9a06g032_init_h2mode(struct r9a06g032_priv *clocks)
writel(usb, clocks->reg + R9A06G032_SYSCTRL_USB);
}
+static inline
+struct r9a06g032_priv *priv_from_rcdev(struct reset_controller_dev *resetdev)
+{
+ return container_of(resetdev, struct r9a06g032_priv, rcdev);
+}
+
+static int r9a06g032_reset_set(struct reset_controller_dev *rcdev,
+ bool set, unsigned long id)
+{
+ struct r9a06g032_priv *priv = priv_from_rcdev(rcdev);
+ unsigned long flags;
+
+ spin_lock_irqsave(&priv->lock, flags);
+ clk_rdesc_set(priv, r9a06g032_resets[id], set);
+ spin_unlock_irqrestore(&priv->lock, flags);
+
+ return 0;
+}
+
+static int r9a06g032_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ return r9a06g032_reset_set(rcdev, false, id);
+}
+
+static int r9a06g032_reset_deassert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ return r9a06g032_reset_set(rcdev, true, id);
+}
+
+static int r9a06g032_reset_status(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct r9a06g032_priv *priv = priv_from_rcdev(rcdev);
+
+ return !clk_rdesc_get(priv, r9a06g032_resets[id]);
+}
+
+static const struct reset_control_ops r9a06g032_reset_ops = {
+ .assert = r9a06g032_reset_assert,
+ .deassert = r9a06g032_reset_deassert,
+ .status = r9a06g032_reset_status,
+};
+
static int __init r9a06g032_clocks_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1394,6 +1446,13 @@ static int __init r9a06g032_clocks_probe(struct platform_device *pdev)
if (error)
return error;
+ clocks->rcdev.ops = &r9a06g032_reset_ops;
+ clocks->rcdev.of_node = np;
+ clocks->rcdev.nr_resets = ARRAY_SIZE(r9a06g032_resets);
+ error = devm_reset_controller_register(dev, &clocks->rcdev);
+ if (error)
+ return error;
+
error = r9a06g032_add_clk_domain(dev);
if (error)
return error;
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node
2026-11-25 15:53 [PATCH v3 0/3] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller Kyle Hendry via B4 Relay
@ 2026-11-25 15:53 ` Kyle Hendry via B4 Relay
2 siblings, 0 replies; 6+ messages in thread
From: Kyle Hendry via B4 Relay @ 2026-11-25 15:53 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel
Cc: linux-renesas-soc, linux-clk, devicetree, linux-kernel,
Wolfram Sang, Kyle Hendry
From: Kyle Hendry <khendry@reliablecontrols.com>
Update the rzn1 system controller node with cells for the reset controller
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
---
arch/arm/boot/dts/renesas/r9a06g032.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/renesas/r9a06g032.dtsi b/arch/arm/boot/dts/renesas/r9a06g032.dtsi
index 5455dccfbdd0..f2bf087f7ad2 100644
--- a/arch/arm/boot/dts/renesas/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/renesas/r9a06g032.dtsi
@@ -146,6 +146,7 @@ sysctrl: system-controller@4000c000 {
compatible = "renesas,r9a06g032-sysctrl";
reg = <0x4000c000 0x1000>;
#clock-cells = <1>;
+ #reset-cells = <1>;
#power-domain-cells = <0>;
clocks = <&ext_mclk>, <&ext_rtc_clk>,
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells
2026-11-25 15:53 ` [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry via B4 Relay
@ 2026-11-25 18:59 ` Wolfram Sang
0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2026-11-25 18:59 UTC (permalink / raw)
To: khendry
Cc: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel, linux-renesas-soc, linux-clk,
devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
On Wed, Nov 25, 2026 at 07:53:43AM -0800, Kyle Hendry via B4 Relay wrote:
> From: Kyle Hendry <khendry@reliablecontrols.com>
>
> Update the rzn1 system controller to indicate it can be a reset controller
> and add defines for miic resets
>
> Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller
2026-11-25 15:53 ` [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller Kyle Hendry via B4 Relay
@ 2026-11-25 19:04 ` Wolfram Sang
0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2026-11-25 19:04 UTC (permalink / raw)
To: khendry
Cc: Geert Uytterhoeven, Stephen Boyd, Brian Masney, Jerome Brunet,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
Fabrizio Castro, Philipp Zabel, linux-renesas-soc, linux-clk,
devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]
Hi Kyle,
> The rzn1 system controller has two resets that need to be cleared for the
> mii converter to work. They are not directly associated with any clocks
> so they need a reset controller to set them.
>
> They are documented in the PWRCTRL_SWITCHCTRL (0x4000C188) register as:
>
> Bit 3: RSTN_CLK25 - Active low Reset for Timestamp signal selection logic
> Bit 4: RSTN_ETH - Active low Reset for RGMII/RMII Converter (50 MHz).
>
> Add a reset controller and add resets for those bits.
>
> Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
Sashiko's comment about selecting RESET_CONTROLLER is still true.
> +static int r9a06g032_reset_set(struct reset_controller_dev *rcdev,
> + bool set, unsigned long id)
> +{
> + struct r9a06g032_priv *priv = priv_from_rcdev(rcdev);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&priv->lock, flags);
> + clk_rdesc_set(priv, r9a06g032_resets[id], set);
> + spin_unlock_irqrestore(&priv->lock, flags);
I checked the docs again. (Do you have them? You can find the relevant
part here[1]). Figure 7.3 and 7.4 mention a reset propagation time of
5us. So, it is not describing a pulse of 5us. But every access to the
RSTN register needs this delay for propagation. So, despite the U-Boot
code not having the delay, I think we should add a 'udelay(5)' here
after the unlock. What do you think?
[1] https://lv.mouser.com/datasheet/2/698/r01uh0750ej0150_rzn1_introduction-2931374.pdf
Happy hacking,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-25 19:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 15:53 [PATCH v3 0/3] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter Kyle Hendry via B4 Relay
2026-11-25 15:53 ` [PATCH v3 1/3] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry via B4 Relay
2026-11-25 18:59 ` Wolfram Sang
2026-11-25 15:53 ` [PATCH v3 2/3] clk: renesas: r9a06g032: Add reset controller Kyle Hendry via B4 Relay
2026-11-25 19:04 ` Wolfram Sang
2026-11-25 15:53 ` [PATCH v3 3/3] ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node Kyle Hendry via B4 Relay
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®