devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
@ 2025-09-26 17:54 Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 1/3] riscv: dts: spacemit: enable the i2c2 adapter " Aurelien Jarno
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Aurelien Jarno @ 2025-09-26 17:54 UTC (permalink / raw)
  To: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Yixun Lan
  Cc: Aurelien Jarno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

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/20250923205028.2355244-1-aurelien@aurel32.net/  

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/20250921210237.943370-1-aurelien@aurel32.net/


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(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] riscv: dts: spacemit: enable the i2c2 adapter on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
@ 2025-09-26 17:54 ` Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 2/3] riscv: dts: spacemit: add 24c02 eeprom " Aurelien Jarno
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aurelien Jarno @ 2025-09-26 17:54 UTC (permalink / raw)
  To: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Yixun Lan
  Cc: Aurelien Jarno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

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

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
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(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 66375fd1e9974..3b6e4f52e9aad 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -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";
diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index c9e9a844d2b1c..d565882c46dd7 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -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 */
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index bc61a380baca8..d4f38ded52c93 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -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>;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 1/3] riscv: dts: spacemit: enable the i2c2 adapter " Aurelien Jarno
@ 2025-09-26 17:54 ` Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 3/3] riscv: dts: spacemit: add i2c aliases " Aurelien Jarno
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aurelien Jarno @ 2025-09-26 17:54 UTC (permalink / raw)
  To: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Yixun Lan
  Cc: Aurelien Jarno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

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.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
v2: no change 

 .../boot/dts/spacemit/k1-bananapi-f3.dts      | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 3b6e4f52e9aad..de10b1cb00aee 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -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>;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] riscv: dts: spacemit: add i2c aliases on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 1/3] riscv: dts: spacemit: enable the i2c2 adapter " Aurelien Jarno
  2025-09-26 17:54 ` [PATCH v3 2/3] riscv: dts: spacemit: add 24c02 eeprom " Aurelien Jarno
@ 2025-09-26 17:54 ` Aurelien Jarno
  2025-09-27  1:00 ` [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom " Yixun Lan
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aurelien Jarno @ 2025-09-26 17:54 UTC (permalink / raw)
  To: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Yixun Lan
  Cc: Aurelien Jarno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

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.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
v2: no change 

 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index de10b1cb00aee..3a01ffe92c0f0 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -14,6 +14,8 @@ aliases {
 		ethernet0 = &eth0;
 		ethernet1 = &eth1;
 		serial0 = &uart0;
+		i2c2 = &i2c2;
+		i2c8 = &i2c8;
 	};
 
 	chosen {
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
                   ` (2 preceding siblings ...)
  2025-09-26 17:54 ` [PATCH v3 3/3] riscv: dts: spacemit: add i2c aliases " Aurelien Jarno
@ 2025-09-27  1:00 ` Yixun Lan
  2025-09-27 11:52 ` Vivian Wang
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yixun Lan @ 2025-09-27  1:00 UTC (permalink / raw)
  To: Aurelien Jarno
  Cc: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

Hi Aurelien,

On 19:54 Fri 26 Sep     , Aurelien Jarno wrote:
> 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..

Reviewed-by: Yixun Lan <dlan@gentoo.org>

-- 
Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
                   ` (3 preceding siblings ...)
  2025-09-27  1:00 ` [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom " Yixun Lan
@ 2025-09-27 11:52 ` Vivian Wang
  2025-09-28  2:04 ` Troy Mitchell
  2025-10-14  0:18 ` Yixun Lan
  6 siblings, 0 replies; 8+ messages in thread
From: Vivian Wang @ 2025-09-27 11:52 UTC (permalink / raw)
  To: Aurelien Jarno, linux-kernel, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Yixun Lan
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support

On 9/27/25 01:54, Aurelien Jarno wrote:

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

Reviewed-by: Vivian Wang <wangruikang@iscas.ac.cn>

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
                   ` (4 preceding siblings ...)
  2025-09-27 11:52 ` Vivian Wang
@ 2025-09-28  2:04 ` Troy Mitchell
  2025-10-14  0:18 ` Yixun Lan
  6 siblings, 0 replies; 8+ messages in thread
From: Troy Mitchell @ 2025-09-28  2:04 UTC (permalink / raw)
  To: Aurelien Jarno, linux-kernel, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Yixun Lan
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support, Troy Mitchell

On Fri, Sep 26, 2025 at 07:54:36PM +0200, Aurelien Jarno wrote:
> 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/20250923205028.2355244-1-aurelien@aurel32.net/  
> 
> 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/20250921210237.943370-1-aurelien@aurel32.net/
> 
> 
> 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(-)
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> 
> -- 
> 2.47.2
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3
  2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
                   ` (5 preceding siblings ...)
  2025-09-28  2:04 ` Troy Mitchell
@ 2025-10-14  0:18 ` Yixun Lan
  6 siblings, 0 replies; 8+ messages in thread
From: Yixun Lan @ 2025-10-14  0:18 UTC (permalink / raw)
  To: linux-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Aurelien Jarno
  Cc: Yixun Lan,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list:RISC-V ARCHITECTURE,
	open list:RISC-V SPACEMIT SoC Support


On Fri, 26 Sep 2025 19:54:36 +0200, Aurelien Jarno wrote:
> 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,
-- 
Yixun Lan


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-14  0:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 17:54 [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom on BPI-F3 Aurelien Jarno
2025-09-26 17:54 ` [PATCH v3 1/3] riscv: dts: spacemit: enable the i2c2 adapter " Aurelien Jarno
2025-09-26 17:54 ` [PATCH v3 2/3] riscv: dts: spacemit: add 24c02 eeprom " Aurelien Jarno
2025-09-26 17:54 ` [PATCH v3 3/3] riscv: dts: spacemit: add i2c aliases " Aurelien Jarno
2025-09-27  1:00 ` [PATCH v3 0/3] riscv: dts: spacemit: add 24c02 eeprom " Yixun Lan
2025-09-27 11:52 ` Vivian Wang
2025-09-28  2:04 ` Troy Mitchell
2025-10-14  0:18 ` Yixun Lan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).