diff mbox series

[09/10] ARM: dts: stm32: enable USB OTG in dual role mode on stm32mp135f-dk

Message ID 20221014092651.25202-10-fabrice.gasnier@foss.st.com (mailing list archive)
State New, archived
Headers show
Series Add support for USB on STM32MP13 | expand

Commit Message

Fabrice Gasnier Oct. 14, 2022, 9:26 a.m. UTC
The USB OTG controller provides the USB data available on stm32mp135f-dk,
on the Type-C connector. Data role is determined by "usb-role-switch".

A STM32G0 provides the USB Type-C and Power Delivery connectivity.
It controls dual role power and dual role data through UCSI protocol over
I2C. It's wired on I2C1, with an interrupt pin on PI2 GPIO.
Its firmware maybe updated over I2C, so use the optional firmware-name
to enable firmware update.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
---
 arch/arm/boot/dts/stm32mp135f-dk.dts | 34 ++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Krzysztof Kozlowski Oct. 14, 2022, 4:16 p.m. UTC | #1
On 14/10/2022 05:26, Fabrice Gasnier wrote:
> The USB OTG controller provides the USB data available on stm32mp135f-dk,
> on the Type-C connector. Data role is determined by "usb-role-switch".
> 
> A STM32G0 provides the USB Type-C and Power Delivery connectivity.
> It controls dual role power and dual role data through UCSI protocol over
> I2C. It's wired on I2C1, with an interrupt pin on PI2 GPIO.
> Its firmware maybe updated over I2C, so use the optional firmware-name
> to enable firmware update.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
>  arch/arm/boot/dts/stm32mp135f-dk.dts | 34 ++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/stm32mp135f-dk.dts b/arch/arm/boot/dts/stm32mp135f-dk.dts
> index 02ff2bc664da..1c92bf096397 100644
> --- a/arch/arm/boot/dts/stm32mp135f-dk.dts
> +++ b/arch/arm/boot/dts/stm32mp135f-dk.dts
> @@ -95,6 +95,28 @@ &i2c1 {
>  	/* spare dmas for other usage */
>  	/delete-property/dmas;
>  	/delete-property/dma-names;
> +
> +	stm32g0@53 {

Node names should be generic, usually typec.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/stm32mp135f-dk.dts b/arch/arm/boot/dts/stm32mp135f-dk.dts
index 02ff2bc664da..1c92bf096397 100644
--- a/arch/arm/boot/dts/stm32mp135f-dk.dts
+++ b/arch/arm/boot/dts/stm32mp135f-dk.dts
@@ -95,6 +95,28 @@  &i2c1 {
 	/* spare dmas for other usage */
 	/delete-property/dmas;
 	/delete-property/dma-names;
+
+	stm32g0@53 {
+		compatible = "st,stm32g0-typec";
+		reg = <0x53>;
+		/* Alert pin on PI2 */
+		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+		interrupt-parent = <&gpioi>;
+		/* Internal pull-up on PI2 */
+		pinctrl-names = "default";
+		pinctrl-0 = <&stm32g0_intn_pins_a>;
+		firmware-name = "stm32g0-ucsi.mp135f-dk.fw";
+		connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+
+			port {
+				con_usb_c_g0_ep: endpoint {
+					remote-endpoint = <&usbotg_hs_ep>;
+				};
+			};
+		};
+	};
 };
 
 &i2c5 {
@@ -158,6 +180,18 @@  hub@1 {
 	};
 };
 
+&usbotg_hs {
+	phys = <&usbphyc_port1 0>;
+	phy-names = "usb2-phy";
+	usb-role-switch;
+	status = "okay";
+	port {
+		usbotg_hs_ep: endpoint {
+			remote-endpoint = <&con_usb_c_g0_ep>;
+		};
+	};
+};
+
 &usbphyc {
 	status = "okay";
 };