* [PATCH 0/9] nvmem: patches (set 1) for 7.1
@ 2026-03-27 13:17 srini
2026-03-27 13:17 ` [PATCH 1/9] dt-bindings: nvmem: qfprom: Add Kaanapali compatible srini
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla
From: Srinivas Kandagatla <srini@kernel.org>
Hi Greg,
Here are few nvmem patches for 7.1, Could you please queue
these for 7.1.
Patches include
- new RK3568, RK3562 and Kaanapali providers
- some code cleanup.
Thanks,
Srini
Felix Gu (1):
nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of
semicolons
Finley Xiao (2):
nvmem: rockchip-otp: Add support for RK3568
nvmem: rockchip-otp: Add support for RK3562
Jingyi Wang (1):
dt-bindings: nvmem: qfprom: Add Kaanapali compatible
Jonas Karlman (3):
dt-bindings: nvmem: rockchip,otp: Add compatible for RK3528
nvmem: rockchip-otp: Handle internal word_size in main reg_read op
nvmem: rockchip-otp: Add support for RK3528
Kever Yang (1):
dt-bindings: nvmem: rockchip,otp: Add support for RK3562 and RK3568
Michael Walle (1):
dt-bindings: nvmem: sl28cpld: Drop sa67mcu compatible
.../nvmem/layouts/kontron,sl28-vpd.yaml | 7 +-
.../bindings/nvmem/qcom,qfprom.yaml | 1 +
.../bindings/nvmem/rockchip,otp.yaml | 83 +++++++--
drivers/nvmem/qnap-mcu-eeprom.c | 8 +-
drivers/nvmem/rockchip-otp.c | 161 ++++++++++++++----
5 files changed, 208 insertions(+), 52 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/9] dt-bindings: nvmem: qfprom: Add Kaanapali compatible
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 2/9] nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of semicolons srini
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Jingyi Wang, Krzysztof Kozlowski, Srinivas Kandagatla
From: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
Document compatible string for the QFPROM on Kaanapali platform.
Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
index 839513d4b499..2ab047f2bb69 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
@@ -26,6 +26,7 @@ properties:
- qcom,ipq8064-qfprom
- qcom,ipq8074-qfprom
- qcom,ipq9574-qfprom
+ - qcom,kaanapali-qfprom
- qcom,msm8226-qfprom
- qcom,msm8916-qfprom
- qcom,msm8917-qfprom
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/9] nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of semicolons
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
2026-03-27 13:17 ` [PATCH 1/9] dt-bindings: nvmem: qfprom: Add Kaanapali compatible srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 3/9] dt-bindings: nvmem: sl28cpld: Drop sa67mcu compatible srini
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Felix Gu, Heiko Stuebner, Srinivas Kandagatla
From: Felix Gu <ustc.gu@gmail.com>
The nvcfg struct member assignments were incorrectly using commas instead
of semicolons.
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/qnap-mcu-eeprom.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/nvmem/qnap-mcu-eeprom.c b/drivers/nvmem/qnap-mcu-eeprom.c
index 0b919895b3b2..07bdaa2a33fa 100644
--- a/drivers/nvmem/qnap-mcu-eeprom.c
+++ b/drivers/nvmem/qnap-mcu-eeprom.c
@@ -86,10 +86,10 @@ static int qnap_mcu_eeprom_probe(struct platform_device *pdev)
nvcfg.read_only = true;
nvcfg.root_only = false;
nvcfg.reg_read = qnap_mcu_eeprom_read;
- nvcfg.size = QNAP_MCU_EEPROM_SIZE,
- nvcfg.word_size = 1,
- nvcfg.stride = 1,
- nvcfg.priv = mcu,
+ nvcfg.size = QNAP_MCU_EEPROM_SIZE;
+ nvcfg.word_size = 1;
+ nvcfg.stride = 1;
+ nvcfg.priv = mcu;
ndev = devm_nvmem_register(&pdev->dev, &nvcfg);
if (IS_ERR(ndev))
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/9] dt-bindings: nvmem: sl28cpld: Drop sa67mcu compatible
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
2026-03-27 13:17 ` [PATCH 1/9] dt-bindings: nvmem: qfprom: Add Kaanapali compatible srini
2026-03-27 13:17 ` [PATCH 2/9] nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of semicolons srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 4/9] dt-bindings: nvmem: rockchip,otp: Add support for RK3562 and RK3568 srini
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Michael Walle, Conor Dooley, Srinivas Kandagatla
From: Michael Walle <mwalle@kernel.org>
I was just informed that this product is discontinued (without being
ever released to the market). Pull the plug and let's not waste any more
maintainers time and revert commit 4a9b344e90c7 ("dt-bindings: nvmem:
sl28cpld: add sa67mcu compatible").
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Michael Walle <mwalle@kernel.org>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
.../bindings/nvmem/layouts/kontron,sl28-vpd.yaml | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
index afd1919c6b1c..c713e23819f1 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
@@ -19,12 +19,7 @@ select: false
properties:
compatible:
- oneOf:
- - items:
- - enum:
- - kontron,sa67-vpd
- - const: kontron,sl28-vpd
- - const: kontron,sl28-vpd
+ const: kontron,sl28-vpd
serial-number:
type: object
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/9] dt-bindings: nvmem: rockchip,otp: Add support for RK3562 and RK3568
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (2 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 3/9] dt-bindings: nvmem: sl28cpld: Drop sa67mcu compatible srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 5/9] dt-bindings: nvmem: rockchip,otp: Add compatible for RK3528 srini
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Kever Yang, Rob Herring (Arm),
Heiko Stuebner, Srinivas Kandagatla
From: Kever Yang <kever.yang@rock-chips.com>
Add compatible entry for the otp controller in RK3562 and RK3568, add
schema for different clock names for new entry.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
.../bindings/nvmem/rockchip,otp.yaml | 58 +++++++++++++++----
1 file changed, 48 insertions(+), 10 deletions(-)
diff --git a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
index dc89020b0950..e90136f7dcfb 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
@@ -14,6 +14,8 @@ properties:
enum:
- rockchip,px30-otp
- rockchip,rk3308-otp
+ - rockchip,rk3562-otp
+ - rockchip,rk3568-otp
- rockchip,rk3576-otp
- rockchip,rk3588-otp
@@ -26,19 +28,15 @@ properties:
clock-names:
minItems: 3
- items:
- - const: otp
- - const: apb_pclk
- - const: phy
- - const: arb
+ maxItems: 4
resets:
minItems: 1
- maxItems: 3
+ maxItems: 4
reset-names:
minItems: 1
- maxItems: 3
+ maxItems: 4
required:
- compatible
@@ -64,13 +62,44 @@ allOf:
clocks:
maxItems: 3
clock-names:
- maxItems: 3
+ items:
+ - const: otp
+ - const: apb_pclk
+ - const: phy
resets:
maxItems: 1
reset-names:
items:
- const: phy
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - rockchip,rk3562-otp
+ - rockchip,rk3568-otp
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ maxItems: 4
+ clock-names:
+ items:
+ - const: otp
+ - const: apb_pclk
+ - const: phy
+ - const: sbpi
+ resets:
+ minItems: 4
+ maxItems: 4
+ reset-names:
+ items:
+ - const: otp
+ - const: apb
+ - const: phy
+ - const: sbpi
+
- if:
properties:
compatible:
@@ -82,7 +111,10 @@ allOf:
clocks:
maxItems: 3
clock-names:
- maxItems: 3
+ items:
+ - const: otp
+ - const: apb_pclk
+ - const: phy
resets:
minItems: 2
maxItems: 2
@@ -101,10 +133,16 @@ allOf:
properties:
clocks:
minItems: 4
+ maxItems: 4
clock-names:
- minItems: 4
+ items:
+ - const: otp
+ - const: apb_pclk
+ - const: phy
+ - const: arb
resets:
minItems: 3
+ maxItems: 3
reset-names:
items:
- const: otp
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] dt-bindings: nvmem: rockchip,otp: Add compatible for RK3528
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (3 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 4/9] dt-bindings: nvmem: rockchip,otp: Add support for RK3562 and RK3568 srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 6/9] nvmem: rockchip-otp: Handle internal word_size in main reg_read op srini
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Jonas Karlman, Heiko Stuebner, Rob Herring (Arm),
Srinivas Kandagatla
From: Jonas Karlman <jonas@kwiboo.se>
Add compatible string for the OTP controller in RK3528. Compared to the
RK3562 and RK3568 the OTP in RK3528 does not have a phy clock or reset.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
.../bindings/nvmem/rockchip,otp.yaml | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
index e90136f7dcfb..7e4d5e1c4ced 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml
@@ -14,6 +14,7 @@ properties:
enum:
- rockchip,px30-otp
- rockchip,rk3308-otp
+ - rockchip,rk3528-otp
- rockchip,rk3562-otp
- rockchip,rk3568-otp
- rockchip,rk3576-otp
@@ -72,6 +73,30 @@ allOf:
items:
- const: phy
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - rockchip,rk3528-otp
+ then:
+ properties:
+ clocks:
+ maxItems: 3
+ clock-names:
+ items:
+ - const: otp
+ - const: apb_pclk
+ - const: sbpi
+ resets:
+ minItems: 3
+ maxItems: 3
+ reset-names:
+ items:
+ - const: otp
+ - const: apb
+ - const: sbpi
+
- if:
properties:
compatible:
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/9] nvmem: rockchip-otp: Handle internal word_size in main reg_read op
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (4 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 5/9] dt-bindings: nvmem: rockchip,otp: Add compatible for RK3528 srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 7/9] nvmem: rockchip-otp: Add support for RK3568 srini
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Jonas Karlman, Willy Tarreau, Heiko Stuebner,
Srinivas Kandagatla
From: Jonas Karlman <jonas@kwiboo.se>
Rockchip SoCs RK3576 and RK3588 read data from the OTP using 32-bit
words instead of normal 8-bit bytes. Similar RK3506, RK3528, RK3562 and
RK3568 will read data from OTP using 16-bit words.
The nvmem core stride and word_size cannot fully be used as cells is not
always aligned. Continue to report a stride=1 and word_size=1 in
nvmem_config and instead handle use of SoC specific word_size internally
in the driver.
Move current SoC specific word_size handling from the RK3588 read_reg
operation to the main read_reg operation to help simplify the SoC
specific read_reg operation and allow code reuse in a future RK3568
reg_read operation.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/rockchip-otp.c | 72 ++++++++++++++++++++----------------
1 file changed, 40 insertions(+), 32 deletions(-)
diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
index d88f12c53242..45bbb6147fb7 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -59,7 +59,6 @@
#define RK3588_OTPC_AUTO_EN 0x08
#define RK3588_OTPC_INT_ST 0x84
#define RK3588_OTPC_DOUT0 0x20
-#define RK3588_NBYTES 4
#define RK3588_BURST_NUM 1
#define RK3588_BURST_SHIFT 8
#define RK3588_ADDR_SHIFT 16
@@ -69,6 +68,7 @@
struct rockchip_data {
int size;
int read_offset;
+ int word_size;
const char * const *clks;
int num_clks;
nvmem_reg_read_t reg_read;
@@ -185,48 +185,28 @@ static int px30_otp_read(void *context, unsigned int offset,
}
static int rk3588_otp_read(void *context, unsigned int offset,
- void *val, size_t bytes)
+ void *val, size_t count)
{
struct rockchip_otp *otp = context;
- unsigned int addr_start, addr_end, addr_len;
- int ret, i = 0;
- u32 data;
- u8 *buf;
-
- addr_start = round_down(offset, RK3588_NBYTES) / RK3588_NBYTES;
- addr_end = round_up(offset + bytes, RK3588_NBYTES) / RK3588_NBYTES;
- addr_len = addr_end - addr_start;
- addr_start += otp->data->read_offset / RK3588_NBYTES;
-
- buf = kzalloc(array_size(addr_len, RK3588_NBYTES), GFP_KERNEL);
- if (!buf)
- return -ENOMEM;
+ u32 *buf = val;
+ int ret;
- while (addr_len--) {
- writel((addr_start << RK3588_ADDR_SHIFT) |
+ while (count--) {
+ writel((offset++ << RK3588_ADDR_SHIFT) |
(RK3588_BURST_NUM << RK3588_BURST_SHIFT),
otp->base + RK3588_OTPC_AUTO_CTRL);
writel(RK3588_AUTO_EN, otp->base + RK3588_OTPC_AUTO_EN);
ret = rockchip_otp_wait_status(otp, RK3588_OTPC_INT_ST,
RK3588_RD_DONE);
- if (ret < 0) {
+ if (ret) {
dev_err(otp->dev, "timeout during read setup\n");
- goto read_end;
+ return ret;
}
- data = readl(otp->base + RK3588_OTPC_DOUT0);
- memcpy(&buf[i], &data, RK3588_NBYTES);
-
- i += RK3588_NBYTES;
- addr_start++;
+ *buf++ = readl(otp->base + RK3588_OTPC_DOUT0);
}
- memcpy(val, buf + offset % RK3588_NBYTES, bytes);
-
-read_end:
- kfree(buf);
-
return ret;
}
@@ -234,7 +214,7 @@ static int rockchip_otp_read(void *context, unsigned int offset,
void *val, size_t bytes)
{
struct rockchip_otp *otp = context;
- int ret;
+ int ret, word_size;
if (!otp->data || !otp->data->reg_read)
return -EINVAL;
@@ -245,8 +225,34 @@ static int rockchip_otp_read(void *context, unsigned int offset,
return ret;
}
- ret = otp->data->reg_read(context, offset, val, bytes);
+ offset += otp->data->read_offset;
+ word_size = otp->data->word_size;
+
+ if (word_size > 1) {
+ unsigned int addr_start, addr_end;
+ size_t count;
+ u8 *buf;
+
+ addr_start = offset / word_size;
+ addr_end = DIV_ROUND_UP(offset + bytes, word_size);
+ count = addr_end - addr_start;
+
+ buf = kzalloc(array_size(count, word_size), GFP_KERNEL);
+ if (!buf) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ ret = otp->data->reg_read(context, addr_start, buf, count);
+ if (!ret)
+ memcpy(val, buf + (offset % word_size), bytes);
+
+ kfree(buf);
+ } else {
+ ret = otp->data->reg_read(context, offset, val, bytes);
+ }
+err:
clk_bulk_disable_unprepare(otp->data->num_clks, otp->clks);
return ret;
@@ -259,7 +265,7 @@ static struct nvmem_config otp_config = {
.type = NVMEM_TYPE_OTP,
.read_only = true,
.stride = 1,
- .word_size = 1,
+ .word_size = sizeof(u8),
.reg_read = rockchip_otp_read,
};
@@ -277,6 +283,7 @@ static const struct rockchip_data px30_data = {
static const struct rockchip_data rk3576_data = {
.size = 0x100,
.read_offset = 0x700,
+ .word_size = sizeof(u32),
.clks = px30_otp_clocks,
.num_clks = ARRAY_SIZE(px30_otp_clocks),
.reg_read = rk3588_otp_read,
@@ -289,6 +296,7 @@ static const char * const rk3588_otp_clocks[] = {
static const struct rockchip_data rk3588_data = {
.size = 0x400,
.read_offset = 0xc00,
+ .word_size = sizeof(u32),
.clks = rk3588_otp_clocks,
.num_clks = ARRAY_SIZE(rk3588_otp_clocks),
.reg_read = rk3588_otp_read,
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/9] nvmem: rockchip-otp: Add support for RK3568
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (5 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 6/9] nvmem: rockchip-otp: Handle internal word_size in main reg_read op srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 8/9] nvmem: rockchip-otp: Add support for RK3562 srini
2026-03-27 13:17 ` [PATCH 9/9] nvmem: rockchip-otp: Add support for RK3528 srini
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Finley Xiao, Kever Yang, Heiko Stuebner,
Srinivas Kandagatla
From: Finley Xiao <finley.xiao@rock-chips.com>
This adds the necessary data for handling otp the rk3568.
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/rockchip-otp.c | 69 ++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
index 45bbb6147fb7..cfb69bc58869 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -27,6 +27,7 @@
#define OTPC_USER_CTRL 0x0100
#define OTPC_USER_ADDR 0x0104
#define OTPC_USER_ENABLE 0x0108
+#define OTPC_USER_QP 0x0120
#define OTPC_USER_Q 0x0124
#define OTPC_INT_STATUS 0x0304
#define OTPC_SBPI_CMD0_OFFSET 0x1000
@@ -184,6 +185,58 @@ static int px30_otp_read(void *context, unsigned int offset,
return ret;
}
+static int rk3568_otp_read(void *context, unsigned int offset, void *val,
+ size_t count)
+{
+ struct rockchip_otp *otp = context;
+ u16 *buf = val;
+ u32 otp_qp;
+ int ret;
+
+ ret = rockchip_otp_reset(otp);
+ if (ret) {
+ dev_err(otp->dev, "failed to reset otp phy\n");
+ return ret;
+ }
+
+ ret = rockchip_otp_ecc_enable(otp, true);
+ if (ret) {
+ dev_err(otp->dev, "rockchip_otp_ecc_enable err\n");
+ return ret;
+ }
+
+ writel(OTPC_USE_USER | OTPC_USE_USER_MASK, otp->base + OTPC_USER_CTRL);
+ udelay(5);
+
+ while (count--) {
+ writel(offset++ | OTPC_USER_ADDR_MASK,
+ otp->base + OTPC_USER_ADDR);
+ writel(OTPC_USER_FSM_ENABLE | OTPC_USER_FSM_ENABLE_MASK,
+ otp->base + OTPC_USER_ENABLE);
+
+ ret = rockchip_otp_wait_status(otp, OTPC_INT_STATUS,
+ OTPC_USER_DONE);
+ if (ret) {
+ dev_err(otp->dev, "timeout during read setup\n");
+ goto read_end;
+ }
+
+ otp_qp = readl(otp->base + OTPC_USER_QP);
+ if (((otp_qp & 0xc0) == 0xc0) || (otp_qp & 0x20)) {
+ ret = -EIO;
+ dev_err(otp->dev, "ecc check error during read setup\n");
+ goto read_end;
+ }
+
+ *buf++ = readl(otp->base + OTPC_USER_Q);
+ }
+
+read_end:
+ writel(0x0 | OTPC_USE_USER_MASK, otp->base + OTPC_USER_CTRL);
+
+ return ret;
+}
+
static int rk3588_otp_read(void *context, unsigned int offset,
void *val, size_t count)
{
@@ -280,6 +333,18 @@ static const struct rockchip_data px30_data = {
.reg_read = px30_otp_read,
};
+static const char * const rk3568_otp_clocks[] = {
+ "otp", "apb_pclk", "phy", "sbpi",
+};
+
+static const struct rockchip_data rk3568_data = {
+ .size = 0x80,
+ .word_size = sizeof(u16),
+ .clks = rk3568_otp_clocks,
+ .num_clks = ARRAY_SIZE(rk3568_otp_clocks),
+ .reg_read = rk3568_otp_read,
+};
+
static const struct rockchip_data rk3576_data = {
.size = 0x100,
.read_offset = 0x700,
@@ -311,6 +376,10 @@ static const struct of_device_id rockchip_otp_match[] = {
.compatible = "rockchip,rk3308-otp",
.data = &px30_data,
},
+ {
+ .compatible = "rockchip,rk3568-otp",
+ .data = &rk3568_data,
+ },
{
.compatible = "rockchip,rk3576-otp",
.data = &rk3576_data,
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/9] nvmem: rockchip-otp: Add support for RK3562
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (6 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 7/9] nvmem: rockchip-otp: Add support for RK3568 srini
@ 2026-03-27 13:17 ` srini
2026-03-27 13:17 ` [PATCH 9/9] nvmem: rockchip-otp: Add support for RK3528 srini
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Finley Xiao, Kever Yang, Heiko Stuebner,
Willy Tarreau, Srinivas Kandagatla
From: Finley Xiao <finley.xiao@rock-chips.com>
This adds the necessary data for handling otp on the rk3562.
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Willy Tarreau <w@1wt.eu>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/rockchip-otp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
index cfb69bc58869..62ce22d72586 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -376,6 +376,10 @@ static const struct of_device_id rockchip_otp_match[] = {
.compatible = "rockchip,rk3308-otp",
.data = &px30_data,
},
+ {
+ .compatible = "rockchip,rk3562-otp",
+ .data = &rk3568_data,
+ },
{
.compatible = "rockchip,rk3568-otp",
.data = &rk3568_data,
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 9/9] nvmem: rockchip-otp: Add support for RK3528
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
` (7 preceding siblings ...)
2026-03-27 13:17 ` [PATCH 8/9] nvmem: rockchip-otp: Add support for RK3562 srini
@ 2026-03-27 13:17 ` srini
8 siblings, 0 replies; 10+ messages in thread
From: srini @ 2026-03-27 13:17 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Jonas Karlman, Heiko Stuebner, Willy Tarreau,
Srinivas Kandagatla
From: Jonas Karlman <jonas@kwiboo.se>
Add support for the OTP controller in RK3528. The OTPC is similar to the
OTPC in RK3562 and RK3568, exept for a missing phy clock and reset.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
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 62ce22d72586..0ec78b5e19e7 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -333,6 +333,18 @@ static const struct rockchip_data px30_data = {
.reg_read = px30_otp_read,
};
+static const char * const rk3528_otp_clocks[] = {
+ "otp", "apb_pclk", "sbpi",
+};
+
+static const struct rockchip_data rk3528_data = {
+ .size = 0x80,
+ .word_size = sizeof(u16),
+ .clks = rk3528_otp_clocks,
+ .num_clks = ARRAY_SIZE(rk3528_otp_clocks),
+ .reg_read = rk3568_otp_read,
+};
+
static const char * const rk3568_otp_clocks[] = {
"otp", "apb_pclk", "phy", "sbpi",
};
@@ -376,6 +388,10 @@ static const struct of_device_id rockchip_otp_match[] = {
.compatible = "rockchip,rk3308-otp",
.data = &px30_data,
},
+ {
+ .compatible = "rockchip,rk3528-otp",
+ .data = &rk3528_data,
+ },
{
.compatible = "rockchip,rk3562-otp",
.data = &rk3568_data,
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-03-27 13:18 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-27 13:17 [PATCH 0/9] nvmem: patches (set 1) for 7.1 srini
2026-03-27 13:17 ` [PATCH 1/9] dt-bindings: nvmem: qfprom: Add Kaanapali compatible srini
2026-03-27 13:17 ` [PATCH 2/9] nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of semicolons srini
2026-03-27 13:17 ` [PATCH 3/9] dt-bindings: nvmem: sl28cpld: Drop sa67mcu compatible srini
2026-03-27 13:17 ` [PATCH 4/9] dt-bindings: nvmem: rockchip,otp: Add support for RK3562 and RK3568 srini
2026-03-27 13:17 ` [PATCH 5/9] dt-bindings: nvmem: rockchip,otp: Add compatible for RK3528 srini
2026-03-27 13:17 ` [PATCH 6/9] nvmem: rockchip-otp: Handle internal word_size in main reg_read op srini
2026-03-27 13:17 ` [PATCH 7/9] nvmem: rockchip-otp: Add support for RK3568 srini
2026-03-27 13:17 ` [PATCH 8/9] nvmem: rockchip-otp: Add support for RK3562 srini
2026-03-27 13:17 ` [PATCH 9/9] nvmem: rockchip-otp: Add support for RK3528 srini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox