Skip to contentSkip to conversation

riscv: dts: spacemit: add 24c02 eeprom on BPI-F3

PATCH Superseded Aurelien Jarno 4 participants 18 messages Sep 21, 2025 – Sep 24, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover riscv: dts: spacemit: add 24c02 eeprom on BPI-F3

The BPI-F3 board has a 24c02 eeprom connected to the i2c bus #2. It holds board data. This patchset adds support for it.

Aurelien Jarno (3):
riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3
riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
riscv: dts: spacemit: add i2c aliases on BPI-F3

 .../boot/dts/spacemit/k1-bananapi-f3.dts      | 19 ++++++++++++++++++-
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |  7 +++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi          | 13 +++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)
Signature · 7 lines
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

PATCH 1/3 riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3

Define properties for the I2C adapter, and enable it on the BPI-F3. It will be used by the 24c02 eeprom.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  6 ++++++
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi    |  7 +++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            | 13 +++++++++++++
 3 files changed, 26 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 66375fd1e9974..3b6e4f52e9aad 100644
@@ -111,6 +111,12 @@ rgmii1: phy@1 {
 	};
 };
 
+&i2c2 {
+	pinctrl-0 = <&i2c2_0_cfg>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &i2c8 {
 	pinctrl-0 = <&i2c8_cfg>;
 	pinctrl-names = "default";
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +7 -0
index c9e9a844d2b1c..d565882c46dd7 100644
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
+	i2c2_0_cfg: i2c2-0-cfg {
+		i2c2-0-pins {
+			pinmux = <K1_PADCONF(84, 4)>,	/* I2C2_SCL */
+				 <K1_PADCONF(85, 4)>;	/* I2C2_SDA */
+		};
+	};
+
 	i2c8_cfg: i2c8-cfg {
 		i2c8-0-pins {
 			pinmux = <K1_PADCONF(93, 0)>,	/* PWR_SCL */
arch/riscv/boot/dts/spacemit/k1.dtsi +13 -0
index bc61a380baca8..d4f38ded52c93 100644
@@ -497,6 +497,19 @@ pwm7: pwm@d401bc00 {
 			status = "disabled";
 		};
 
+		i2c2: i2c@d4012000 {
+			compatible = "spacemit,k1-i2c";
+			reg = <0x0 0xd4012000 0x0 0x38>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&syscon_apbc CLK_TWSI2>,
+				 <&syscon_apbc CLK_TWSI2_BUS>;
+			clock-names = "func", "bus";
+			clock-frequency = <400000>;
+			interrupts = <38>;
+			status = "disabled";
+		};
+
 		i2c8: i2c@d401d800 {
 			compatible = "spacemit,k1-i2c";
 			reg = <0x0 0xd401d800 0x0 0x38>;
Signature · 7 lines
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
reviewer
#2 lore raw

Re: [PATCH 1/3] riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi gmac1-pins { · line 95

Quoted 12 lines · Aurelien Jarno

Define properties for the I2C adapter, and enable it on the BPI-F3. It will be used by the 24c02 eeprom.

---

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +1 -0
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
+	i2c2_0_cfg: i2c2-0-cfg {

Should this be i2c2_4_cfg here?
From what I see, in the initial version the second cell was meant to be the function number rather than the serial index.

It looks like the pwm part is also incorrect.

- Troy

Quoted 41 lines
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +6 -0
+		i2c2-0-pins {
+			pinmux = <K1_PADCONF(84, 4)>,	/* I2C2_SCL */
+				 <K1_PADCONF(85, 4)>;	/* I2C2_SDA */
+		};
+	};
+
 	i2c8_cfg: i2c8-cfg {
 		i2c8-0-pins {
 			pinmux = <K1_PADCONF(93, 0)>,	/* PWR_SCL */
arch/riscv/boot/dts/spacemit/k1.dtsi +13 -0
index bc61a380baca8..d4f38ded52c93 100644
@@ -497,6 +497,19 @@ pwm7: pwm@d401bc00 {
 			status = "disabled";
 		};
 
+		i2c2: i2c@d4012000 {
+			compatible = "spacemit,k1-i2c";
+			reg = <0x0 0xd4012000 0x0 0x38>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&syscon_apbc CLK_TWSI2>,
+				 <&syscon_apbc CLK_TWSI2_BUS>;
+			clock-names = "func", "bus";
+			clock-frequency = <400000>;
+			interrupts = <38>;
+			status = "disabled";
+		};
+
 		i2c8: i2c@d401d800 {
 			compatible = "spacemit,k1-i2c";
 			reg = <0x0 0xd401d800 0x0 0x38>;
Signature · 7 lines
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#3 lore raw

Re: [PATCH 1/3] riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3

Hi Troy,

Thanks for the review.

Quoted 12 lines · Troy Mitchell
Quoted 11 lines · Aurelien Jarno

Define properties for the I2C adapter, and enable it on the BPI-F3. It will be used by the 24c02 eeprom.

---

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +0 -0
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
Quoted 4 lines

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi gmac1-pins { · line 95

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +1 -0
+	i2c2_0_cfg: i2c2-0-cfg {

Should this be i2c2_4_cfg here?
From what I see, in the initial version the second cell was meant to be the function number rather than the serial index.

Ok, I wasn't aware of that convention, I just reused the same numbering of the downstream 6.6 kernel. I'll fix that and use i2c2_4_cfg.

Quoted 1 line

It looks like the pwm part is also incorrect.

Yes, and also the submitted PCIE patches.

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
reviewer
#4 lore raw

Re: [PATCH 1/3] riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3

Quoted 17 lines · Aurelien Jarno

Hi Troy,

Thanks for the review.

Quoted 12 lines · Troy Mitchell
Quoted 11 lines · Aurelien Jarno

Define properties for the I2C adapter, and enable it on the BPI-F3. It will be used by the 24c02 eeprom.

---

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +0 -0
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
Quoted 7 lines
Quoted 4 lines

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi gmac1-pins { · line 95

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +1 -0
+	i2c2_0_cfg: i2c2-0-cfg {

Should this be i2c2_4_cfg here?
From what I see, in the initial version the second cell was meant to be the function number rather than the serial index.

Ok, I wasn't aware of that convention, I just reused the same numbering of the downstream 6.6 kernel. I'll fix that and use i2c2_4_cfg.

I'm wrong..
The second number isn't function number.
You can find a more detailed discussion here:
(riscv: dts: spacemit: define a SPI controller node)

- Troy

Quoted 11 lines
Quoted 2 lines

It looks like the pwm part is also incorrect.

Yes, and also the submitted PCIE patches.

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#5 lore raw

Re: [PATCH 1/3] riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3

Quoted 23 lines · Troy Mitchell
Quoted 22 lines · Aurelien Jarno

Hi Troy,

Thanks for the review.

Quoted 16 lines · Troy Mitchell

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi gmac1-pins { · line 95

Quoted 12 lines · Aurelien Jarno

Define properties for the I2C adapter, and enable it on the BPI-F3. It will be used by the 24c02 eeprom.

---

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +1 -0
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
+	i2c2_0_cfg: i2c2-0-cfg {

Should this be i2c2_4_cfg here?
From what I see, in the initial version the second cell was meant to be the function number rather than the serial index.

Quoted 6 lines
Quoted 2 lines

Ok, I wasn't aware of that convention, I just reused the same numbering of the downstream 6.6 kernel. I'll fix that and use i2c2_4_cfg.

I'm wrong..
The second number isn't function number.
You can find a more detailed discussion here:
(riscv: dts: spacemit: define a SPI controller node)

Ok, I'll revert the change in the V3

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#6 lore raw

PATCH 2/3 riscv: dts: spacemit: add 24c02 eeprom on BPI-F3

In reply to Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +10 -1
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;
+		read-only;
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
-			buck3 {
+			vcc1v8_sys: buck3 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-ramp-delay = <5000>;
Signature · 7 lines
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#7 lore raw

Hi Aurelien,

Quoted 23 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

..

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 124

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+		read-only;

so you're sure there is no demand to write data to eeprom? (update info at linux env)

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts buck2 { · line 155

Quoted 11 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +3 -1
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
-			buck3 {
+			vcc1v8_sys: buck3 {

I'm not sure if adding an alias here is a good idea, it occurs buck3 serve the suppy for many devices, besides, to me it's more proper to name it as eeprom_vcc1v8 for the eeprom according to schematics in this case..

Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-ramp-delay = <5000>;
Signature · 1 line
2.47.2
Signature · 1 line
Yixun Lan (dlan)
#8 lore raw

Hi,

Quoted 27 lines · Yixun Lan

Hi Aurelien,

Quoted 23 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

..

Quoted 3 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 124

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+		read-only;

so you're sure there is no demand to write data to eeprom? (update info at linux env)

It seems to only contains board infos (mac addresses), but if there are other use cases, that can indeed be dropped.

Quoted 9 lines
Quoted 9 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +2 -0
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
Quoted 6 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts buck2 { · line 155

Quoted 2 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
-			buck3 {
+			vcc1v8_sys: buck3 {

I'm not sure if adding an alias here is a good idea, it occurs buck3 serve the suppy for many devices, besides, to me it's more proper to name it as eeprom_vcc1v8 for the eeprom according to schematics in this case..

We need to add a label to be able to reference it for the eeprom vcc-supply, but we'll have to also reference it for other devices (e.g. emmc, wifi, phys, etc... It tried to choose a common name, ie the right most one on the schematics. Another option could be to call it buck3, but other name suggestions are welcome.

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#9 lore raw

Hi Aurelien,

Quoted 30 lines · Aurelien Jarno

Hi,

Quoted 27 lines · Yixun Lan

Hi Aurelien,

Quoted 23 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

..

Quoted 7 lines
Quoted 3 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 124

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+		read-only;

so you're sure there is no demand to write data to eeprom? (update info at linux env)

It seems to only contains board infos (mac addresses), but if there are other use cases, that can indeed be dropped.

On my second thought, I'm ok with it being "read-only", as we flash these infos during firmware burning stage, then never alter them later.

Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +2 -0
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
Quoted 6 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts buck2 { · line 155

Quoted 2 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
-			buck3 {
+			vcc1v8_sys: buck3 {

I'm not sure if adding an alias here is a good idea, it occurs buck3 serve the suppy for many devices, besides, to me it's more proper to name it as eeprom_vcc1v8 for the eeprom according to schematics in this case..

Quoted 5 lines

We need to add a label to be able to reference it for the eeprom vcc-supply, but we'll have to also reference it for other devices (e.g. emmc, wifi, phys, etc... It tried to choose a common name, ie the right most one on the schematics. Another option could be to call it buck3, but other name suggestions are welcome.

how about simply making it "buck3_1v8", then probably add a comment later in the eeprom node? to mapping to the shecmatics

	vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */
Quoted 4 lines
Signature · 3 lines
-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
Signature · 1 line
Yixun Lan (dlan)
#10 lore raw
Quoted 59 lines · Yixun Lan

Hi Aurelien,

Quoted 30 lines · Aurelien Jarno

Hi,

Quoted 27 lines · Yixun Lan

Hi Aurelien,

Quoted 23 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

..

Quoted 7 lines
Quoted 3 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 124

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+		read-only;

so you're sure there is no demand to write data to eeprom? (update info at linux env)

It seems to only contains board infos (mac addresses), but if there are other use cases, that can indeed be dropped.

On my second thought, I'm ok with it being "read-only", as we flash these infos during firmware burning stage, then never alter them later.

Quoted 16 lines
Quoted 15 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts buck2 { · line 155

Quoted 11 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +3 -1
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
-			buck3 {
+			vcc1v8_sys: buck3 {

I'm not sure if adding an alias here is a good idea, it occurs buck3 serve the suppy for many devices, besides, to me it's more proper to name it as eeprom_vcc1v8 for the eeprom according to schematics in this case..

Quoted 8 lines
Quoted 5 lines

We need to add a label to be able to reference it for the eeprom vcc-supply, but we'll have to also reference it for other devices (e.g. emmc, wifi, phys, etc... It tried to choose a common name, ie the right most one on the schematics. Another option could be to call it buck3, but other name suggestions are welcome.

how about simply making it "buck3_1v8", then probably add a comment later in the eeprom node? to mapping to the shecmatics

	vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */

Thanks that sounds good. I'll send an updated patchset with that change.

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
reviewer
#11 lore raw
In reply to Aurelien Jarno
Quoted 30 lines · Aurelien Jarno

Hi,

Quoted 27 lines · Yixun Lan

Hi Aurelien,

Quoted 23 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

..

Quoted 6 lines
Quoted 3 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 124

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+		read-only;

so you're sure there is no demand to write data to eeprom? (update info at linux env)

It seems to only contains board infos (mac addresses), but if there are other use cases, that can indeed be dropped.

Then you can split the EEPROM into different parts.
Each part can be described as an individual nvmem cell in the device tree. Some of them can be marked as read-only, while others remain writable.

Documentation/devicetree/bindings/eeprom/at24.yaml +15:

```
  - $ref: /schemas/nvmem/nvmem-deprecated-cells.yaml
```

- Troy

Quoted 31 lines
Quoted 10 lines
Quoted 10 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +2 -0
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
Quoted 6 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts buck2 { · line 155

Quoted 2 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
-			buck3 {
+			vcc1v8_sys: buck3 {

I'm not sure if adding an alias here is a good idea, it occurs buck3 serve the suppy for many devices, besides, to me it's more proper to name it as eeprom_vcc1v8 for the eeprom according to schematics in this case..

We need to add a label to be able to reference it for the eeprom vcc-supply, but we'll have to also reference it for other devices (e.g. emmc, wifi, phys, etc... It tried to choose a common name, ie the right most one on the schematics. Another option could be to call it buck3, but other name suggestions are welcome.

Signature · 7 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#12 lore raw

Hi Troy,

Quoted 4 lines · Troy Mitchell
Quoted 3 lines · Aurelien Jarno

On 2025-09-22 11:21, Yixun Lan wrote:
It seems to only contains board infos (mac addresses), but if there are other use cases, that can indeed be dropped.

Quoted 8 lines

Then you can split the EEPROM into different parts.
Each part can be described as an individual nvmem cell in the device tree. Some of them can be marked as read-only, while others remain writable.

Documentation/devicetree/bindings/eeprom/at24.yaml +15:

```
  - $ref: /schemas/nvmem/nvmem-deprecated-cells.yaml
```

As pointed by Vivian the best for that is to use "onie,tlv-layout". I'll do that in the V2.

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
reviewer
#13 lore raw
In reply to Aurelien Jarno
Quoted 14 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 123

Quoted 9 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

I'm not sure this is 16..
Could you double check it?

- Troy

Quoted 23 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +4 -1
+		read-only;
+		size = <256>;
+	};
 };
 
 &i2c8 {
@@ -143,7 +152,7 @@ buck2 {
 				regulator-always-on;
 			};
 
-			buck3 {
+			vcc1v8_sys: buck3 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-ramp-delay = <5000>;
Signature · 7 lines
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#14 lore raw

Hi,

Quoted 10 lines · Troy Mitchell
Quoted 9 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 5 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 123

Quoted 9 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +6 -0
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;

I'm not sure this is 16..
Could you double check it?

Yes, this matches the datasheet:
https://www.giantec-semi.com/juchen1123/uploads/pdf/GT24C02_DS_Au.pdf

It says "Page Size: 16 bytes"

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#15 lore raw
In reply to Aurelien Jarno

Hi Aurelien,

Quoted 18 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 128

Quoted 10 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +8 -0
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;
+		read-only;
+		size = <256>;
+	};
 };
 

I wonder if it would possibly make sense to specify a nvmem-layout here. The BPI-F3 I have here has this in the 24c02:

00000000  54 6c 76 49 6e 66 6f 00  01 00 20 24 06 fe fe fe  |TlvInfo... $....|
00000010  XX XX XX 2a 02 00 02 23  0c XX XX XX XX XX XX XX  |...*...#.XXXXXXX|
00000020  XX XX XX XX XX fe 04 XX  XX XX XX ff ff ff ff ff  |XXXXX..XXXX.....|
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

*
00000100

(... with variable parts replaced with X)

And, AFAICT, this is a "onie,tlv-layout" with fields:

0x24 mac-adddress
0x2a num-macs
0x23 serial-number
0xfe crc32

As you can see the mac-address assignment looks bogus with fe:fe:fe (it is used by vendor code though, so at least it seems to be intended). It does appear at least to have useful information.

Can you confirm on your hardware? What do you think about this: should we add it now or add it when we have users?

Vivian "dramforever" Wang

#16 lore raw

Hi Vivian,

Quoted 46 lines · Vivian Wang

Hi Aurelien,

Quoted 18 lines · Aurelien Jarno

The BPI-F3 contains a 24c02 eeprom, that contains among other things the MAC addresses of the two network interfaces. For this reason, mark it as read-only.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
index 3b6e4f52e9aad..574d10fdf9b82 100644
@@ -115,6 +115,15 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &i2c2 { · line 128

Quoted 10 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +8 -0
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&vcc1v8_sys>;
+		pagesize = <16>;
+		read-only;
+		size = <256>;
+	};
 };
 

I wonder if it would possibly make sense to specify a nvmem-layout here. The BPI-F3 I have here has this in the 24c02:

00000000  54 6c 76 49 6e 66 6f 00  01 00 20 24 06 fe fe fe  |TlvInfo... $....|
00000010  XX XX XX 2a 02 00 02 23  0c XX XX XX XX XX XX XX  |...*...#.XXXXXXX|
00000020  XX XX XX XX XX fe 04 XX  XX XX XX ff ff ff ff ff  |XXXXX..XXXX.....|
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

*
00000100

(... with variable parts replaced with X)

And, AFAICT, this is a "onie,tlv-layout" with fields:

Quoted 8 lines

0x24 mac-adddress
0x2a num-macs
0x23 serial-number
0xfe crc32

As you can see the mac-address assignment looks bogus with fe:fe:fe (it is used by vendor code though, so at least it seems to be intended). It does appear at least to have useful information.

The reason I initially tried to dump the content of the eeprom was to check the MAC addresses provided to the kernel by u-boot at they looked strange to me starting with fe:fe:fe... But at least they match.

Quoted 2 lines

Can you confirm on your hardware? What do you think about this: should we add it now or add it when we have users?

I also have the TlvInfo data on my board, but it misses the serial-number field.

This is a good idea to use the "onie,tlv-layout" layout, I'll do that in the V2.

Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#17 lore raw

PATCH 3/3 riscv: dts: spacemit: add i2c aliases on BPI-F3

In reply to Aurelien Jarno

Add i2c aliases for i2c2 and i2c8 on BPI-F3. This is useful to keep a stable number for the /dev entries after loading the i2c-dev module.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +2 -0
index 574d10fdf9b82..a71eaf1c65deb 100644
@@ -14,6 +14,8 @@ aliases {
 		ethernet0 = &eth0;
 		ethernet1 = &eth1;
 		serial0 = &uart0;
+		i2c2 = &i2c2;
+		i2c8 = &i2c8;
 	};
 
 	chosen {
Signature · 7 lines
2.47.2


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