Implement OCOTP driver for Vybrid using NVMEM
Subsystems (5)
v9 cover Implement OCOTP driver for Vybrid using NVMEM
Hello,
This patchset is based on top of v9 of Srinivas's NVMEM framework patches. Tested on Greg's tree char-misc-next branch along with Stefan's NAND driver patchset.
Sample output on Colibri VF50
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# uname -a
Linux colibri-vf 4.2.0-rc6-00130-g24fcfdc #3 SMP Wed Aug 12 18:31:24 IST 2015 armv7l GNU/Linux
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# hexdump nvmem 0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000410 72a6 df64 0000 0000 0000 0000 0000 0000 0000420 11d4 2c14 0000 0000 0000 0000 0000 0000 0000430 0000 0000 0000 0000 0000 0000 0000 0000
*
0000450 0280 0000 0000 0000 0000 0000 0000 0000 0000460 0000 0000 0000 0000 0000 0000 0000 0000
*
0000880 8f01 0000 0000 0000 0000 0000 0000 0000 0000890 0000 0000 0000 0000 0000 0000 0000 0000
*
00008c0 0000 1000 0000 0000 0000 0000 0000 0000 00008d0 3202 0800 0000 0000 0000 0000 0000 0000 00008e0 0000 e100 0000 0000 0000 0000 0000 0000 00008f0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000c80 bada bada 0000 0000 0000 0000 0000 0000
*
0000cc0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000cf0
The driver has changed quite a bit from the first version relying on of_platform_populate in mach file, to using SoC driver under drivers/soc and finally to NVMEM.
Feedback and comments most welcome.
Version 8 patches can be found here
https://lkml.org/lkml/2015/8/10/566
Version 7 patches can be found here
https://lkml.org/lkml/2015/8/6/440
Version 6 RFC patches can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.2/05123.html
Version 5 of the patchset can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.0/03787.html
Version 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199
Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.html
Version 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.html
Version 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.html
The RFC version can be found here
https://lkml.org/lkml/2015/5/11/13
Changes since v8:
1. Fix three lines over 80 characters
2. Rebase on top of Greg's char-misc-next branch
Changes since v7:
1. Add COMPILE_TEST to Kconfig
2. Use GENMASK and BIT macros where applicable
3. Fix a code alignment issue
4. Get the max_register value for regmap config using resource_size()
5. Also add copyright info as the driver logic is based off on ocotp code in barebox
6. Add missing info related to clock in DT binding doc
Changes since v6:
1. Use the v9 of NVMEM framework patchset
2. Add a few comments
3. Initialise buffer address not part of the fuse map to 0 instead of only handling buffer locations with valid fuse addresses.
Changes since v5:
Use NVMEM framework by Srinivas and Maxime
Changes since v4:
1. Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
2. Make Kconfig govern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)
Changes since v3:
Instead of using the syscon_regmap_lookup_by_compatible function use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.
Changes since v2:
Implement the SoC bus code as a driver in drivers/soc by registering with fsl,mscm-cpucfg as per Arnd's feedback
Changes since v1:
Sort the headers in alphabetical order
Changes since RFC:
Use a DT entry for the ROM area while specifying it as syscon.
Thanks & Regards,
Sanchayan Maity.
Sanchayan Maity (4):
clk: clk-vf610: Add clock for Vybrid OCOTP controller
ARM: dts: vfxxx: Add OCOTP node
drivers: nvmem: Add Vybrid OCOTP support
nvmem: Add DT binding documentation for Vybrid OCOTP driver
.../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 ++ arch/arm/boot/dts/vfxxx.dtsi | 9 + drivers/clk/imx/clk-vf610.c | 1 + drivers/nvmem/Kconfig | 10 + drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 +++++++++++++++++++++ include/dt-bindings/clock/vf610-clock.h | 3 +- 7 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt create mode 100644 drivers/nvmem/vf610-ocotp.c
Signature · 1 line
2.5.0
PATCH v9 1/4 clk: clk-vf610: Add clock for Vybrid OCOTP controller
Add clock support for Vybrid On-Chip One Time Programmable (OCOTP) controller.
While the OCOTP block does not require explicit clock gating, for programming the OCOTP timing register the clock rate of ipg clock is required for timing calculations related to fuse and shadow register read sequence. We explicitly specify the ipg clock for OCOTP as a result.
--- drivers/clk/imx/clk-vf610.c | 1 + include/dt-bindings/clock/vf610-clock.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-vf610.c +1 -0
@@ -387,6 +387,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_SNVS ] =imx_clk_gate2 ("snvs-rtc" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (7 )); clk[VF610_CLK_DAP ] =imx_clk_gate ("dap" ,"platform_bus" ,CCM_CCSR ,24 ); + clk[VF610_CLK_OCOTP ] =imx_clk_gate ("ocotp" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (5 ));imx_check_clocks (clk,ARRAY_SIZE (clk));
include/dt-bindings/clock/vf610-clock.h +2 -1
@@ -194,6 +194,7 @@#define VF610_PLL7_BYPASS 181#define VF610_CLK_SNVS 182#define VF610_CLK_DAP 183 -#define VF610_CLK_END 184 +#define VF610_CLK_OCOTP 184 +#define VF610_CLK_END 185#endif /* __DT_BINDINGS_CLOCK_VF610_H */
Signature · 1 line
2.5.0
PATCH v9 2/4 ARM: dts: vfxxx: Add OCOTP node
In reply to Sanchayan MaityAdd device tree node for the On-Chip One Time Programmable controller (OCOTP) on the Vybrid platform.
--- arch/arm/boot/dts/vfxxx.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +9 -0
@@ -403,6 +403,15 @@ status = "disabled"; }; + ocotp: ocotp at 400a5000 { + compatible = "fsl,vf610-ocotp"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x400a5000 0xCF0>; + clocks = <&clks VF610_CLK_OCOTP>; + clock-names = "ocotp"; + }; + snvs0: snvs at 400a7000 { compatible = "fsl,sec-v4.0-mon", "simple-bus"; #address-cells = <1>;
Signature · 1 line
2.5.0
PATCH v9 3/4 drivers: nvmem: Add Vybrid OCOTP support
In reply to Sanchayan MaityThe patch adds support for the On Chip One Time Programmable Peripheral (OCOTP) on the Vybrid platform.
--- drivers/nvmem/Kconfig | 10 ++ drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 314 insertions(+) create mode 100644 drivers/nvmem/vf610-ocotp.c
drivers/nvmem/Kconfig +10 -0
@@ -36,4 +36,14 @@ config NVMEM_SUNXI_SID This driver can also be built as a module. If so, the module will be called nvmem_sunxi_sid. +config NVMEM_VF610_OCOTP + tristate "VF610 SoC OCOTP support" + depends on SOC_VF610 || COMPILE_TEST + help + This is a driver for the 'OCOTP' peripheral available on Vybrid + devices like VF5xx and VF6xx. + + This driver can also be build as a module. If so, the module will + be called nvmem-vf610-ocotp. + endif
drivers/nvmem/Makefile +2 -0
@@ -10,3 +10,5 @@ obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o nvmem_qfprom-y := qfprom.o obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o nvmem_sunxi_sid-y := sunxi_sid.o +obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +nvmem-vf610-ocotp-y := vf610-ocotp.o
drivers/nvmem/vf610-ocotp.c new file +302 -0
302 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v9 4/4 nvmem: Add DT binding documentation for Vybrid OCOTP driver
In reply to Sanchayan MaityAdd the devicetree bindings for the Freescale Vybrid On-Chip OTP driver.
--- .../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +21 -0
@@ -0,0 +1,21 @@ +On-Chip OTP Memory for Freescale Vybrid + +Required Properties: + compatible: + - "fsl,vf610-ocotp" for VF5xx/VF6xx + #address-cells : Should be 1 + #size-cells : Should be 1 + reg : Address and length of OTP controller and fuse map registers + clocks : ipg clock we associate with the OCOTP peripheral + clock-names : Must contain "ocotp" as matching entry + +Example for Vybrid VF5xx/VF6xx: + + ocotp: ocotp at 400a5000 { + compatible = "fsl,vf610-ocotp"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x400a5000 0xCF0>; + clocks = <&clks VF610_CLK_OCOTP>; + clock-names = "ocotp"; + };
Signature · 1 line
2.5.0
Hello,
Ping? Any feedback? Is this good to be merged?
Thanks.
- Sanchayan.
Quoted 140 lines · Sanchayan Maity
Hello,
This patchset is based on top of v9 of Srinivas's NVMEM framework patches. Tested on Greg's tree char-misc-next branch along with Stefan's NAND driver patchset.
Sample output on Colibri VF50
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# uname -a
Linux colibri-vf 4.2.0-rc6-00130-g24fcfdc #3 SMP Wed Aug 12 18:31:24 IST 2015 armv7l GNU/Linuxroot at colibri-vf:/sys/bus/nvmem/devices/ocotp0# hexdump nvmem 0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000410 72a6 df64 0000 0000 0000 0000 0000 0000 0000420 11d4 2c14 0000 0000 0000 0000 0000 0000 0000430 0000 0000 0000 0000 0000 0000 0000 0000
*
0000450 0280 0000 0000 0000 0000 0000 0000 0000 0000460 0000 0000 0000 0000 0000 0000 0000 0000
*
0000880 8f01 0000 0000 0000 0000 0000 0000 0000 0000890 0000 0000 0000 0000 0000 0000 0000 0000
*
00008c0 0000 1000 0000 0000 0000 0000 0000 0000 00008d0 3202 0800 0000 0000 0000 0000 0000 0000 00008e0 0000 e100 0000 0000 0000 0000 0000 0000 00008f0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000c80 bada bada 0000 0000 0000 0000 0000 0000
*
0000cc0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000cf0The driver has changed quite a bit from the first version relying on
of_platform_populatein mach file, to using SoC driver underdrivers/socand finally to NVMEM.Feedback and comments most welcome.
Version 8 patches can be found here
https://lkml.org/lkml/2015/8/10/566Version 7 patches can be found here
https://lkml.org/lkml/2015/8/6/440Version 6 RFC patches can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.2/05123.htmlVersion 5 of the patchset can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.0/03787.htmlVersion 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.htmlVersion 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.htmlVersion 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.htmlThe RFC version can be found here
https://lkml.org/lkml/2015/5/11/13Changes since v8:
1. Fix three lines over 80 characters
2. Rebase on top of Greg's char-misc-next branchChanges since v7:
1. AddCOMPILE_TESTtoKconfig
2. Use GENMASK and BIT macros where applicable
3. Fix a code alignment issue
4. Get themax_registervalue for regmap config usingresource_size()
5. Also add copyright info as the driver logic is based off on ocotp code in barebox
6. Add missing info related to clock in DT binding docChanges since v6:
1. Use the v9 of NVMEM framework patchset
2. Add a few comments
3. Initialise buffer address not part of the fuse map to 0 instead of only handling buffer locations with valid fuse addresses.Changes since v5:
Use NVMEM framework by Srinivas and MaximeChanges since v4:
1. Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
2. MakeKconfiggovern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)Changes since v3:
Instead of using thesyscon_regmap_lookup_by_compatiblefunction use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.Changes since v2:
Implement the SoC bus code as a driver indrivers/socby registering with fsl,mscm-cpucfg as per Arnd's feedbackChanges since v1:
Sort the headers in alphabetical orderChanges since RFC:
Use a DT entry for the ROM area while specifying it as syscon.Thanks & Regards,
Sanchayan Maity.Sanchayan Maity (4):
clk: clk-vf610: Add clock for Vybrid OCOTP controller
ARM: dts: vfxxx: Add OCOTP node
drivers: nvmem: Add Vybrid OCOTP support
nvmem: Add DT binding documentation for Vybrid OCOTP driver.../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 ++ arch/arm/boot/dts/vfxxx.dtsi | 9 + drivers/clk/imx/clk-vf610.c | 1 + drivers/nvmem/Kconfig | 10 + drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 +++++++++++++++++++++ include/dt-bindings/clock/vf610-clock.h | 3 +- 7 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt create mode 100644 drivers/nvmem/vf610-ocotp.cSignature · 1 line
2.5.0
Hello,
Ping? Anything preventing this from being accepted? I can rework it then if so.
Thanks.
- Sanchayan.
Quoted 140 lines · Sanchayan Maity
Hello,
This patchset is based on top of v9 of Srinivas's NVMEM framework patches. Tested on Greg's tree char-misc-next branch along with Stefan's NAND driver patchset.
Sample output on Colibri VF50
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# uname -a
Linux colibri-vf 4.2.0-rc6-00130-g24fcfdc #3 SMP Wed Aug 12 18:31:24 IST 2015 armv7l GNU/Linuxroot at colibri-vf:/sys/bus/nvmem/devices/ocotp0# hexdump nvmem 0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000410 72a6 df64 0000 0000 0000 0000 0000 0000 0000420 11d4 2c14 0000 0000 0000 0000 0000 0000 0000430 0000 0000 0000 0000 0000 0000 0000 0000
*
0000450 0280 0000 0000 0000 0000 0000 0000 0000 0000460 0000 0000 0000 0000 0000 0000 0000 0000
*
0000880 8f01 0000 0000 0000 0000 0000 0000 0000 0000890 0000 0000 0000 0000 0000 0000 0000 0000
*
00008c0 0000 1000 0000 0000 0000 0000 0000 0000 00008d0 3202 0800 0000 0000 0000 0000 0000 0000 00008e0 0000 e100 0000 0000 0000 0000 0000 0000 00008f0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000c80 bada bada 0000 0000 0000 0000 0000 0000
*
0000cc0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000cf0The driver has changed quite a bit from the first version relying on
of_platform_populatein mach file, to using SoC driver underdrivers/socand finally to NVMEM.Feedback and comments most welcome.
Version 8 patches can be found here
https://lkml.org/lkml/2015/8/10/566Version 7 patches can be found here
https://lkml.org/lkml/2015/8/6/440Version 6 RFC patches can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.2/05123.htmlVersion 5 of the patchset can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.0/03787.htmlVersion 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.htmlVersion 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.htmlVersion 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.htmlThe RFC version can be found here
https://lkml.org/lkml/2015/5/11/13Changes since v8:
1. Fix three lines over 80 characters
2. Rebase on top of Greg's char-misc-next branchChanges since v7:
1. AddCOMPILE_TESTtoKconfig
2. Use GENMASK and BIT macros where applicable
3. Fix a code alignment issue
4. Get themax_registervalue for regmap config usingresource_size()
5. Also add copyright info as the driver logic is based off on ocotp code in barebox
6. Add missing info related to clock in DT binding docChanges since v6:
1. Use the v9 of NVMEM framework patchset
2. Add a few comments
3. Initialise buffer address not part of the fuse map to 0 instead of only handling buffer locations with valid fuse addresses.Changes since v5:
Use NVMEM framework by Srinivas and MaximeChanges since v4:
1. Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
2. MakeKconfiggovern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)Changes since v3:
Instead of using thesyscon_regmap_lookup_by_compatiblefunction use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.Changes since v2:
Implement the SoC bus code as a driver indrivers/socby registering with fsl,mscm-cpucfg as per Arnd's feedbackChanges since v1:
Sort the headers in alphabetical orderChanges since RFC:
Use a DT entry for the ROM area while specifying it as syscon.Thanks & Regards,
Sanchayan Maity.Sanchayan Maity (4):
clk: clk-vf610: Add clock for Vybrid OCOTP controller
ARM: dts: vfxxx: Add OCOTP node
drivers: nvmem: Add Vybrid OCOTP support
nvmem: Add DT binding documentation for Vybrid OCOTP driver.../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 ++ arch/arm/boot/dts/vfxxx.dtsi | 9 + drivers/clk/imx/clk-vf610.c | 1 + drivers/nvmem/Kconfig | 10 + drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 +++++++++++++++++++++ include/dt-bindings/clock/vf610-clock.h | 3 +- 7 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt create mode 100644 drivers/nvmem/vf610-ocotp.cSignature · 1 line
2.5.0
Hi Sanchayan,
Quoted 4 lines · maitysanchayan at gmail.com
Hello,
Ping? Anything preventing this from being accepted? I can rework it then if so.
Thanks for your patience,
We are in the middle of merge window, I will pick the driver for 4.4 after 4.3-rc1 is released for linux-next testing.
--srini
Quoted 146 lines
Thanks.
- Sanchayan.
Quoted 140 lines · Sanchayan Maity
Hello,
This patchset is based on top of v9 of Srinivas's NVMEM framework patches. Tested on Greg's tree char-misc-next branch along with Stefan's NAND driver patchset.
Sample output on Colibri VF50
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# uname -a
Linux colibri-vf 4.2.0-rc6-00130-g24fcfdc #3 SMP Wed Aug 12 18:31:24 IST 2015 armv7l GNU/Linuxroot at colibri-vf:/sys/bus/nvmem/devices/ocotp0# hexdump nvmem 0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000410 72a6 df64 0000 0000 0000 0000 0000 0000 0000420 11d4 2c14 0000 0000 0000 0000 0000 0000 0000430 0000 0000 0000 0000 0000 0000 0000 0000
*
0000450 0280 0000 0000 0000 0000 0000 0000 0000 0000460 0000 0000 0000 0000 0000 0000 0000 0000
*
0000880 8f01 0000 0000 0000 0000 0000 0000 0000 0000890 0000 0000 0000 0000 0000 0000 0000 0000
*
00008c0 0000 1000 0000 0000 0000 0000 0000 0000 00008d0 3202 0800 0000 0000 0000 0000 0000 0000 00008e0 0000 e100 0000 0000 0000 0000 0000 0000 00008f0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000c80 bada bada 0000 0000 0000 0000 0000 0000
*
0000cc0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000cf0The driver has changed quite a bit from the first version relying on
of_platform_populatein mach file, to using SoC driver underdrivers/socand finally to NVMEM.Feedback and comments most welcome.
Version 8 patches can be found here
https://lkml.org/lkml/2015/8/10/566Version 7 patches can be found here
https://lkml.org/lkml/2015/8/6/440Version 6 RFC patches can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.2/05123.htmlVersion 5 of the patchset can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.0/03787.htmlVersion 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.htmlVersion 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.htmlVersion 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.htmlThe RFC version can be found here
https://lkml.org/lkml/2015/5/11/13Changes since v8:
1. Fix three lines over 80 characters
2. Rebase on top of Greg's char-misc-next branchChanges since v7:
1. AddCOMPILE_TESTtoKconfig
2. Use GENMASK and BIT macros where applicable
3. Fix a code alignment issue
4. Get themax_registervalue for regmap config usingresource_size()
5. Also add copyright info as the driver logic is based off on ocotp code in barebox
6. Add missing info related to clock in DT binding docChanges since v6:
1. Use the v9 of NVMEM framework patchset
2. Add a few comments
3. Initialise buffer address not part of the fuse map to 0 instead of only handling buffer locations with valid fuse addresses.Changes since v5:
Use NVMEM framework by Srinivas and MaximeChanges since v4:
1. Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
2. MakeKconfiggovern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)Changes since v3:
Instead of using thesyscon_regmap_lookup_by_compatiblefunction use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.Changes since v2:
Implement the SoC bus code as a driver indrivers/socby registering with fsl,mscm-cpucfg as per Arnd's feedbackChanges since v1:
Sort the headers in alphabetical orderChanges since RFC:
Use a DT entry for the ROM area while specifying it as syscon.Thanks & Regards,
Sanchayan Maity.Sanchayan Maity (4):
clk: clk-vf610: Add clock for Vybrid OCOTP controller
ARM: dts: vfxxx: Add OCOTP node
drivers: nvmem: Add Vybrid OCOTP support
nvmem: Add DT binding documentation for Vybrid OCOTP driver.../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 ++ arch/arm/boot/dts/vfxxx.dtsi | 9 + drivers/clk/imx/clk-vf610.c | 1 + drivers/nvmem/Kconfig | 10 + drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 +++++++++++++++++++++ include/dt-bindings/clock/vf610-clock.h | 3 +- 7 files changed, 347 insertions(+), 1 deletion(-)create mode 100644
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txtcreate mode 100644drivers/nvmem/vf610-ocotp.c--
2.5.0
Hi,
Quoted 11 lines · Srinivas Kandagatla
Hi Sanchayan,
Quoted 4 lines · maitysanchayan at gmail.com
Hello,
Ping? Anything preventing this from being accepted? I can rework it then if so.
Thanks for your patience,
We are in the middle of merge window, I will pick the driver for 4.4 after 4.3-rc1 is released for linux-next testing.
Thank you very much for the update Srinivas.
- Sanchayan.
Quoted 149 lines
--srini
Quoted 146 lines
Thanks.
- Sanchayan.
Quoted 140 lines · Sanchayan Maity
Hello,
This patchset is based on top of v9 of Srinivas's NVMEM framework patches. Tested on Greg's tree char-misc-next branch along with Stefan's NAND driver patchset.
Sample output on Colibri VF50
root at colibri-vf:/sys/bus/nvmem/devices/ocotp0# uname -a
Linux colibri-vf 4.2.0-rc6-00130-g24fcfdc #3 SMP Wed Aug 12 18:31:24 IST 2015 armv7l GNU/Linuxroot at colibri-vf:/sys/bus/nvmem/devices/ocotp0# hexdump nvmem 0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000410 72a6 df64 0000 0000 0000 0000 0000 0000 0000420 11d4 2c14 0000 0000 0000 0000 0000 0000 0000430 0000 0000 0000 0000 0000 0000 0000 0000
*
0000450 0280 0000 0000 0000 0000 0000 0000 0000 0000460 0000 0000 0000 0000 0000 0000 0000 0000
*
0000880 8f01 0000 0000 0000 0000 0000 0000 0000 0000890 0000 0000 0000 0000 0000 0000 0000 0000
*
00008c0 0000 1000 0000 0000 0000 0000 0000 0000 00008d0 3202 0800 0000 0000 0000 0000 0000 0000 00008e0 0000 e100 0000 0000 0000 0000 0000 0000 00008f0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000c80 bada bada 0000 0000 0000 0000 0000 0000
*
0000cc0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000cf0The driver has changed quite a bit from the first version relying on
of_platform_populatein mach file, to using SoC driver underdrivers/socand finally to NVMEM.Feedback and comments most welcome.
Version 8 patches can be found here
https://lkml.org/lkml/2015/8/10/566Version 7 patches can be found here
https://lkml.org/lkml/2015/8/6/440Version 6 RFC patches can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.2/05123.htmlVersion 5 of the patchset can be found here
http://lkml.iu.edu/hypermail/linux/kernel/1506.0/03787.htmlVersion 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.htmlVersion 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.htmlVersion 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.htmlThe RFC version can be found here
https://lkml.org/lkml/2015/5/11/13Changes since v8:
1. Fix three lines over 80 characters
2. Rebase on top of Greg's char-misc-next branchChanges since v7:
1. AddCOMPILE_TESTtoKconfig
2. Use GENMASK and BIT macros where applicable
3. Fix a code alignment issue
4. Get themax_registervalue for regmap config usingresource_size()
5. Also add copyright info as the driver logic is based off on ocotp code in barebox
6. Add missing info related to clock in DT binding docChanges since v6:
1. Use the v9 of NVMEM framework patchset
2. Add a few comments
3. Initialise buffer address not part of the fuse map to 0 instead of only handling buffer locations with valid fuse addresses.Changes since v5:
Use NVMEM framework by Srinivas and MaximeChanges since v4:
1. Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
2. MakeKconfiggovern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)Changes since v3:
Instead of using thesyscon_regmap_lookup_by_compatiblefunction use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.Changes since v2:
Implement the SoC bus code as a driver indrivers/socby registering with fsl,mscm-cpucfg as per Arnd's feedbackChanges since v1:
Sort the headers in alphabetical orderChanges since RFC:
Use a DT entry for the ROM area while specifying it as syscon.Thanks & Regards,
Sanchayan Maity.Sanchayan Maity (4):
clk: clk-vf610: Add clock for Vybrid OCOTP controller
ARM: dts: vfxxx: Add OCOTP node
drivers: nvmem: Add Vybrid OCOTP support
nvmem: Add DT binding documentation for Vybrid OCOTP driver.../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 ++ arch/arm/boot/dts/vfxxx.dtsi | 9 + drivers/clk/imx/clk-vf610.c | 1 + drivers/nvmem/Kconfig | 10 + drivers/nvmem/Makefile | 2 + drivers/nvmem/vf610-ocotp.c | 302 +++++++++++++++++++++ include/dt-bindings/clock/vf610-clock.h | 3 +- 7 files changed, 347 insertions(+), 1 deletion(-)create mode 100644
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txtcreate mode 100644drivers/nvmem/vf610-ocotp.c--
2.5.0
Re: [PATCH v9 4/4] nvmem: Add DT binding documentation for Vybrid OCOTP driver
In reply to Sanchayan MaityQuoted 16 lines · Sanchayan Maity
Add the devicetree bindings for the Freescale Vybrid On-Chip OTP driver.
Signed-off-by Sanchayan Maity <[email protected]>--- .../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txtDocumentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +0
-0
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +10
-0@@ -0,0 +1,21 @@ +On-Chip OTP Memory for Freescale Vybrid + +Required Properties: + compatible: + - "fsl,vf610-ocotp" for VF5xx/VF6xx + #address-cells : Should be 1 + #size-cells : Should be 1 + reg : Address and length of OTP controller and fuse map registers + clocks : ipg clock we associate with the OCOTP peripheral + clock-names : Must contain "ocotp" as matching entry
I'm not sure "ocotp" is a good name for describing a clock from OCOTP internal point of view. "ipg" might be better. But I would suggest you drop clock-names property completely, if "ipg" is the only clock you need to describe here. The clock-names is necessary only when there are multiple clocks to distinguish.
With clock-names dropped, the driver works by passing NULL as the second parameter to devm_clk_get() call.
Shawn
Quoted 14 lines
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +11
-0+ +Example for Vybrid VF5xx/VF6xx: + + ocotp: ocotp at 400a5000 { + compatible = "fsl,vf610-ocotp"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x400a5000 0xCF0>; + clocks = <&clks VF610_CLK_OCOTP>; + clock-names = "ocotp"; + };Signature · 1 line
2.5.0
Re: [PATCH v9 1/4] clk: clk-vf610: Add clock for Vybrid OCOTP controller
In reply to Sanchayan MaityQuoted 9 lines · Sanchayan Maity
Add clock support for Vybrid On-Chip One Time Programmable (OCOTP) controller.
While the OCOTP block does not require explicit clock gating, for programming the OCOTP timing register the clock rate of ipg clock is required for timing calculations related to fuse and shadow register read sequence. We explicitly specify the ipg clock for OCOTP as a result.
Quoted 5 lines
Signed-off-by Sanchayan Maity <[email protected]>--- drivers/clk/imx/clk-vf610.c | 1 + include/dt-bindings/clock/vf610-clock.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
Please copy linux-clk list and clock maintainers on i.MX clock patches as well. If you run ./scripts/get_maintainer.pl on the patch, you will get them.
Shawn
Quoted 29 lines
drivers/clk/imx/clk-vf610.c +1
-0@@ -387,6 +387,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_SNVS ] =imx_clk_gate2 ("snvs-rtc" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (7 )); clk[VF610_CLK_DAP ] =imx_clk_gate ("dap" ,"platform_bus" ,CCM_CCSR ,24 ); + clk[VF610_CLK_OCOTP ] =imx_clk_gate ("ocotp" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (5 ));imx_check_clocks (clk,ARRAY_SIZE (clk));include/dt-bindings/clock/vf610-clock.h +2
-1@@ -194,6 +194,7 @@#define VF610_PLL7_BYPASS 181#define VF610_CLK_SNVS 182#define VF610_CLK_DAP 183 -#define VF610_CLK_END 184 +#define VF610_CLK_OCOTP 184 +#define VF610_CLK_END 185#endif /* __DT_BINDINGS_CLOCK_VF610_H */ Signature · 1 line
2.5.0
Re: [PATCH v9 4/4] nvmem: Add DT binding documentation for Vybrid OCOTP driver
In reply to Shawn GuoQuoted 34 lines · Shawn Guo
Quoted 16 lines · Sanchayan Maity
Add the devicetree bindings for the Freescale Vybrid On-Chip OTP driver.
Signed-off-by Sanchayan Maity <[email protected]>--- .../devicetree/bindings/nvmem/vf610-ocotp.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/vf610-ocotp.txtDocumentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +0
-0Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +10
-0@@ -0,0 +1,21 @@ +On-Chip OTP Memory for Freescale Vybrid + +Required Properties: + compatible: + - "fsl,vf610-ocotp" for VF5xx/VF6xx + #address-cells : Should be 1 + #size-cells : Should be 1 + reg : Address and length of OTP controller and fuse map registers + clocks : ipg clock we associate with the OCOTP peripheral + clock-names : Must contain "ocotp" as matching entryI'm not sure "ocotp" is a good name for describing a clock from OCOTP internal point of view. "ipg" might be better. But I would suggest you drop clock-names property completely, if "ipg" is the only clock you need to describe here. The clock-names is necessary only when there are multiple clocks to distinguish.
Quoted 2 lines
With clock-names dropped, the driver works by passing NULL as the second parameter to
devm_clk_get()call.
Ok. Will drop the clock-names property retest and try sending it by tomorrow.
- Sanchayan.
Quoted 17 lines
Shawn
Quoted 14 lines
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt new file +11
-0+ +Example for Vybrid VF5xx/VF6xx: + + ocotp: ocotp at 400a5000 { + compatible = "fsl,vf610-ocotp"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x400a5000 0xCF0>; + clocks = <&clks VF610_CLK_OCOTP>; + clock-names = "ocotp"; + };Signature · 1 line
2.5.0
Re: [PATCH v9 1/4] clk: clk-vf610: Add clock for Vybrid OCOTP controller
In reply to Shawn GuoQuoted 16 lines · Shawn Guo
Quoted 9 lines · Sanchayan Maity
Add clock support for Vybrid On-Chip One Time Programmable (OCOTP) controller.
While the OCOTP block does not require explicit clock gating, for programming the OCOTP timing register the clock rate of ipg clock is required for timing calculations related to fuse and shadow register read sequence. We explicitly specify the ipg clock for OCOTP as a result.
Quoted 5 lines
Signed-off-by Sanchayan Maity <[email protected]>--- drivers/clk/imx/clk-vf610.c | 1 + include/dt-bindings/clock/vf610-clock.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 3 lines
Please copy linux-clk list and clock maintainers on i.MX clock patches as well. If you run
./scripts/get_maintainer.plon the patch, you will get them.
Ok. Will take care of this with the next version. Thanks.
- Sanchayan.
Quoted 32 lines
Shawn
Quoted 29 lines
drivers/clk/imx/clk-vf610.c +1
-0@@ -387,6 +387,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_SNVS ] =imx_clk_gate2 ("snvs-rtc" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (7 )); clk[VF610_CLK_DAP ] =imx_clk_gate ("dap" ,"platform_bus" ,CCM_CCSR ,24 ); + clk[VF610_CLK_OCOTP ] =imx_clk_gate ("ocotp" ,"ipg_bus" ,CCM_CCGR6 ,CCM_CCGRx_CGn (5 ));imx_check_clocks (clk,ARRAY_SIZE (clk));include/dt-bindings/clock/vf610-clock.h +2
-1@@ -194,6 +194,7 @@#define VF610_PLL7_BYPASS 181#define VF610_CLK_SNVS 182#define VF610_CLK_DAP 183 -#define VF610_CLK_END 184 +#define VF610_CLK_OCOTP 184 +#define VF610_CLK_END 185#endif /* __DT_BINDINGS_CLOCK_VF610_H */ Signature · 1 line
2.5.0