[PATCH 2/3] nvmem: rockchip-otp: Add support for RK3506

Jonas Karlman jonas at kwiboo.se
Wed Dec 2 12:49:34 PST 2026


Hi Srinivas,

On 12/1/2026 3:02 PM, Srinivas Kandagatla wrote:
> 
> 
> On 11/28/26 10:17 PM, Jonas Karlman wrote:
>> Add support for the OTP controller in RK3506. The OTPC is similar to the
>> OTP controller in RK3528, except that reading from the last 8 bytes,
>> offset 120-127, fails ECC on RK3506.
> 
> That means they are not compatible are they?

They use same clocks array and read function, from driver perspective
only the size differs, 120 bytes on RK3506 and 128 bytes on RK3528.

> But the binding patch says other wise.

I do not follow. The binding patch adds a unique compatible for RK3506
(rockchip,rk3506-otp) and RK3528 uses its own (rockchip,rk3528-otp).

However, the patch mention that they use similar clocks and resets so
the new compatible for rk3506 was added to bindings conditions that
already existed for the rk3528 variant.

> 
> Or is this a bug or errata?

Unsure, the datasheet for RK3506 mention 8K bits, with 7K bits for
secure world. On Rockchip SoCs this typically mean 1024 bits (128 bytes)
for non-secure and 7168 bits for secure. For some unknown reason reading
the last 64 bits of those 1024 bits trigger an ECC error status on
RK3506. Vendor kernel also seems to limit the size to 120 bytes to avoid
this ECC error status.

Regards,
Jonas

> 
> --srini
> 
> 
>>
>> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
>> ---
>>  drivers/nvmem/rockchip-otp.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
>> index 7eb834516ab4..3422017d391e 100644
>> --- a/drivers/nvmem/rockchip-otp.c
>> +++ b/drivers/nvmem/rockchip-otp.c
>> @@ -345,6 +345,14 @@ static const char * const rk3528_otp_clocks[] = {
>>  	"otp", "apb_pclk", "sbpi",
>>  };
>>  
>> +static const struct rockchip_data rk3506_data = {
>> +	.size = 0x78,
>> +	.word_size = sizeof(u16),
>> +	.clks = rk3528_otp_clocks,
>> +	.num_clks = ARRAY_SIZE(rk3528_otp_clocks),
>> +	.reg_read = rk3568_otp_read,
>> +};
>> +
>>  static const struct rockchip_data rk3528_data = {
>>  	.size = 0x80,
>>  	.word_size = sizeof(u16),
>> @@ -396,6 +404,10 @@ static const struct of_device_id rockchip_otp_match[] = {
>>  		.compatible = "rockchip,rk3308-otp",
>>  		.data = &px30_data,
>>  	},
>> +	{
>> +		.compatible = "rockchip,rk3506-otp",
>> +		.data = &rk3506_data,
>> +	},
>>  	{
>>  		.compatible = "rockchip,rk3528-otp",
>>  		.data = &rk3528_data,
> 




More information about the linux-arm-kernel mailing list