Skip to contentSkip to conversation

phy: qcom-qusb2: Add support for SDM630/660

PATCH In review [email protected] 5 participants 6 messages Sep 26, 2020 – Sep 30, 2020

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

PATCH 1/1 phy: qcom-qusb2: Add support for SDM630/660

From: Konrad Dybcio <[email protected]>

QUSB on these SoCs actually uses *almost* the same configuration that msm8996 does, so we can reuse the phy_cfg from there with just a single change (se clock scheme).

---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
 drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml +1 -0
index ccda92859eca..97dae24752b4 100644
@@ -21,6 +21,7 @@ properties:
               - qcom,ipq8074-qusb2-phy
               - qcom,msm8996-qusb2-phy
               - qcom,msm8998-qusb2-phy
+              - qcom,sdm660-qusb2-phy
       - items:
           - enum:
               - qcom,sc7180-qusb2-phy
drivers/phy/qualcomm/phy-qcom-qusb2.c +6 -1
index 557547dabfd5..a4d706b361b9 100644
@@ -702,7 +702,8 @@ static int qusb2_phy_init(struct phy *phy)
 	usleep_range(150, 160);
 
 	/* Default is single-ended clock on msm8996 */
-	qphy->has_se_clk_scheme = true;
+	if (!of_device_is_compatible(phy->dev.of_node, "qcom,sdm660-qusb2-phy"))
+		qphy->has_se_clk_scheme = true;
 	/*
 	 * read TCSR_PHY_CLK_SCHEME register to check if single-ended
 	 * clock scheme is selected. If yes, then disable differential
@@ -818,6 +819,10 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 	}, {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
+	}, {
+		.compatible	= "qcom,sdm660-qusb2-phy",
+		/* sdm630/660 use the same config as msm8996. */
+		.data		= &msm8996_phy_cfg,
 	}, {
 		/*
 		 * Deprecated. Only here to support legacy device
Signature · 1 line
2.28.0
maintainer
#2 lore raw
In reply to [email protected]
Quoted 31 lines · On Sat, Sep 26, 2020 at 03:11:57PM +0200, [email protected] wrote:

From: Konrad Dybcio <[email protected]>

QUSB on these SoCs actually uses *almost* the same configuration that msm8996 does, so we can reuse the phy_cfg from there with just a single change (se clock scheme).

---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
 drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml +1 -0
index ccda92859eca..97dae24752b4 100644
@@ -21,6 +21,7 @@ properties:
               - qcom,ipq8074-qusb2-phy
               - qcom,msm8996-qusb2-phy
               - qcom,msm8998-qusb2-phy
+              - qcom,sdm660-qusb2-phy
       - items:
           - enum:
               - qcom,sc7180-qusb2-phy
drivers/phy/qualcomm/phy-qcom-qusb2.c +0 -0
index 557547dabfd5..a4d706b361b9 100644

drivers/phy/qualcomm/phy-qcom-qusb2.c static int qusb2_phy_init(struct phy *phy) · line 706

Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qusb2.c +2 -1
@@ -702,7 +702,8 @@ static int qusb2_phy_init(struct phy *phy)
 	usleep_range(150, 160);
 
 	/* Default is single-ended clock on msm8996 */
-	qphy->has_se_clk_scheme = true;
+	if (!of_device_is_compatible(phy->dev.of_node, "qcom,sdm660-qusb2-phy"))
+		qphy->has_se_clk_scheme = true;

You should just pull this from the driver data.

Quoted 17 lines
drivers/phy/qualcomm/phy-qcom-qusb2.c +4 -0
 	/*
 	 * read TCSR_PHY_CLK_SCHEME register to check if single-ended
 	 * clock scheme is selected. If yes, then disable differential
@@ -818,6 +819,10 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 	}, {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
+	}, {
+		.compatible	= "qcom,sdm660-qusb2-phy",
+		/* sdm630/660 use the same config as msm8996. */
+		.data		= &msm8996_phy_cfg,
 	}, {
 		/*
 		 * Deprecated. Only here to support legacy device
Signature · 1 line
2.28.0
#3 lore raw
Quoted 1 line

You should just pull this from the driver data.

I reused 8996's phy_cfg so as to change one line and not repeat dozens for what's essentially the same thing, so I don't think it's the better option..

Konrad

maintainer
#4 lore raw
Quoted 6 lines · Konrad Dybcio
Quoted 2 lines

You should just pull this from the driver data.

I reused 8996's phy_cfg so as to change one line and not repeat dozens for what's essentially the same thing, so I don't think it's the better option..

Okay, save it for the next person when the if statement grows.

Rob

Tested-by on v1 1/1
#5 lore raw
In reply to [email protected]

Tested on Xiaomi Redmi Note 7 (lavender), SDM660

Quoted 13 lines · On 9/26/20 4:11 PM, [email protected] wrote:

From: Konrad Dybcio <[email protected]>

QUSB on these SoCs actually uses *almost* the same configuration that msm8996 does, so we can reuse the phy_cfg from there with just a single change (se clock scheme).

---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
 drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)