summaryrefslogtreecommitdiff
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorOza Pawandeep <oza.oza@broadcom.com>2017-06-09 12:59:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-09 13:08:27 +0300
commite827756d64773515fa7de5e7e942a6d1494bf64e (patch)
treee47ad0baf56539c641a7e5c35780fd9069e3d5ce /drivers/nvmem
parentde0d6dbdbdb23ddb85f10d54a516e794f9a873e0 (diff)
downloadlinux-e827756d64773515fa7de5e7e942a6d1494bf64e.tar.xz
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>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/bcm-ocotp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c
index 646cadbf1f93..3c56e3b2bd65 100644
--- a/drivers/nvmem/bcm-ocotp.c
+++ b/drivers/nvmem/bcm-ocotp.c
@@ -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);
}