* [PATCH v3 0/3] rockchip,otp: Add support for rk3562 and rk3568 @ 2025-04-15 10:32 Kever Yang 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Kever Yang @ 2025-04-15 10:32 UTC (permalink / raw) To: heiko Cc: linux-rockchip, Kever Yang, devicetree, Conor Dooley, Rob Herring, Srinivas Kandagatla, linux-kernel, Krzysztof Kozlowski, linux-arm-kernel Rockchip rk3562 and rk3568 has the same otp controller, which is different with those already support in the driver, add support for it. This patch set depends on Jonas's change[1]. [1] https://lore.kernel.org/r/20250316191900.1858944-1-jonas@kwiboo.se Changes in v3: - update the clock name from "usr" to "otp" and re-order to sync with other soc. - rebase on rk3576 and rk3528, changes suggest by Jonas - Use rk3568 data structure for rk3562 Changes in v2: - Update the commit message and add maxItems in schema. Finley Xiao (2): nvmem: rockchip-otp: Add support for rk3568-otp nvmem: rockchip-otp: Add support for rk3562 Kever Yang (1): dt-bindings: nvmem: rockchip,otp: Add support for rk3562 and rk3568 .../bindings/nvmem/rockchip,otp.yaml | 53 ++++++++++++-- drivers/nvmem/rockchip-otp.c | 73 +++++++++++++++++++ 2 files changed, 119 insertions(+), 7 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/3] dt-bindings: nvmem: rockchip,otp: Add support for rk3562 and rk3568 2025-04-15 10:32 [PATCH v3 0/3] rockchip,otp: Add support for rk3562 and rk3568 Kever Yang @ 2025-04-15 10:32 ` Kever Yang 2025-04-21 18:45 ` Rob Herring (Arm) 2025-04-22 10:06 ` Heiko Stübner 2025-04-15 10:32 ` [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp Kever Yang 2025-04-15 10:32 ` [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 Kever Yang 2 siblings, 2 replies; 9+ messages in thread From: Kever Yang @ 2025-04-15 10:32 UTC (permalink / raw) To: heiko Cc: linux-rockchip, Kever Yang, devicetree, Conor Dooley, Rob Herring, Srinivas Kandagatla, linux-kernel, Krzysztof Kozlowski, linux-arm-kernel 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> --- Changes in v3: - update the clock name from "usr" to "otp" and re-order to sync with other soc. Changes in v2: - Update the commit message and add maxItems in schema. .../bindings/nvmem/rockchip,otp.yaml | 53 ++++++++++++++++--- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml b/Documentation/devicetree/bindings/nvmem/rockchip,otp.yaml index a44d44b32809..8b257662f282 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,rk3588-otp reg: @@ -25,19 +27,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 @@ -62,12 +60,45 @@ allOf: properties: clocks: maxItems: 3 + clock-names: + 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: @@ -78,8 +109,16 @@ allOf: properties: clocks: minItems: 4 + maxItems: 4 + clock-names: + items: + - const: otp + - const: apb_pclk + - const: phy + - const: arb resets: minItems: 3 + maxItems: 3 reset-names: items: - const: otp -- 2.25.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: nvmem: rockchip,otp: Add support for rk3562 and rk3568 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang @ 2025-04-21 18:45 ` Rob Herring (Arm) 2025-04-22 10:06 ` Heiko Stübner 1 sibling, 0 replies; 9+ messages in thread From: Rob Herring (Arm) @ 2025-04-21 18:45 UTC (permalink / raw) To: Kever Yang Cc: Srinivas Kandagatla, Krzysztof Kozlowski, heiko, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, Conor Dooley On Tue, 15 Apr 2025 18:32:01 +0800, Kever Yang wrote: > 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> > --- > > Changes in v3: > - update the clock name from "usr" to "otp" and re-order to sync with > other soc. > > Changes in v2: > - Update the commit message and add maxItems in schema. > > .../bindings/nvmem/rockchip,otp.yaml | 53 ++++++++++++++++--- > 1 file changed, 46 insertions(+), 7 deletions(-) > Reviewed-by: Rob Herring (Arm) <robh@kernel.org> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: nvmem: rockchip,otp: Add support for rk3562 and rk3568 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang 2025-04-21 18:45 ` Rob Herring (Arm) @ 2025-04-22 10:06 ` Heiko Stübner 1 sibling, 0 replies; 9+ messages in thread From: Heiko Stübner @ 2025-04-22 10:06 UTC (permalink / raw) To: Kever Yang Cc: linux-rockchip, Kever Yang, devicetree, Conor Dooley, Rob Herring, Srinivas Kandagatla, linux-kernel, Krzysztof Kozlowski, linux-arm-kernel Am Dienstag, 15. April 2025, 12:32:01 Mitteleuropäische Sommerzeit schrieb Kever Yang: > 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: Heiko Stuebner <heiko@sntech.de> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp 2025-04-15 10:32 [PATCH v3 0/3] rockchip,otp: Add support for rk3562 and rk3568 Kever Yang 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang @ 2025-04-15 10:32 ` Kever Yang 2025-04-22 10:07 ` Heiko Stübner 2025-04-15 10:32 ` [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 Kever Yang 2 siblings, 1 reply; 9+ messages in thread From: Kever Yang @ 2025-04-15 10:32 UTC (permalink / raw) To: heiko Cc: linux-rockchip, Finley Xiao, Kever Yang, linux-arm-kernel, linux-kernel, 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> --- Changes in v3: - rebase on rk3576 and rk3528, changes suggest by Jonas Changes in v2: None 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.25.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp 2025-04-15 10:32 ` [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp Kever Yang @ 2025-04-22 10:07 ` Heiko Stübner 0 siblings, 0 replies; 9+ messages in thread From: Heiko Stübner @ 2025-04-22 10:07 UTC (permalink / raw) To: Kever Yang Cc: linux-rockchip, Finley Xiao, Kever Yang, linux-arm-kernel, linux-kernel, Srinivas Kandagatla Am Dienstag, 15. April 2025, 12:32:02 Mitteleuropäische Sommerzeit schrieb Kever Yang: > 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> Reviewed-by: Heiko Stuebner <heiko@sntech.de> On a Quartz64b Tested-by: Heiko Stuebner <heiko@sntech.de> > --- > > Changes in v3: > - rebase on rk3576 and rk3528, changes suggest by Jonas > > Changes in v2: None > > 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, > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 2025-04-15 10:32 [PATCH v3 0/3] rockchip,otp: Add support for rk3562 and rk3568 Kever Yang 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang 2025-04-15 10:32 ` [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp Kever Yang @ 2025-04-15 10:32 ` Kever Yang 2025-04-22 10:07 ` Heiko Stübner 2025-07-28 19:01 ` Willy Tarreau 2 siblings, 2 replies; 9+ messages in thread From: Kever Yang @ 2025-04-15 10:32 UTC (permalink / raw) To: heiko Cc: linux-rockchip, Finley Xiao, Kever Yang, linux-arm-kernel, linux-kernel, 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> --- Changes in v3: - Use rk3568 data structure for rk3562 Changes in v2: None 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.25.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 2025-04-15 10:32 ` [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 Kever Yang @ 2025-04-22 10:07 ` Heiko Stübner 2025-07-28 19:01 ` Willy Tarreau 1 sibling, 0 replies; 9+ messages in thread From: Heiko Stübner @ 2025-04-22 10:07 UTC (permalink / raw) To: Kever Yang Cc: linux-rockchip, Finley Xiao, Kever Yang, linux-arm-kernel, linux-kernel, Srinivas Kandagatla Am Dienstag, 15. April 2025, 12:32:03 Mitteleuropäische Sommerzeit schrieb Kever Yang: > 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> Reviewed-by: Heiko Stuebner <heiko@sntech.de> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 2025-04-15 10:32 ` [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 Kever Yang 2025-04-22 10:07 ` Heiko Stübner @ 2025-07-28 19:01 ` Willy Tarreau 1 sibling, 0 replies; 9+ messages in thread From: Willy Tarreau @ 2025-07-28 19:01 UTC (permalink / raw) To: Kever Yang Cc: heiko, linux-rockchip, Finley Xiao, linux-arm-kernel, linux-kernel, Srinivas Kandagatla On Tue, Apr 15, 2025 at 06:32:03PM +0800, Kever Yang wrote: > 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> Successfully tested with Jonas' patches on top of it on my Radxa E20C (RK3528): Tested-by: Willy Tarreau <w@1wt.eu> Willy ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-07-28 19:02 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-15 10:32 [PATCH v3 0/3] rockchip,otp: Add support for rk3562 and rk3568 Kever Yang 2025-04-15 10:32 ` [PATCH v3 1/3] dt-bindings: nvmem: " Kever Yang 2025-04-21 18:45 ` Rob Herring (Arm) 2025-04-22 10:06 ` Heiko Stübner 2025-04-15 10:32 ` [PATCH v3 2/3] nvmem: rockchip-otp: Add support for rk3568-otp Kever Yang 2025-04-22 10:07 ` Heiko Stübner 2025-04-15 10:32 ` [PATCH v3 3/3] nvmem: rockchip-otp: Add support for rk3562 Kever Yang 2025-04-22 10:07 ` Heiko Stübner 2025-07-28 19:01 ` Willy Tarreau
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).