From d93b5d4a2145acf2c67a24e26e17a7908c95ebbc Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Sun, 18 Aug 2019 10:33:40 +0100 Subject: nvmem: imx-ocotp: Add i.MX8MN support i.MX8MN is a new SoC of i.MX8M series, it is similar to i.MX8MM in terms of addressing and clock setup, add support for its fuse read/write. Signed-off-by: Anson Huang Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20190818093345.29647-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/imx-ocotp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/nvmem') diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 42d4451e7d67..dff2f3c357f5 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -479,6 +479,12 @@ static const struct ocotp_params imx8mm_params = { .set_timing = imx_ocotp_set_imx6_timing, }; +static const struct ocotp_params imx8mn_params = { + .nregs = 256, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, +}; + static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6q-ocotp", .data = &imx6q_params }, { .compatible = "fsl,imx6sl-ocotp", .data = &imx6sl_params }, @@ -490,6 +496,7 @@ static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx7ulp-ocotp", .data = &imx7ulp_params }, { .compatible = "fsl,imx8mq-ocotp", .data = &imx8mq_params }, { .compatible = "fsl,imx8mm-ocotp", .data = &imx8mm_params }, + { .compatible = "fsl,imx8mn-ocotp", .data = &imx8mn_params }, { }, }; MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); -- cgit v1.2.3 From 2ac00e34acfc93af19376f83bb31db1aea1f006a Mon Sep 17 00:00:00 2001 From: Stefan Mavrodiev Date: Sun, 18 Aug 2019 10:33:41 +0100 Subject: nvmem: sunxi_sid: fix A64 SID controller support Like in H3, A64 SID controller doesn't return correct data when using direct access. It appears that on A64, SID needs 8 bytes of word_size. Workaround is to enable read by registers. Signed-off-by: Stefan Mavrodiev Acked-by: Chen-Yu Tsai Tested-by: Vasily Khoruzhick Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20190818093345.29647-4-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/sunxi_sid.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/nvmem') diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index a079a80ddf2c..e26ef1bbf198 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -186,6 +186,7 @@ static const struct sunxi_sid_cfg sun8i_h3_cfg = { static const struct sunxi_sid_cfg sun50i_a64_cfg = { .value_offset = 0x200, .size = 0x100, + .need_register_readout = true, }; static const struct sunxi_sid_cfg sun50i_h6_cfg = { -- cgit v1.2.3 From cb6b0a393c4a6d43e29ef476d19313c5fef8b6c7 Mon Sep 17 00:00:00 2001 From: Martin Blumenstingl Date: Sun, 18 Aug 2019 10:33:42 +0100 Subject: nvmem: meson-mx-efuse: allow reading data smaller than word_size Some Amlogic boards store the Ethernet MAC address inside the eFuse. The Ethernet MAC address uses 6 bytes. The existing logic in meson_mx_efuse_read() would write beyond the end of the data buffer when trying to read data with a size that is not aligned to word_size (4 bytes on Meson8, Meson8b and Meson8m2). Calculate the remaining data to copy inside meson_mx_efuse_read() so reading 6 bytes doesn't write beyond the end of the data buffer. Signed-off-by: Martin Blumenstingl Reviewed-by: Neil Armstrong Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20190818093345.29647-5-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/meson-mx-efuse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/nvmem') diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c index b9f9ce089de9..07c9f38c1c60 100644 --- a/drivers/nvmem/meson-mx-efuse.c +++ b/drivers/nvmem/meson-mx-efuse.c @@ -155,7 +155,8 @@ static int meson_mx_efuse_read(void *context, unsigned int offset, if (err) break; - memcpy(buf + i, &tmp, efuse->config.word_size); + memcpy(buf + i, &tmp, + min_t(size_t, bytes - i, efuse->config.word_size)); } meson_mx_efuse_mask_bits(efuse, MESON_MX_EFUSE_CNTL1, -- cgit v1.2.3 From 5fb812293ad67574146ff1fe9725252aa1dca724 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 18 Aug 2019 10:33:43 +0100 Subject: nvmem: mxs-ocotp: update MODULE_AUTHOR() email address The email address listed in MODULE_AUTHOR() will be disabled in the near future. Replace it with my private one. Signed-off-by: Stefan Wahren Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20190818093345.29647-6-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/mxs-ocotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/nvmem') diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c index c34d9fecfb10..8e4898dec002 100644 --- a/drivers/nvmem/mxs-ocotp.c +++ b/drivers/nvmem/mxs-ocotp.c @@ -200,6 +200,6 @@ static struct platform_driver mxs_ocotp_driver = { }; module_platform_driver(mxs_ocotp_driver); -MODULE_AUTHOR("Stefan Wahren "); +MODULE_AUTHOR("Stefan Wahren Date: Sun, 18 Aug 2019 10:33:45 +0100 Subject: nvmem: imx: add i.MX8QM platform support i.MX8QM efuse table has some difference with i.MX8QXP platform, so add i.MX8QM platform support. Signed-off-by: Fugang Duan Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20190818093345.29647-8-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/imx-ocotp-scu.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/nvmem') diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c index d9dc482ecb2f..61a17f943f47 100644 --- a/drivers/nvmem/imx-ocotp-scu.c +++ b/drivers/nvmem/imx-ocotp-scu.c @@ -16,6 +16,7 @@ enum ocotp_devtype { IMX8QXP, + IMX8QM, }; struct ocotp_devtype_data { @@ -39,6 +40,11 @@ static struct ocotp_devtype_data imx8qxp_data = { .nregs = 800, }; +static struct ocotp_devtype_data imx8qm_data = { + .devtype = IMX8QM, + .nregs = 800, +}; + static int imx_sc_misc_otp_fuse_read(struct imx_sc_ipc *ipc, u32 word, u32 *val) { @@ -118,6 +124,7 @@ static struct nvmem_config imx_scu_ocotp_nvmem_config = { static const struct of_device_id imx_scu_ocotp_dt_ids[] = { { .compatible = "fsl,imx8qxp-scu-ocotp", (void *)&imx8qxp_data }, + { .compatible = "fsl,imx8qm-scu-ocotp", (void *)&imx8qm_data }, { }, }; MODULE_DEVICE_TABLE(of, imx_scu_ocotp_dt_ids); -- cgit v1.2.3