2023-06-12 22:34:05

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 0/3] arm64: dts: qcom: sc8180x: USB TypeC plumbing

This wires up USB Type-C and pmic_glink to provide battery monitoring,
external display and orientation switching of the SuperSpeed pins.

Note that the external display has a functional dependency on INTF/PHY
selection in the DPU driver.

Bjorn Andersson (3):
arm64: dts: qcom: sc8180x: Add USB Type-C of_graph anchors
arm64: dts: qcom: sc8180x-primus: Wire up USB Type-C
arm64: dts: qcom: sc8180x-flex5g: Wire up USB Type-C

.../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 196 ++++++++++++++++++
arch/arm64/boot/dts/qcom/sc8180x-primus.dts | 196 ++++++++++++++++++
arch/arm64/boot/dts/qcom/sc8180x.dtsi | 48 +++++
3 files changed, 440 insertions(+)

--
2.25.1



2023-06-12 22:35:53

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 1/3] arm64: dts: qcom: sc8180x: Add USB Type-C of_graph anchors

Define anchors for wiring up the USB Type-C graph in the board files.

Signed-off-by: Bjorn Andersson <[email protected]>
---
arch/arm64/boot/dts/qcom/sc8180x.dtsi | 48 +++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8180x.dtsi b/arch/arm64/boot/dts/qcom/sc8180x.dtsi
index a7668f9e68d6..4144beb70cb4 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc8180x.dtsi
@@ -2464,6 +2464,23 @@ usb_prim_qmpphy: phy@88e9000 {

status = "disabled";

+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ usb_prim_qmpphy_out: endpoint {};
+ };
+
+ port@2 {
+ reg = <2>;
+
+ usb_prim_qmpphy_dp_in: endpoint {};
+ };
+ };
+
usb_prim_ssphy: usb3-phy@88e9200 {
reg = <0 0x088e9200 0 0x200>,
<0 0x088e9400 0 0x200>,
@@ -2513,6 +2530,23 @@ usb_sec_qmpphy: phy@88ee000 {

status = "disabled";

+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ usb_sec_qmpphy_out: endpoint {};
+ };
+
+ port@2 {
+ reg = <2>;
+
+ usb_sec_qmpphy_dp_in: endpoint {};
+ };
+ };
+
usb_sec_ssphy: usb3-phy@88e9200 {
reg = <0 0x088ee200 0 0x200>,
<0 0x088ee400 0 0x200>,
@@ -2607,6 +2641,11 @@ usb_prim_dwc3: usb@a600000 {
snps,dis_enblslpm_quirk;
phys = <&usb_prim_hsphy>, <&usb_prim_ssphy>;
phy-names = "usb2-phy", "usb3-phy";
+
+ port {
+ usb_prim_role_switch: endpoint {
+ };
+ };
};
};

@@ -2659,6 +2698,11 @@ usb_sec_dwc3: usb@a800000 {
snps,dis_enblslpm_quirk;
phys = <&usb_sec_hsphy>, <&usb_sec_ssphy>;
phy-names = "usb2-phy", "usb3-phy";
+
+ port {
+ usb_sec_role_switch: endpoint {
+ };
+ };
};
};

@@ -2986,6 +3030,8 @@ dp0_in: endpoint {

port@1 {
reg = <1>;
+ mdss_dp0_out: endpoint {
+ };
};
};

@@ -3060,6 +3106,8 @@ dp1_in: endpoint {

port@1 {
reg = <1>;
+ mdss_dp1_out: endpoint {
+ };
};
};

--
2.25.1


2023-06-12 22:50:13

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: qcom: sc8180x-flex5g: Wire up USB Type-C

Following the SC8180X Primus reference design, add pmic_glink and USB
Type-C wiring for battery manager, external display and orientation
switching.

Signed-off-by: Bjorn Andersson <[email protected]>
---
.../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 196 ++++++++++++++++++
1 file changed, 196 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index fe3b366e1435..677cb255fad2 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -45,6 +45,84 @@ lid {
};
};

