Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1613974 > unrolled thread
| Started by | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| First post | 2017-03-31 14:50 +0200 |
| Last post | 2017-03-31 15:30 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 00/11] nvmem: patches for v4.12 Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-31 14:50 +0200
[PATCH 10/11] nvmem: imx-ocotp: clear error bit after reading locked values Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-31 14:50 +0200
[PATCH 08/11] dt-bindings: imx-ocotp: add compatible string for i.MX7D/S Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-31 15:00 +0200
Re: [PATCH 08/11] dt-bindings: imx-ocotp: add compatible string for i.MX7D/S Rob Herring <robh+dt@kernel.org> - 2017-04-03 14:50 +0200
[PATCH 03/11] nvmem: sunxi-sid: read NVMEM size from device compatible Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-31 15:20 +0200
[PATCH 01/11] MAINTAINERS: nvmem: Remove myself from maintainers Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-31 15:30 +0200
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Date | 2017-03-31 14:50 +0200 |
| Subject | [PATCH 00/11] nvmem: patches for v4.12 |
| Message-ID | <tr4a6-4Fm-5@gated-at.bofh.it> |
Hi Greg, This patchset contains new driver support for imx-iim, few enhancements for sunxi and imx-octop driver and a fix for nvmem core. Can you please queue these for v4.12. Thanks, srini Aban Bedel (1): nvmem: core: Allow allocating several anonymous nvmem devices Icenowy Zheng (2): nvmem: sunxi-sid: read NVMEM size from device compatible nvmem: sunxi-sid: add support for H3's SID controller Maxime Ripard (1): MAINTAINERS: nvmem: Remove myself from maintainers Michael Grzeschik (1): nvmem: Add driver for the i.MX IIM Peng Fan (2): dt-bindings: imx-ocotp: add compatible string for i.MX7D/S nvmem: octop: Add i.MX7D support Richard Leitner (3): nvmem: imx-ocotp: fix usage of "dev" pointers nvmem: imx-ocotp: clear error bit after reading locked values nvmem: imx-ocotp: add write support Sascha Hauer (1): dt-bindings: nvmem: Add i.MX IIM binding doc .../bindings/nvmem/allwinner,sunxi-sid.txt | 6 +- .../devicetree/bindings/nvmem/imx-iim.txt | 22 ++ .../devicetree/bindings/nvmem/imx-ocotp.txt | 5 + MAINTAINERS | 1 - drivers/nvmem/Kconfig | 11 + drivers/nvmem/Makefile | 2 + drivers/nvmem/core.c | 3 +- drivers/nvmem/imx-iim.c | 173 ++++++++++++++ drivers/nvmem/imx-ocotp.c | 254 ++++++++++++++++++++- drivers/nvmem/sunxi_sid.c | 89 +++++++- 10 files changed, 554 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/nvmem/imx-iim.txt create mode 100644 drivers/nvmem/imx-iim.c -- 2.7.4
[toc] | [next] | [standalone]
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Date | 2017-03-31 14:50 +0200 |
| Subject | [PATCH 10/11] nvmem: imx-ocotp: clear error bit after reading locked values |
| Message-ID | <tr4a6-4Fm-27@gated-at.bofh.it> |
| In reply to | #1613974 |
From: Richard Leitner <richard.leitner@skidata.com>
When reading a "read locked" value from the OCOTP controller on i.MX6
SoC's an error bit is set. This bit has to be cleared by software before
any new write, read or reload access can be issued.
Therefore clear it after we detect such an "locked read".
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/imx-ocotp.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 0d33705..0bb8d0d 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -25,6 +25,19 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
+#define IMX_OCOTP_OFFSET_B0W0 0x400 /* Offset from base address of the
+ * OTP Bank0 Word0
+ */
+#define IMX_OCOTP_OFFSET_PER_WORD 0x10 /* Offset between the start addr
+ * of two consecutive OTP words.
+ */
+#define IMX_OCOTP_ADDR_CTRL 0x0000
+#define IMX_OCOTP_ADDR_CTRL_CLR 0x0008
+
+#define IMX_OCOTP_BM_CTRL_ERROR 0x00000200
+
+#define IMX_OCOTP_READ_LOCKED_VAL 0xBADABADA
+
struct ocotp_priv {
struct device *dev;
struct clk *clk;
@@ -32,6 +45,17 @@ struct ocotp_priv {
unsigned int nregs;
};
+static void imx_ocotp_clr_err_if_set(void __iomem *base)
+{
+ u32 c;
+
+ c = readl(base + IMX_OCOTP_ADDR_CTRL);
+ if (!(c & IMX_OCOTP_BM_CTRL_ERROR))
+ return;
+
+ writel(IMX_OCOTP_BM_CTRL_ERROR, base + IMX_OCOTP_ADDR_CTRL_CLR);
+}
+
static int imx_ocotp_read(void *context, unsigned int offset,
void *val, size_t bytes)
{
@@ -52,11 +76,22 @@ static int imx_ocotp_read(void *context, unsigned int offset,
dev_err(priv->dev, "failed to prepare/enable ocotp clk\n");
return ret;
}
- for (i = index; i < (index + count); i++)
- *buf++ = readl(priv->base + 0x400 + i * 0x10);
- clk_disable_unprepare(priv->clk);
+ for (i = index; i < (index + count); i++) {
+ *buf++ = readl(priv->base + IMX_OCOTP_OFFSET_B0W0 +
+ i * IMX_OCOTP_OFFSET_PER_WORD);
+
+ /* 47.3.1.2
+ * For "read locked" registers 0xBADABADA will be returned and
+ * HW_OCOTP_CTRL[ERROR] will be set. It must be cleared by
+ * software before any new write, read or reload access can be
+ * issued
+ */
+ if (*(buf - 1) == IMX_OCOTP_READ_LOCKED_VAL)
+ imx_ocotp_clr_err_if_set(priv->base);
+ }
+ clk_disable_unprepare(priv->clk);
return 0;
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Date | 2017-03-31 15:00 +0200 |
| Subject | [PATCH 08/11] dt-bindings: imx-ocotp: add compatible string for i.MX7D/S |
| Message-ID | <tr4jN-4Kh-47@gated-at.bofh.it> |
| In reply to | #1613974 |
From: Peng Fan <peng.fan@nxp.com> Add compatible string for i.MX7D/S Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt index 966a72e..bbde2e4 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt @@ -9,6 +9,7 @@ Required properties: "fsl,imx6sl-ocotp" (i.MX6SL), or "fsl,imx6sx-ocotp" (i.MX6SX), "fsl,imx6ul-ocotp" (i.MX6UL), + "fsl,imx7d-ocotp" (i.MX7D/S), followed by "syscon". - reg: Should contain the register base and length. - clocks: Should contain a phandle pointing to the gated peripheral clock. -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh+dt@kernel.org> |
|---|---|
| Date | 2017-04-03 14:50 +0200 |
| Subject | Re: [PATCH 08/11] dt-bindings: imx-ocotp: add compatible string for i.MX7D/S |
| Message-ID | <ts9AK-6V6-11@gated-at.bofh.it> |
| In reply to | #1613991 |
On Fri, Mar 31, 2017 at 7:44 AM, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote: > From: Peng Fan <peng.fan@nxp.com> > > Add compatible string for i.MX7D/S > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > Cc: Shawn Guo <shawnguo@kernel.org> > Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 1 + > 1 file changed, 1 insertion(+) Needs to go to DT list, but this is trivial. Acked-by: Rob Herring <robh@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Date | 2017-03-31 15:20 +0200 |
| Subject | [PATCH 03/11] nvmem: sunxi-sid: read NVMEM size from device compatible |
| Message-ID | <tr4D7-56f-1@gated-at.bofh.it> |
| In reply to | #1613974 |
From: Icenowy Zheng <icenowy@aosc.xyz>
Sometimes the SID device have more memory address space than the real
NVMEM size (for the registers used to read/write the SID).
Fetch the NVMEM size from device compatible, rather than the memory
address space's length, in order to prepare for adding some
registers-based read support.
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/sunxi_sid.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 1567ccc..69524b6 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/random.h>
@@ -32,6 +33,10 @@ static struct nvmem_config econfig = {
.owner = THIS_MODULE,
};
+struct sunxi_sid_cfg {
+ u32 size;
+};
+
struct sunxi_sid {
void __iomem *base;
};
@@ -72,18 +77,24 @@ static int sunxi_sid_probe(struct platform_device *pdev)
struct sunxi_sid *sid;
int ret, i, size;
char *randomness;
+ const struct sunxi_sid_cfg *cfg;
sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL);
if (!sid)
return -ENOMEM;
+ cfg = of_device_get_match_data(dev);
+ if (!cfg)
+ return -EINVAL;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
sid->base = devm_ioremap_resource(dev, res);
if (IS_ERR(sid->base))
return PTR_ERR(sid->base);
- size = resource_size(res) - 1;
- econfig.size = resource_size(res);
+ size = cfg->size;
+
+ econfig.size = size;
econfig.dev = dev;
econfig.reg_read = sunxi_sid_read;
econfig.priv = sid;
@@ -119,9 +130,17 @@ static int sunxi_sid_remove(struct platform_device *pdev)
return nvmem_unregister(nvmem);
}
+static const struct sunxi_sid_cfg sun4i_a10_cfg = {
+ .size = 0x10,
+};
+
+static const struct sunxi_sid_cfg sun7i_a20_cfg = {
+ .size = 0x200,
+};
+
static const struct of_device_id sunxi_sid_of_match[] = {
- { .compatible = "allwinner,sun4i-a10-sid" },
- { .compatible = "allwinner,sun7i-a20-sid" },
+ { .compatible = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_cfg },
+ { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg },
{/* sentinel */},
};
MODULE_DEVICE_TABLE(of, sunxi_sid_of_match);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Date | 2017-03-31 15:30 +0200 |
| Subject | [PATCH 01/11] MAINTAINERS: nvmem: Remove myself from maintainers |
| Message-ID | <tr4MN-59K-5@gated-at.bofh.it> |
| In reply to | #1613974 |
From: Maxime Ripard <maxime.ripard@free-electrons.com> I've never been really been maintaining nvmem, so make that official. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index c776906..5db21b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9027,7 +9027,6 @@ F: drivers/nvme/target/fcloop.c NVMEM FRAMEWORK M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> -M: Maxime Ripard <maxime.ripard@free-electrons.com> S: Maintained F: drivers/nvmem/ F: Documentation/devicetree/bindings/nvmem/ -- 2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web