Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmem: correct Broadcom OTP controller driver writes

- use data write offset to write otp data instead of read offset
- use OTP program command 0x8 to write otp with ECC rather than just
command 0xA without ECC

Fixes: 9d59c6e8ae27 ("nvmem: Add the Broadcom OTP controller driver")
Signed-off-by: Oza Pawandeep <oza.oza@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Oza Pawandeep and committed by
Greg Kroah-Hartman
e827756d de0d6dbd

+2 -2
+2 -2
drivers/nvmem/bcm-ocotp.c
··· 34 34 #define OTPC_CMD_READ 0x0 35 35 #define OTPC_CMD_OTP_PROG_ENABLE 0x2 36 36 #define OTPC_CMD_OTP_PROG_DISABLE 0x3 37 - #define OTPC_CMD_PROGRAM 0xA 37 + #define OTPC_CMD_PROGRAM 0x8 38 38 39 39 /* OTPC Status Bits */ 40 40 #define OTPC_STAT_CMD_DONE BIT(1) ··· 209 209 set_command(priv->base, OTPC_CMD_PROGRAM); 210 210 set_cpu_address(priv->base, address++); 211 211 for (i = 0; i < priv->map->otpc_row_size; i++) { 212 - writel(*buf, priv->base + priv->map->data_r_offset[i]); 212 + writel(*buf, priv->base + priv->map->data_w_offset[i]); 213 213 buf++; 214 214 bytes_written += sizeof(*buf); 215 215 }