* [PATCH v2 1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
2024-05-17 9:09 [PATCH v2 0/3] Add I2C support on TH1520 Thomas Bonnefille
@ 2024-05-17 9:09 ` Thomas Bonnefille
2024-05-17 16:14 ` Conor Dooley
2024-05-17 9:09 ` [PATCH v2 2/3] riscv: dts: thead: Add TH1520 I2C nodes Thomas Bonnefille
2024-05-17 9:09 ` [PATCH v2 3/3] riscv: dts: thead: Enable I2C on the BeagleV-Ahead Thomas Bonnefille
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Bonnefille @ 2024-05-17 9:09 UTC (permalink / raw)
To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Conor Dooley
Cc: Palmer Dabbelt, Albert Ou, Paul Walmsley, Thomas Petazzoni,
Miquèl Raynal, linux-i2c, devicetree, linux-kernel,
linux-riscv, Thomas Bonnefille
Add documentation for compatible string thead,th1520-i2c which can be
used specifically for the TH1520 SoC.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml b/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml
index d9293c57f573..60035a787e5c 100644
--- a/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml
@@ -33,6 +33,10 @@ properties:
- const: snps,designware-i2c
- description: Baikal-T1 SoC System I2C controller
const: baikal,bt1-sys-i2c
+ - description: T-HEAD TH1520 SoCs I2C controller
+ items:
+ - const: thead,th1520-i2c
+ - const: snps,designware-i2c
reg:
minItems: 1
--
2.45.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
2024-05-17 9:09 ` [PATCH v2 1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c Thomas Bonnefille
@ 2024-05-17 16:14 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2024-05-17 16:14 UTC (permalink / raw)
To: Thomas Bonnefille
Cc: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Palmer Dabbelt, Albert Ou, Paul Walmsley,
Thomas Petazzoni, Miquèl Raynal, linux-i2c, devicetree,
linux-kernel, linux-riscv
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
On Fri, May 17, 2024 at 11:09:53AM +0200, Thomas Bonnefille wrote:
> Add documentation for compatible string thead,th1520-i2c which can be
> used specifically for the TH1520 SoC.
>
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] riscv: dts: thead: Add TH1520 I2C nodes
2024-05-17 9:09 [PATCH v2 0/3] Add I2C support on TH1520 Thomas Bonnefille
2024-05-17 9:09 ` [PATCH v2 1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c Thomas Bonnefille
@ 2024-05-17 9:09 ` Thomas Bonnefille
2024-05-26 12:01 ` Emil Renner Berthing
2024-05-17 9:09 ` [PATCH v2 3/3] riscv: dts: thead: Enable I2C on the BeagleV-Ahead Thomas Bonnefille
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Bonnefille @ 2024-05-17 9:09 UTC (permalink / raw)
To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Conor Dooley
Cc: Palmer Dabbelt, Albert Ou, Paul Walmsley, Thomas Petazzoni,
Miquèl Raynal, linux-i2c, devicetree, linux-kernel,
linux-riscv, Thomas Bonnefille
Add nodes for the five I2C on the T-Head TH1520 RISCV SoC.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
arch/riscv/boot/dts/thead/th1520.dtsi | 50 +++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index de7116290ca4..ae6cf4c441cf 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -252,6 +252,36 @@ gpio2: gpio-controller@0 {
};
};
+ i2c0: i2c@ffe7f20000 {
+ compatible = "thead,th1520-i2c", "snps,designware-i2c";
+ reg = <0xff 0xe7f20000 0x0 0x4000>;
+ interrupts = <44 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk CLK_I2C0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
+ i2c1: i2c@ffe7f24000 {
+ compatible = "thead,th1520-i2c", "snps,designware-i2c";
+ reg = <0xff 0xe7f24000 0x0 0x4000>;
+ interrupts = <45 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk CLK_I2C1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
+ i2c4: i2c@ffe7f28000 {
+ compatible = "thead,th1520-i2c", "snps,designware-i2c";
+ reg = <0xff 0xe7f28000 0x0 0x4000>;
+ interrupts = <48 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk CLK_I2C4>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
gpio@ffe7f38000 {
compatible = "snps,dw-apb-gpio";
reg = <0xff 0xe7f38000 0x0 0x1000>;
@@ -342,6 +372,16 @@ uart2: serial@ffec010000 {
status = "disabled";
};
+ i2c3: i2c@ffec014000 {
+ compatible = "thead,th1520-i2c", "snps,designware-i2c";
+ reg = <0xff 0xec014000 0x0 0x4000>;
+ interrupts = <47 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk CLK_I2C3>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
dmac0: dma-controller@ffefc00000 {
compatible = "snps,axi-dma-1.01a";
reg = <0xff 0xefc00000 0x0 0x1000>;
@@ -416,6 +456,16 @@ uart5: serial@fff7f0c000 {
status = "disabled";
};
+ i2c5: i2c@fff7f2c000 {
+ compatible = "thead,th1520-i2c", "snps,designware-i2c";
+ reg = <0xff 0xf7f2c000 0x0 0x4000>;
+ interrupts = <49 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk CLK_I2C5>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
timer4: timer@ffffc33000 {
compatible = "snps,dw-apb-timer";
reg = <0xff 0xffc33000 0x0 0x14>;
--
2.45.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 2/3] riscv: dts: thead: Add TH1520 I2C nodes
2024-05-17 9:09 ` [PATCH v2 2/3] riscv: dts: thead: Add TH1520 I2C nodes Thomas Bonnefille
@ 2024-05-26 12:01 ` Emil Renner Berthing
0 siblings, 0 replies; 7+ messages in thread
From: Emil Renner Berthing @ 2024-05-26 12:01 UTC (permalink / raw)
To: Thomas Bonnefille, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Conor Dooley
Cc: Palmer Dabbelt, Albert Ou, Paul Walmsley, Thomas Petazzoni,
Miquèl Raynal, linux-i2c, devicetree, linux-kernel,
linux-riscv
Hi Thomas,
Thanks for the patch. Some comments below.
Thomas Bonnefille wrote:
> Add nodes for the five I2C on the T-Head TH1520 RISCV SoC.
>
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
> arch/riscv/boot/dts/thead/th1520.dtsi | 50 +++++++++++++++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
> index de7116290ca4..ae6cf4c441cf 100644
> --- a/arch/riscv/boot/dts/thead/th1520.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520.dtsi
> @@ -252,6 +252,36 @@ gpio2: gpio-controller@0 {
> };
> };
>
> + i2c0: i2c@ffe7f20000 {
> + compatible = "thead,th1520-i2c", "snps,designware-i2c";
> + reg = <0xff 0xe7f20000 0x0 0x4000>;
> + interrupts = <44 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clk CLK_I2C0>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
> + i2c1: i2c@ffe7f24000 {
> + compatible = "thead,th1520-i2c", "snps,designware-i2c";
> + reg = <0xff 0xe7f24000 0x0 0x4000>;
> + interrupts = <45 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clk CLK_I2C1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
> + i2c4: i2c@ffe7f28000 {
> + compatible = "thead,th1520-i2c", "snps,designware-i2c";
> + reg = <0xff 0xe7f28000 0x0 0x4000>;
> + interrupts = <48 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clk CLK_I2C4>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
These nodes should be ordered by their memory addres, but the gpio2 controller
above has address 0xffe7f34000 which is greater than i2c0 at 0xffe7f20000.
> gpio@ffe7f38000 {
> compatible = "snps,dw-apb-gpio";
> reg = <0xff 0xe7f38000 0x0 0x1000>;
> @@ -342,6 +372,16 @@ uart2: serial@ffec010000 {
> status = "disabled";
> };
>
> + i2c3: i2c@ffec014000 {
> + compatible = "thead,th1520-i2c", "snps,designware-i2c";
> + reg = <0xff 0xec014000 0x0 0x4000>;
> + interrupts = <47 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clk CLK_I2C3>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
> dmac0: dma-controller@ffefc00000 {
> compatible = "snps,axi-dma-1.01a";
> reg = <0xff 0xefc00000 0x0 0x1000>;
> @@ -416,6 +456,16 @@ uart5: serial@fff7f0c000 {
> status = "disabled";
> };
>
> + i2c5: i2c@fff7f2c000 {
> + compatible = "thead,th1520-i2c", "snps,designware-i2c";
> + reg = <0xff 0xf7f2c000 0x0 0x4000>;
> + interrupts = <49 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clk CLK_I2C5>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
I know it's probably hard to test i2c2 with the Ahead board, but chances are
very low that the disignware driver works with i2c0, i2c1, i2c3, i2c4 and i2c5,
but not i2c2, so plaese add that node too. The audio and aon i2cs are fine to
add later.
> timer4: timer@ffffc33000 {
> compatible = "snps,dw-apb-timer";
> reg = <0xff 0xffc33000 0x0 0x14>;
>
> --
> 2.45.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] riscv: dts: thead: Enable I2C on the BeagleV-Ahead
2024-05-17 9:09 [PATCH v2 0/3] Add I2C support on TH1520 Thomas Bonnefille
2024-05-17 9:09 ` [PATCH v2 1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c Thomas Bonnefille
2024-05-17 9:09 ` [PATCH v2 2/3] riscv: dts: thead: Add TH1520 I2C nodes Thomas Bonnefille
@ 2024-05-17 9:09 ` Thomas Bonnefille
2024-05-26 12:06 ` Emil Renner Berthing
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Bonnefille @ 2024-05-17 9:09 UTC (permalink / raw)
To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Conor Dooley
Cc: Palmer Dabbelt, Albert Ou, Paul Walmsley, Thomas Petazzoni,
Miquèl Raynal, linux-i2c, devicetree, linux-kernel,
linux-riscv, Thomas Bonnefille
This commit enables the I2C0 controller of the TH1520, together with
the FT24C32A EEPROM that is connected to it.
In addition, this commit also enables the I2C controllers I2C2, I2C4
and I2C5 as they are all three exposed on headers (P9 19 and 20 for I2C2,
P9 17 and 18 for I2C5 and MikroBus 7 and 5 for I2C4).
It also defined the required pinctrl nodes.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 84 ++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index 57a2578123eb..aeb04f5159d5 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -121,6 +121,47 @@ led-pins {
};
};
+&padctrl1_apsys {
+ i2c0_pins: i2c0-0 {
+ i2c-pins {
+ pins = "I2C0_SDA",
+ "I2C0_SCL";
+ function = "i2c";
+ bias-pull-up = <2100>;
+ drive-strength = <7>;
+ input-enable;
+ input-schmitt-enable;
+ slew-rate = <0>;
+ };
+ };
+
+ i2c4_pins: i2c4-0 {
+ i2c-pins {
+ pins = "GPIO0_19", /*I2C4_SDA*/
+ "GPIO0_18"; /*I2C4_SCL*/
+ function = "i2c";
+ bias-pull-up = <2100>;
+ drive-strength = <7>;
+ input-enable;
+ input-schmitt-enable;
+ slew-rate = <0>;
+ };
+ };
+
+ i2c5_pins: i2c5-0 {
+ i2c-pins {
+ pins = "QSPI1_D0_MOSI", /*I2C5_SDA*/
+ "QSPI1_CSN0"; /*I2C5_SCL*/
+ function = "i2c";
+ bias-pull-up = <2100>;
+ drive-strength = <7>;
+ input-enable;
+ input-schmitt-enable;
+ slew-rate = <0>;
+ };
+ };
+};
+
&padctrl0_apsys {
uart0_pins: uart0-0 {
tx-pins {
@@ -143,6 +184,19 @@ rx-pins {
slew-rate = <0>;
};
};
+
+ i2c2_pins: i2c2-0 {
+ i2c-pins {
+ pins = "I2C2_SDA",
+ "I2C2_SCL";
+ function = "i2c";
+ bias-pull-up = <2100>;
+ drive-strength = <7>;
+ input-enable;
+ input-schmitt-enable;
+ slew-rate = <0>;
+ };
+ };
};
&uart0 {
@@ -150,3 +204,33 @@ &uart0 {
pinctrl-0 = <&uart0_pins>;
status = "okay";
};
+
+&i2c0 {
+ status = "okay";
+ clock-frequency = <100000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c0_pins>;
+
+ eeprom@50 {
+ compatible = "atmel,24c32";
+ reg = <0x50>;
+ };
+};
+
+&i2c2 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c2_pins>;
+};
+
+&i2c4 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c4_pins>;
+};
+
+&i2c5 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c5_pins>;
+};
--
2.45.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 3/3] riscv: dts: thead: Enable I2C on the BeagleV-Ahead
2024-05-17 9:09 ` [PATCH v2 3/3] riscv: dts: thead: Enable I2C on the BeagleV-Ahead Thomas Bonnefille
@ 2024-05-26 12:06 ` Emil Renner Berthing
0 siblings, 0 replies; 7+ messages in thread
From: Emil Renner Berthing @ 2024-05-26 12:06 UTC (permalink / raw)
To: Thomas Bonnefille, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jisheng Zhang, Guo Ren, Fu Wei, Drew Fustini,
Emil Renner Berthing, Conor Dooley
Cc: Palmer Dabbelt, Albert Ou, Paul Walmsley, Thomas Petazzoni,
Miquèl Raynal, linux-i2c, devicetree, linux-kernel,
linux-riscv
Thomas Bonnefille wrote:
> This commit enables the I2C0 controller of the TH1520, together with
> the FT24C32A EEPROM that is connected to it.
> In addition, this commit also enables the I2C controllers I2C2, I2C4
> and I2C5 as they are all three exposed on headers (P9 19 and 20 for I2C2,
> P9 17 and 18 for I2C5 and MikroBus 7 and 5 for I2C4).
> It also defined the required pinctrl nodes.
>
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
> arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 84 ++++++++++++++++++++++
> 1 file changed, 84 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> index 57a2578123eb..aeb04f5159d5 100644
> --- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> +++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> @@ -121,6 +121,47 @@ led-pins {
> };
> };
>
> +&padctrl1_apsys {
These node references should be ordered alphabetically, so please put this
below &padctrl0_apsys.
> + i2c0_pins: i2c0-0 {
> + i2c-pins {
> + pins = "I2C0_SDA",
> + "I2C0_SCL";
> + function = "i2c";
> + bias-pull-up = <2100>;
Are you sure the strong pull-up is needed here and below?
> + drive-strength = <7>;
> + input-enable;
> + input-schmitt-enable;
> + slew-rate = <0>;
> + };
> + };
> +
> + i2c4_pins: i2c4-0 {
> + i2c-pins {
> + pins = "GPIO0_19", /*I2C4_SDA*/
> + "GPIO0_18"; /*I2C4_SCL*/
Please add spaces here like other kernel comments. Eg. /* I2C4_SDA */
> + function = "i2c";
> + bias-pull-up = <2100>;
> + drive-strength = <7>;
> + input-enable;
> + input-schmitt-enable;
> + slew-rate = <0>;
> + };
> + };
> +
> + i2c5_pins: i2c5-0 {
> + i2c-pins {
> + pins = "QSPI1_D0_MOSI", /*I2C5_SDA*/
> + "QSPI1_CSN0"; /*I2C5_SCL*/
Same here.
> + function = "i2c";
> + bias-pull-up = <2100>;
> + drive-strength = <7>;
> + input-enable;
> + input-schmitt-enable;
> + slew-rate = <0>;
> + };
> + };
> +};
> +
> &padctrl0_apsys {
> uart0_pins: uart0-0 {
> tx-pins {
> @@ -143,6 +184,19 @@ rx-pins {
> slew-rate = <0>;
> };
> };
> +
> + i2c2_pins: i2c2-0 {
i2c2-0 sorts before uart0-0 alphabetically.
> + i2c-pins {
> + pins = "I2C2_SDA",
> + "I2C2_SCL";
> + function = "i2c";
> + bias-pull-up = <2100>;
> + drive-strength = <7>;
> + input-enable;
> + input-schmitt-enable;
> + slew-rate = <0>;
> + };
> + };
> };
>
> &uart0 {
> @@ -150,3 +204,33 @@ &uart0 {
> pinctrl-0 = <&uart0_pins>;
> status = "okay";
> };
> +
> +&i2c0 {
Again please sort these references alphabetically.
> + status = "okay";
And the properties. Eg. move status below pinctrl-0.
> + clock-frequency = <100000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&i2c0_pins>;
> +
> + eeprom@50 {
> + compatible = "atmel,24c32";
> + reg = <0x50>;
> + };
> +};
> +
> +&i2c2 {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&i2c2_pins>;
> +};
> +
> +&i2c4 {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&i2c4_pins>;
> +};
> +
> +&i2c5 {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&i2c5_pins>;
> +};
>
> --
> 2.45.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 7+ messages in thread