Skip to contentSkip to conversation

nvmem: add lpc18xx OTP memory driver

PATCH New Joachim Eastwood 4 participants 9 messages Sep 13, 2016 – Oct 8, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover nvmem: add lpc18xx OTP memory driver

This patch set adds a simple read-only nvmem driver for the internal OTP (One Time Programmable) memory found on all LPC18xx/43xx devices. Write support is coming later when the required firmware driver for the boot ROM goes upstream.

Note that dtsi patch is only included for reference. I intend to take it myself through the lpc18xx tree once the bindings are accepted and the driver goes upstream.

Joachim Eastwood (3):
nvmem: add NXP LPC18xx OTP driver
nvmem: dt: document lpc1850 OTP binding
ARM: dts: lpc18xx: add otp node

 .../devicetree/bindings/nvmem/lpc1850-otp.txt      |  20 ++++
 arch/arm/boot/dts/lpc18xx.dtsi                     |  12 ++
 drivers/nvmem/Kconfig                              |  10 ++
 drivers/nvmem/Makefile                             |   2 +
 drivers/nvmem/lpc18xx_otp.c                        | 123 +++++++++++++++++++++
 5 files changed, 167 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt
 create mode 100644 drivers/nvmem/lpc18xx_otp.c
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/3 nvmem: add NXP LPC18xx OTP driver

Add simple read only driver for the internal OTP (One Time Programmable) memory found on all NXP LPC18xx and LPC43xx devices.

The OTP memory is split into 4 banks each with 4 32-bits word. Some of the banks contain predefined data while others are for general purpose and user programmable via the OTP API in ROM. Note that writing to the OTP memory is not yet supported.

---
 drivers/nvmem/Kconfig       |  10 ++++
 drivers/nvmem/Makefile      |   2 +
 drivers/nvmem/lpc18xx_otp.c | 123 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 135 insertions(+)
 create mode 100644 drivers/nvmem/lpc18xx_otp.c
drivers/nvmem/Kconfig +10 -0
index f550c45..282037b 100644
@@ -35,6 +35,16 @@ config NVMEM_LPC18XX_EEPROM
 	  To compile this driver as a module, choose M here: the module
 	  will be called nvmem_lpc18xx_eeprom.
 
+config NVMEM_LPC18XX_OTP
+	tristate "NXP LPC18XX OTP Memory Support"
+	depends on ARCH_LPC18XX || COMPILE_TEST
+	depends on HAS_IOMEM
+	help
+	  Say Y here to include support for NXP LPC18xx OTP memory found on
+	  all LPC18xx and LPC43xx devices.
+	  To compile this driver as a module, choose M here: the module
+	  will be called nvmem_lpc18xx_otp.
+
 config NVMEM_MXS_OCOTP
 	tristate "Freescale MXS On-Chip OTP Memory Support"
 	depends on ARCH_MXS || COMPILE_TEST
drivers/nvmem/Makefile +2 -0
index 45ab1ae..df485a9 100644
@@ -10,6 +10,8 @@ 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_LPC18XX_OTP)	+= nvmem_lpc18xx_otp.o
+nvmem_lpc18xx_otp-y		:= lpc18xx_otp.o
 obj-$(CONFIG_NVMEM_MXS_OCOTP)	+= nvmem-mxs-ocotp.o
 nvmem-mxs-ocotp-y		:= mxs-ocotp.o
 obj-$(CONFIG_MTK_EFUSE)		+= nvmem_mtk-efuse.o
drivers/nvmem/lpc18xx_otp.c new file +123 -0

123 lines not on this page · raw message

Signature · 1 line
2.9.3
#2 lore raw

PATCH 1/3 nvmem: add NXP LPC18xx OTP driver

Quoted 8 lines · Joachim Eastwood

Add simple read only driver for the internal OTP (One Time Programmable) memory found on all NXP LPC18xx and LPC43xx devices.

The OTP memory is split into 4 banks each with 4 32-bits word. Some of the banks contain predefined data while others are for general purpose and user programmable via the OTP API in ROM. Note that writing to the OTP memory is not yet supported.

Quoted 8 lines
---
 drivers/nvmem/Kconfig       |  10 ++++
 drivers/nvmem/Makefile      |   2 +
 drivers/nvmem/lpc18xx_otp.c | 123 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 135 insertions(+)
 create mode 100644 drivers/nvmem/lpc18xx_otp.c

Patch looks good to me.

I will pick this patch + bindings patch once rc1 lands in.

Thanks,
srini

#3 lore raw

PATCH 1/3 nvmem: add NXP LPC18xx OTP driver

In reply to Joachim Eastwood

Hi Joachim, Srinivas,

Quoted 10 lines · Joachim Eastwood

Add simple read only driver for the internal OTP (One Time Programmable) memory found on all NXP LPC18xx and LPC43xx devices.

The OTP memory is split into 4 banks each with 4 32-bits word. Some of the banks contain predefined data while others are for general purpose and user programmable via the OTP API in ROM. Note that writing to the OTP memory is not yet supported.

---

please feel free to add my

--
With best wishes,
Vladimir

#4 lore raw

PATCH 1/3 nvmem: add NXP LPC18xx OTP driver

