arm: dts: imx6qdl: add clocks property for ocotp node
Subsystems (3)
PATCH v2 1/3 arm: dts: imx6qdl: add clocks property for ocotp node
Add clocks property for ocotp node.
---
V2:
none
arch/arm/boot/dts/imx6qdl.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/imx6qdl.dtsi +1 -0
@@ -1100,6 +1100,7 @@ ocotp: ocotp@021bc000 { compatible = "fsl,imx6q-ocotp", "syscon"; reg = <0x021bc000 0x4000>; + clocks = <&clks IMX6QDL_CLK_IIM>; }; tzasc@021d0000 { /* TZASC1 */
Signature · 1 line
2.6.6
PATCH v2 2/3 arm: dts: imx6sl: add clocks property for ocotp node
Add clocks property for ocotp node.
---
V2:
none
arch/arm/boot/dts/imx6sl.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/imx6sl.dtsi +1 -0
@@ -853,6 +853,7 @@ ocotp: ocotp@021bc000 { compatible = "fsl,imx6sl-ocotp", "syscon"; reg = <0x021bc000 0x4000>; + clocks = <&clks IMX6SL_CLK_OCOTP>; }; audmux: audmux@021d8000 {
Signature · 1 line
2.6.6
PATCH v2 3/3 nvmem: imx-ocotp: handling clock
In reply to Peng FanBefore access ocotp nvmem area, the clock should be enabled. Or, hexdump nvmem will hang the system. So, use such flow:
"
1. clock_enable_prepare
2. read nvmem ocotp area
3. clock_disable_unprepare
"
---
V2:
Follow Fabio's comments, check return value of clk_prepare_enable
drivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +15 -1
@@ -15,6 +15,7 @@* http://www.gnu.org/copyleft/gpl.html */ +#include <linux/clk.h> #include <linux/device.h> #include <linux/io.h> #include <linux/module.h>
@@ -27,6 +28,7 @@struct ocotp_priv {struct device *dev; +struct clk *clk;void __iomem *base;unsigned int nregs; };
@@ -37,7 +39,7 @@ static int imx_ocotp_read(void *context, const void *reg, size_t reg_size,struct ocotp_priv *priv = context;unsigned int offset = *(u32 *)reg;unsigned int count; -int i; +int i, ret;u32 index; index = offset >>2 ;
@@ -46,11 +48,19 @@ static int imx_ocotp_read(void *context, const void *reg, size_t reg_size,if (count > (priv->nregs - index)) count = priv->nregs - index; + ret =clk_prepare_enable (priv->clk); +if (ret <0 ) { +dev_err (priv->dev,"failed to prepare/enable ocotp clk\n" ); +return ret; + } +for (i = index; i < (index + count); i++) { *(u32 *)val =readl (priv->base +0x400 + i *0x10 ); val +=4 ; } +clk_disable_unprepare (priv->clk); +return 0 ; }
@@ -112,6 +122,10 @@ static int imx_ocotp_probe(struct platform_device *pdev)if (IS_ERR (priv->base))return PTR_ERR (priv->base); + priv->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (priv->clk)) +return PTR_ERR (priv->clk); + of_id =of_match_device (imx_ocotp_dt_ids, dev); priv->nregs = (unsigned int )of_id->data; imx_ocotp_regmap_config.max_register =4 * priv->nregs -4 ;
Signature · 1 line
2.6.6
RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock
Hi,
Kindly ping..
Any comments on this patch set?
Quoted 92 lines
-----Original Message-----
From: linux-kernel-owner at vger.kernel.org [mailto:linux-kernel- owner at vger.kernel.org] On Behalf Of Peng Fan
Sent: Thursday, April 21, 2016 1:26 AM
To: shawnguo at kernel.org; srinivas.kandagatla at linaro.org; maxime.ripard at free-electrons.com
Cc: linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; linux- kernel at vger.kernel.org; van.freenix at gmail.com
Subject: [PATCH V2 3/3] nvmem: imx-ocotp: handling clockBefore access ocotp nvmem area, the clock should be enabled. Or,
hexdump nvmemwill hang the system. So, use such flow:
"
1.clock_enable_prepare
2. read nvmem ocotp area
3.clock_disable_unprepare
"Signed-off-by Peng Fan <[email protected]>Cc Srinivas Kandagatla <[email protected]>Cc Maxime Ripard <[email protected]>Cc Shawn Guo <[email protected]>---
V2:
Follow Fabio's comments, check return value ofclk_prepare_enabledrivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)drivers/nvmem/imx-ocotp.c index renamed from drivers/nvmem/imx-ocotp.c +0
-0d7796eb..3f1dd9f 100644
drivers/nvmem/imx-ocotp.c +3
-1@@ -15,6 +15,7 @@* http://www.gnu.org/copyleft/gpl.html */ +#include <linux/clk.h> #include <linux/device.h> #include <linux/io.h> #include <linux/module.h> @@ -27,6 +28,7 @@struct ocotp_priv {struct device *dev; +struct clk *clk;void __iomem *base;unsigned int nregs; };@@ -37,7 +39,7 @@ static int imx_ocotp_read(void *context, const void *reg,size_t reg_size, struct ocotp_priv *priv = context;unsigned int offset = *(u32 *)reg;unsigned int count; -int i; +int i, ret;u32 index;drivers/nvmem/imx-ocotp.c +12
-0index = offset >>2 ;@@ -46,11 +48,19 @@ static int imx_ocotp_read(void *context, const void *reg, size_t reg_size, if (count > (priv->nregs - index)) count = priv->nregs - index; + ret =clk_prepare_enable (priv->clk); +if (ret <0 ) { +dev_err (priv->dev,"failed to prepare/enable ocotp clk\n" ); +return ret; + } +for (i = index; i < (index + count); i++) { *(u32 *)val =readl (priv->base +0x400 + i *0x10 ); val +=4 ; } +clk_disable_unprepare (priv->clk); +return 0 ; }@@ -112,6 +122,10 @@ static int imx_ocotp_probe(struct platform_device *pdev)if (IS_ERR (priv->base))return PTR_ERR (priv->base); + priv->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (priv->clk)) +return PTR_ERR (priv->clk); + of_id =of_match_device (imx_ocotp_dt_ids, dev); priv->nregs = (unsigned int )of_id->data;
Quoted 3 lines
imx_ocotp_regmap_config.max_register = 4 *
priv->nregs- 4;
--
2.6.6
Thanks,
Peng.
Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock
In reply to Peng FanThanks for the Ping, I totally missed this thread.
Quoted 12 lines · Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or,
hexdump nvmemwill hang the system. So, use such flow:
"
1.clock_enable_prepare
2. read nvmem ocotp area
3.clock_disable_unprepare
"Signed-off-by Peng Fan <[email protected]>Cc Srinivas Kandagatla <[email protected]>Cc Maxime Ripard <[email protected]>Cc Shawn Guo <[email protected]>
Quoted 7 lines
---
V2:
Follow Fabio's comments, check return value ofclk_prepare_enabledrivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
Changes to the driver looks good to me,
Only one comment, As the clock property is now made mandatory, you should update the dt-bindings with this info too.
thanks,
srini
Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock
Hi Srinivas,
Quoted 20 lines · Srinivas Kandagatla
Thanks for the Ping, I totally missed this thread.
Quoted 17 lines · Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or,
hexdump nvmemwill hang the system. So, use such flow:
"
1.clock_enable_prepare
2. read nvmem ocotp area
3.clock_disable_unprepare
"Signed-off-by Peng Fan <[email protected]>Cc Srinivas Kandagatla <[email protected]>Cc Maxime Ripard <[email protected]>Cc Shawn Guo <[email protected]>---
V2:
Follow Fabio's comments, check return value ofclk_prepare_enable
Quoted 6 lines
Quoted 2 lines
drivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)Changes to the driver looks good to me,
Only one comment, As the clock property is now made mandatory, you should update the dt-bindings with this info too.
In Documentation/devicetree/bindings/nvmem/imx-ocotp.txt, the clock property is already marked Required properties:
"
Required properties:
- compatible: should be one of
"fsl,imx6q-ocotp" (i.MX6Q/D/DL/S), "fsl,imx6sl-ocotp" (i.MX6SL), or "fsl,imx6sx-ocotp" (i.MX6SX), followed by "syscon".
- reg: Should contain the register base and length.
- clocks: Should contain a phandle pointing to the gated peripheral clock.
Example:
ocotp: ocotp at 021bc000 {
compatible = "fsl,imx6q-ocotp", "syscon";
reg = <0x021bc000 0x4000>;
clocks = <&clks IMX6QDL_CLK_IIM>;
};"
I think I do not need to update it, since it's already there -:)
Thanks,
Peng.
Quoted 4 lines
thanks,
srini
Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock
Quoted 26 lines · Peng Fan
Hi Srinivas,
Quoted 23 lines · Srinivas Kandagatla
Thanks for the Ping, I totally missed this thread.
Quoted 19 lines · Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or,
hexdump nvmemwill hang the system. So, use such flow:
"
1.clock_enable_prepare
2. read nvmem ocotp area
3.clock_disable_unprepare
"Signed-off-by Peng Fan <[email protected]>Cc Srinivas Kandagatla <[email protected]>Cc Maxime Ripard <[email protected]>Cc Shawn Guo <[email protected]>---
V2:
Follow Fabio's comments, check return value ofclk_prepare_enabledrivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 3 lines
Changes to the driver looks good to me,
Only one comment, As the clock property is now made mandatory, you should update the dt-bindings with this info too.In
Documentation/devicetree/bindings/nvmem/imx-ocotp.txt, the clock property is already marked Required properties:
Ok, I can take this patch, dt patch should go via the dt maintainers.
thanks,
--srini
RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock
Quoted 41 lines
-----Original Message-----
From: linux-kernel-owner at vger.kernel.org [mailto:linux-kernel- owner at vger.kernel.org] On Behalf Of Srinivas Kandagatla
Sent: Tuesday, May 10, 2016 6:32 PM
To: Peng Fan <[email protected]>
Cc: shawnguo at kernel.org; maxime.ripard at free-electrons.com; linux-arm- kernel at lists.infradead.org; devicetree at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clockQuoted 26 lines · Peng Fan
Hi Srinivas,
Quoted 23 lines · Srinivas Kandagatla
Thanks for the Ping, I totally missed this thread.
Quoted 19 lines · Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or,
hexdump nvmemwill hang the system. So, use such flow:
"
1.clock_enable_prepare
2. read nvmem ocotp area
3.clock_disable_unprepare
"Signed-off-by Peng Fan <[email protected]>Cc Srinivas Kandagatla <[email protected]>Cc Maxime Ripard <[email protected]>Cc Shawn Guo <[email protected]>---
V2:
Follow Fabio's comments, check return value ofclk_prepare_enabledrivers/nvmem/imx-ocotp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Changes to the driver looks good to me, Only one comment, As the clock property is now made mandatory, you should update the dt-bindings with this info too.
In
Documentation/devicetree/bindings/nvmem/imx-ocotp.txt, the clock property is already marked Required properties:Ok, I can take this patch, dt patch should go via the dt maintainers.
Thanks, Srinivas.
Shawn,
Will you review and pick up the other two patches, since changes to i.MX dts files?
https://lkml.org/lkml/2016/4/20/150 arm: dts: imx6qdl: add clocks property for ocotp node
https://lkml.org/lkml/2016/4/20/153 arm: dts: imx6sl: add clocks property for ocotp node
Thanks,
Peng.
Quoted 3 lines
thanks,
--srini
Shawn Guo
AppliedQuoted 6 lines · Peng Fan
Add clocks property for ocotp node.
Signed-off-by Peng Fan <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Rob Herring <[email protected]>
Applied both dts patches, thanks.