+ pmic-glink {
+ compatible = "qcom,sc8180x-pmic-glink", "qcom,pmic-glink";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ connector@0 {
+ compatible = "usb-c-connector";
+ reg = <0>;
+ power-role = "dual";
+ data-role = "dual";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ pmic_glink_con0_hs: endpoint {
+ remote-endpoint = <&usb_prim_role_switch>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ pmic_glink_con0_ss: endpoint {
+ remote-endpoint = <&usb_prim_qmpphy_out>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ pmic_glink_con0_sbu: endpoint {
+ remote-endpoint = <&usbprim_sbu_mux>;
+ };
+ };
+ };
+ };
+
+ connector@1 {
+ compatible = "usb-c-connector";
+ reg = <1>;
+ power-role = "dual";
+ data-role = "dual";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+
+ pmic_glink_con1_hs: endpoint {
+ remote-endpoint = <&usb_sec_role_switch>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ pmic_glink_con1_ss: endpoint {
+ remote-endpoint = <&usb_sec_qmpphy_out>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ pmic_glink_con1_sbu: endpoint {
+ remote-endpoint = <&usbsec_sbu_mux>;
+ };
+ };
+ };
+ };
+ };
+
reserved-memory {
rmtfs_mem: rmtfs-region@85500000 {
compatible = "qcom,rmtfs-mem";
@@ -100,6 +178,44 @@ vreg_s4a_1p8: pm8150-s4-regulator {

vin-supply = <&vph_pwr>;
};
+
+ usbprim-sbu-mux {
+ compatible = "pericom,pi3usb102", "gpio-sbu-mux";
+
+ enable-gpios = <&tlmm 152 GPIO_ACTIVE_LOW>;
+ select-gpios = <&tlmm 100 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&usbprim_sbu_default>;
+
+ mode-switch;
+ orientation-switch;
+
+ port {
+ usbprim_sbu_mux: endpoint {
+ remote-endpoint = <&pmic_glink_con0_sbu>;
+ };
+ };
+ };
+
+ usbsec-sbu-mux {
+ compatible = "pericom,pi3usb102", "gpio-sbu-mux";
+
+ enable-gpios = <&tlmm 188 GPIO_ACTIVE_LOW>;
+ select-gpios = <&tlmm 187 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&usbsec_sbu_default>;
+
+ mode-switch;
+ orientation-switch;
+
+ port {
+ usbsec_sbu_mux: endpoint {
+ remote-endpoint = <&pmic_glink_con1_sbu>;
+ };
+ };
+ };
};

&apps_rsc {
@@ -283,6 +399,24 @@ &mdss {
status = "okay";
};

+&mdss_dp0 {
+ status = "okay";
+};
+
+&mdss_dp0_out {
+ data-lanes = <0 1>;
+ remote-endpoint = <&usb_prim_qmpphy_dp_in>;
+};
+
+&mdss_dp1 {
+ status = "okay";
+};
+
+&mdss_dp1_out {
+ data-lanes = <0 1>;
+ remote-endpoint = <&usb_sec_qmpphy_dp_in>;
+};
+
&mdss_edp {
data-lanes = <0 1 2 3>;

@@ -419,6 +553,8 @@ &usb_prim_qmpphy {
vdda-phy-supply = <&vreg_l3c_1p2>;
vdda-pll-supply = <&vreg_l5e_0p88>;

+ orientation-switch;
+
status = "okay";
};

@@ -430,6 +566,18 @@ &usb_prim_dwc3 {
dr_mode = "host";
};

+&usb_prim_qmpphy_dp_in {
+ remote-endpoint = <&mdss_dp0_out>;
+};
+
+&usb_prim_qmpphy_out {
+ remote-endpoint = <&pmic_glink_con0_ss>;
+};
+
+&usb_prim_role_switch {
+ remote-endpoint = <&pmic_glink_con0_hs>;
+};
+
&usb_sec_hsphy {
vdda-pll-supply = <&vreg_l5e_0p88>;
vdda18-supply = <&vreg_l12a_1p8>;
@@ -442,9 +590,23 @@ &usb_sec_qmpphy {
vdda-phy-supply = <&vreg_l3c_1p2>;
vdda-pll-supply = <&vreg_l5e_0p88>;

+ orientation-switch;
+
status = "okay";
};

+&usb_sec_qmpphy_dp_in {
+ remote-endpoint = <&mdss_dp1_out>;
+};
+
+&usb_sec_qmpphy_out {
+ remote-endpoint = <&pmic_glink_con1_ss>;
+};
+
+&usb_sec_role_switch {
+ remote-endpoint = <&pmic_glink_con1_hs>;
+};
+
&usb_sec {
status = "okay";
};
@@ -560,6 +722,40 @@ wake-n-pins {
};
};

+ usbprim_sbu_default: usbprim-sbu-state {
+ oe-n-pins {
+ pins = "gpio152";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ output-high;
+ };
+
+ sel-pins {
+ pins = "gpio100";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ };
+ };
+
+ usbsec_sbu_default: usbsec-sbu-state {
+ oe-n-pins {
+ pins = "gpio188";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ output-high;
+ };
+
+ sel-pins {
+ pins = "gpio187";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ };
+ };
+
uart13_state: uart13-state {
cts-pins {
pins = "gpio43";
--
2.25.1


2023-06-12 23:04:34

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 2/3] arm64: dts: qcom: sc8180x-primus: Wire up USB Type-C

Wire up pmic_glink and the various components of USB Type-C to get
battery status, orientation switching of SuperSpeed USB, as well as
support for external display on the SC8180X Primus reference device.

Signed-off-by: Bjorn Andersson <[email protected]>
---
arch/arm64/boot/dts/qcom/sc8180x-primus.dts | 196 ++++++++++++++++++++
1 file changed, 196 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8180x-primus.dts b/arch/arm64/boot/dts/qcom/sc8180x-primus.dts
index fc038474cb71..1716fe788f74 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-primus.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-primus.dts
@@ -50,6 +50,84 @@ lid-switch {
};
};

+ pmic-glink {
+ compatible = "qcom,sc8180x-pmic-glink", "qcom,pmic-glink";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ connector@0 {
+ compatible = "usb-c-connector";
+ reg = <0>;
+ power-role = "dual";
+ data-role = "dual";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ pmic_glink_con0_hs: endpoint {
+ remote-endpoint = <&usb_prim_role_switch>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ pmic_glink_con0_ss: endpoint {
+ remote-endpoint = <&usb_prim_qmpphy_out>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ pmic_glink_con0_sbu: endpoint {
+ remote-endpoint = <&usbprim_sbu_mux>;
+ };
+ };
+ };
+ };
+
+ connector@1 {
+ compatible = "usb-c-connector";
+ reg = <1>;
+ power-role = "dual";
+ data-role = "dual";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+
+ pmic_glink_con1_hs: endpoint {
+ remote-endpoint = <&usb_sec_role_switch>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ pmic_glink_con1_ss: endpoint {
+ remote-endpoint = <&usb_sec_qmpphy_out>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ pmic_glink_con1_sbu: endpoint {
+ remote-endpoint = <&usbsec_sbu_mux>;
+ };
+ };
+ };
+ };
+ };
+
reserved-memory {
rmtfs_mem: rmtfs-region@85500000 {
compatible = "qcom,rmtfs-mem";
@@ -143,6 +221,44 @@ vreg_s4a_1p8: pm8150-s4 {

vin-supply = <&vph_pwr>;
};
+
+ usbprim-sbu-mux {
+ compatible = "pericom,pi3usb102", "gpio-sbu-mux";
+
+ enable-gpios = <&tlmm 152 GPIO_ACTIVE_LOW>;
+ select-gpios = <&tlmm 100 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&usbprim_sbu_default>;
+
+ mode-switch;
+ orientation-switch;
+
+ port {
+ usbprim_sbu_mux: endpoint {
+ remote-endpoint = <&pmic_glink_con0_sbu>;
+ };
+ };
+ };
+
+ usbsec-sbu-mux {
+ compatible = "pericom,pi3usb102", "gpio-sbu-mux";
+
+ enable-gpios = <&tlmm 188 GPIO_ACTIVE_LOW>;
+ select-gpios = <&tlmm 187 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&usbsec_sbu_default>;
+
+ mode-switch;
+ orientation-switch;
+
+ port {
+ usbsec_sbu_mux: endpoint {
+ remote-endpoint = <&pmic_glink_con1_sbu>;
+ };
+ };
+ };
};

&apps_rsc {
@@ -363,6 +479,24 @@ &mdss {
status = "okay";
};

+&mdss_dp0 {
+ status = "okay";
+};
+
+&mdss_dp0_out {
+ data-lanes = <0 1>;
+ remote-endpoint = <&usb_prim_qmpphy_dp_in>;
+};
+
+&mdss_dp1 {
+ status = "okay";
+};
+
+&mdss_dp1_out {
+ data-lanes = <0 1>;
+ remote-endpoint = <&usb_sec_qmpphy_dp_in>;
+};
+
&mdss_edp {
data-lanes = <0 1 2 3>;

@@ -496,6 +630,8 @@ &usb_prim_qmpphy {
vdda-phy-supply = <&vreg_l3c_1p2>;
vdda-pll-supply = <&vreg_l5e_0p88>;

+ orientation-switch;
+
status = "okay";
};

@@ -507,6 +643,18 @@ &usb_prim_dwc3 {
dr_mode = "host";
};

+&usb_prim_qmpphy_dp_in {
+ remote-endpoint = <&mdss_dp0_out>;
+};
+
+&usb_prim_qmpphy_out {
+ remote-endpoint = <&pmic_glink_con0_ss>;
+};
+
+&usb_prim_role_switch {
+ remote-endpoint = <&pmic_glink_con0_hs>;
+};
+
&usb_sec_hsphy {
vdda-pll-supply = <&vreg_l5e_0p88>;
vdda18-supply = <&vreg_l12a_1p8>;
@@ -519,9 +667,23 @@ &usb_sec_qmpphy {
vdda-phy-supply = <&vreg_l3c_1p2>;
vdda-pll-supply = <&vreg_l5e_0p88>;

+ orientation-switch;
+
status = "okay";
};

+&usb_sec_qmpphy_dp_in {
+ remote-endpoint = <&mdss_dp1_out>;
+};
+
+&usb_sec_qmpphy_out {
+ remote-endpoint = <&pmic_glink_con1_ss>;
+};
+
+&usb_sec_role_switch {
+ remote-endpoint = <&pmic_glink_con1_hs>;
+};
+
&usb_sec {
status = "okay";
};
@@ -635,6 +797,40 @@ wake-n-pins {
};
};

+ usbprim_sbu_default: usbprim-sbu-state {
+ oe-n-pins {
+ pins = "gpio152";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ output-high;
+ };
+
+ sel-pins {
+ pins = "gpio100";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ };
+ };
+
+ usbsec_sbu_default: usbsec-sbu-state {
+ oe-n-pins {
+ pins = "gpio188";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ output-high;
+ };
+
+ sel-pins {
+ pins = "gpio187";
+ function = "gpio";
+ bias-disable;
+ drive-strength = <16>;
+ };
+ };
+
tp_int_active_state: tp-int-active-state {
tp-int-pins {
pins = "gpio24";
--
2.25.1


2023-06-13 11:11:00

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 1/3] arm64: dts: qcom: sc8180x: Add USB Type-C of_graph anchors



On 13.06.2023 00:14, Bjorn Andersson wrote:
> Define anchors for wiring up the USB Type-C graph in the board files.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>

Konrad
> arch/arm64/boot/dts/qcom/sc8180x.dtsi | 48 +++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc8180x.dtsi b/arch/arm64/boot/dts/qcom/sc8180x.dtsi
> index a7668f9e68d6..4144beb70cb4 100644
> --- a/arch/arm64/boot/dts/qcom/sc8180x.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc8180x.dtsi
> @@ -2464,6 +2464,23 @@ usb_prim_qmpphy: phy@88e9000 {
>
> status = "disabled";
>
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + usb_prim_qmpphy_out: endpoint {};
> + };
> +
> + port@2 {
> + reg = <2>;
> +
> + usb_prim_qmpphy_dp_in: endpoint {};
> + };
> + };
> +
> usb_prim_ssphy: usb3-phy@88e9200 {
> reg = <0 0x088e9200 0 0x200>,
> <0 0x088e9400 0 0x200>,
> @@ -2513,6 +2530,23 @@ usb_sec_qmpphy: phy@88ee000 {
>
> status = "disabled";
>
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + usb_sec_qmpphy_out: endpoint {};
> + };
> +
> + port@2 {
> + reg = <2>;
> +
> + usb_sec_qmpphy_dp_in: endpoint {};
> + };
> + };
> +
> usb_sec_ssphy: usb3-phy@88e9200 {
> reg = <0 0x088ee200 0 0x200>,
> <0 0x088ee400 0 0x200>,
> @@ -2607,6 +2641,11 @@ usb_prim_dwc3: usb@a600000 {
> snps,dis_enblslpm_quirk;
> phys = <&usb_prim_hsphy>, <&usb_prim_ssphy>;
> phy-names = "usb2-phy", "usb3-phy";
> +
> + port {
> + usb_prim_role_switch: endpoint {
> + };
> + };
> };
> };
>
> @@ -2659,6 +2698,11 @@ usb_sec_dwc3: usb@a800000 {
> snps,dis_enblslpm_quirk;
> phys = <&usb_sec_hsphy>, <&usb_sec_ssphy>;
> phy-names = "usb2-phy", "usb3-phy";
> +
> + port {
> + usb_sec_role_switch: endpoint {
> + };
> + };
> };
> };
>
> @@ -2986,6 +3030,8 @@ dp0_in: endpoint {
>
> port@1 {
> reg = <1>;
> + mdss_dp0_out: endpoint {
> + };
> };
> };
>
> @@ -3060,6 +3106,8 @@ dp1_in: endpoint {
>
> port@1 {
> reg = <1>;
> + mdss_dp1_out: endpoint {
> + };
> };
> };
>

2023-07-22 05:16:10

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 0/3] arm64: dts: qcom: sc8180x: USB TypeC plumbing


On Mon, 12 Jun 2023 15:14:53 -0700, Bjorn Andersson wrote:
> This wires up USB Type-C and pmic_glink to provide battery monitoring,
> external display and orientation switching of the SuperSpeed pins.
>
> Note that the external display has a functional dependency on INTF/PHY
> selection in the DPU driver.
>
> Bjorn Andersson (3):
> arm64: dts: qcom: sc8180x: Add USB Type-C of_graph anchors
> arm64: dts: qcom: sc8180x-primus: Wire up USB Type-C
> arm64: dts: qcom: sc8180x-flex5g: Wire up USB Type-C
>
> [...]

Applied, thanks!

[1/3] arm64: dts: qcom: sc8180x: Add USB Type-C of_graph anchors
commit: b0246331c51e65c1d7c853bc617904058540d47f
[2/3] arm64: dts: qcom: sc8180x-primus: Wire up USB Type-C
commit: ab590fa619b562b43f7c31c60d2725e04c63d961
[3/3] arm64: dts: qcom: sc8180x-flex5g: Wire up USB Type-C
commit: 36bd9fad228e62d029380083e037a6632678cd3a

Best regards,
--
Bjorn Andersson <[email protected]>