From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Andrey Yurovsky <yurovsky@gmail.com> Subject: [PATCH 22/25] nvmem: add i.MX7 support to snvs-lpgpr Date: Fri, 9 Mar 2018 14:47:16 +0000 [thread overview] Message-ID: <20180309144719.29904-23-srinivas.kandagatla@linaro.org> (raw) In-Reply-To: <20180309144719.29904-1-srinivas.kandagatla@linaro.org> From: Andrey Yurovsky <yurovsky@gmail.com> The i.MX7 family has similar SNVS hardware so make the snvs-lpgpr support it along with the i.MX6 family. The register interface is the same except for the number and offset of the general purpose registers. Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- .../devicetree/bindings/nvmem/snvs-lpgpr.txt | 3 ++- drivers/nvmem/Kconfig | 4 ++-- drivers/nvmem/snvs_lpgpr.c | 27 +++++++++++++++++----- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/snvs-lpgpr.txt b/Documentation/devicetree/bindings/nvmem/snvs-lpgpr.txt index 20bc49b49799..3cb170896658 100644 --- a/Documentation/devicetree/bindings/nvmem/snvs-lpgpr.txt +++ b/Documentation/devicetree/bindings/nvmem/snvs-lpgpr.txt @@ -1,5 +1,5 @@ Device tree bindings for Low Power General Purpose Register found in i.MX6Q/D -Secure Non-Volatile Storage. +and i.MX7 Secure Non-Volatile Storage. This DT node should be represented as a sub-node of a "syscon", "simple-mfd" node. @@ -8,6 +8,7 @@ Required properties: - compatible: should be one of the fallowing variants: "fsl,imx6q-snvs-lpgpr" for Freescale i.MX6Q/D/DL/S "fsl,imx6ul-snvs-lpgpr" for Freescale i.MX6UL + "fsl,imx7d-snvs-lpgpr" for Freescale i.MX7D/S Example: snvs: snvs@020cc000 { diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index ff505af064ba..5f9bc787d634 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -167,10 +167,10 @@ config MESON_MX_EFUSE config NVMEM_SNVS_LPGPR tristate "Support for Low Power General Purpose Register" - depends on SOC_IMX6 || COMPILE_TEST + depends on SOC_IMX6 || SOC_IMX7D || COMPILE_TEST help This is a driver for Low Power General Purpose Register (LPGPR) available on - i.MX6 SoCs in Secure Non-Volatile Storage (SNVS) of this chip. + i.MX6 and i.MX7 SoCs in Secure Non-Volatile Storage (SNVS) of this chip. This driver can also be built as a module. If so, the module will be called nvmem-snvs-lpgpr. diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c index 92e1e41d128e..c050a23a9f2b 100644 --- a/drivers/nvmem/snvs_lpgpr.c +++ b/drivers/nvmem/snvs_lpgpr.c @@ -14,15 +14,21 @@ #include <linux/regmap.h> #define IMX6Q_SNVS_HPLR 0x00 -#define IMX6Q_GPR_SL BIT(5) #define IMX6Q_SNVS_LPLR 0x34 -#define IMX6Q_GPR_HL BIT(5) #define IMX6Q_SNVS_LPGPR 0x68 +#define IMX7D_SNVS_HPLR 0x00 +#define IMX7D_SNVS_LPLR 0x34 +#define IMX7D_SNVS_LPGPR 0x90 + +#define IMX_GPR_SL BIT(5) +#define IMX_GPR_HL BIT(5) + struct snvs_lpgpr_cfg { int offset; int offset_hplr; int offset_lplr; + int size; }; struct snvs_lpgpr_priv { @@ -36,6 +42,14 @@ static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx6q = { .offset = IMX6Q_SNVS_LPGPR, .offset_hplr = IMX6Q_SNVS_HPLR, .offset_lplr = IMX6Q_SNVS_LPLR, + .size = 4, +}; + +static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx7d = { + .offset = IMX7D_SNVS_LPGPR, + .offset_hplr = IMX7D_SNVS_HPLR, + .offset_lplr = IMX7D_SNVS_LPLR, + .size = 16, }; static int snvs_lpgpr_write(void *context, unsigned int offset, void *val, @@ -50,14 +64,14 @@ static int snvs_lpgpr_write(void *context, unsigned int offset, void *val, if (ret < 0) return ret; - if (lock_reg & IMX6Q_GPR_SL) + if (lock_reg & IMX_GPR_SL) return -EPERM; ret = regmap_read(priv->regmap, dcfg->offset_lplr, &lock_reg); if (ret < 0) return ret; - if (lock_reg & IMX6Q_GPR_HL) + if (lock_reg & IMX_GPR_HL) return -EPERM; return regmap_bulk_write(priv->regmap, dcfg->offset + offset, val, @@ -112,7 +126,7 @@ static int snvs_lpgpr_probe(struct platform_device *pdev) cfg->dev = dev; cfg->stride = 4; cfg->word_size = 4; - cfg->size = 4; + cfg->size = dcfg->size, cfg->owner = THIS_MODULE; cfg->reg_read = snvs_lpgpr_read; cfg->reg_write = snvs_lpgpr_write; @@ -126,6 +140,7 @@ static const struct of_device_id snvs_lpgpr_dt_ids[] = { { .compatible = "fsl,imx6q-snvs-lpgpr", .data = &snvs_lpgpr_cfg_imx6q }, { .compatible = "fsl,imx6ul-snvs-lpgpr", .data = &snvs_lpgpr_cfg_imx6q }, + { .compatible = "fsl,imx7d-snvs-lpgpr", .data = &snvs_lpgpr_cfg_imx7d }, { }, }; MODULE_DEVICE_TABLE(of, snvs_lpgpr_dt_ids); @@ -140,5 +155,5 @@ static struct platform_driver snvs_lpgpr_driver = { module_platform_driver(snvs_lpgpr_driver); MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>"); -MODULE_DESCRIPTION("Low Power General Purpose Register in i.MX6 Secure Non-Volatile Storage"); +MODULE_DESCRIPTION("Low Power General Purpose Register in i.MX6 and i.MX7 Secure Non-Volatile Storage"); MODULE_LICENSE("GPL v2"); -- 2.15.1
next prev parent reply other threads:[~2018-03-09 14:47 UTC|newest] Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-09 14:46 [PATCH 00/25] nvmem: patches for v4.17 srinivas.kandagatla 2018-03-09 14:46 ` [PATCH 01/25] nvmem: Document struct nvmem_config srinivas.kandagatla 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2018-03-09 14:46 ` [PATCH 02/25] nvmem: core: Allow specifying device name verbatim srinivas.kandagatla 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2018-03-09 14:46 ` [PATCH 03/25] nvmem: Introduce devm_nvmem_(un)register() srinivas.kandagatla 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2018-03-09 14:46 ` [PATCH 04/25] nvmem: vf610-ocotp: Convert to use devm_nvmem_register() srinivas.kandagatla 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2018-03-09 14:46 ` [PATCH 05/25] nvmem: imx-ocotp: " srinivas.kandagatla 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla at linaro.org 2018-03-09 14:46 ` srinivas.kandagatla 2018-03-09 14:47 ` [PATCH 06/25] nvmem: uniphier-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 07/25] nvmem: snvs_lgpr: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 08/25] nvmem: rockchip-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 09/25] nvmem: mtk-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 10/25] nvmem: meson-mx-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 11/25] nvmem: meson-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 12/25] nvmem: lpc18xx_otp: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 13/25] nvmem: imx-iim: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 14/25] nvmem: bcm-ocotp: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 15/25] nvmem: qfprom: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 16/25] nvmem: snvs_lpgpr: Convert commas to semicolons srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 17/25] nvmem: rockchip-efuse: Make use of of_device_get_match_data() srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 18/25] nvmem: vf610-ocotp: Do not use "&pdev->dev" explicitly srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 19/25] nvmem: rockchip-efuse: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 20/25] nvmem: imx-iim: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` [PATCH 21/25] nvmem: bcm-ocotp: " srinivas.kandagatla 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla at linaro.org 2018-03-09 14:47 ` srinivas.kandagatla [this message] 2018-03-09 14:47 ` [PATCH 23/25] nvmem: sunxi-sid: fix H3 SID controller support srinivas.kandagatla 2018-03-09 14:47 ` [PATCH 24/25] dt-bindings: nvmem: imx-ocotp: update the binding to reflect data cells srinivas.kandagatla 2018-03-09 14:47 ` [PATCH 25/25] nvmem: imx-ocotp: remove unused dead code srinivas.kandagatla
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180309144719.29904-23-srinivas.kandagatla@linaro.org \ --to=srinivas.kandagatla@linaro.org \ --cc=gregkh@linuxfoundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=yurovsky@gmail.com \ --subject='Re: [PATCH 22/25] nvmem: add i.MX7 support to snvs-lpgpr' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.