Skip to contentSkip to conversation

arm64: dts: rockchip: add EEPROM node for NanoPi R4S

PATCH Superseded Tianling Shen 3 participants 10 messages Jun 7, 2021

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: rockchip: add EEPROM node for NanoPi R4S

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +9 -0
index cef4d18b599d..4a82f50a07c5 100644
@@ -68,6 +68,15 @@
 	status = "disabled";
 };
 
+&i2c2 {
+	eeprom@51 {
+		compatible = "microchip,24c02", "atmel,24c02";
+		reg = <0x51>;
+		pagesize = <16>;
+		read-only; /* This holds our MAC */
+	};
+};
+
 &i2c4 {
 	status = "disabled";
 };
Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 14 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 73

Quoted 6 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -0
@@ -68,6 +68,15 @@
        status = "disabled";
 };
 
+&i2c2 {
+       eeprom@51 {
+               compatible = "microchip,24c02", "atmel,24c02";

The actual part number is Microchip 24AA025E48, but I don't think the way this device splits its storage area is easy to support without additional modifications to the driver.

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 76

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -0
+               reg = <0x51>;
+               pagesize = <16>;
+               read-only; /* This holds our MAC */

Please also add the size, as well as a cell defining the offset and length to the MAC address. The gmac node can then reference this with:

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

which will actually pick up the MAC address.

Regards
ChenYu

Quoted 14 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -1
+       };
+};
+
 &i2c4 {
        status = "disabled";
 };
--

2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi Chen-Yu,

Quoted 21 lines · Chen-Yu Tsai

Hi,

Quoted 17 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644
@@ -68,6 +68,15 @@
        status = "disabled";
 };
 
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 73

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -0
+&i2c2 {
+       eeprom@51 {
+               compatible = "microchip,24c02", "atmel,24c02";

The actual part number is Microchip 24AA025E48, but I don't think the way this device splits its storage area is easy to support without additional modifications to the driver.

On the face of it, it seems to work fine, and I can read the data correctly. (built with at24 eeprom driver)

Thanks,
Tianling.

Quoted 31 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 76

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -0
+               reg = <0x51>;
+               pagesize = <16>;
+               read-only; /* This holds our MAC */

Please also add the size, as well as a cell defining the offset and length to the MAC address. The gmac node can then reference this with:

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

which will actually pick up the MAC address.

Regards
ChenYu

Quoted 14 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -1
+       };
+};
+
 &i2c4 {
        status = "disabled";
 };
--

2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
In reply to Tianling Shen

Hi Tianling,

Quoted 13 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 77

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
@@ -68,6 +68,15 @@
 	status = "disabled";
 };
 
+&i2c2 {
+	eeprom@51 {
+		compatible = "microchip,24c02", "atmel,24c02";
+		reg = <0x51>;
+		pagesize = <16>;
 
+		read-only; /* This holds our MAC */

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Johan

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +3 -0
+	};
+};
+
 &i2c4 {
 	status = "disabled";

};

#4 lore raw
Quoted 26 lines · Johan Jonker

Hi Tianling,

Quoted 21 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +5 -0
index cef4d18b599d..4a82f50a07c5 100644
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
Quoted 5 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 76

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +1 -0
+             read-only; /* This holds our MAC */

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

ChenYu

#5 lore raw

Hi Chen-Yu,

Quoted 29 lines · Chen-Yu Tsai
Quoted 28 lines · Johan Jonker

Hi Tianling,

Quoted 23 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
index cef4d18b599d..4a82f50a07c5 100644
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
 
+             read-only; /* This holds our MAC */
Quoted 7 lines
Quoted 3 lines

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

The 24AA02XEXX is programmed at the factory with a globally unique node address stored in the upper half of the array and permanently write-protected. The remaining 1,024 bits are available for application use.

Just a question...

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

Which part does this point to?

Can we use the lower part to store/rewrite this too?

===

From at24.yaml:

items:
- pattern:
"^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
- pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"

How does Microchip 24AA025E48 fit the regex? What compatible would you advise?

===

Johan

Quoted 3 lines

ChenYu

#6 lore raw

Hi,

Quoted 46 lines · Johan Jonker

Hi Chen-Yu,

Quoted 29 lines · Chen-Yu Tsai
Quoted 28 lines · Johan Jonker

Hi Tianling,

Quoted 23 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
index cef4d18b599d..4a82f50a07c5 100644
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
 
+             read-only; /* This holds our MAC */
Quoted 7 lines
Quoted 3 lines

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

The 24AA02XEXX is programmed at the factory with a globally unique node address stored in the upper half of the array and permanently write-protected. The remaining 1,024 bits are available for application use.

Quoted 6 lines

Just a question...

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

Which part does this point to?

In the eeprom node:

    mac_address: mac-address@fa {
            reg = <0xfa 0x6>;
    };
Quoted 1 line

Can we use the lower part to store/rewrite this too?

If you don't set it to read only, then you could rewrite the lower portion. Writes to the upper portion would be ignored.

Quoted 11 lines

===

From at24.yaml:

items:
- pattern:
"^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
- pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"

How does Microchip 24AA025E48 fit the regex? What compatible would you advise?

New regex: "^microchip,24aa025?e(48|64)$"

All that was what I had around in my tree.

ChenYu

#7 lore raw
In reply to Johan Jonker

Hi Johan,

Quoted 38 lines · Johan Jonker

Hi Chen-Yu,

Quoted 33 lines · Chen-Yu Tsai
Quoted 31 lines · Johan Jonker

Hi Tianling,

Quoted 13 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 77

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
 
+             read-only; /* This holds our MAC */

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Quoted 8 lines
Quoted 2 lines

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

The 24AA02XEXX is programmed at the factory with a globally unique node address stored in the upper half of the array and permanently write-protected. The remaining 1,024 bits are available for application use.

In my opinion, as this contains data programmed by the factory, would it be okay to keep it read-only?

Quoted 13 lines

Just a question...

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

Which part does this point to?

Can we use the lower part to store/rewrite this too?

===

From at24.yaml:

Quoted 7 lines

items:
- pattern:
"^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
- pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"

How does Microchip 24AA025E48 fit the regex? What compatible would you advise?

It seems that 24AA025E48 is a variant of 24MAC402 [1], and atmel,24c02 will be okay in this case.
1. https://lkml.org/lkml/2018/1/24/494

Thanks,
Tianling.

Quoted 8 lines

===

Johan

Quoted 3 lines

ChenYu

#8 lore raw
Quoted 51 lines · Tianling Shen

Hi Johan,

Quoted 38 lines · Johan Jonker

Hi Chen-Yu,

Quoted 33 lines · Chen-Yu Tsai
Quoted 31 lines · Johan Jonker

Hi Tianling,

Quoted 13 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 77

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
 
+             read-only; /* This holds our MAC */

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Quoted 8 lines
Quoted 2 lines

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

The 24AA02XEXX is programmed at the factory with a globally unique node address stored in the upper half of the array and permanently write-protected. The remaining 1,024 bits are available for application use.

Quoted 2 lines

In my opinion, as this contains data programmed by the factory, would it be okay to keep it read-only?

This chip is not completely read-only.
There might be users that like to try some other mac_address or store something else in that lower part. Is this then still possible? Generic DT describes hardware independent from what Linux drivers or other OS are capable off.
This factory mac_addres is permanently write-protected, so no need to keep the rest read-only.

     nvmem-cells = <&new_mac_address_in_lower_part>;
     nvmem-cells-names = "mac-address";
Quoted 19 lines
Quoted 19 lines

Just a question...

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

Which part does this point to?

Can we use the lower part to store/rewrite this too?

===

From at24.yaml:

items:
- pattern:
"^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
- pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"

Quoted 6 lines
Quoted 2 lines

How does Microchip 24AA025E48 fit the regex? What compatible would you advise?

It seems that 24AA025E48 is a variant of 24MAC402 [1], and atmel,24c02 will be okay in this case.
1. https://lkml.org/lkml/2018/1/24/494

Ask Heiko. ;)

As long as it does not generate more notifications then we already have.

Quoted 12 lines

Thanks,
Tianling.

Quoted 8 lines

===

Johan

Quoted 3 lines

ChenYu

#9 lore raw
Quoted 91 lines · Johan Jonker
Quoted 51 lines · Tianling Shen

Hi Johan,

Quoted 38 lines · Johan Jonker

Hi Chen-Yu,

Quoted 33 lines · Chen-Yu Tsai
Quoted 31 lines · Johan Jonker

Hi Tianling,

Quoted 13 lines · Tianling Shen

NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which stores the MAC address.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +0 -0
index cef4d18b599d..4a82f50a07c5 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts line 77

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +6 -0
@@ -68,6 +68,15 @@
      status = "disabled";
 };
 
+&i2c2 {
+     eeprom@51 {
+             compatible = "microchip,24c02", "atmel,24c02";
+             reg = <0x51>;
+             pagesize = <16>;
 
+             read-only; /* This holds our MAC */

The mainline dts files should be generic I think.
Any comment about "use", partitions or write ability should be avoided. It's up the user.

Quoted 8 lines
Quoted 2 lines

Per the datasheet for this specific EEPROM, the latter half (128 bytes) is read-only in hardware by design though.

The 24AA02XEXX is programmed at the factory with a globally unique node address stored in the upper half of the array and permanently write-protected. The remaining 1,024 bits are available for application use.

Quoted 2 lines

In my opinion, as this contains data programmed by the factory, would it be okay to keep it read-only?

This chip is not completely read-only.
There might be users that like to try some other mac_address or store something else in that lower part. Is this then still possible? Generic DT describes hardware independent from what Linux drivers or other OS are capable off.
This factory mac_addres is permanently write-protected, so no need to keep the rest read-only.

     nvmem-cells = <&new_mac_address_in_lower_part>;
     nvmem-cells-names = "mac-address";
Quoted 22 lines
Quoted 21 lines

Just a question...

    nvmem-cells = <&mac_address>;
    nvmem-cells-names = "mac-address";

Which part does this point to?

Can we use the lower part to store/rewrite this too?

===

From at24.yaml:

items:
- pattern:
"^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
- pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"

How does Microchip 24AA025E48 fit the regex? What compatible would you advise?

Quoted 7 lines
Quoted 3 lines

It seems that 24AA025E48 is a variant of 24MAC402 [1], and atmel,24c02 will be okay in this case.
1. https://lkml.org/lkml/2018/1/24/494

Ask Heiko. ;)

As long as it does not generate more notifications then we already have.

I think having a part specific compatible would be better. That way if someone wanted to implement read-only "feedback" to users for the second half they could.

ChenYu

Quoted 12 lines
Quoted 12 lines

Thanks,
Tianling.

Quoted 8 lines

===

Johan

Quoted 3 lines

ChenYu