Enable SS/HS USB support on SM8150
Subsystems (5)
v3 cover Enable SS/HS USB support on SM8150
Add required device tree nodes to enable the USB SS and HS paths on the primary USB controller on SM8150. In addition, implement missing resources from the SM8150 GCC driver, which includes the USB GDSC and the USB PIPE clocks.
Changes in v3:
- Set dr_mode to "peripheral" on the SM8150 MTP DTSI file.
Changes in v2:
- Combine GDSC and USB PIPE clock changes.
- Re-order DTS nodes based on address
Jack Pham (1):
arm64: dts: qcom: sm8150: Add USB and PHY device nodes
Wesley Cheng (1):
clk: qcom: gcc: Add USB3 PIPE clock and GDSC for SM8150
arch/arm64/boot/dts/qcom/sm8150-mtp.dts | 21 +++++++ arch/arm64/boot/dts/qcom/sm8150.dtsi | 92 +++++++++++++++++++++++++++++ drivers/clk/qcom/gcc-sm8150.c | 52 ++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sm8150.h | 4 ++ 4 files changed, 169 insertions(+)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 clk: qcom: gcc: Add USB3 PIPE clock and GDSC for SM8150
This adds the USB3 PIPE clock and GDSC structures, so that the USB driver can vote for these resources to be enabled/disabled when required. Both are needed for SS and HS USB paths to operate properly. The GDSC will allow the USB system to be brought out of reset, while the PIPE clock is needed for data transactions between the PHY and controller.
--- drivers/clk/qcom/gcc-sm8150.c | 52 +++++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sm8150.h | 4 +++ 2 files changed, 56 insertions(+)
drivers/clk/qcom/gcc-sm8150.c +52 -0
@@ -21,6 +21,7 @@#include "clk-rcg.h" #include "clk-regmap.h" #include "reset.h" +#include "gdsc.h" enum {P_BI_TCXO ,
@@ -3171,6 +3172,18 @@ enum { }, }; +static struct clk_branch gcc_usb3_prim_phy_pipe_clk = { + .halt_check =BRANCH_HALT_SKIP , + .clkr = { + .enable_reg =0xf058 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_usb3_prim_phy_pipe_clk" , + .ops = &clk_branch2_ops, + }, + }, +}; +static struct clk_branch gcc_usb3_sec_clkref_clk = { .halt_reg =0x8c028 , .halt_check =BRANCH_HALT ,
@@ -3218,6 +3231,18 @@ enum { }, }; +static struct clk_branch gcc_usb3_sec_phy_pipe_clk = { + .halt_check =BRANCH_HALT_SKIP , + .clkr = { + .enable_reg =0x10058 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_usb3_sec_phy_pipe_clk" , + .ops = &clk_branch2_ops, + }, + }, +}; +/* * Clock ON depends on external parent 'config noc', so cant poll * delay and also mark as crtitical for video boot
@@ -3292,6 +3317,24 @@ enum { }, }; +static struct gdsc usb30_prim_gdsc = { + .gdscr =0xf004 , + .pd = { + .name ="usb30_prim_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =POLL_CFG_GDSCR , +}; + +static struct gdsc usb30_sec_gdsc = { + .gdscr =0x10004 , + .pd = { + .name ="usb30_sec_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =POLL_CFG_GDSCR , +}; +static struct clk_regmap *gcc_sm8150_clocks[] = { [GCC_AGGRE_NOC_PCIE_TBU_CLK ] = &gcc_aggre_noc_pcie_tbu_clk.clkr, [GCC_AGGRE_UFS_CARD_AXI_CLK ] = &gcc_aggre_ufs_card_axi_clk.clkr,
@@ -3480,10 +3523,12 @@ enum { [GCC_USB3_PRIM_PHY_AUX_CLK] = &gcc_usb3_prim_phy_aux_clk.clkr, [GCC_USB3_PRIM_PHY_AUX_CLK_SRC] = &gcc_usb3_prim_phy_aux_clk_src.clkr, [GCC_USB3_PRIM_PHY_COM_AUX_CLK] = &gcc_usb3_prim_phy_com_aux_clk.clkr, + [GCC_USB3_PRIM_PHY_PIPE_CLK] = &gcc_usb3_prim_phy_pipe_clk.clkr, [GCC_USB3_SEC_CLKREF_CLK] = &gcc_usb3_sec_clkref_clk.clkr, [GCC_USB3_SEC_PHY_AUX_CLK] = &gcc_usb3_sec_phy_aux_clk.clkr, [GCC_USB3_SEC_PHY_AUX_CLK_SRC] = &gcc_usb3_sec_phy_aux_clk_src.clkr, [GCC_USB3_SEC_PHY_COM_AUX_CLK] = &gcc_usb3_sec_phy_com_aux_clk.clkr, + [GCC_USB3_SEC_PHY_PIPE_CLK] = &gcc_usb3_sec_phy_pipe_clk.clkr, [GCC_VIDEO_AHB_CLK] = &gcc_video_ahb_clk.clkr, [GCC_VIDEO_AXI0_CLK] = &gcc_video_axi0_clk.clkr, [GCC_VIDEO_AXI1_CLK] = &gcc_video_axi1_clk.clkr,
@@ -3527,6 +3572,11 @@ enum { [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 }, }; +static struct gdsc *gcc_sm8150_gdscs[] = { + [USB30_PRIM_GDSC ] = &usb30_prim_gdsc, + [USB30_SEC_GDSC ] = &usb30_sec_gdsc, +}; +static const struct regmap_config gcc_sm8150_regmap_config = { .reg_bits =32 , .reg_stride =4 ,
@@ -3541,6 +3591,8 @@ enum { .num_clks = ARRAY_SIZE(gcc_sm8150_clocks), .resets = gcc_sm8150_resets, .num_resets = ARRAY_SIZE(gcc_sm8150_resets), + .gdscs = gcc_sm8150_gdscs, + .num_gdscs = ARRAY_SIZE(gcc_sm8150_gdscs), };static const struct of_device_id gcc_sm8150_match_table[] = {
include/dt-bindings/clock/qcom,gcc-sm8150.h +4 -0
@@ -240,4 +240,8 @@#define GCC_USB30_SEC_BCR 27#define GCC_USB_PHY_CFG_AHB2PHY_BCR 28 +/* GCC GDSCRs */ +#define USB30_PRIM_GDSC 4 +#define USB30_SEC_GDSC 5 +#endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 2/2 arm64: dts: qcom: sm8150: Add USB and PHY device nodes
In reply to Wesley ChengFrom: Jack Pham <[email protected]>
Add device nodes for the USB3 controller, QMP SS PHY and SNPS HS PHY.
--- arch/arm64/boot/dts/qcom/sm8150-mtp.dts | 21 ++++++++ arch/arm64/boot/dts/qcom/sm8150.dtsi | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
arch/arm64/boot/dts/qcom/sm8150-mtp.dts +21 -0
@@ -408,3 +408,24 @@ vdda-pll-supply = <&vreg_l3c_1p2>; vdda-pll-max-microamp = <19000>; }; + +&usb_1_hsphy { + status = "okay"; + vdda-pll-supply = <&vdd_usb_hs_core>; + vdda33-supply = <&vdda_usb_hs_3p1>; + vdda18-supply = <&vdda_usb_hs_1p8>; +}; + +&usb_1_qmpphy { + status = "okay"; + vdda-phy-supply = <&vreg_l3c_1p2>; + vdda-pll-supply = <&vdda_usb_ss_dp_core_1>; +}; + +&usb_1 { + status = "okay"; +}; + +&usb_1_dwc3 { + dr_mode = "peripheral"; +};
arch/arm64/boot/dts/qcom/sm8150.dtsi +92 -0
98 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v3 2/2] arm64: dts: qcom: sm8150: Add USB and PHY device nodes
Quoted 5 lines · Wesley Cheng
From: Jack Pham <[email protected]>
Add device nodes for the USB3 controller, QMP SS PHY and SNPS HS PHY.
Thanks for the respin Wesley, and thanks for testing Vinod. Just spotted one little details below.
Quoted 5 lines
Signed-off-by Jack Pham <[email protected]>Signed-off-by Wesley Cheng <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>Tested-by Vinod Koul <[email protected]>---
Please make a habit of documenting what changed since the previous version here, below the ---.
Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8150-mtp.dts | 21 ++++++++ arch/arm64/boot/dts/qcom/sm8150.dtsi | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
[..]
Quoted 1 line
arch/arm64/boot/dts/qcom/sm8150.dtsi +0
-0
[..]
Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8150.dtsi +3
-0+ usb_1_hsphy: phy@88e2000 { + compatible = "qcom,usb-snps-hs-7nm-phy", + "qcom,sm8150-usb-hs-phy";
[..]
arch/arm64/boot/dts/qcom/sm8150.dtsi line 673
Quoted 2 lines
arch/arm64/boot/dts/qcom/sm8150.dtsi +2
-0+ usb_1: usb@a6f8800 { + compatible = "qcom,sdm845-dwc3", "qcom,dwc3";
The first cell here should be qcom,sm8150-dwc3. The Linux driver will "fall through" and match on the less specific "qcom,dwc3", but if we in the future realize that we have sm8150 specific behavior/quirks we can make the driver match on the more specific one to implement this.
And similarly the order of the compatibles in &usb_1_hsphy should be reversed as well.
Regards,
Bjorn
Re: [PATCH v3 2/2] arm64: dts: qcom: sm8150: Add USB and PHY device nodes
Quoted 38 lines · Bjorn Andersson
Quoted 5 lines · Wesley Cheng
From: Jack Pham <[email protected]>
Add device nodes for the USB3 controller, QMP SS PHY and SNPS HS PHY.
Thanks for the respin Wesley, and thanks for testing Vinod. Just spotted one little details below.
Quoted 5 lines
Signed-off-by Jack Pham <[email protected]>Signed-off-by Wesley Cheng <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>Tested-by Vinod Koul <[email protected]>---
Please make a habit of documenting what changed since the previous version here, below the ---.
Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8150-mtp.dts | 21 ++++++++ arch/arm64/boot/dts/qcom/sm8150.dtsi | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)[..]
Quoted 1 line
arch/arm64/boot/dts/qcom/sm8150.dtsi +0
-0[..]
Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8150.dtsi +3
-0+ usb_1_hsphy: phy@88e2000 { + compatible = "qcom,usb-snps-hs-7nm-phy", + "qcom,sm8150-usb-hs-phy";[..]
arch/arm64/boot/dts/qcom/sm8150.dtsi line 673
Quoted 2 lines
arch/arm64/boot/dts/qcom/sm8150.dtsi +2
-0+ usb_1: usb@a6f8800 { + compatible = "qcom,sdm845-dwc3", "qcom,dwc3";The first cell here should be qcom,sm8150-dwc3. The Linux driver will "fall through" and match on the less specific "qcom,dwc3", but if we in the future realize that we have sm8150 specific behavior/quirks we can make the driver match on the more specific one to implement this.
Quoted 6 lines
And similarly the order of the compatibles in
&usb_1_hsphyshould be reversed as well.Regards,
Bjorn
Hi Bjorn,
Thanks for the input. Will do that and re-submit v4.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 4 lines · Wesley Cheng
Add required device tree nodes to enable the USB SS and HS paths on the primary USB controller on SM8150. In addition, implement missing resources from the SM8150 GCC driver, which includes the USB GDSC and the USB PIPE clocks.
lgtm:
Signature · 1 line
~Vinod