Add support for NXP LPC18xx EEPROM using nvmem
v4 cover Add support for NXP LPC18xx EEPROM using nvmem
This patch series adds support for NXP LPC18xx EEPROM memory found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
This patchset is based on tag next-20151116 of the linux-next repository. It has been successfully tested on a LPC4337 CIAA-NXP Board.
EEPROM notes:
------------
EEPROM size is 16384 bytes and it can be entirely read and written/erased with 1 word (4 bytes) granularity. The last page (128 bytes) contains the EEPROM initialization data and is not writable.
Erase/program time is less than 3ms. The EEPROM device requires a ~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing the system bus clock by the division factor, contained in the divider register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
Changeset:
---------
v3 -> v4:
* Added busywait polling for erase/program operation to finish.
v2 -> v3:
* Documented 'resets' property in devicetree bindings.
* Added dynamic power on/off when writing/reading the EEPROM.
* Added check for aligned offset in EEPROM writes.
* Properly remove the driver in the reverse order of initialization.
* Minor fixes.
v1 -> v2:
* Moved dt-bindings to be the first patch.
* Changed compatible name from lpc1850 to lpc1857 as the former doesn't have EEPROM.
* Fix hardware description which contained SoCs models without EEPROM.
* Disabled fast_io and changed mdelay for msleep in regmap writes.
* Replaced BUG_ON() in write function for an -EINVAL return.
* Add patches for defconfig and devicetree files.
Thanks,
Ariel D'Alessandro (4):
DT: nvmem: Add NXP LPC18xx EEPROM memory binding documentation
nvmem: NXP LPC18xx EEPROM memory NVMEM driver
ARM: dts: lpc18xx: add EEPROM memory node
ARM: configs: lpc18xx: enable EEPROM NVMEM driver
.../devicetree/bindings/nvmem/lpc1857-eeprom.txt | 28 ++ arch/arm/boot/dts/lpc18xx.dtsi | 12 + arch/arm/configs/lpc18xx_defconfig | 2 + drivers/nvmem/Kconfig | 9 + drivers/nvmem/Makefile | 2 + drivers/nvmem/lpc18xx_eeprom.c | 330 +++++++++++++++++++++ 6 files changed, 383 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1857-eeprom.txt create mode 100644 drivers/nvmem/lpc18xx_eeprom.c
Signature · 1 line
2.6.2
PATCH v4 1/4 DT: nvmem: Add NXP LPC18xx EEPROM memory binding documentation
Add the devicetree binding document for NXP LPC18xx EEPROM memory.
--- .../devicetree/bindings/nvmem/lpc1857-eeprom.txt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1857-eeprom.txt
Documentation/devicetree/bindings/nvmem/lpc1857-eeprom.txt new file +28 -0
@@ -0,0 +1,28 @@ +* NXP LPC18xx EEPROM memory NVMEM driver + +Required properties: + - compatible: Should be "nxp,lpc1857-eeprom" + - reg: Must contain an entry with the physical base address and length + for each entry in reg-names. + - reg-names: Must include the following entries. + - reg: EEPROM registers. + - mem: EEPROM address space. + - clocks: Must contain an entry for each entry in clock-names. + - clock-names: Must include the following entries. + - eeprom: EEPROM operating clock. + - resets: Should contain a reference to the reset controller asserting + the EEPROM in reset. + - interrupts: Should contain EEPROM interrupt. + +Example: + + eeprom: eeprom at 4000e000 { + compatible = "nxp,lpc1857-eeprom"; + reg = <0x4000e000 0x1000>, + <0x20040000 0x4000>; + reg-names = "reg", "mem"; + clocks = <&ccu1 CLK_CPU_EEPROM>; + clock-names = "eeprom"; + resets = <&rgu 27>; + interrupts = <4>; + };
Signature · 1 line
2.6.2
PATCH v4 2/4 nvmem: NXP LPC18xx EEPROM memory NVMEM driver
In reply to Ariel D'AlessandroThis commit adds support for NXP LPC18xx EEPROM memory found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
EEPROM size is 16384 bytes and it can be entirely read and written/erased with 1 word (4 bytes) granularity. The last page (128 bytes) contains the EEPROM initialization data and is not writable.
Erase/program time is less than 3ms. The EEPROM device requires a ~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing the system bus clock by the division factor, contained in the divider register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
--- drivers/nvmem/Kconfig | 9 ++ drivers/nvmem/Makefile | 2 + drivers/nvmem/lpc18xx_eeprom.c | 330 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 341 insertions(+) create mode 100644 drivers/nvmem/lpc18xx_eeprom.c
drivers/nvmem/Kconfig +9 -0
@@ -25,6 +25,15 @@ config NVMEM_IMX_OCOTP This driver can also be built as a module. If so, the module will be called nvmem-imx-ocotp. +config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST + help + Say Y here to include support for NXP LPC18xx EEPROM memory found in + NXP LPC185x/3x and LPC435x/3x/2x/1x devices. + To compile this driver as a module, choose M here: the module + will be called nvmem_lpc18xx_eeprom. + config NVMEM_MXS_OCOTP tristate "Freescale MXS On-Chip OTP Memory Support" depends on ARCH_MXS || COMPILE_TEST
drivers/nvmem/Makefile +2 -0
@@ -8,6 +8,8 @@ nvmem_core-y := core.o # Devices obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o nvmem-imx-ocotp-y := imx-ocotp.o +obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o nvmem-mxs-ocotp-y := mxs-ocotp.o obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o
drivers/nvmem/lpc18xx_eeprom.c new file +330 -0
330 lines not on this page · raw message
Signature · 1 line
2.6.2
PATCH v4 2/4 nvmem: NXP LPC18xx EEPROM memory NVMEM driver
Quoted 12 lines
Ariel D'Alessandro <[email protected]> hat am 17. November 2015 um 21:02 geschrieben:
This commit adds support for NXP LPC18xx EEPROM memory found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
EEPROM size is 16384 bytes and it can be entirely read and written/erased with 1 word (4 bytes) granularity. The last page (128 bytes) contains the EEPROM initialization data and is not writable.
Quoted 8 lines
Erase/program time is less than 3ms. The EEPROM device requires a ~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing the system bus clock by the division factor, contained in the divider register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
Signed-off-by Ariel D'Alessandro <[email protected]>
Btw Rob Herring acked [PATCH v3 1/4] yesterday.
PATCH v4 3/4 ARM: dts: lpc18xx: add EEPROM memory node
In reply to Ariel D'AlessandroAdd node for the NXP LPC18xx EEPROM memory which can be found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
--- arch/arm/boot/dts/lpc18xx.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/lpc18xx.dtsi +12 -0
@@ -166,6 +166,18 @@ status = "disabled"; }; + eeprom: eeprom at 4000e000 { + compatible = "nxp,lpc1857-eeprom"; + reg = <0x4000e000 0x1000>, + <0x20040000 0x4000>; + reg-names = "reg", "mem"; + clocks = <&ccu1 CLK_CPU_EEPROM>; + clock-names = "eeprom"; + resets = <&rgu 27>; + interrupts = <4>; + status = "disabled"; + }; + mac: ethernet at 40010000 { compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac"; reg = <0x40010000 0x2000>;
Signature · 1 line
2.6.2
PATCH v4 3/4 ARM: dts: lpc18xx: add EEPROM memory node
Hi Joachim,
Could you take this DT patches via your tree, I picked up the nvmem patches.
thanks,
srini
Quoted 32 lines · Ariel D'Alessandro
Add node for the NXP LPC18xx EEPROM memory which can be found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/lpc18xx.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)arch/arm/boot/dts/lpc18xx.dtsi +12
-0@@ -166,6 +166,18 @@ status = "disabled"; }; + eeprom: eeprom at 4000e000 { + compatible = "nxp,lpc1857-eeprom"; + reg = <0x4000e000 0x1000>, + <0x20040000 0x4000>; + reg-names = "reg", "mem"; + clocks = <&ccu1 CLK_CPU_EEPROM>; + clock-names = "eeprom"; + resets = <&rgu 27>; + interrupts = <4>; + status = "disabled"; + }; + mac: ethernet at 40010000 { compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac"; reg = <0x40010000 0x2000>;
PATCH v4 3/4 ARM: dts: lpc18xx: add EEPROM memory node
Hi Srinivas.
Quoted 3 lines · Srinivas Kandagatla
Hi Joachim,
Could you take this DT patches via your tree, I picked up the nvmem patches.
Cool.
Yes, I will take the DT and defconfig patch.
regards,
Joachim Eastwood
PATCH v4 4/4 ARM: configs: lpc18xx: enable EEPROM NVMEM driver
In reply to Ariel D'AlessandroEnable NVMEM driver for NXP LPC18xx EEPROM, which can be found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
--- arch/arm/configs/lpc18xx_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/lpc18xx_defconfig +2 -0
@@ -148,6 +148,8 @@ CONFIG_ARM_PL172_MPMC=y CONFIG_PWM=y CONFIG_PWM_LPC18XX_SCT=y CONFIG_PHY_LPC18XX_USB_OTG=y +CONFIG_NVMEM=y +CONFIG_NVMEM_LPC18XX_EEPROM=y CONFIG_EXT2_FS=y # CONFIG_FILE_LOCKING is not set # CONFIG_DNOTIFY is not set
Signature · 1 line
2.6.2
v4 cover Add support for NXP LPC18xx EEPROM using nvmem
In reply to Ariel D'AlessandroHi Srinivas,
I just realized that these patches (1/4, 2/4) didn't get picked up. Could you please check this?
Thanks,
El 17/11/15 a las 17:02, Ariel D'Alessandro escribi?:
Quoted 59 lines
This patch series adds support for NXP LPC18xx EEPROM memory found in NXP LPC185x/3x and LPC435x/3x/2x/1x devices.
This patchset is based on tag next-20151116 of the linux-next repository. It has been successfully tested on a LPC4337 CIAA-NXP Board.
EEPROM notes:
------------EEPROM size is 16384 bytes and it can be entirely read and written/erased with 1 word (4 bytes) granularity. The last page (128 bytes) contains the EEPROM initialization data and is not writable.
Erase/program time is less than 3ms. The EEPROM device requires a ~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing the system bus clock by the division factor, contained in the divider register (minus 1 encoded).
EEPROM will be kept in Power Down mode except during read/write calls.
Changeset:
---------
v3 -> v4:
* Added busywait polling for erase/program operation to finish.v2 -> v3:
* Documented 'resets' property in devicetree bindings.
* Added dynamic power on/off when writing/reading the EEPROM.
* Added check for aligned offset in EEPROM writes.
* Properly remove the driver in the reverse order of initialization.
* Minor fixes.v1 -> v2:
* Moved dt-bindings to be the first patch.
* Changed compatible name from lpc1850 to lpc1857 as the former doesn't have EEPROM.
* Fix hardware description which contained SoCs models without EEPROM.
* Disabledfast_ioand changed mdelay for msleep in regmap writes.
* ReplacedBUG_ON()in write function for an-EINVALreturn.
* Add patches for defconfig and devicetree files.Thanks,
Ariel D'Alessandro (4):
DT: nvmem: Add NXP LPC18xx EEPROM memory binding documentation
nvmem: NXP LPC18xx EEPROM memory NVMEM driver
ARM: dts: lpc18xx: add EEPROM memory node
ARM: configs: lpc18xx: enable EEPROM NVMEM driver.../devicetree/bindings/nvmem/lpc1857-eeprom.txt | 28 ++ arch/arm/boot/dts/lpc18xx.dtsi | 12 + arch/arm/configs/lpc18xx_defconfig | 2 + drivers/nvmem/Kconfig | 9 + drivers/nvmem/Makefile | 2 + drivers/nvmem/lpc18xx_eeprom.c | 330 +++++++++++++++++++++ 6 files changed, 383 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1857-eeprom.txt create mode 100644 drivers/nvmem/lpc18xx_eeprom.c
Signature · 2 lines
Ariel D'Alessandro, VanguardiaSur www.vanguardiasur.com.ar