Skip to contentSkip to conversation

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

PATCH Applied Aurelien Jarno 4 participants 8 messages Sep 26, 2025 – Oct 14, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 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.

Changes between version 2 and version 3:

- Revert the name change for i2c2-0-cfg and i2c2-0-pins, the second cell is not a function number, but an index.

Here is version 2 of this series:
https://lore.kernel.org/lkml/[email protected]/

Changes between version 1 and version 2:
- Rename i2c2-0-cfg and i2c2-0-pins into i2c2-4-cfg and i2c2-4-pins to match the naming convention encoding the function number in the second cell.
- Rename the 24c02 supply name label to buck3_1v8
- Add a onie,tlv-layout nvmem layout describing the content of the 24c02 eeprom

Here is version 1 of this series:
https://lore.kernel.org/lkml/[email protected]/

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      | 33 ++++++++++++++++++-
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |  7 ++++
 arch/riscv/boot/dts/spacemit/k1.dtsi          | 13 ++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
Signature · 1 line
2.47.2
#1 lore raw

PATCH v3 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.

---
v2: Revert the name change for i2c2-0-cfg and i2c2-0-pins, the second cell
is not a function number, but an index.

 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 · 1 line
2.47.2
#2 lore raw

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

In reply to Aurelien Jarno

The BPI-F3 board includes a 24c02 eeprom, that stores the MAC addresses of the two network interfaces and the board's serial number. These values are also exposed via an onie,tlv-layout nvmem layout.

The eeprom is marked as read-only since its contents are not supposed to be modified.

---
v2: no change

 .../boot/dts/spacemit/k1-bananapi-f3.dts      | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +24 -1
index 3b6e4f52e9aad..de10b1cb00aee 100644
@@ -115,6 +115,29 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_0_cfg>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	eeprom@50 {
+		compatible = "atmel,24c02";
+		reg = <0x50>;
+		vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */
+		pagesize = <16>;
+		read-only;
+		size = <256>;
+
+		nvmem-layout {
+			compatible = "onie,tlv-layout";
+
+			mac-address {
+				#nvmem-cell-cells = <1>;
+			};
+
+			num-macs {
+			};
+
+			serial-number {
+			};
+		};
+	};
 };
 
 &i2c8 {
@@ -143,7 +166,7 @@ buck2 {
 				regulator-always-on;
 			};
 
-			buck3 {
+			buck3_1v8: buck3 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-ramp-delay = <5000>;
Signature · 1 line
2.47.2
#3 lore raw

PATCH v3 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.

---
v2: no change

 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 de10b1cb00aee..3a01ffe92c0f0 100644
@@ -14,6 +14,8 @@ aliases {
 		ethernet0 = &eth0;
 		ethernet1 = &eth1;
 		serial0 = &uart0;
+		i2c2 = &i2c2;
+		i2c8 = &i2c8;
 	};
 
 	chosen {
Signature · 1 line
2.47.2
Reviewed-by on the v3 series
#4 lore raw
In reply to Aurelien Jarno

Hi Aurelien,

Quoted 3 lines · Aurelien Jarno

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

looks good to me, but will wait for others to give reviews, btw, generally, I will proceed after v6.18-rc1 is tagged..

Signature · 1 line
Yixun Lan (dlan)
Reviewed-by on the v3 series
#5 lore raw
In reply to Aurelien Jarno
Quoted 2 lines · Aurelien Jarno

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

I guess now it's up to me to figure out how to wire the MAC address nodes to the two ethernet nodes, after we get 6.18-rc1 of course.

Theoretically it might not matter for Linux since a bootloader can set mac-address, but I think it would be a nice to have for less full-fledged boot situations.

Thanks,
Vivian "dramforever" Wang

reviewer Reviewed-by on the v3 series
#6 lore raw
In reply to Aurelien Jarno
Quoted 26 lines · Aurelien Jarno

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

Changes between version 2 and version 3:

- Revert the name change for i2c2-0-cfg and i2c2-0-pins, the second cell is not a function number, but an index.

Here is version 2 of this series:
https://lore.kernel.org/lkml/[email protected]/

Changes between version 1 and version 2:
- Rename i2c2-0-cfg and i2c2-0-pins into i2c2-4-cfg and i2c2-4-pins to match the naming convention encoding the function number in the second cell.
- Rename the 24c02 supply name label to buck3_1v8
- Add a onie,tlv-layout nvmem layout describing the content of the 24c02 eeprom

Here is version 1 of this series:
https://lore.kernel.org/lkml/[email protected]/

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

Quoted 4 lines
 .../boot/dts/spacemit/k1-bananapi-f3.dts      | 33 ++++++++++++++++++-
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |  7 ++++
 arch/riscv/boot/dts/spacemit/k1.dtsi          | 13 ++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
Quoted 9 lines
Signature · 8 lines
-- 
2.47.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Applied
#7 lore raw
In reply to Aurelien Jarno
Quoted 9 lines · Aurelien Jarno

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

Changes between version 2 and version 3:

- Revert the name change for i2c2-0-cfg and i2c2-0-pins, the second cell is not a function number, but an index.

[...]

Applied, thanks!

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

      https://github.com/spacemit-com/linux/commit/dcca2287773b69201b756723e8d45b6b8ad81b34
[2/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
      https://github.com/spacemit-com/linux/commit/bfce75e2345fa1ecbf046e696994132f56d6db1c
[3/3] riscv: dts: spacemit: add i2c aliases on BPI-F3
      https://github.com/spacemit-com/linux/commit/859ce3828f0b462e991c24224390def4c8fea673

Best regards,

Signature · 1 line
Yixun Lan