Skip to contentSkip to conversation

Add driver for OCOTP in Sunplus SP7021 SoC

PATCH In review Vincent Shih 3 participants 5 messages Dec 22, 2021 – Feb 24, 2022

Subsystems (3)
lore
Share & tools
lore

Vincent Shih

author maintainer
#0 lore raw

v4 cover Add driver for OCOTP in Sunplus SP7021 SoC

This is a patch series for OCOTP driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD Card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Vincent Shih (2):
nvmem: Add driver for OCOTP in Sunplus SP7021
dt-bindings: nvmem: Add bindings doc for Sunplus OCOTP driver

 .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       |  86 ++++++++
 MAINTAINERS                                        |   6 +
 drivers/nvmem/Kconfig                              |  12 ++
 drivers/nvmem/Makefile                             |   2 +
 drivers/nvmem/sunplus-ocotp.c                      | 228 +++++++++++++++++++++
 5 files changed, 334 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
 create mode 100644 drivers/nvmem/sunplus-ocotp.c
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v4 1/2 nvmem: Add driver for OCOTP in Sunplus SP7021

Add driver for OCOTP in Sunplus SP7021

---
Changes in v3:
- Addressed the comments by Mr. Srinivas Kandagatla.

 MAINTAINERS                   |   5 +
 drivers/nvmem/Kconfig         |  12 +++
 drivers/nvmem/Makefile        |   2 +
 drivers/nvmem/sunplus-ocotp.c | 228 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 247 insertions(+)
 create mode 100644 drivers/nvmem/sunplus-ocotp.c
MAINTAINERS +5 -0
index 80eebc1..0e6593a 100644
@@ -17947,6 +17947,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS OCOTP DRIVER
+M:	Vincent Shih <[email protected]>
+S:	Maintained
+F:	drivers/nvmem/sunplus-ocotp.c
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/nvmem/Kconfig +12 -0
index da41461..4559950 100644
@@ -300,4 +300,16 @@ config NVMEM_BRCM_NVRAM
 	  This driver provides support for Broadcom's NVRAM that can be accessed
 	  using I/O mapping.
 
+config NVMEM_SUNPLUS_OCOTP
+	tristate "Sunplus SoC OTP support"
+	depends on SOC_SP7021 || COMPILE_TEST
+	depends on HAS_IOMEM
+	help
+	  This is a driver for the On-chip OTP controller (OCOTP) available
+	  on Sunplus SoCs. It provides access to 128 bytes of one-time
+	  programmable eFuse.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called nvmem-sunplus-ocotp.
+
 endif
drivers/nvmem/Makefile +2 -0
index dcbbde3..0f14cd9 100644
@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) 	+= nvmem-rmem.o
 nvmem-rmem-y			:= rmem.o
 obj-$(CONFIG_NVMEM_BRCM_NVRAM)	+= nvmem_brcm_nvram.o
 nvmem_brcm_nvram-y		:= brcm_nvram.o
+obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP)	+= nvmem_sunplus_ocotp.o
+nvmem_sunplus_ocotp-y		:= sunplus-ocotp.o
drivers/nvmem/sunplus-ocotp.c new file +228 -0

228 lines not on this page · raw message

Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH v4 2/2 dt-bindings: nvmem: Add bindings doc for Sunplus OCOTP driver

In reply to Vincent Shih

Add bindings doc for Sunplus OCOTP driver

---
Changes in v3
- No change

 .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       | 86 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +86 -0
new file mode 100644
index 0000000..4b28f37
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/sunplus,sp7021-ocotp.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: On-Chip OTP Memory for Sunplus SP7021
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+allOf:
+  - $ref: "nvmem.yaml#"
+
+properties:
+  compatible:
+    const: sunplus,sp7021-ocotp
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: hb_gpio
+      - const: otprx
+
+  clocks:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+  thermal-calibration:
+    type: object
+    description: thermal calibration values
+
+  disconnect-voltage:
+    type: object
+    description: disconnect voltages of usb2 port 0 and port 1
+
+  mac-address0:
+    type: object
+    description: MAC address of ethernet port 0
+
+  mac-address1:
+    type: object
+    description: MAC address of ethernet port 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+
+    otp: otp@9c00af00 {
+        compatible = "sunplus,sp7021-ocotp";
+        reg = <0x9c00af00 0x34>, <0x9c00af80 0x58>;
+        reg-names = "hb_gpio", "otprx";
+        clocks = <&clks OTPRX>;
+
+        #address-cells = <1>;
+        #size-cells = <1>;
+        therm_calib: thermal-calibration@14 {
+          reg = <0x14 0x3>;
+        };
+        disc_vol: disconnect-voltage@18 {
+          reg = <0x18 0x2>;
+        };
+        mac_addr0: mac-address0@34 {
+          reg = <0x34 0x6>;
+        };
+        mac_addr1: mac-address1@3a {
+          reg = <0x3a 0x6>;
+        };
+    };
+...
MAINTAINERS +1 -0
index 0e6593a..2afd1ea 100644
@@ -17950,6 +17950,7 @@ F:	drivers/net/ethernet/dlink/sundance.c
 SUNPLUS OCOTP DRIVER
 M:	Vincent Shih <[email protected]>
 S:	Maintained
+F:	Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
 F:	drivers/nvmem/sunplus-ocotp.c
 
 SUPERH
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v4 2/2] dt-bindings: nvmem: Add bindings doc for Sunplus OCOTP driver

Quoted 5 lines · Vincent Shih

Add bindings doc for Sunplus OCOTP driver

Quoted 8 lines

---
Changes in v3
- No change

 .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       | 86 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml

This is now failing in linux-next:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/spi/spi-sunplus-sp7021.example.dt.yaml:
spi@9C002D80: 'clocks-names' is a required property
From schema: /builds/robherring/linux-dt/Documentation/devicetree/bindings/spi/spi-sunplus-sp7021.yaml Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.example.dts:19:18:
fatal error: dt-bindings/clock/sp-sp7021.h: No such file or directory
19 | #include <dt-bindings/clock/sp-sp7021.h>

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

Please send a fix ASAP.

Rob

#4 lore raw
In reply to Vincent Shih
Quoted 6 lines · Vincent Shih

This is a patch series for OCOTP driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD Card and etc.) into a single chip. It is designed for industrial control.

Quoted 7 lines

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Vincent Shih (2):
nvmem: Add driver for OCOTP in Sunplus SP7021
dt-bindings: nvmem: Add bindings doc for Sunplus OCOTP driver

Applied thanks,

--srini

Quoted 10 lines
  .../bindings/nvmem/sunplus,sp7021-ocotp.yaml       |  86 ++++++++
  MAINTAINERS                                        |   6 +
  drivers/nvmem/Kconfig                              |  12 ++
  drivers/nvmem/Makefile                             |   2 +
  drivers/nvmem/sunplus-ocotp.c                      | 228 +++++++++++++++++++++
  5 files changed, 334 insertions(+)

create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml create mode 100644 drivers/nvmem/sunplus-ocotp.c