Add OTP driver for Sunplus SP7021 SoC
Subsystems (3)
Vincent Shih
maintainercover Add OTP driver for Sunplus SP7021 SoC
This is a patch series for otp driver for Sunplus SP7021 SoC.
Sunplus SP7021 is an ARM Coretex 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 Sunplus SP7021
dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema
.../bindings/nvmem/sunplus,sp7021-ocotp.yaml | 116 ++++++++++++ MAINTAINERS | 8 + drivers/nvmem/Kconfig | 9 + drivers/nvmem/Makefile | 1 + drivers/nvmem/sunplus-ocotp.c | 207 +++++++++++++++++++++ drivers/nvmem/sunplus-ocotp.h | 136 ++++++++++++++ drivers/nvmem/sunplus-ocotp0.c | 54 ++++++ 7 files changed, 531 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml create mode 100644 drivers/nvmem/sunplus-ocotp.c create mode 100644 drivers/nvmem/sunplus-ocotp.h create mode 100644 drivers/nvmem/sunplus-ocotp0.c
Signature · 1 line
2.7.4
Vincent Shih
maintainerPATCH 1/2 nvmem: Add driver for Sunplus SP7021
Add driver for Sunplus SP7021
--- MAINTAINERS | 7 ++ drivers/nvmem/Kconfig | 9 ++ drivers/nvmem/Makefile | 1 + drivers/nvmem/sunplus-ocotp.c | 207 +++++++++++++++++++++++++++++++++++++++++ drivers/nvmem/sunplus-ocotp.h | 136 +++++++++++++++++++++++++++ drivers/nvmem/sunplus-ocotp0.c | 54 +++++++++++ 6 files changed, 414 insertions(+) create mode 100644 drivers/nvmem/sunplus-ocotp.c create mode 100644 drivers/nvmem/sunplus-ocotp.h create mode 100644 drivers/nvmem/sunplus-ocotp0.c
MAINTAINERS +7 -0
@@ -17947,6 +17947,13 @@ 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 +F: drivers/nvmem/sunplus-ocotp.h +F: drivers/nvmem/sunplus-ocotp0.c + SUPERH M: Yoshinori Sato <[email protected]> M: Rich Felker <[email protected]>
drivers/nvmem/Kconfig +9 -0
@@ -300,4 +300,13 @@ 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 + depends on HAS_IOMEM + help + This is a driver for the On-chip OTP controller (OCOTP) available on + Sunplus SoCs, providing access to 128 bytes of one-time programmable + eFuse0. + endif
drivers/nvmem/Makefile +1 -0
@@ -61,3 +61,4 @@ 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) += sunplus-ocotp.o sunplus-ocotp0.o
drivers/nvmem/sunplus-ocotp.c new file +207 -0
207 lines not on this page · raw message
drivers/nvmem/sunplus-ocotp.h new file +136 -0
136 lines not on this page · raw message
drivers/nvmem/sunplus-ocotp0.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.7.4
Vincent Shih
maintainerPATCH 2/2 dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema
In reply to Vincent ShihConvert Sunplus OCOTP to json-schema
--- .../bindings/nvmem/sunplus,sp7021-ocotp.yaml | 116 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +116 -0
@@ -0,0 +1,116 @@ +# 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 + + resets: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + therm_calib: + type: object + description: thermal calibration values + properties: + reg: + maxItems: 1 + + required: + - reg + + mac_addr0: + type: object + description: MAC address of ethernet port 0 + properties: + reg: + maxItems: 1 + + required: + - reg + + mac_addr1: + type: object + description: MAC address of ethernet port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + + disc_vol: + type: object + description: disconnect voltages of usb2 port 0 and port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + +required: + - compatible + - reg + - reg-names + - clocks + - resets + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/sp-sp7021.h> + #include <dt-bindings/reset/sp-sp7021.h> + + otp: otp@9C00AF00 { + compatible = "sunplus,sp7021-ocotp"; + reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>; + reg-names = "hb_gpio", "otprx"; + clocks = <&clks OTPRX>; + resets = <&rstc RST_OTPRX>; + + #address-cells = <1>; + #size-cells = <1>; + therm_calib: therm_calib@14 { + reg = <0x14 0x3>; + }; + mac_addr0: mac_addr0@34 { + reg = <0x34 0x6>; + }; + mac_addr1: mac_addr1@3A { + reg = <0x3A 0x6>; + }; + disc_vol: disc_vol@18 { + reg = <0x18 0x2>; + }; + }; +...
MAINTAINERS +1 -0
@@ -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 F: drivers/nvmem/sunplus-ocotp.h F: drivers/nvmem/sunplus-ocotp0.c
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH 2/2] dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema
Quoted 3 lines · Vincent Shih
Convert Sunplus OCOTP to json-schema
Signed-off-by Vincent Shih <[email protected]>
Author and Sob emails don't match.
Quoted 42 lines
--- .../bindings/nvmem/sunplus,sp7021-ocotp.yaml | 116 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yamlDocumentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +30
-0@@ -0,0 +1,116 @@ +# 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 +
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml line 40
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +10
-0+ resets: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + therm_calib:
s/_/-/ in node names.
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml line 48
Quoted 9 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +8
-0+ type: object + description: thermal calibration values + properties: + reg: + maxItems: 1 + + required: + - reg
You can drop 'reg' as nvmem.yaml should cover that.
Quoted 36 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +36
-0+ + mac_addr0: + type: object + description: MAC address of ethernet port 0 + properties: + reg: + maxItems: 1 + + required: + - reg + + mac_addr1: + type: object + description: MAC address of ethernet port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + + disc_vol: + type: object + description: disconnect voltages of usb2 port 0 and port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + +required: + - compatible + - reg + - reg-names + - clocks
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml line 94
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +10
-0+ - resets + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/sp-sp7021.h> + #include <dt-bindings/reset/sp-sp7021.h> + + otp: otp@9C00AF00 {
Lowercase hex for unit-address
Quoted 5 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +5
-0+ compatible = "sunplus,sp7021-ocotp"; + reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>; + reg-names = "hb_gpio", "otprx"; + clocks = <&clks OTPRX>; + resets = <&rstc RST_OTPRX>;
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml line 109
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +10
-0+ + #address-cells = <1>; + #size-cells = <1>; + therm_calib: therm_calib@14 { + reg = <0x14 0x3>; + }; + mac_addr0: mac_addr0@34 { + reg = <0x34 0x6>; + }; + mac_addr1: mac_addr1@3A {
Here too. If nvmem.yaml is not checking this, it should be.
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml line 112
Quoted 3 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +3
-0+ reg = <0x3A 0x6>; + }; + disc_vol: disc_vol@18 {
Sort nodes in order of unit-address.
Quoted 20 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml new file +4
-0+ reg = <0x18 0x2>; + }; + }; +...MAINTAINERS +1
-0@@ -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 F: drivers/nvmem/sunplus-ocotp.h F: drivers/nvmem/sunplus-ocotp0.cSignature · 1 line
2.7.4
RE: [PATCH 2/2] dt-bindings: nvmem: Convert Sunplus OCOTP to json-schema
hello
Quoted 169 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Friday, November 12, 2021 11:34 PM
To: Vincent Shih <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Vincent Shih 施錕鴻 <[email protected]>
Subject: Re: [PATCH 2/2] dt-bindings: nvmem: Convert Sunplus OCOTP to json-schemaQuoted 3 lines · Vincent Shih
Convert Sunplus OCOTP to json-schema
Signed-off-by Vincent Shih <[email protected]>Author and Sob emails don't match.
Quoted 45 lines
--- .../bindings/nvmem/sunplus,sp7021-ocotp.yaml | 116 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 117 insertions(+) create mode 100644
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yamldiff --git
a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yamlb/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yamlnew file mode 100644
index 0000000..2d18f38Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +30
-0+++ l@@ -0,0 +1,116 @@ +# 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 +Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam line 39
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +10
-0+ resets: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + therm_calib:s/_/-/ in node names.
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam
Quoted 9 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +8
-0+ type: object + description: thermal calibration values + properties: + reg: + maxItems: 1 + + required: + - regYou can drop 'reg' as
nvmem.yamlshould cover that.Quoted 36 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +36
-0+ + mac_addr0: + type: object + description: MAC address of ethernet port 0 + properties: + reg: + maxItems: 1 + + required: + - reg + + mac_addr1: + type: object + description: MAC address of ethernet port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + + disc_vol: + type: object + description: disconnect voltages of usb2 port 0 and port 1 + properties: + reg: + maxItems: 1 + + required: + - reg + +required: + - compatible + - reg + - reg-names + - clocksDocumentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +10
-0+ - resets + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/sp-sp7021.h> + #include <dt-bindings/reset/sp-sp7021.h> + + otp: otp@9C00AF00 {Lowercase hex for unit-address
Quoted 5 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +5
-0+ compatible = "sunplus,sp7021-ocotp"; + reg = <0x9C00AF00 0x34>, <0x9C00AF80 0x58>; + reg-names = "hb_gpio", "otprx"; + clocks = <&clks OTPRX>; + resets = <&rstc RST_OTPRX>;Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +10
-0+ + #address-cells = <1>; + #size-cells = <1>; + therm_calib: therm_calib@14 { + reg = <0x14 0x3>; + }; + mac_addr0: mac_addr0@34 { + reg = <0x34 0x6>; + }; + mac_addr1: mac_addr1@3A {Here too. If
nvmem.yamlis not checking this, it should be.Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam
Quoted 3 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +3
-0+ reg = <0x3A 0x6>; + }; + disc_vol: disc_vol@18 {Sort nodes in order of unit-address.
Quoted 11 lines
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yam new file +4
-0+ reg = <0x18 0x2>; + }; + }; +...MAINTAINERS +0
-0@@ -17950,6 +17950,7 @@ F: drivers/net/ethernet/dlink/sundance.c SUNPLUS OCOTP DRIVER M: Vincent Shih <[email protected]> S: Maintained
Quoted 8 lines
Quoted 8 lines
MAINTAINERS +1
-1+F: Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml F: drivers/nvmem/sunplus-ocotp.c F: drivers/nvmem/sunplus-ocotp.h F: drivers/nvmem/sunplus-ocotp0.c --2.7.4
Refer to your comments, I modified the statements shown below
...
...
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
- resets
Examples:
- |
#include <dt-bindings/clock/sp-sp7021.h>
#include <dt-bindings/reset/sp-sp7021.h>
otp: otp@9c00af00 {
compatible = "sunplus,sp7021-ocotp";
reg = <0x9c00af00 0x34>, <0x9c00af80, 0x58>;
reg-names = "hb_gpio", "otprx";
clocks = <&clks OTPRX>;
resets = <&rstc, RST_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>;
};
};...
Is that correct?
Thank you for your review !