Skip to contentSkip to conversation

Enable USB support in IPQ8074

PATCH In review Sivaprakash Murugesan 4 participants 12 messages Jun 8, 2020 – Jun 24, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Enable USB support in IPQ8074

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

[V3]
* Rebased patch 3 on 5.7 and linux-next tag next-20200608
[V2]
* Added new device compatible qcom,ipq8074-qusb2-phy for qusb2
* Addressed Bjorn's review comments on dts and binding

Sivaprakash Murugesan (5):
dt-bindings: phy: qcom,qmp: Add ipq8074 usb dt bindings
dt-bindings: phy: qcom,qusb2: Add ipq8074 device compatible
phy: qcom-qmp: Add USB QMP PHY support for IPQ8074
phy: qcom-qusb2: Add ipq8074 device compatible
arm64: dts: ipq8074: enable USB support

 .../devicetree/bindings/phy/qcom,qmp-phy.yaml      |   2 +
 .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    |   1 +
 arch/arm64/boot/dts/qcom/ipq8074-hk01.dts          |  24 +++
 arch/arm64/boot/dts/qcom/ipq8074.dtsi              | 167 +++++++++++++++++++++
 drivers/phy/qualcomm/phy-qcom-qmp.c                | 102 +++++++++++++
 drivers/phy/qualcomm/phy-qcom-qusb2.c              |   3 +
 6 files changed, 299 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/5 dt-bindings: phy: qcom,qmp: Add ipq8074 usb dt bindings

Add ipq8074 qmp phy device compatible for super speed usb support.

---
 Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml +2 -0
index 973b2d1..afc9fc4 100644
@@ -18,6 +18,7 @@ properties:
   compatible:
     enum:
       - qcom,ipq8074-qmp-pcie-phy
+      - qcom,ipq8074-qmp-usb3-phy
       - qcom,msm8996-qmp-pcie-phy
       - qcom,msm8996-qmp-ufs-phy
       - qcom,msm8996-qmp-usb3-phy
@@ -158,6 +159,7 @@ allOf:
         compatible:
           contains:
             enum:
+              - qcom,ipq8074-qmp-usb3-phy
               - qcom,msm8996-qmp-usb3-phy
               - qcom,msm8998-qmp-pcie-phy
               - qcom,msm8998-qmp-usb3-phy
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/5 dt-bindings: phy: qcom,qusb2: Add ipq8074 device compatible

In reply to Sivaprakash Murugesan

Add ipq8074 compatible in QUSB2 PHY for high speed USB support.

---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml +1 -0
index b5a6195..9ba62dc 100644
@@ -18,6 +18,7 @@ properties:
     oneOf:
       - items:
         - enum:
+          - qcom,ipq8074-qusb2-phy
           - qcom,msm8996-qusb2-phy
           - qcom,msm8998-qusb2-phy
       - items:
Signature · 1 line
2.7.4
#3 lore raw

PATCH v3 3/5 phy: qcom-qmp: Add USB QMP PHY support for IPQ8074

In reply to Sivaprakash Murugesan

Add QMP USB PHY found in IPQ8074

---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 102 ++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp.c +102 -0
index e91040a..544f140 100644
@@ -198,6 +198,81 @@ static const unsigned int sm8150_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
 	[QPHY_SW_RESET]			= QPHY_V4_PCS_UFS_SW_RESET,
 };
 
+static const struct qmp_phy_init_tbl ipq8074_usb3_serdes_tbl[] = {
+	QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x1a),
+	QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x08),
+	QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x30),
+	QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0x0f),
+	QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x01),
+	QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x06),
+	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0x0f),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x06),
+	/* PLL and Loop filter settings */
+	QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x82),
+	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x55),
+	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x55),
+	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x03),
+	QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0x0b),
+	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16),
+	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x28),
+	QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
+	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0x15),
+	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0x34),
+	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_CFG, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0x0a),
+	/* SSC settings */
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x01),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x01),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x00),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0xde),
+	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x07),
+};
+
+static const struct qmp_phy_init_tbl ipq8074_usb3_rx_tbl[] = {
+	QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x06),
+	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x02),
+	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4c),
+	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xb8),
+	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77),
+	QMP_PHY_INIT_CFG(QSERDES_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
+	QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x03),
+	QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_DEGLITCH_CNTRL, 0x16),
+	QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_ENABLES, 0x0),
+};
+
+static const struct qmp_phy_init_tbl ipq8074_usb3_pcs_tbl[] = {
+	QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V0, 0x15),
+	QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V0, 0x0e),
+	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83),
+	QMP_PHY_INIT_CFG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Y_V3_PCS_TXDEEMPH_M3P5DB_V0, 0x0f),
+};
+
 static const struct qmp_phy_init_tbl msm8996_pcie_serdes_tbl[] = {
 	QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x1c),
 	QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x10),
@@ -1593,6 +1668,30 @@ static const char * const qmp_phy_vreg_l[] = {
 	"vdda-phy", "vdda-pll",
 };
 
+static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
+	.type			= PHY_TYPE_USB3,
+	.nlanes			= 1,
+
+	.serdes_tbl		= ipq8074_usb3_serdes_tbl,
+	.serdes_tbl_num		= ARRAY_SIZE(ipq8074_usb3_serdes_tbl),
+	.tx_tbl			= msm8996_usb3_tx_tbl,
+	.tx_tbl_num		= ARRAY_SIZE(msm8996_usb3_tx_tbl),
+	.rx_tbl			= ipq8074_usb3_rx_tbl,
+	.rx_tbl_num		= ARRAY_SIZE(ipq8074_usb3_rx_tbl),
+	.pcs_tbl		= ipq8074_usb3_pcs_tbl,
+	.pcs_tbl_num		= ARRAY_SIZE(ipq8074_usb3_pcs_tbl),
+	.clk_list		= msm8996_phy_clk_l,
+	.num_clks		= ARRAY_SIZE(msm8996_phy_clk_l),
+	.reset_list		= msm8996_usb3phy_reset_l,
+	.num_resets		= ARRAY_SIZE(msm8996_usb3phy_reset_l),
+	.vreg_list		= qmp_phy_vreg_l,
+	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
+	.regs			= usb3phy_regs_layout,
+
+	.start_ctrl		= SERDES_START | PCS_START,
+	.pwrdn_ctrl		= SW_PWRDN,
+};
+
 static const struct qmp_phy_cfg msm8996_pciephy_cfg = {
 	.type			= PHY_TYPE_PCIE,
 	.nlanes			= 3,
@@ -2699,6 +2798,9 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)
 
 static const struct of_device_id qcom_qmp_phy_of_match_table[] = {
 	{
+		.compatible = "qcom,ipq8074-qmp-usb3-phy",
+		.data = &ipq8074_usb3phy_cfg,
+	}, {
 		.compatible = "qcom,msm8996-qmp-pcie-phy",
 		.data = &msm8996_pciephy_cfg,
 	}, {
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 4/5 phy: qcom-qusb2: Add ipq8074 device compatible

In reply to Sivaprakash Murugesan

Add ipq8074 qusb2 device compatible for high speed usb support.

---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +3 -0
index 393011a..557547d 100644
@@ -810,6 +810,9 @@ static const struct phy_ops qusb2_phy_gen_ops = {
 
 static const struct of_device_id qusb2_phy_of_match_table[] = {
 	{
+		.compatible	= "qcom,ipq8074-qusb2-phy",
+		.data		= &msm8996_phy_cfg,
+	}, {
 		.compatible	= "qcom,msm8996-qusb2-phy",
 		.data		= &msm8996_phy_cfg,
 	}, {
Signature · 1 line
2.7.4
Reviewed-by on v3 4/5
#5 lore raw

Re: [PATCH V3 4/5] phy: qcom-qusb2: Add ipq8074 device compatible

Quoted 12 lines · Sivaprakash Murugesan

Add ipq8074 qusb2 device compatible for high speed usb support.

---
  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +0 -0
index 393011a..557547d 100644

drivers/phy/qualcomm/phy-qcom-qusb2.c static const struct phy_ops qusb2_phy_gen_ops = { · line 818

Quoted 9 lines
drivers/phy/qualcomm/phy-qcom-qusb2.c +3 -0
@@ -810,6 +810,9 @@ static const struct phy_ops qusb2_phy_gen_ops = {
 
  static const struct of_device_id qusb2_phy_of_match_table[] = {
  	{
+		.compatible	= "qcom,ipq8074-qusb2-phy",
+		.data		= &msm8996_phy_cfg,
+	}, {
  		.compatible	= "qcom,msm8996-qusb2-phy",
  		.data		= &msm8996_phy_cfg,
  	}, {

Regards,

 Sricharan

#6 lore raw

PATCH v3 5/5 arm64: dts: ipq8074: enable USB support

In reply to Sivaprakash Murugesan

IPQ8074 has two super speed usb ports, add phy and dwc3 nodes to enable them.

---
 arch/arm64/boot/dts/qcom/ipq8074-hk01.dts |  24 +++++
 arch/arm64/boot/dts/qcom/ipq8074.dtsi     | 167 ++++++++++++++++++++++++++++++
 2 files changed, 191 insertions(+)
arch/arm64/boot/dts/qcom/ipq8074-hk01.dts +24 -0
index 6754cb0..dadaa8e 100644
@@ -82,3 +82,27 @@
 		nand-bus-width = <8>;
 	};
 };
+
+&qusb_phy_0 {
+	status = "ok";
+};
+
+&qusb_phy_1 {
+	status = "ok";
+};
+
+&ssphy_0 {
+	status = "ok";
+};
+
+&ssphy_1 {
+	status = "ok";
+};
+
+&usb_0 {
+	status = "ok";
+};
+
+&usb_1 {
+	status = "ok";
+};
arch/arm64/boot/dts/qcom/ipq8074.dtsi +167 -0

179 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw
In reply to Sivaprakash Murugesan

Ping!

Hi Vinod,

can you please review this patch series?

Quoted 24 lines · Sivaprakash Murugesan

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

[V3]
* Rebased patch 3 on 5.7 and linux-next tag next-20200608
[V2]
* Added new device compatible qcom,ipq8074-qusb2-phy for qusb2
* Addressed Bjorn's review comments on dts and binding

Sivaprakash Murugesan (5):
dt-bindings: phy: qcom,qmp: Add ipq8074 usb dt bindings
dt-bindings: phy: qcom,qusb2: Add ipq8074 device compatible
phy: qcom-qmp: Add USB QMP PHY support for IPQ8074
phy: qcom-qusb2: Add ipq8074 device compatible
arm64: dts: ipq8074: enable USB support

  .../devicetree/bindings/phy/qcom,qmp-phy.yaml      |   2 +
  .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    |   1 +
  arch/arm64/boot/dts/qcom/ipq8074-hk01.dts          |  24 +++
  arch/arm64/boot/dts/qcom/ipq8074.dtsi              | 167 +++++++++++++++++++++
  drivers/phy/qualcomm/phy-qcom-qmp.c                | 102 +++++++++++++
  drivers/phy/qualcomm/phy-qcom-qusb2.c              |   3 +
  6 files changed, 299 insertions(+)
#8 lore raw

Hi Vinod, Bjorn

This series is completely reviewed and acked now, can you

take this for merging?

Quoted 32 lines · Sivaprakash Murugesan

Ping!

Hi Vinod,

can you please review this patch series?

Quoted 25 lines · Sivaprakash Murugesan

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

[V3]
  * Rebased patch 3 on 5.7 and linux-next tag next-20200608 [V2]
  * Added new device compatible qcom,ipq8074-qusb2-phy for qusb2
  * Addressed Bjorn's review comments on dts and binding

Sivaprakash Murugesan (5):
   dt-bindings: phy: qcom,qmp: Add ipq8074 usb dt bindings
   dt-bindings: phy: qcom,qusb2: Add ipq8074 device compatible
   phy: qcom-qmp: Add USB QMP PHY support for IPQ8074
   phy: qcom-qusb2: Add ipq8074 device compatible
   arm64: dts: ipq8074: enable USB support

  .../devicetree/bindings/phy/qcom,qmp-phy.yaml |   2 + .../devicetree/bindings/phy/qcom,qusb2-phy.yaml |   1 + arch/arm64/boot/dts/qcom/ipq8074-hk01.dts          | 24 +++ arch/arm64/boot/dts/qcom/ipq8074.dtsi              | 167
+++++++++++++++++++++
  drivers/phy/qualcomm/phy-qcom-qmp.c                | 102 +++++++++++++ drivers/phy/qualcomm/phy-qcom-qusb2.c |   3 +

  6 files changed, 299 insertions(+)
Tested-by on the v3 series
#9 lore raw
In reply to Sivaprakash Murugesan

Hi Siva,

Quoted 16 lines · Sivaprakash Murugesan

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

[V3]
* Rebased patch 3 on 5.7 and linux-next tag next-20200608
[V2]
* Added new device compatible qcom,ipq8074-qusb2-phy for qusb2
* Addressed Bjorn's review comments on dts and binding

Sivaprakash Murugesan (5):
dt-bindings: phy: qcom,qmp: Add ipq8074 usb dt bindings
dt-bindings: phy: qcom,qusb2: Add ipq8074 device compatible
phy: qcom-qmp: Add USB QMP PHY support for IPQ8074
phy: qcom-qusb2: Add ipq8074 device compatible
arm64: dts: ipq8074: enable USB support

Quoted 7 lines
  .../devicetree/bindings/phy/qcom,qmp-phy.yaml      |   2 +
  .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    |   1 +
  arch/arm64/boot/dts/qcom/ipq8074-hk01.dts          |  24 +++
  arch/arm64/boot/dts/qcom/ipq8074.dtsi              | 167 +++++++++++++++++++++
  drivers/phy/qualcomm/phy-qcom-qmp.c                | 102 +++++++++++++
  drivers/phy/qualcomm/phy-qcom-qusb2.c              |   3 +
  6 files changed, 299 insertions(+)

 Tested this series on hk01.c1 for USB mass storage.

Regards,

 Sricharan

maintainer
#10 lore raw
In reply to Sivaprakash Murugesan
Quoted 2 lines · Sivaprakash Murugesan

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

Applied 1 thru 4. Bjorn can take the 5th one, thanks

Signature · 1 line
~Vinod
#11 lore raw
Quoted 6 lines · Vinod Koul
Quoted 2 lines · Sivaprakash Murugesan

IPQ8074 has two super speed USB ports, with QMP and QUSB2 PHYs. This patch set enables the USB PHYs and USB dwc3 in IPQ8074.

Applied 1 thru 4. Bjorn can take the 5th one, thanks

Thanks Vinod, I've applied and pushed out patch 5.

Regards,
Bjorn