arm64: dts: qcom: sm8250-xiaomi-elish: Add pm8150b type-c node and enable usb otg
authorJianhua Lu <lujianhua000@gmail.com>
Sun, 26 Nov 2023 02:28:49 +0000 (10:28 +0800)
committerBjorn Andersson <andersson@kernel.org>
Sun, 3 Dec 2023 04:13:50 +0000 (20:13 -0800)
Add type-c node to feature otg function and set usb-role-switch property
for usb_1_dwc3 to enable usb otg.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20231126022849.14273-2-lujianhua000@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi

index 3d4ea42..946365f 100644 (file)
@@ -6,6 +6,7 @@
 #include <dt-bindings/arm/qcom,ids.h>
 #include <dt-bindings/phy/phy.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/usb/pd.h>
 #include "sm8250.dtsi"
 #include "pm8150.dtsi"
 #include "pm8150b.dtsi"
        };
 };
 
+&pm8150b_typec {
+       vdd-pdphy-supply = <&vreg_l2a_3p1>;
+       status = "okay";
+
+       connector {
+               compatible = "usb-c-connector";
+
+               power-role = "source";
+               data-role = "dual";
+               self-powered;
+
+               source-pdos = <PDO_FIXED(5000, 3000,
+                                        PDO_FIXED_DUAL_ROLE |
+                                        PDO_FIXED_USB_COMM |
+                                        PDO_FIXED_DATA_SWAP)>;
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+
+                               pm8150b_role_switch_in: endpoint {
+                                       remote-endpoint = <&usb_1_role_switch_out>;
+                               };
+                       };
+               };
+       };
+};
+
+&pm8150b_vbus {
+       status = "okay";
+};
+
 &pon_pwrkey {
        status = "okay";
 };
 };
 
 &usb_1_dwc3 {
-       dr_mode = "peripheral";
+       dr_mode = "otg";
        maximum-speed = "high-speed";
        /* Remove USB3 phy */
        phys = <&usb_1_hsphy>;
        phy-names = "usb2-phy";
+       usb-role-switch;
 };
 
 &usb_1_hsphy {
        status = "okay";
 };
 
+&usb_1_role_switch_out {
+       remote-endpoint = <&pm8150b_role_switch_in>;
+};
+
 &ufs_mem_hc {
        vcc-supply = <&vreg_l17a_3p0>;
        vcc-max-microamp = <800000>;