Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register
@ 2024-01-16  1:08 Dmitry Baryshkov
  2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The USB-C PHY on the MSM8998, QCM2290, SM6115 and several other platforms
doesn't have built-in PCS_MISC_CLAMP_ENABLE register. Instead clamping
is handled separately via the register in the TCSR space. Make the new
phy-qcom-qmp-usbc driver correctly handle the clamp register.

For backwards compatibility the driver treats these registers as
optional. They are only required for the PHY suspend/resume. However the
schema declares corresponding property as required, it should be present
on all relevant platforms.

At this point I'm not sure whether having a single TCSR-based register
will be enough or whether we will have to add more TCSR registers in
future. In order to avoid repeating TCSR handle (and having multiple
instances of TCSR regmap in the driver) use qcom,tcsr-reg property
rather than someting more exact like qcom,vls-clamp-reg.

Dependecies: PHY-related changes of [1]

Note for the backporters: if the patch is packported to the kernel
before the phy-qocm-qmp-usbc split, the phy-qcom-qmp-usb driver needs to
handle both PCS_MISC_CLAMP_ENABLE and VLS_CLAMP registers as optional.

[1] https://lore.kernel.org/linux-arm-msm/20240113-pmi632-typec-v2-0-182d9aa0a5b3@linaro.org/

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Dmitry Baryshkov (6):
      dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115
      dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers
      phy: qcom: qmp-usbc: handle CLAMP register in a correct way
      arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY
      arm64: dts: qcom: qcm2290: declare VLS CLAMP register for USB3 PHY
      arm64: dts: qcom: sm6115: declare VLS CLAMP register for USB3 PHY

 .../devicetree/bindings/mfd/qcom,tcsr.yaml         |  2 +
 .../bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml    | 11 +++++
 arch/arm64/boot/dts/qcom/msm8998.dtsi              |  2 +
 arch/arm64/boot/dts/qcom/qcm2290.dtsi              |  7 ++++
 arch/arm64/boot/dts/qcom/sm6115.dtsi               |  7 ++++
 drivers/phy/qualcomm/phy-qcom-qmp-usbc.c           | 48 +++++++++++++++++-----
 6 files changed, 66 insertions(+), 11 deletions(-)
---
base-commit: d0f9c0b672a974d32c40d369f63e441a7dd66d74
change-id: 20240116-usbc-phy-vls-clamp-10189efdcf12

Best regards,
-- 
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  2024-01-16  8:11   ` Krzysztof Kozlowski
  2024-01-25 13:32   ` (subset) " Lee Jones
  2024-01-16  1:08 ` [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers Dmitry Baryshkov
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

Add qcom,qcm2290-tcsr and qcom,sm6115-tcsr, compatibles for TCSR blocks
on the corresponding platforms.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
index 798705ab6a46..b97d77015335 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
+++ b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
@@ -19,6 +19,7 @@ properties:
       - enum:
           - qcom,msm8976-tcsr
           - qcom,msm8998-tcsr
+          - qcom,qcm2290-tcsr
           - qcom,qcs404-tcsr
           - qcom,sc7180-tcsr
           - qcom,sc7280-tcsr
@@ -28,6 +29,7 @@ properties:
           - qcom,sdx55-tcsr
           - qcom,sdx65-tcsr
           - qcom,sm4450-tcsr
+          - qcom,sm6115-tcsr
           - qcom,sm8150-tcsr
           - qcom,sm8250-tcsr
           - qcom,sm8350-tcsr

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
  2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  2024-01-16  8:13   ` Krzysztof Kozlowski
  2024-01-16  1:08 ` [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way Dmitry Baryshkov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The QMP USB PHYs on msm8998, qcm2290 and some other platforms don't have
the PCS_MISC_CLAMP_ENABLE register. Instead they need to toggle the
register in the TCSR space. Declare the registers accessible through the
TCSR space.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 .../devicetree/bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml
index da5d4cbca24c..140843347d1e 100644
--- a/Documentation/devicetree/bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,msm8998-qmp-usb3-phy.yaml
@@ -55,6 +55,14 @@ properties:
       Flag the PHY as possible handler of USB Type-C orientation switching
     type: boolean
 
+  qcom,tcsr-reg:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: phandle to TCSR hardware block
+          - description: offset of the VLS CLAMP register
+    description: Clamp register present in the TCSR
+
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
     properties:
@@ -78,6 +86,7 @@ required:
   - "#clock-cells"
   - clock-output-names
   - "#phy-cells"
+  - qcom,tcsr-reg
 
 allOf:
   - if:
@@ -148,6 +157,8 @@ examples:
 
       orientation-switch;
 
+      qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;
+
       ports {
         #address-cells = <1>;
         #size-cells = <0>;

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
  2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
  2024-01-16  1:08 ` [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  2024-01-16 11:59   ` Konrad Dybcio
  2024-01-16  1:08 ` [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY Dmitry Baryshkov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The QMP USB PHYs on msm8998, qcm2290 and some other platforms don't have
the PCS_MISC_CLAMP_ENABLE register. Instead they need to toggle the
register in the TCSR space. Make the new phy-qcom-qmp-usbc driver
correctly handle the clamp register.

Fixes: a51969fafc82 ("phy: qcom-qmp: Add QMP V3 USB3 PHY support for msm8998")
Fixes: 8abe5e778b2c ("phy: qcom-qmp: Add QCM2290 USB3 PHY support")
Cc: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 48 ++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
index 214cf4203de4..3a4b4849db0f 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
@@ -10,11 +10,13 @@
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
 #include <linux/reset.h>
 #include <linux/slab.h>
@@ -56,9 +58,6 @@
 /* QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR register bits */
 #define IRQ_CLEAR				BIT(0)
 
-/* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */
-#define CLAMP_EN				BIT(0) /* enables i/o clamp_n */
-
 #define PHY_INIT_COMPLETE_TIMEOUT		10000
 
 struct qmp_phy_init_tbl {
@@ -94,7 +93,6 @@ enum qphy_reg_layout {
 	QPHY_PCS_AUTONOMOUS_MODE_CTRL,
 	QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR,
 	QPHY_PCS_POWER_DOWN_CONTROL,
-	QPHY_PCS_MISC_CLAMP_ENABLE,
 	/* Keep last to ensure regs_layout arrays are properly initialized */
 	QPHY_LAYOUT_SIZE
 };
@@ -106,7 +104,6 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
 	[QPHY_PCS_AUTONOMOUS_MODE_CTRL]	= QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL,
 	[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR,
 	[QPHY_PCS_POWER_DOWN_CONTROL]	= QPHY_V3_PCS_POWER_DOWN_CONTROL,
-	[QPHY_PCS_MISC_CLAMP_ENABLE]	= QPHY_V3_PCS_MISC_CLAMP_ENABLE,
 };
 
 static const unsigned int qmp_v3_usb3phy_regs_layout_qcm2290[QPHY_LAYOUT_SIZE] = {
@@ -369,6 +366,9 @@ struct qmp_usbc {
 	void __iomem *tx2;
 	void __iomem *rx2;
 
+	struct regmap *tcsr_map;
+	u32 vls_clamp_reg;
+
 	struct clk *pipe_clk;
 	struct clk_bulk_data *clks;
 	int num_clks;
@@ -691,7 +691,6 @@ static void qmp_usbc_enable_autonomous_mode(struct qmp_usbc *qmp)
 {
 	const struct qmp_phy_cfg *cfg = qmp->cfg;
 	void __iomem *pcs = qmp->pcs;
-	void __iomem *pcs_misc = qmp->pcs_misc;
 	u32 intr_mask;
 
 	if (qmp->mode == PHY_MODE_USB_HOST_SS ||
@@ -712,19 +711,18 @@ static void qmp_usbc_enable_autonomous_mode(struct qmp_usbc *qmp)
 	qphy_setbits(pcs, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], intr_mask);
 
 	/* Enable i/o clamp_n for autonomous mode */
-	if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE])
-		qphy_clrbits(pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE], CLAMP_EN);
+	if (qmp->tcsr_map && qmp->vls_clamp_reg)
+		regmap_write(qmp->tcsr_map, qmp->vls_clamp_reg, 1);
 }
 
 static void qmp_usbc_disable_autonomous_mode(struct qmp_usbc *qmp)
 {
 	const struct qmp_phy_cfg *cfg = qmp->cfg;
 	void __iomem *pcs = qmp->pcs;
-	void __iomem *pcs_misc = qmp->pcs_misc;
 
 	/* Disable i/o clamp_n on resume for normal mode */
-	if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE])
-		qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE], CLAMP_EN);
+	if (qmp->tcsr_map && qmp->vls_clamp_reg)
+		regmap_write(qmp->tcsr_map, qmp->vls_clamp_reg, 0);
 
 	qphy_clrbits(pcs, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL],
 		     ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL | ALFPS_DTCT_EN);
