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>
---
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
On Sun, Sep 21, 2025 at 11:01:41PM +0200, Aurelien Jarno wrote: > 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> > --- > --- 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 { 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 > + 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 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Troy, Thanks for the review. On 2025-09-23 09:32, Troy Mitchell wrote: > On Sun, Sep 21, 2025 at 11:01:41PM +0200, Aurelien Jarno wrote: > > 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> > > --- > > --- 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 { > 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. > It looks like the pwm part is also incorrect. Yes, and also the submitted PCIE patches. Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://aurel32.net
On Tue, Sep 23, 2025 at 09:16:50PM +0200, Aurelien Jarno wrote: > Hi Troy, > > Thanks for the review. > > On 2025-09-23 09:32, Troy Mitchell wrote: > > On Sun, Sep 21, 2025 at 11:01:41PM +0200, Aurelien Jarno wrote: > > > 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> > > > --- > > > --- 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 { > > 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 > > > It looks like the pwm part is also incorrect. > > Yes, and also the submitted PCIE patches. > > Aurelien > > -- > Aurelien Jarno GPG: 4096R/1DDD8C9B > aurelien@aurel32.net http://aurel32.net >
© 2016 - 2025 Red Hat, Inc.