]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nvmem: correct Broadcom OTP controller driver writes
authorOza Pawandeep <oza.oza@broadcom.com>
Fri, 9 Jun 2017 09:59:06 +0000 (10:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2017 10:08:27 +0000 (12:08 +0200)
- 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>
drivers/nvmem/bcm-ocotp.c

index 646cadbf1f9390f3e298b0db325a2d2e5321bedc..3c56e3b2bd65fcd244bb6a5e438033a22d54da1e 100644 (file)
@@ -34,7 +34,7 @@
 #define OTPC_CMD_READ                0x0
 #define OTPC_CMD_OTP_PROG_ENABLE     0x2
 #define OTPC_CMD_OTP_PROG_DISABLE    0x3
-#define OTPC_CMD_PROGRAM             0xA
+#define OTPC_CMD_PROGRAM             0x8
 
 /* OTPC Status Bits */
 #define OTPC_STAT_CMD_DONE           BIT(1)
@@ -209,7 +209,7 @@ static int bcm_otpc_write(void *context, unsigned int offset, void *val,
                set_command(priv->base, OTPC_CMD_PROGRAM);
                set_cpu_address(priv->base, address++);
                for (i = 0; i < priv->map->otpc_row_size; i++) {
-                       writel(*buf, priv->base + priv->map->data_r_offset[i]);
+                       writel(*buf, priv->base + priv->map->data_w_offset[i]);
                        buf++;
                        bytes_written += sizeof(*buf);
                }