Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] nvmem: rockchip-otp: Add support for the RV1106
@ 2026-12-03 12:24 Weihong Guan
  2026-12-03 12:24 ` [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106 Weihong Guan
  2026-12-03 12:24 ` [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106 Weihong Guan
  0 siblings, 2 replies; 5+ messages in thread
From: Weihong Guan @ 2026-12-03 12:24 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Weihong Guan, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, Ondrej Jirman, devicetree, linux-arm-kernel,
	linux-rockchip

The RV1106, and the RV1103 which shares its blocks, has the RK3568's
OTP controller behind six clocks and six resets. These two patches add
the compatible to the binding and its data to the driver; the device
tree node can come with the RV1106/RV1103 dtsi, which is under review
(Simon Glass's series).

Tested on a Luckfox Pico Plus (RV1103) on 7.3.7 with an out-of-tree
RV1103 device tree that has the node as in the binding: the OTP's 0x80
bytes read the same as with the vendor's clock and reset names, the
board's dtb validates against the binding, and dt_binding_check passes.

The driver data matches Rockchip's own driver for the RV1106 (size,
read routine, clocks); Ondrej Jirman's port of it to 6.x was the start.
Written with the help of an AI assistant (Claude), as each patch's
Assisted-by says: the binding's rules and the commit messages, from our
out-of-tree patch; reviewed, built and tested on the board by me.

Weihong Guan (2):
  dt-bindings: nvmem: rockchip,otp: Add RV1106
  nvmem: rockchip-otp: Add support for RV1106

 .../bindings/nvmem/rockchip,otp.yaml          | 38 +++++++++++++++++--
 drivers/nvmem/rockchip-otp.c                  | 16 ++++++++
 2 files changed, 50 insertions(+), 4 deletions(-)


base-commit: ca20d5a011d35fc25e328fe31ac47f7aae557c5a
-- 
2.47.3


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

* [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106
  2026-12-03 12:24 [PATCH 0/2] nvmem: rockchip-otp: Add support for the RV1106 Weihong Guan
@ 2026-12-03 12:24 ` Weihong Guan
  2026-12-03 12:48   ` sashiko-bot
  2026-12-03 12:24 ` [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106 Weihong Guan
  1 sibling, 1 reply; 5+ messages in thread
From: Weihong Guan @ 2026-12-03 12:24 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Weihong Guan, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, Ondrej Jirman, devicetree, linux-arm-kernel,
	linux-rockchip

The RV1106 OTP controller works as the RK3568's, behind six clocks and
six resets: the RK3568's four (otp, apb, phy, sbpi), the arbiter's
the RK3588 also has (arb), and CLK_PMC_OTP / SRST_PMC_OTP (pmc), as
Rockchip's own RV1106 device tree lists them. The RV1103 has the same
block.

Allow up to six clocks and resets, and add the compatible with its
clock and reset names.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Weihong Guan <weihong.guan@gmail.com>
---
 .../bindings/nvmem/rockchip,otp.yaml          | 38 +++++++++++++++++--
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
index 7e4d5e1c4..0db99a365 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
@@ -19,25 +19,26 @@ properties:
       - rockchip,rk3568-otp
       - rockchip,rk3576-otp
       - rockchip,rk3588-otp
+      - rockchip,rv1106-otp
 
   reg:
     maxItems: 1
 
   clocks:
     minItems: 3
-    maxItems: 4
+    maxItems: 6
 
   clock-names:
     minItems: 3
-    maxItems: 4
+    maxItems: 6
 
   resets:
     minItems: 1
-    maxItems: 4
+    maxItems: 6
 
   reset-names:
     minItems: 1
-    maxItems: 4
+    maxItems: 6
 
 required:
   - compatible
@@ -174,6 +175,35 @@ allOf:
             - const: apb
             - const: arb
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rv1106-otp
+    then:
+      properties:
+        clocks:
+          minItems: 6
+        clock-names:
+          items:
+            - const: otp
+            - const: apb_pclk
+            - const: phy
+            - const: sbpi
+            - const: arb
+            - const: pmc
+        resets:
+          minItems: 6
+        reset-names:
+          items:
+            - const: otp
+            - const: apb
+            - const: phy
+            - const: sbpi
+            - const: arb
+            - const: pmc
+
 unevaluatedProperties: false
 
 examples:
-- 
2.47.3


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

* [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106
  2026-12-03 12:24 [PATCH 0/2] nvmem: rockchip-otp: Add support for the RV1106 Weihong Guan
  2026-12-03 12:24 ` [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106 Weihong Guan
@ 2026-12-03 12:24 ` Weihong Guan
  2026-12-03 13:06   ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Weihong Guan @ 2026-12-03 12:24 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Weihong Guan, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, Ondrej Jirman, devicetree, linux-arm-kernel,
	linux-rockchip

The RV1106's OTP is read as the RK3568's: 16-bit words through the same
user-mode sequence, 0x80 bytes, as in Rockchip's own driver for it. It
only needs two more clocks, so add its data with its six clocks and the
compatible. The RV1103 uses the same block and compatible.

Tested on a Luckfox Pico Plus (RV1103), the node as in the binding: the
OTP reads "RV" 0x1103 at offset 0 and again at 0x68.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Weihong Guan <weihong.guan@gmail.com>
---
 drivers/nvmem/rockchip-otp.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
index 7eb834516..43712b6f0 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -387,6 +387,18 @@ static const struct rockchip_data rk3588_data = {
 	.reg_read = rk3588_otp_read,
 };
 
+static const char * const rv1106_otp_clocks[] = {
+	"otp", "apb_pclk", "phy", "sbpi", "arb", "pmc",
+};
+
+static const struct rockchip_data rv1106_data = {
+	.size = 0x80,
+	.word_size = sizeof(u16),
+	.clks = rv1106_otp_clocks,
+	.num_clks = ARRAY_SIZE(rv1106_otp_clocks),
+	.reg_read = rk3568_otp_read,
+};
+
 static const struct of_device_id rockchip_otp_match[] = {
 	{
 		.compatible = "rockchip,px30-otp",
@@ -416,6 +428,10 @@ static const struct of_device_id rockchip_otp_match[] = {
 		.compatible = "rockchip,rk3588-otp",
 		.data = &rk3588_data,
 	},
+	{
+		.compatible = "rockchip,rv1106-otp",
+		.data = &rv1106_data,
+	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rockchip_otp_match);
-- 
2.47.3


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

* Re: [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106
  2026-12-03 12:24 ` [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106 Weihong Guan
@ 2026-12-03 12:48   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-03 12:48 UTC (permalink / raw)
  To: Weihong Guan; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dt-bindings: nvmem: rockchip,rv1106-otp requires absent phy
  clock and reset
--

commit f0e228867b478683405ba8909839fc2a663be34d
Author: Weihong Guan <weihong.guan@gmail.com>

dt-bindings: nvmem: rockchip,otp: Add RV1106

This commit adds the rockchip,rv1106-otp compatible to the Rockchip OTP
binding and raises the maximum clock and reset counts to six.

> diff --git a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
> index 7e4d5e1c4cedc..0db99a3651c34 100644
> --- a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
> +++ b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml

[ ... ]

> @@ -174,6 +175,35 @@ allOf:
>              - const: apb
>              - const: arb
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - rockchip,rv1106-otp
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 6
> +        clock-names:
> +          items:
> +            - const: otp
> +            - const: apb_pclk
> +            - const: phy
> +            - const: sbpi
> +            - const: arb
> +            - const: pmc
> +        resets:
> +          minItems: 6
> +        reset-names:
> +          items:
> +            - const: otp
> +            - const: apb
> +            - const: phy
> +            - const: sbpi
> +            - const: arb
> +            - const: pmc

[Severity: Medium]
Does rockchip,rv1106-otp actually have a phy clock and reset?

Neither include/dt-bindings/clock/rockchip,rv1106-cru.h nor
drivers/clk/rockchip/clk-rv1106.c defines an OTP PHY clock.  Like RK3528,
which omits phy in this binding, RV1106 defines PCLK_OTP_MASK instead of
an OTP PHY clock alongside its arbiter, APB, SBPI, user, and PMC clocks.

Requiring a mandatory phy entry prevents an RV1106 or RV1103 DTS from
satisfying the schema with a valid OTP PHY clock ID, or forces it to
mislabel an unrelated clock such as PCLK_OTP_MASK as phy.

If RV1106 has no OTP PHY clock, phy should be dropped (or PCLK_OTP_MASK
named explicitly if needed); otherwise the missing clock should be added
to the RV1106 CRU binding and driver first.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203122416.682071-1-weihong.guan@gmail.com?part=1

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

* Re: [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106
  2026-12-03 12:24 ` [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106 Weihong Guan
@ 2026-12-03 13:06   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-03 13:06 UTC (permalink / raw)
  To: Weihong Guan; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvmem: rockchip-otp: rv1106_otp_clocks requires nonexistent
  phy clock
--

commit ede968e4fdcf1ce13352f1f4f84a15321202e696
Author: Weihong Guan <weihong.guan@gmail.com>

nvmem: rockchip-otp: Add support for RV1106

This commit adds Rockchip RV1106/RV1103 support to the Rockchip OTP
driver, reusing rk3568_otp_read() with a 0x80-byte size and six clocks.

> diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
> index 7eb834516ab4b..43712b6f0194d 100644
> --- a/drivers/nvmem/rockchip-otp.c
> +++ b/drivers/nvmem/rockchip-otp.c
> @@ -387,6 +387,18 @@ static const struct rockchip_data rk3588_data = {
>  	.reg_read = rk3588_otp_read,
>  };
>  
> +static const char * const rv1106_otp_clocks[] = {
> +	"otp", "apb_pclk", "phy", "sbpi", "arb", "pmc",
> +};

[Severity: Medium]
Should rv1106_otp_clocks require a phy clock?

The RV1106 CRU in include/dt-bindings/clock/rockchip,rv1106-cru.h and
drivers/clk/rockchip/clk-rv1106.c has no OTP PHY clock; the sixth
non-secure OTP clock is PCLK_OTP_MASK.

Because rockchip_otp_probe() fetches every entry with
devm_clk_bulk_get(), requiring phy either fails probe with -ENOENT when
a DT node lists only the real CRU clocks or locks the DT ABI into
mislabeling PCLK_OTP_MASK as phy.

On RK3528, which has the same CRU OTP clocks, commit a255f352b0e0
("nvmem: rockchip-otp: Add support for RK3528") omitted phy.  Both
rv1106_otp_clocks and commit "dt-bindings: nvmem: rockchip,otp: Add
RV1106" should either drop phy or name PCLK_OTP_MASK (e.g., mask).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203122416.682071-1-weihong.guan@gmail.com?part=2

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

end of thread, other threads:[~2026-12-03 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:24 [PATCH 0/2] nvmem: rockchip-otp: Add support for the RV1106 Weihong Guan
2026-12-03 12:24 ` [PATCH 1/2] dt-bindings: nvmem: rockchip,otp: Add RV1106 Weihong Guan
2026-12-03 12:48   ` sashiko-bot
2026-12-03 12:24 ` [PATCH 2/2] nvmem: rockchip-otp: Add support for RV1106 Weihong Guan
2026-12-03 13:06   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox