arm64: dts: ti: verdin-am62: add support for Verdin USB1 interface
authorAndrejs Cainikovs <andrejs.cainikovs@toradex.com>
Fri, 9 Feb 2024 13:01:06 +0000 (14:01 +0100)
committerVignesh Raghavendra <vigneshr@ti.com>
Thu, 15 Feb 2024 14:12:40 +0000 (19:42 +0530)
Add support for Verdin USB1 interface, implements role switch
functionality using "gpio-usb-b-connector", VBUS is also now
controlled with "regulator-fixed" using a standard GPIO.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20240209130106.38739-1-andrejs.cainikovs@gmail.com
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi

index 6a06724b6d168b1e2beeb8659f5fb03e5f52e589..7e9bdba438b1c7383c788f1dd5e460bfed8fc570 100644 (file)
                usb1 = &usb1;
        };
 
+       connector {
+               compatible = "gpio-usb-b-connector", "usb-b-connector";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_usb0_id>;
+               id-gpios = <&main_gpio1 19 GPIO_ACTIVE_HIGH>;
+               label = "USB_1";
+               self-powered;
+               vbus-supply = <&reg_usb0_vbus>;
+
+               port {
+                       usb_dr_connector: endpoint {
+                               remote-endpoint = <&usb0_ep>;
+                       };
+               };
+       };
+
        verdin_gpio_keys: gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                vin-supply = <&reg_sd_3v3_1v8>;
        };
 
+       reg_usb0_vbus: regulator-usb0-vbus {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_usb0_en>;
+               enable-active-high;
+               /* Verdin USB_1_EN (SODIMM 155) */
+               gpio = <&main_gpio1 50 GPIO_ACTIVE_HIGH>;
+               regulator-max-microvolt = <5000000>;
+               regulator-min-microvolt = <5000000>;
+               regulator-name = "USB_1_EN";
+       };
+
        reserved-memory {
                #address-cells = <2>;
                #size-cells = <2>;
                >;
        };
 
+       /* Verdin USB_1_EN */
+       pinctrl_usb0_en: main-gpio1-50-default-pins {
+               pinctrl-single,pins = <
+                       AM62X_IOPAD(0x0254, PIN_INPUT, 7) /* (C20) USB0_DRVVBUS.GPIO1_50 */ /* SODIMM 155 */
+               >;
+       };
+
        /* On-module I2C - PMIC_I2C */
        pinctrl_i2c0: main-i2c0-default-pins {
                pinctrl-single,pins = <
                >;
        };
 
-       /* Verdin USB_1 */
-       pinctrl_usb0: main-usb0-default-pins {
-               pinctrl-single,pins = <
-                       AM62X_IOPAD(0x0254, PIN_OUTPUT, 0) /* (C20) USB0_DRVVBUS */ /* SODIMM 155 */
-               >;
-       };
-
        /* Verdin USB_2 */
        pinctrl_usb1: main-usb1-default-pins {
                pinctrl-single,pins = <
                "",
                "",
                "SODIMM_17",
-               "", /* 50 */
+               "SODIMM_155", /* 50 */
                "",
                "",
                "",
        status = "disabled";
 };
 
-/* TODO: role swich using ID pin */
 &usb0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usb0>, <&pinctrl_usb0_id>;
+       adp-disable;
+       usb-role-switch;
        status = "disabled";
+
+       port {
+               usb0_ep: endpoint {
+                       remote-endpoint = <&usb_dr_connector>;
+               };
+       };
 };
 
 /* Verdin USB_2 */