Skip to contentSkip to conversation

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

PATCH Superseded Aurelien Jarno 1 participant 4 messages Sep 23, 2025

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

Version 2 incorporates changes suggested during review of v1.

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

---

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 v2 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:
- 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.

 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..7df7f2c547750 100644
@@ -111,6 +111,12 @@ rgmii1: phy@1 {
 	};
 };
 
+&i2c2 {
+	pinctrl-0 = <&i2c2_4_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..2a5e819160df2 100644
@@ -92,6 +92,13 @@ gmac1-pins {
 		};
 	};
 
+	i2c2_4_cfg: i2c2-4-cfg {
+		i2c2-4-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 v2 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:
- Rename the 24c02 supply name label to buck3_1v8
- Add a onie,tlv-layout nvmem layout describing the content of the 24c02 eeprom

 .../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 7df7f2c547750..994bc23cc1023 100644
@@ -115,6 +115,29 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_4_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 v2 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 994bc23cc1023..b2ef0596168cf 100644
@@ -14,6 +14,8 @@ aliases {
 		ethernet0 = &eth0;
 		ethernet1 = &eth1;
 		serial0 = &uart0;
+		i2c2 = &i2c2;
+		i2c8 = &i2c8;
 	};
 
 	chosen {
Signature · 1 line
2.47.2