@@ -1063,6 +1061,30 @@ static int qmp_usbc_parse_dt(struct qmp_usbc *qmp)
 	return 0;
 }
 
+static int qmp_usbc_parse_vls_clamp(struct qmp_usbc *qmp)
+{
+	struct of_phandle_args tcsr_args;
+	struct device *dev = qmp->dev;
+	int ret;
+
+	/*  for backwards compatibility ignore if there is no property */
+	ret = of_parse_phandle_with_fixed_args(dev->of_node, "qcom,tcsr-reg", 1, 0,
+					       &tcsr_args);
+	if (ret == -ENOENT)
+		return 0;
+	else if (ret < 0)
+		return dev_err_probe(dev, ret, "Failed to parse qcom,tcsr-reg\n");
+
+	qmp->tcsr_map = syscon_node_to_regmap(tcsr_args.np);
+	of_node_put(tcsr_args.np);
+	if (IS_ERR(qmp->tcsr_map))
+		return PTR_ERR(qmp->tcsr_map);
+
+	qmp->vls_clamp_reg = tcsr_args.args[0];
+
+	return 0;
+}
+
 static int qmp_usbc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1093,6 +1115,10 @@ static int qmp_usbc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	ret = qmp_usbc_parse_vls_clamp(qmp);
+	if (ret)
+		return ret;
+
 	/* Check for legacy binding with child node. */
 	np = of_get_child_by_name(dev->of_node, "phy");
 	if (np) {

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2024-01-16  1:08 ` [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  2024-01-16 11:59   ` Konrad Dybcio
  2024-01-16  1:08 ` [PATCH 5/6] arm64: dts: qcom: qcm2290: " Dmitry Baryshkov
  2024-01-16  1:08 ` [PATCH 6/6] arm64: dts: qcom: sm6115: " Dmitry Baryshkov
  5 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The USB3 PHY on the MSM8998 platform doesn't have built-in
PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately
via the register in the TCSR space. Declare corresponding register.

Fixes: 026dad8f5873 ("arm64: dts: qcom: msm8998: Add USB-related nodes")
Cc: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index 2793cc22d381..e21e5693ba1e 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -2174,6 +2174,8 @@ usb3phy: phy@c010000 {
 			reset-names = "phy",
 				      "phy_phy";
 
+			qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;
+
 			status = "disabled";
 		};
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] arm64: dts: qcom: qcm2290: declare VLS CLAMP register for USB3 PHY
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
                   ` (3 preceding siblings ...)
  2024-01-16  1:08 ` [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  2024-01-16 12:00   ` Konrad Dybcio
  2024-01-16  1:08 ` [PATCH 6/6] arm64: dts: qcom: sm6115: " Dmitry Baryshkov
  5 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The USB3 PHY on the QCM2290 platform doesn't have built-in
PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately
via the register in the TCSR space. Declare corresponding register.

Fixes: 0c55f6229bc3 ("arm64: dts: qcom: qcm2290: Add USB3 PHY")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcm2290.dtsi b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
index 0911fb08ed63..68b52e8faba5 100644
--- a/arch/arm64/boot/dts/qcom/qcm2290.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
@@ -442,6 +442,11 @@ tcsr_mutex: hwlock@340000 {
 			#hwlock-cells = <1>;
 		};
 
+		tcsr_regs_1: syscon@360000 {
+			compatible = "qcom,qcm2290-tcsr", "syscon";
+			reg = <0x0 0x00360000 0x0 0x20000>;
+		};
+
 		tlmm: pinctrl@500000 {
 			compatible = "qcom,qcm2290-tlmm";
 			reg = <0x0 0x00500000 0x0 0x300000>;
@@ -690,6 +695,8 @@ usb_qmpphy: phy@1615000 {
 
 			#phy-cells = <0>;
 
+			qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;
+
 			status = "disabled";
 		};
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] arm64: dts: qcom: sm6115: declare VLS CLAMP register for USB3 PHY
  2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
                   ` (4 preceding siblings ...)
  2024-01-16  1:08 ` [PATCH 5/6] arm64: dts: qcom: qcm2290: " Dmitry Baryshkov
@ 2024-01-16  1:08 ` Dmitry Baryshkov
  5 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-01-16  1:08 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy, Dmitry Baryshkov

The USB3 PHY on the SM6115 platform doesn't have built-in
PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately
via the register in the TCSR space. Declare corresponding register.

Fixes: 9dd5f6dba729 ("arm64: dts: qcom: sm6115: Add USB SS qmp phy node")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/sm6115.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi
index 160e098f1075..8cee943fb24e 100644
--- a/arch/arm64/boot/dts/qcom/sm6115.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi
@@ -614,6 +614,11 @@ tcsr_mutex: hwlock@340000 {
 			#hwlock-cells = <1>;
 		};
 
+		tcsr_regs_1: syscon@360000 {
+			compatible = "qcom,sm6115-tcsr", "syscon";
+			reg = <0x0 0x00360000 0x0 0x20000>;
+		};
+
 		tlmm: pinctrl@500000 {
 			compatible = "qcom,sm6115-tlmm";
 			reg = <0x0 0x00500000 0x0 0x400000>,
@@ -879,6 +884,8 @@ usb_qmpphy: phy@1615000 {
 
 			#phy-cells = <0>;
 
+			qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;
+
 			status = "disabled";
 		};
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115
  2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
@ 2024-01-16  8:11   ` Krzysztof Kozlowski
  2024-01-25 13:32   ` (subset) " Lee Jones
  1 sibling, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2024-01-16  8:11 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Konrad Dybcio, Lee Jones,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy

On 16/01/2024 02:08, Dmitry Baryshkov wrote:
> Add qcom,qcm2290-tcsr and qcom,sm6115-tcsr, compatibles for TCSR blocks
> on the corresponding platforms.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers
  2024-01-16  1:08 ` [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers Dmitry Baryshkov
@ 2024-01-16  8:13   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2024-01-16  8:13 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Konrad Dybcio, Lee Jones,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy

On 16/01/2024 02:08, Dmitry Baryshkov wrote:
> The QMP USB PHYs on msm8998, qcm2290 and some other platforms don't have
> the PCS_MISC_CLAMP_ENABLE register. Instead they need to toggle the
> register in the TCSR space. Declare the registers accessible through the
> TCSR space.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way
  2024-01-16  1:08 ` [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way Dmitry Baryshkov
@ 2024-01-16 11:59   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2024-01-16 11:59 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy



On 1/16/24 02:08, Dmitry Baryshkov wrote:
> The QMP USB PHYs on msm8998, qcm2290 and some other platforms don't have
> the PCS_MISC_CLAMP_ENABLE register. Instead they need to toggle the
> register in the TCSR space. Make the new phy-qcom-qmp-usbc driver
> correctly handle the clamp register.
> 
> Fixes: a51969fafc82 ("phy: qcom-qmp: Add QMP V3 USB3 PHY support for msm8998")
> Fixes: 8abe5e778b2c ("phy: qcom-qmp: Add QCM2290 USB3 PHY support")
> Cc: Jeffrey Hugo <quic_jhugo@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---

[...]

> +
> +	/*  for backwards compatibility ignore if there is no property */

Double space

Looks good otherwise, I think!

Konrad

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY
  2024-01-16  1:08 ` [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY Dmitry Baryshkov
@ 2024-01-16 11:59   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2024-01-16 11:59 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy



On 1/16/24 02:08, Dmitry Baryshkov wrote:
> The USB3 PHY on the MSM8998 platform doesn't have built-in
> PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately
> via the register in the TCSR space. Declare corresponding register.
> 
> Fixes: 026dad8f5873 ("arm64: dts: qcom: msm8998: Add USB-related nodes")
> Cc: Jeffrey Hugo <quic_jhugo@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
> index 2793cc22d381..e21e5693ba1e 100644
> --- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
> @@ -2174,6 +2174,8 @@ usb3phy: phy@c010000 {
>   			reset-names = "phy",
>   				      "phy_phy";
>   
> +			qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;

This leaks outside the syscon.

Konrad

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] arm64: dts: qcom: qcm2290: declare VLS CLAMP register for USB3 PHY
  2024-01-16  1:08 ` [PATCH 5/6] arm64: dts: qcom: qcm2290: " Dmitry Baryshkov
@ 2024-01-16 12:00   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2024-01-16 12:00 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo
  Cc: linux-arm-msm, devicetree, linux-phy



On 1/16/24 02:08, Dmitry Baryshkov wrote:
> The USB3 PHY on the QCM2290 platform doesn't have built-in
> PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately
> via the register in the TCSR space. Declare corresponding register.
> 
> Fixes: 0c55f6229bc3 ("arm64: dts: qcom: qcm2290: Add USB3 PHY")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   arch/arm64/boot/dts/qcom/qcm2290.dtsi | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/qcm2290.dtsi b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> index 0911fb08ed63..68b52e8faba5 100644
> --- a/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> +++ b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> @@ -442,6 +442,11 @@ tcsr_mutex: hwlock@340000 {
>   			#hwlock-cells = <1>;
>   		};
>   
> +		tcsr_regs_1: syscon@360000 {
> +			compatible = "qcom,qcm2290-tcsr", "syscon";
> +			reg = <0x0 0x00360000 0x0 0x20000>;
> +		};
> +
>   		tlmm: pinctrl@500000 {
>   			compatible = "qcom,qcm2290-tlmm";
>   			reg = <0x0 0x00500000 0x0 0x300000>;
> @@ -690,6 +695,8 @@ usb_qmpphy: phy@1615000 {
>   
>   			#phy-cells = <0>;
>   
> +			qcom,tcsr-reg = <&tcsr_regs_1 0x6b244>;

This also leaks outside the syscon space.

Konrad

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: (subset) [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115
  2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
  2024-01-16  8:11   ` Krzysztof Kozlowski
@ 2024-01-25 13:32   ` Lee Jones
  1 sibling, 0 replies; 13+ messages in thread
From: Lee Jones @ 2024-01-25 13:32 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vinod Koul,
	Kishon Vijay Abraham I, Jeffrey Hugo, Dmitry Baryshkov
  Cc: linux-arm-msm, devicetree, linux-phy

On Tue, 16 Jan 2024 03:08:27 +0200, Dmitry Baryshkov wrote:
> Add qcom,qcm2290-tcsr and qcom,sm6115-tcsr, compatibles for TCSR blocks
> on the corresponding platforms.
> 
> 

Applied, thanks!

[1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115
      commit: cd84e6bd331fd556116ec4889dc282b07c392e42

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-25 13:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16  1:08 [PATCH 0/6] phy: qcom: qmp-usbc: properly handle the clamping register Dmitry Baryshkov
2024-01-16  1:08 ` [PATCH 1/6] dt-bindings: mfd: qcom,tcsr: Add compatibles for QCM2290 and SM6115 Dmitry Baryshkov
2024-01-16  8:11   ` Krzysztof Kozlowski
2024-01-25 13:32   ` (subset) " Lee Jones
2024-01-16  1:08 ` [PATCH 2/6] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: add TCSR registers Dmitry Baryshkov
2024-01-16  8:13   ` Krzysztof Kozlowski
2024-01-16  1:08 ` [PATCH 3/6] phy: qcom: qmp-usbc: handle CLAMP register in a correct way Dmitry Baryshkov
2024-01-16 11:59   ` Konrad Dybcio
2024-01-16  1:08 ` [PATCH 4/6] arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY Dmitry Baryshkov
2024-01-16 11:59   ` Konrad Dybcio
2024-01-16  1:08 ` [PATCH 5/6] arm64: dts: qcom: qcm2290: " Dmitry Baryshkov
2024-01-16 12:00   ` Konrad Dybcio
2024-01-16  1:08 ` [PATCH 6/6] arm64: dts: qcom: sm6115: " Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox