Skip to contentSkip to conversation

MIPS: CI20: Add efuse driver for Ingenic JZ4780 and attach to DM9000 for stable MAC addresses

RFC Superseded H. Nikolaus Schaller 6 participants 16 messages Feb 17, 2020 – Feb 24, 2020

Subsystems (4)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover MIPS: CI20: Add efuse driver for Ingenic JZ4780 and attach to DM9000 for stable MAC addresses

* removed read_only for nvmem config because there is no write method
* Kconfig: replaced depends MACH_JZ4780 with MACH_INGENIC
* run through checkpatch and fixed issues
* made use of devm_nvram_register() and get rid of jz4780_efuse_remove() (suggested by Srinivas Kandagatla <[email protected]>)
* squashed previous patch 1/9 and 2/9 into single (regmap based) driver

RFC V3 2020-02-16 20:20:59:

This series is based on and a follow up for

https://lore.kernel.org/patchwork/cover/868157/

("[v2,0/2] Add efuse driver for Ingenic JZ4780 SoC")

Original authors were
PrasannaKumar Muralidharan <[email protected]> Mathieu Malaterre <[email protected]>

and there are additions / code improvements by
H. Nikolaus Schaller <[email protected]>
Paul Cercueil <[email protected]>

This setup works, if the dm9000 driver is compiled as a module.

Therefore it is all RFC level. It is also not completely checkpatched.

H. Nikolaus Schaller (1):
MIPS: DTS: CI20: make DM9000 Ethernet controller use NVMEM to find the
default MAC address

PrasannaKumar Muralidharan (5):
nvmem: add driver for JZ4780 efuse
Bindings: nvmem: add bindings for JZ4780 efuse
Documentation: ABI: nvmem: add documentation for JZ4780 efuse ABI
nvmem: MAINTAINERS: add maintainer for JZ4780 efuse driver
MIPS: DTS: JZ4780: define node for JZ4780 efuse

 .../ABI/testing/sysfs-driver-jz4780-efuse     |  16 ++
 .../bindings/nvmem/ingenic,jz4780-efuse.txt   |  17 ++
 MAINTAINERS                                   |   5 +
 arch/mips/boot/dts/ingenic/ci20.dts           |   3 +
 arch/mips/boot/dts/ingenic/jz4780.dtsi        |  17 +-
 drivers/nvmem/Kconfig                         |  10 +
 drivers/nvmem/Makefile                        |   2 +
 drivers/nvmem/jz4780-efuse.c                  | 229 ++++++++++++++++++
 8 files changed, 298 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-jz4780-efuse
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt
 create mode 100644 drivers/nvmem/jz4780-efuse.c
Signature · 1 line
2.23.0
#1 lore raw

RFC v4 1/6 nvmem: add driver for JZ4780 efuse

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only exposes a read only access to the entire 8K bits efuse memory and nvmem cells.

---
 drivers/nvmem/Kconfig        |  10 ++
 drivers/nvmem/Makefile       |   2 +
 drivers/nvmem/jz4780-efuse.c | 229 +++++++++++++++++++++++++++++++++++
 3 files changed, 241 insertions(+)
 create mode 100644 drivers/nvmem/jz4780-efuse.c
drivers/nvmem/Kconfig +10 -0
index 35efab1ba8d9..8143e6e1dd82 100644
@@ -55,6 +55,16 @@ config NVMEM_IMX_OCOTP_SCU
 	  This is a driver for the SCU On-Chip OTP Controller (OCOTP)
 	  available on i.MX8 SoCs.
 
+config JZ4780_EFUSE
+	tristate "JZ4780 EFUSE Memory Support"
+	depends on MACH_INGENIC || COMPILE_TEST
+	depends on HAS_IOMEM
+	help
+	  Say Y here to include support for JZ4780 efuse memory found on
+	  all JZ4780 SoC based devices.
+	  To compile this driver as a module, choose M here: the module
+	  will be called nvmem_jz4780_efuse.
+
 config NVMEM_LPC18XX_EEPROM
 	tristate "NXP LPC18XX EEPROM Memory Support"
 	depends on ARCH_LPC18XX || COMPILE_TEST
drivers/nvmem/Makefile +2 -0
index 6b466cd1427b..65a268d17807 100644
@@ -18,6 +18,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP)	+= nvmem-imx-ocotp.o
 nvmem-imx-ocotp-y		:= imx-ocotp.o
 obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU)	+= nvmem-imx-ocotp-scu.o
 nvmem-imx-ocotp-scu-y		:= imx-ocotp-scu.o
+obj-$(CONFIG_JZ4780_EFUSE)		+= nvmem_jz4780_efuse.o
+nvmem_jz4780_efuse-y		:= jz4780-efuse.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
drivers/nvmem/jz4780-efuse.c new file +229 -0

229 lines not on this page · raw message

Signature · 1 line
2.23.0
#2 lore raw

RFC v4 2/6 Bindings: nvmem: add bindings for JZ4780 efuse

In reply to H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
 .../bindings/nvmem/ingenic,jz4780-efuse.txt     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +17 -0
new file mode 100644
index 000000000000..339e74daa9a9
@@ -0,0 +1,17 @@
+Ingenic JZ EFUSE driver bindings
+
+Required properties:
+- "compatible"		Must be set to "ingenic,jz4780-efuse"
+- "reg"			Register location and length
+- "clocks"		Handle for the ahb clock for the efuse.
+- "clock-names"		Must be "bus_clk"
+
+Example:
+
+efuse: efuse@134100d0 {
+	compatible = "ingenic,jz4780-efuse";
+	reg = <0x134100d0 0x2c>;
+
+	clocks = <&cgu JZ4780_CLK_AHB2>;
+	clock-names = "bus_clk";
+};
Signature · 1 line
2.23.0
maintainer
#3 lore raw

Re: [RFC v4 2/6] Bindings: nvmem: add bindings for JZ4780 efuse

Quoted 5 lines · H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

Quoted 8 lines
---
 .../bindings/nvmem/ingenic,jz4780-efuse.txt     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt

Please convert to a DT schema.

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt line 7

Quoted 13 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +7 -0
new file mode 100644
index 000000000000..339e74daa9a9
@@ -0,0 +1,17 @@
+Ingenic JZ EFUSE driver bindings
+
+Required properties:
+- "compatible"		Must be set to "ingenic,jz4780-efuse"
+- "reg"			Register location and length
+- "clocks"		Handle for the ahb clock for the efuse.
+- "clock-names"		Must be "bus_clk"

'clk' is redundant. How about 'ahb'?

Quoted 13 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +10 -0
+
+Example:
+
+efuse: efuse@134100d0 {
+	compatible = "ingenic,jz4780-efuse";
+	reg = <0x134100d0 0x2c>;
+
+	clocks = <&cgu JZ4780_CLK_AHB2>;
+	clock-names = "bus_clk";
+};
Signature · 1 line
2.23.0
#4 lore raw

Re: [RFC v4 2/6] Bindings: nvmem: add bindings for JZ4780 efuse

Quoted 18 lines

Am 18.02.2020 um 22:26 schrieb Rob Herring <[email protected]>:

Quoted 5 lines · H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

Quoted 8 lines

---
.../bindings/nvmem/ingenic,jz4780-efuse.txt | 17 +++++++++++++++++

1 file changed, 17 insertions(+)

create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt

Quoted 1 line

Please convert to a DT schema.

Is there someone of you who can help to do that?

DT schemas are still like a Chinese dialect for me (i.e. I can decipher with help but neither speak nor write).

BR and thanks,
Nikolaus

Quoted 30 lines
Quoted 7 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +0 -0
new file mode 100644
index 000000000000..339e74daa9a9

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +7 -0
@@ -0,0 +1,17 @@
+Ingenic JZ EFUSE driver bindings
+
+Required properties:
+- "compatible"		Must be set to "ingenic,jz4780-efuse"
+- "reg"			Register location and length
+- "clocks"		Handle for the ahb clock for the efuse.
+- "clock-names"		Must be "bus_clk"

'clk' is redundant. How about 'ahb'?

Quoted 13 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +10 -0
+
+Example:
+
+efuse: efuse@134100d0 {
+	compatible = "ingenic,jz4780-efuse";
+	reg = <0x134100d0 0x2c>;
+
+	clocks = <&cgu JZ4780_CLK_AHB2>;
+	clock-names = "bus_clk";
+};
Signature · 1 line
2.23.0
#5 lore raw

Re: [RFC v4 2/6] Bindings: nvmem: add bindings for JZ4780 efuse

Hi Nikolaus,

Quoted 16 lines · H. Nikolaus Schaller
Quoted 16 lines

Am 18.02.2020 um 22:26 schrieb Rob Herring <[email protected]>:

Quoted 13 lines · H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
.../bindings/nvmem/ingenic,jz4780-efuse.txt | 17 +++++++++++++++++

1 file changed, 17 insertions(+)

create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt

Quoted 7 lines
Quoted 1 line

Please convert to a DT schema.

Is there someone of you who can help to do that?

DT schemas are still like a Chinese dialect for me (i.e. I can decipher with help but neither speak nor write).

BR and thanks,
Nikolaus

I am also suffering from this, and I am going to ask Paul for advice.

Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +0 -0
new file mode 100644
index 000000000000..339e74daa9a9

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +7 -0
@@ -0,0 +1,17 @@
+Ingenic JZ EFUSE driver bindings
+
+Required properties:
+- "compatible"		Must be set to "ingenic,jz4780-efuse"
+- "reg"			Register location and length
+- "clocks"		Handle for the ahb clock for the efuse.
+- "clock-names"		Must be "bus_clk"

'clk' is redundant. How about 'ahb'?

How about replace "bus_clk" with "efuse"? Other SoCs (like T21, X1000, X1500, X1830, X2000) has a dedicated bit in the CLKGR register to control the EFUSE clock. A corresponding "XXX_CLK_EFUSE" is provided in the "xxx-cgu.c" driver.

Thanks and best regards!

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt new file +10 -0
+
+Example:
+
+efuse: efuse@134100d0 {
+	compatible = "ingenic,jz4780-efuse";
+	reg = <0x134100d0 0x2c>;
+
+	clocks = <&cgu JZ4780_CLK_AHB2>;
+	clock-names = "bus_clk";
+};
Signature · 1 line
2.23.0
#6 lore raw

Re: [RFC v4 2/6] Bindings: nvmem: add bindings for JZ4780 efuse

In reply to H. Nikolaus Schaller
Quoted 7 lines · H. Nikolaus Schaller
Quoted 4 lines
Quoted 3 lines

.../bindings/nvmem/ingenic,jz4780-efuse.txt | 17 +++++++++++++++++

1 file changed, 17 insertions(+)

create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt

Please convert to a DT schema.

Is there someone of you who can help to do that?

DT schemas are still like a Chinese dialect for me (i.e. I can decipher with help but neither speak nor write).

Have a look at an example here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml?h=v5.6-rc2

Some documentation:
https://lwn.net/Articles/771621/

--srini

Quoted 4 lines

BR and thanks,
Nikolaus

#7 lore raw

RFC PATCH 1/1 Bindings: nvmem: add bindings for JZ4780 efuse

In reply to H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
I will not update/maintain this, just have the impression that here some more work is needed to make somebody comfortable with yaml than stick to the usual pointing to documentation and I have not the ingredients for doing
cat Antihistamines >/dev/brain ;-)
and I do not want to see the other patches get lost.

 .../bindings/nvmem/ingenic,jz4780-efuse.yaml  | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +51 -0
new file mode 100644
index 000000000000..ad56c17b0bd5
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/ingenic,jz4780-efuse.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ingenic JZ EFUSE driver bindings
+
+maintainers:
+  - tbd <tbd@tbd>
+
+allOf:
+  - $ref: "nvmem.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - ingenic,jz4780-efuse
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    # Handle for the ahb for the efuse.
+    maxItems: 1
+
+  clock-names:
+   items:
+     - const:  bus_clk
+
+required:
+  - compatible
+  - reg
+  - clock
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/jz4780-cgu.h>
+
+    efuse@134100d0 {
+        compatible = "ingenic,jz4780-efuse";
+        reg = <0x134100d0 0x2c>;
+
+        clocks = <&cgu JZ4780_CLK_AHB2>;
+        clock-names = "bus_clk";
+    };
+
+...
Signature · 1 line
2.20.1
maintainer
#8 lore raw

Re: [PATCH RFC] Bindings: nvmem: add bindings for JZ4780 efuse

Quoted 12 lines · Andreas Kemnade

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

Quoted 7 lines

---
I will not update/maintain this, just have the impression that here some more work is needed to make somebody comfortable with yaml than stick to the usual pointing to documentation and I have not the ingredients for doing
cat Antihistamines >/dev/brain ;-)
and I do not want to see the other patches get lost.

Looks about right...

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml line 1

Quoted 12 lines
 .../bindings/nvmem/ingenic,jz4780-efuse.yaml  | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +1 -0
new file mode 100644
index 000000000000..ad56c17b0bd5
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

Quoted 18 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +18 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/ingenic,jz4780-efuse.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ingenic JZ EFUSE driver bindings
+
+maintainers:
+  - tbd <tbd@tbd>
+
+allOf:
+  - $ref: "nvmem.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - ingenic,jz4780-efuse
+

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  clocks:
+    # Handle for the ahb for the efuse.
+    maxItems: 1
+
+  clock-names:
+   items:
+     - const:  bus_clk

My prior comment still applies.

Also, for a single clock, you don't really need a name.

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+  - clock

'make dt_binding_check' would have pointed the error here for you:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.example.dt.yaml:
efuse@134100d0: 'clock' is a required property

Quoted 20 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +17 -1
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/jz4780-cgu.h>
+
+    efuse@134100d0 {
+        compatible = "ingenic,jz4780-efuse";
+        reg = <0x134100d0 0x2c>;
+
+        clocks = <&cgu JZ4780_CLK_AHB2>;
+        clock-names = "bus_clk";
+    };
+
+...
--

2.20.1

#9 lore raw

Re: [PATCH RFC] Bindings: nvmem: add bindings for JZ4780 efuse

On Thu, 20 Feb 2020 13:53:55 -0600
Rob Herring <[email protected]> wrote:

[...]

Quoted 8 lines

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+  - clock  

'make dt_binding_check' would have pointed the error here for you:

I did run make dt_binding_check...
It stopped because the jz4780-cgu.h included was missing. Then I have added that line and have started dt_binding_check again.
At least here it is doing a full rerun in the second part. After some time I scrolled back and noticed DTC passed
and missed that

Quoted 3 lines

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.example.dt.yaml:
efuse@134100d0: 'clock' is a required property

in the CHECKS line. Well, dt_binding_check is a bit noisy. I guess I should have redirected all output to a text file, before and after my changes. and diffed the results.
Is there any script ready for that?

Regards,
Andreas

maintainer
#10 lore raw

Re: [PATCH RFC] Bindings: nvmem: add bindings for JZ4780 efuse

Quoted 20 lines · Andreas Kemnade

On Thu, 20 Feb 2020 13:53:55 -0600
Rob Herring <[email protected]> wrote:

[...]

Quoted 8 lines

Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+  - clock

'make dt_binding_check' would have pointed the error here for you:

I did run make dt_binding_check...
It stopped because the jz4780-cgu.h included was missing. Then I have added that line and have started dt_binding_check again.
At least here it is doing a full rerun in the second part. After some time I scrolled back and noticed DTC passed
and missed that

Quoted 7 lines
Quoted 3 lines

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.example.dt.yaml:
efuse@134100d0: 'clock' is a required property

in the CHECKS line. Well, dt_binding_check is a bit noisy. I guess I should have redirected all output to a text file, before and after my changes. and diffed the results.
Is there any script ready for that?

grep 'ingenic,jz4780-efuse' <build log> ?

Noisy? There's 8 warnings on Linus' master currently[1]. I try to keep that at 0, but I wouldn't call 8 noisy.

Rob

[1] https://gitlab.com/robherring/linux-dt-bindings/-/jobs/447630363

#11 lore raw

Re: [RFC v4 2/6] Bindings: nvmem: add bindings for JZ4780 efuse

In reply to H. Nikolaus Schaller

--
Jiaxun Yang

---- 在 星期三, 2020-02-19 13:48:56 H. Nikolaus Schaller <[email protected]> 撰写 ----

Quoted 18 lines
Quoted 18 lines

Am 18.02.2020 um 22:26 schrieb Rob Herring <[email protected]>:

Quoted 13 lines · H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
.../bindings/nvmem/ingenic,jz4780-efuse.txt | 17 +++++++++++++++++

1 file changed, 17 insertions(+)

create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt

Quoted 5 lines
Quoted 1 line

Please convert to a DT schema.

Is there someone of you who can help to do that?

DT schemas are still like a Chinese dialect for me (i.e. I can decipher with help but neither speak nor write).

I just had a try.

https://paste.ubuntu.com/p/xgDdmwnGsz/

Not sure if it's correct.

Thanks.

--
Jiaxun Yang

#12 lore raw

RFC v4 3/6 Documentation: ABI: nvmem: add documentation for JZ4780 efuse ABI

In reply to H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
 .../ABI/testing/sysfs-driver-jz4780-efuse        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-jz4780-efuse
Documentation/ABI/testing/sysfs-driver-jz4780-efuse new file +16 -0
new file mode 100644
index 000000000000..bb6f5d6ceea0
@@ -0,0 +1,16 @@
+What:		/sys/devices/*/<our-device>/nvmem
+Date:		December 2017
+Contact:	PrasannaKumar Muralidharan <[email protected]>
+Description:	read-only access to the efuse on the Ingenic JZ4780 SoC
+		The SoC has a one time programmable 8K efuse that is
+		split into segments. The driver supports read only.
+		The segments are
+		0x000   64 bit Random Number
+		0x008  128 bit Ingenic Chip ID
+		0x018  128 bit Customer ID
+		0x028 3520 bit Reserved
+		0x1E0    8 bit Protect Segment
+		0x1E1 2296 bit HDMI Key
+		0x300 2048 bit Security boot key
+Users:		any user space application which wants to read the Chip
+		and Customer ID
Signature · 1 line
2.23.0
#13 lore raw

RFC v4 4/6 nvmem: MAINTAINERS: add maintainer for JZ4780 efuse driver

In reply to H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only expose a read only access to the entire 8K bits efuse memory.

---
 MAINTAINERS | 5 +++++
 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
index a0d86490c2c6..5bab216d8fe9 100644
@@ -8270,6 +8270,11 @@ M:	Zubair Lutfullah Kakakhel <[email protected]>
 S:	Maintained
 F:	drivers/dma/dma-jz4780.c
 
+INGENIC JZ4780 EFUSE Driver
+M:	PrasannaKumar Muralidharan <[email protected]>
+S:	Maintained
+F:	drivers/nvmem/jz4780-efuse.c
+
 INGENIC JZ4780 NAND DRIVER
 M:	Harvey Hunt <[email protected]>
 L:	[email protected]
Signature · 1 line
2.23.0
#14 lore raw

RFC v4 5/6 MIPS: DTS: JZ4780: define node for JZ4780 efuse

In reply to H. Nikolaus Schaller

From: PrasannaKumar Muralidharan <[email protected]>

This patch brings support for the JZ4780 efuse. Currently it only exposes a read only access to the entire 8K bits efuse memory and the ethernet mac address for the davicom dm9000 chip on the CI20 board.

It also changes the nemc reg range to avoid overlap.

---
 arch/mips/boot/dts/ingenic/jz4780.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/mips/boot/dts/ingenic/jz4780.dtsi +16 -1
index f928329b034b..c9461310aa8b 100644
@@ -358,7 +358,7 @@
 
 	nemc: nemc@13410000 {
 		compatible = "ingenic,jz4780-nemc";
-		reg = <0x13410000 0x10000>;
+		reg = <0x13410000 0x4c>;
 		#address-cells = <2>;
 		#size-cells = <1>;
 		ranges = <1 0 0x1b000000 0x1000000
@@ -373,6 +373,21 @@
 		status = "disabled";
 	};
 
+	efuse: efuse@134100d0 {
+		compatible = "ingenic,jz4780-efuse";
+		reg = <0x134100d0 0x2c>;
+
+		clocks = <&cgu JZ4780_CLK_AHB2>;
+		clock-names = "bus_clk";
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		eth0_addr: eth-mac-addr@0x22 {
+			reg = <0x22 0x6>;
+		};
+	};
+
 	dma: dma@13420000 {
 		compatible = "ingenic,jz4780-dma";
 		reg = <0x13420000 0x400
Signature · 1 line
2.23.0
#15 lore raw

RFC v4 6/6 MIPS: DTS: CI20: make DM9000 Ethernet controller use NVMEM to find the default MAC address

In reply to H. Nikolaus Schaller

There is a unique MAC address programmed into the eFuses of the JZ4780 chip in the CI20 factory. By using this for initializing the DM9000 Ethernet controller, every CI20 board has an individual - but stable - MAC address and DHCP can assign stable IP addresses.

---
 arch/mips/boot/dts/ingenic/ci20.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/boot/dts/ingenic/ci20.dts +3 -0
index 37b93166bf22..6dc1f9eeff00 100644
@@ -355,6 +355,9 @@
 
 		interrupt-parent = <&gpe>;
 		interrupts = <19 4>;
+
+		nvmem-cells = <&eth0_addr>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
Signature · 1 line
2.23.0