Skip to content

Commit 6907e80

Browse files
mmindgregkh
authored andcommitted
nvmem: rockchip-otp: Move read-offset into variant-data
The RK3588 has an offset into the OTP area where the readable area begins and automatically adds this to the start address. Other variants are very much similar to rk3588, just with a different offset, so move that value into variant-data. To match the size in bytes, store this value also in bytes and not in number of blocks. Signed-off-by: Heiko Stuebner <[email protected]> Tested-by: Nicolas Frattaroli <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0af2f6b commit 6907e80

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/nvmem/rockchip-otp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#define RK3588_OTPC_AUTO_EN 0x08
6060
#define RK3588_OTPC_INT_ST 0x84
6161
#define RK3588_OTPC_DOUT0 0x20
62-
#define RK3588_NO_SECURE_OFFSET 0x300
6362
#define RK3588_NBYTES 4
6463
#define RK3588_BURST_NUM 1
6564
#define RK3588_BURST_SHIFT 8
@@ -69,6 +68,7 @@
6968

7069
struct rockchip_data {
7170
int size;
71+
int read_offset;
7272
const char * const *clks;
7373
int num_clks;
7474
nvmem_reg_read_t reg_read;
@@ -196,7 +196,7 @@ static int rk3588_otp_read(void *context, unsigned int offset,
196196
addr_start = round_down(offset, RK3588_NBYTES) / RK3588_NBYTES;
197197
addr_end = round_up(offset + bytes, RK3588_NBYTES) / RK3588_NBYTES;
198198
addr_len = addr_end - addr_start;
199-
addr_start += RK3588_NO_SECURE_OFFSET;
199+
addr_start += otp->data->read_offset / RK3588_NBYTES;
200200

201201
buf = kzalloc(array_size(addr_len, RK3588_NBYTES), GFP_KERNEL);
202202
if (!buf)
@@ -280,6 +280,7 @@ static const char * const rk3588_otp_clocks[] = {
280280

281281
static const struct rockchip_data rk3588_data = {
282282
.size = 0x400,
283+
.read_offset = 0xc00,
283284
.clks = rk3588_otp_clocks,
284285
.num_clks = ARRAY_SIZE(rk3588_otp_clocks),
285286
.reg_read = rk3588_otp_read,

0 commit comments

Comments
 (0)