Hi Vladimir,

Quoted 11 lines · Vladimir Zapolskiy

Hi Joachim, Srinivas,

Quoted 8 lines · Joachim Eastwood

Add simple read only driver for the internal OTP (One Time Programmable) memory found on all NXP LPC18xx and LPC43xx devices.

The OTP memory is split into 4 banks each with 4 32-bits word. Some of the banks contain predefined data while others are for general purpose and user programmable via the OTP API in ROM. Note that writing to the OTP memory is not yet supported.

Quoted 6 lines
Quoted 2 lines

---

please feel free to add my

Thanks for testing!

regards,
Joachim Eastwood

#5 lore raw

PATCH 2/3 nvmem: dt: document lpc1850 OTP binding

In reply to Joachim Eastwood

Documenation for the LPC18xx/43xx OTP memory bindings.

---
 .../devicetree/bindings/nvmem/lpc1850-otp.txt        | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +20 -0
new file mode 100644
index 0000000..853b6a7
@@ -0,0 +1,20 @@
+* NXP LPC18xx OTP memory
+
+Internal OTP (One Time Programmable) memory for NXP LPC18xx/43xx devices.
+
+Required properties:
+  - compatible: Should be "nxp,lpc1850-otp"
+  - reg: Must contain an entry with the physical base address and length
+    for each entry in reg-names.
+  - address-cells: must be set to 1.
+  - size-cells: must be set to 1.
+
+See nvmem.txt for more information.
+
+Example:
+  otp: otp at 40045000 {
+    compatible = "nxp,lpc1850-otp";
+    reg = <0x40045000 0x1000>;
+    #address-cells = <1>;
+    #size-cells = <1>;
+  };
Signature · 1 line
2.9.3
maintainer
#6 lore raw

PATCH 2/3 nvmem: dt: document lpc1850 OTP binding

Quoted 15 lines · Joachim Eastwood

Documenation for the LPC18xx/43xx OTP memory bindings.

---
 .../devicetree/bindings/nvmem/lpc1850-otp.txt        | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +1 -0
new file mode 100644
index 0000000..853b6a7
@@ -0,0 +1,20 @@
+* NXP LPC18xx OTP memory

Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +9 -0
+
+Internal OTP (One Time Programmable) memory for NXP LPC18xx/43xx devices.
+
+Required properties:
+  - compatible: Should be "nxp,lpc1850-otp"
+  - reg: Must contain an entry with the physical base address and length
+    for each entry in reg-names.
 
+  - address-cells: must be set to 1.
+  - size-cells: must be set to 1.

Not needed unless you have child nodes.

Quoted 13 lines
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +10 -0
+
+See nvmem.txt for more information.
+
+Example:
+  otp: otp at 40045000 {
+    compatible = "nxp,lpc1850-otp";
+    reg = <0x40045000 0x1000>;
+    #address-cells = <1>;
+    #size-cells = <1>;
+  };
Signature · 1 line
2.9.3
#7 lore raw

PATCH 2/3 nvmem: dt: document lpc1850 OTP binding

Quoted 24 lines · Rob Herring
Quoted 22 lines · Joachim Eastwood

Documenation for the LPC18xx/43xx OTP memory bindings.

---
 .../devicetree/bindings/nvmem/lpc1850-otp.txt        | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +8 -0
new file mode 100644
index 0000000..853b6a7
@@ -0,0 +1,20 @@
+* NXP LPC18xx OTP memory
+
+Internal OTP (One Time Programmable) memory for NXP LPC18xx/43xx devices.
+
+Required properties:
+  - compatible: Should be "nxp,lpc1850-otp"
+  - reg: Must contain an entry with the physical base address and length
+    for each entry in reg-names.
Quoted 4 lines

Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt line 10

Quoted 2 lines
Documentation/devicetree/bindings/nvmem/lpc1850-otp.txt new file +2 -0
+  - address-cells: must be set to 1.
+  - size-cells: must be set to 1.

Not needed unless you have child nodes.

They will have "nvmem" cell children. See patch 3/3

+ /* Flashless devices has part ID in OTP bank 0 */
+ part_id: identification at 0 {
+ reg = <0x0 0x10>;
+ };

These cells are documented in nvmem.txt.

regards,
Joachim Eastwood

#8 lore raw

PATCH 3/3 ARM: dts: lpc18xx: add otp node

In reply to Joachim Eastwood

Add node for the internal OTP (One Time Programmable) memory found on all LPC18xx/43xx SoCs.

---
 arch/arm/boot/dts/lpc18xx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/lpc18xx.dtsi +12 -0
index c6508ed..7ef0bc8 100644
@@ -250,6 +250,18 @@
 			};
 		};
 
+		otp at 40045000 {
+			compatible = "nxp,lpc1850-otp";
+			reg = <0x40045000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			/* Flashless devices has part ID in OTP bank 0 */
+			part_id: identification at 0 {
+				reg = <0x0 0x10>;
+			};
+		};
+
 		rtc: rtc at 40046000 {
 			compatible = "nxp,lpc1850-rtc", "nxp,lpc1788-rtc";
 			reg = <0x40046000 0x1000>;
Signature · 1 line
2.9.3