All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/9] Add QUSB2 PHY support for SC7180
@ 2020-03-09  9:53 Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 1/9] dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml Sandeep Maheswaram
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Converting dt binding to yaml.
Adding compatible for SC7180 in dt bindings.
Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.

Changes in v5:
*Added the dt bindings which are applicable only to QUSB2 V2 PHY in 
 separate block as per comments from Matthias in patch 1/9 and patch 4/9
 and addressed Rob's comment in patch 1/9.
*Separated the patch for new override params and added a local variable
 to access overrides as per comments from Matthias patch 5/9 and 6/9.

Changes in v4:
*Addressed Rob Herrings comments in dt bindings.
*Added new structure for all the overriding tuning params.
*Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy. 
*Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845. 

Changes in v3:
*Using the generic phy cfg table for QUSB2 V2 phy.
*Added support for overriding tuning parameters in QUSB2 V2 PHY
from device tree.

Changes in v2:
Sorted the compatible in driver.
Converted dt binding to yaml.
Added compatible in yaml.

Sandeep Maheswaram (9):
  dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
  dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
    SC7180
  phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
  dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
    parameters
  phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
    V2 PHY
  phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
  arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
  arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
  arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
    device

 .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    | 187 +++++++++++++++++++++
 .../devicetree/bindings/phy/qcom-qusb2-phy.txt     |  68 --------
 arch/arm64/boot/dts/qcom/sc7180-idp.dts            |   6 +-
 arch/arm64/boot/dts/qcom/sc7180.dtsi               |   2 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi               |   4 +-
 drivers/phy/qualcomm/phy-qcom-qusb2.c              | 144 +++++++++++-----
 6 files changed, 297 insertions(+), 114 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
 delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 1/9] dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180 Sandeep Maheswaram
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Convert QUSB2 phy  bindings to DT schema format using json-schema.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    | 149 +++++++++++++++++++++
 .../devicetree/bindings/phy/qcom-qusb2-phy.txt     |  68 ----------
 2 files changed, 149 insertions(+), 68 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
 delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt

diff --git a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
new file mode 100644
index 0000000..2342cd0
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
@@ -0,0 +1,149 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/phy/qcom,qusb2-phy.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm QUSB2 phy controller
+
+maintainers:
+  - Manu Gautam <mgautam@codeaurora.org>
+
+description:
+  QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets.
+
+properties:
+  compatible:
+    enum:
+      - qcom,msm8996-qusb2-phy
+      - qcom,msm8998-qusb2-phy
+      - qcom,sdm845-qusb2-phy
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  clocks:
+    minItems: 2
+    maxItems: 3
+    items:
+      - description: phy config clock
+      - description: 19.2 MHz ref clk
+      - description: phy interface clock (Optional)
+
+  clock-names:
+    minItems: 2
+    maxItems: 3
+    items:
+      - const: cfg_ahb
+      - const: ref
+      - const: iface
+
+  vdda-pll-supply:
+     description:
+       Phandle to 1.8V regulator supply to PHY refclk pll block.
+
+  vdda-phy-dpdm-supply:
+     description:
+       Phandle to 3.1V regulator supply to Dp/Dm port signals.
+
+  resets:
+    maxItems: 1
+    description:
+      Phandle to reset to phy block.
+
+  nvmem-cells:
+    maxItems: 1
+    description:
+        Phandle to nvmem cell that contains 'HS Tx trim'
+        tuning parameter value for qusb2 phy.
+
+  qcom,tcsr-syscon:
+    description:
+        Phandle to TCSR syscon register region.
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: qcom,sdm845-qusb2-phy
+then:
+  properties:
+    qcom,imp-res-offset-value:
+      description:
+        It is a 6 bit value that specifies offset to be
+        added to PHY refgen RESCODE via IMP_CTRL1 register. It is a PHY
+        tuning parameter that may vary for different boards of same SOC.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 63
+          default: 0
+
+    qcom,hstx-trim-value:
+      description:
+        It is a 4 bit value that specifies tuning for HSTX
+        output current.
+        Possible range is - 15mA to 24mA (stepsize of 600 uA).
+        See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 15
+          default: 3
+
+    qcom,preemphasis-level:
+      description:
+        It is a 2 bit value that specifies pre-emphasis level.
+        Possible range is 0 to 15% (stepsize of 5%).
+        See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 3
+          default: 2
+
+    qcom,preemphasis-width:
+      description:
+        It is a 1 bit value that specifies how long the HSTX
+        pre-emphasis (specified using qcom,preemphasis-level) must be in
+        effect. Duration could be half-bit of full-bit.
+        See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 1
+          default: 0
+
+required:
+  - compatible
+  - reg
+  - "#phy-cells"
+  - clocks
+  - clock-names
+  - vdda-pll-supply
+  - vdda-phy-dpdm-supply
+  - resets
+
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-msm8996.h>
+    hsusb_phy: phy@7411000 {
+        compatible = "qcom,msm8996-qusb2-phy";
+        reg = <0x7411000 0x180>;
+        #phy-cells = <0>;
+
+        clocks = <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>,
+                 <&gcc GCC_RX1_USB2_CLKREF_CLK>;
+        clock-names = "cfg_ahb", "ref";
+
+        vdda-pll-supply = <&pm8994_l12>;
+        vdda-phy-dpdm-supply = <&pm8994_l24>;
+
+        resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>;
+        nvmem-cells = <&qusb2p_hstx_trim>;
+    };
diff --git a/Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt b/Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
deleted file mode 100644
index fe29f9e..0000000
--- a/Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-Qualcomm QUSB2 phy controller
-=============================
-
-QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets.
-
-Required properties:
- - compatible: compatible list, contains
-	       "qcom,msm8996-qusb2-phy" for 14nm PHY on msm8996,
-	       "qcom,msm8998-qusb2-phy" for 10nm PHY on msm8998,
-	       "qcom,sdm845-qusb2-phy" for 10nm PHY on sdm845.
-
- - reg: offset and length of the PHY register set.
- - #phy-cells: must be 0.
-
- - clocks: a list of phandles and clock-specifier pairs,
-	   one for each entry in clock-names.
- - clock-names: must be "cfg_ahb" for phy config clock,
-			"ref" for 19.2 MHz ref clk,
-			"iface" for phy interface clock (Optional).
-
- - vdda-pll-supply: Phandle to 1.8V regulator supply to PHY refclk pll block.
- - vdda-phy-dpdm-supply: Phandle to 3.1V regulator supply to Dp/Dm port signals.
-
- - resets: Phandle to reset to phy block.
-
-Optional properties:
- - nvmem-cells: Phandle to nvmem cell that contains 'HS Tx trim'
-		tuning parameter value for qusb2 phy.
-
- - qcom,tcsr-syscon: Phandle to TCSR syscon register region.
- - qcom,imp-res-offset-value: It is a 6 bit value that specifies offset to be
-		added to PHY refgen RESCODE via IMP_CTRL1 register. It is a PHY
-		tuning parameter that may vary for different boards of same SOC.
-		This property is applicable to only QUSB2 v2 PHY (sdm845).
- - qcom,hstx-trim-value: It is a 4 bit value that specifies tuning for HSTX
-		output current.
-		Possible range is - 15mA to 24mA (stepsize of 600 uA).
-		See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
-		This property is applicable to only QUSB2 v2 PHY (sdm845).
-		Default value is 22.2mA for sdm845.
- - qcom,preemphasis-level: It is a 2 bit value that specifies pre-emphasis level.
-		Possible range is 0 to 15% (stepsize of 5%).
-		See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
-		This property is applicable to only QUSB2 v2 PHY (sdm845).
-		Default value is 10% for sdm845.
-- qcom,preemphasis-width: It is a 1 bit value that specifies how long the HSTX
-		pre-emphasis (specified using qcom,preemphasis-level) must be in
-		effect. Duration could be half-bit of full-bit.
-		See dt-bindings/phy/phy-qcom-qusb2.h for applicable values.
-		This property is applicable to only QUSB2 v2 PHY (sdm845).
-		Default value is full-bit width for sdm845.
-
-Example:
-	hsusb_phy: phy@7411000 {
-		compatible = "qcom,msm8996-qusb2-phy";
-		reg = <0x7411000 0x180>;
-		#phy-cells = <0>;
-
-		clocks = <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>,
-			<&gcc GCC_RX1_USB2_CLKREF_CLK>,
-		clock-names = "cfg_ahb", "ref";
-
-		vdda-pll-supply = <&pm8994_l12>;
-		vdda-phy-dpdm-supply = <&pm8994_l24>;
-
-		resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>;
-		nvmem-cells = <&qusb2p_hstx_trim>;
-        };
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 1/9] dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-20 17:55   ` Rob Herring
  2020-03-09  9:53 ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Sandeep Maheswaram
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Add compatibles for generic QUSB2 V2 phy which can be used for
sdm845 and sc7180.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
index 2342cd0..60124a3 100644
--- a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
@@ -15,10 +15,16 @@ description:
 
 properties:
   compatible:
-    enum:
-      - qcom,msm8996-qusb2-phy
-      - qcom,msm8998-qusb2-phy
-      - qcom,sdm845-qusb2-phy
+    oneOf:
+      - items:
+        - enum:
+          - qcom,msm8996-qusb2-phy
+          - qcom,msm8998-qusb2-phy
+      - items:
+        - enum:
+          - qcom,sc7180-qusb2-phy
+          - qcom,sdm845-qusb2-phy
+        - const: qcom,qusb2-v2-phy
   reg:
     maxItems: 1
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 1/9] dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180 Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-04-02 21:39   ` John Stultz
  2020-03-09  9:53 ` [PATCH v5 4/9] dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning parameters Sandeep Maheswaram
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Add generic QUSB2 V2 PHY table so the respective phys
can use the same table.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index bf94a52..70c9da6 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/clk.h>
@@ -177,7 +177,7 @@ static const struct qusb2_phy_init_tbl msm8998_init_tbl[] = {
 	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19),
 };
 
-static const unsigned int sdm845_regs_layout[] = {
+static const unsigned int qusb2_v2_regs_layout[] = {
 	[QUSB2PHY_PLL_CORE_INPUT_OVERRIDE] = 0xa8,
 	[QUSB2PHY_PLL_STATUS]		= 0x1a0,
 	[QUSB2PHY_PORT_TUNE1]		= 0x240,
@@ -191,7 +191,7 @@ static const unsigned int sdm845_regs_layout[] = {
 	[QUSB2PHY_INTR_CTRL]		= 0x230,
 };
 
-static const struct qusb2_phy_init_tbl sdm845_init_tbl[] = {
+static const struct qusb2_phy_init_tbl qusb2_v2_init_tbl[] = {
 	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_ANALOG_CONTROLS_TWO, 0x03),
 	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CLOCK_INVERTERS, 0x7c),
 	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CMODE, 0x80),
@@ -258,10 +258,10 @@ static const struct qusb2_phy_cfg msm8998_phy_cfg = {
 	.update_tune1_with_efuse = true,
 };
 
-static const struct qusb2_phy_cfg sdm845_phy_cfg = {
-	.tbl		= sdm845_init_tbl,
-	.tbl_num	= ARRAY_SIZE(sdm845_init_tbl),
-	.regs		= sdm845_regs_layout,
+static const struct qusb2_phy_cfg qusb2_v2_phy_cfg = {
+	.tbl		= qusb2_v2_init_tbl,
+	.tbl_num	= ARRAY_SIZE(qusb2_v2_init_tbl),
+	.regs		= qusb2_v2_regs_layout,
 
 	.disable_ctrl	= (PWR_CTRL1_VREF_SUPPLY_TRIM | PWR_CTRL1_CLAMP_N_EN |
 			   POWER_DOWN),
@@ -774,8 +774,8 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
 	}, {
-		.compatible	= "qcom,sdm845-qusb2-phy",
-		.data		= &sdm845_phy_cfg,
+		.compatible	= "qcom,qusb2-v2-phy",
+		.data		= &qusb2_v2_phy_cfg,
 	},
 	{ },
 };
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 4/9] dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning parameters
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (2 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 5/9] phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY Sandeep Maheswaram
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Add support for overriding QUSB2 V2 phy tuning parameters
in device tree bindings.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
---
 .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    | 32 +++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
index 60124a3..144ae29 100644
--- a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
@@ -75,7 +75,7 @@ if:
   properties:
     compatible:
       contains:
-        const: qcom,sdm845-qusb2-phy
+        const: qcom,qusb2-v2-phy
 then:
   properties:
     qcom,imp-res-offset-value:
@@ -89,6 +89,26 @@ then:
           maximum: 63
           default: 0
 
+    qcom,bias-ctrl-value:
+      description:
+        It is a 6 bit value that specifies bias-ctrl-value. It is a PHY
+        tuning parameter that may vary for different boards of same SOC.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 63
+          default: 0
+
+    qcom,charge-ctrl-value:
+     description:
+        It is a 2 bit value that specifies charge-ctrl-value. It is a PHY
+        tuning parameter that may vary for different boards of same SOC.
+     allOf:
+       - $ref: /schemas/types.yaml#/definitions/uint32
+       - minimum: 0
+         maximum: 3
+         default: 0
+
     qcom,hstx-trim-value:
       description:
         It is a 4 bit value that specifies tuning for HSTX
@@ -124,6 +144,16 @@ then:
           maximum: 1
           default: 0
 
+    qcom,hsdisc-trim-value:
+      description:
+        It is a 2 bit value tuning parameter that control disconnect
+        threshold and may vary for different boards of same SOC.
+      allOf:
+        - $ref: /schemas/types.yaml#/definitions/uint32
+        - minimum: 0
+          maximum: 3
+          default: 0
+
 required:
   - compatible
   - reg
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 5/9] phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (3 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 4/9] dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning parameters Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 6/9] phy: qcom-qusb2: Add new " Sandeep Maheswaram
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Added new structure for overriding tuning parameters in QUSB2 V2 PHY as the
override params are increased due to usage of generic QUSB2 V2 phy table.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 75 ++++++++++++++++++++---------------
 1 file changed, 43 insertions(+), 32 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 70c9da6..44841c9 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -277,6 +277,28 @@ static const char * const qusb2_phy_vreg_names[] = {
 
 #define QUSB2_NUM_VREGS		ARRAY_SIZE(qusb2_phy_vreg_names)
 
+/* struct override_param - structure holding qusb2 v2 phy overriding param
+ * set override true if the  device tree property exists and read and assign
+ * to value
+ */
+struct override_param {
+	bool override;
+	u8 value;
+};
+
+/*struct override_params - structure holding qusb2 v2 phy overriding params
+ * @imp_res_offset: rescode offset to be updated in IMP_CTRL1 register
+ * @hstx_trim: HSTX_TRIM to be updated in TUNE1 register
+ * @preemphasis: Amplitude Pre-Emphasis to be updated in TUNE1 register
+ * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ */
+struct override_params {
+	struct override_param imp_res_offset;
+	struct override_param hstx_trim;
+	struct override_param preemphasis;
+	struct override_param preemphasis_width;
+};
+
 /**
  * struct qusb2_phy - structure holding qusb2 phy attributes
  *
@@ -292,14 +314,7 @@ static const char * const qusb2_phy_vreg_names[] = {
  * @tcsr: TCSR syscon register map
  * @cell: nvmem cell containing phy tuning value
  *
- * @override_imp_res_offset: PHY should use different rescode offset
- * @imp_res_offset_value: rescode offset to be updated in IMP_CTRL1 register
- * @override_hstx_trim: PHY should use different HSTX o/p current value
- * @hstx_trim_value: HSTX_TRIM value to be updated in TUNE1 register
- * @override_preemphasis: PHY should use different pre-amphasis amplitude
- * @preemphasis_level: Amplitude Pre-Emphasis to be updated in TUNE1 register
- * @override_preemphasis_width: PHY should use different pre-emphasis duration
- * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ * @overrides: pointer to structure for all overriding tuning params
  *
  * @cfg: phy config data
  * @has_se_clk_scheme: indicate if PHY has single-ended ref clock scheme
@@ -319,14 +334,7 @@ struct qusb2_phy {
 	struct regmap *tcsr;
 	struct nvmem_cell *cell;
 
-	bool override_imp_res_offset;
-	u8 imp_res_offset_value;
-	bool override_hstx_trim;
-	u8 hstx_trim_value;
-	bool override_preemphasis;
-	u8 preemphasis_level;
-	bool override_preemphasis_width;
-	u8 preemphasis_width;
+	struct override_params overrides;
 
 	const struct qusb2_phy_cfg *cfg;
 	bool has_se_clk_scheme;
@@ -394,24 +402,25 @@ void qcom_qusb2_phy_configure(void __iomem *base,
 static void qusb2_phy_override_phy_params(struct qusb2_phy *qphy)
 {
 	const struct qusb2_phy_cfg *cfg = qphy->cfg;
+	struct override_params *or = &qphy->overrides;
 
-	if (qphy->override_imp_res_offset)
+	if (or->imp_res_offset.override)
 		qusb2_write_mask(qphy->base, QUSB2PHY_IMP_CTRL1,
-			     qphy->imp_res_offset_value << IMP_RES_OFFSET_SHIFT,
+		or->imp_res_offset.value << IMP_RES_OFFSET_SHIFT,
 			     IMP_RES_OFFSET_MASK);
 
-	if (qphy->override_hstx_trim)
+	if (or->hstx_trim.override)
 		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
-				 qphy->hstx_trim_value << HSTX_TRIM_SHIFT,
+		or->hstx_trim.value << HSTX_TRIM_SHIFT,
 				 HSTX_TRIM_MASK);
 
-	if (qphy->override_preemphasis)
+	if (or->preemphasis.override)
 		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
-				qphy->preemphasis_level << PREEMPHASIS_EN_SHIFT,
+		or->preemphasis.value << PREEMPHASIS_EN_SHIFT,
 				PREEMPHASIS_EN_MASK);
 
-	if (qphy->override_preemphasis_width) {
-		if (qphy->preemphasis_width ==
+	if (or->preemphasis_width.override) {
+		if (or->preemphasis_width.value ==
 		    QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT)
 			qusb2_setbits(qphy->base,
 				      cfg->regs[QUSB2PHY_PORT_TUNE1],
@@ -796,10 +805,12 @@ static int qusb2_phy_probe(struct platform_device *pdev)
 	int ret, i;
 	int num;
 	u32 value;
+	struct override_params *or;
 
 	qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL);
 	if (!qphy)
 		return -ENOMEM;
+	or = &qphy->overrides;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	qphy->base = devm_ioremap_resource(dev, res);
@@ -864,26 +875,26 @@ static int qusb2_phy_probe(struct platform_device *pdev)
 
 	if (!of_property_read_u32(dev->of_node, "qcom,imp-res-offset-value",
 				  &value)) {
-		qphy->imp_res_offset_value = (u8)value;
-		qphy->override_imp_res_offset = true;
+		or->imp_res_offset.value = (u8)value;
+		or->imp_res_offset.override = true;
 	}
 
 	if (!of_property_read_u32(dev->of_node, "qcom,hstx-trim-value",
 				  &value)) {
-		qphy->hstx_trim_value = (u8)value;
-		qphy->override_hstx_trim = true;
+		or->hstx_trim.value = (u8)value;
+		or->hstx_trim.override = true;
 	}
 
 	if (!of_property_read_u32(dev->of_node, "qcom,preemphasis-level",
 				     &value)) {
-		qphy->preemphasis_level = (u8)value;
-		qphy->override_preemphasis = true;
+		or->preemphasis.value = (u8)value;
+		or->preemphasis.override = true;
 	}
 
 	if (!of_property_read_u32(dev->of_node, "qcom,preemphasis-width",
 				     &value)) {
-		qphy->preemphasis_width = (u8)value;
-		qphy->override_preemphasis_width = true;
+		or->preemphasis_width.value = (u8)value;
+		or->preemphasis_width.override = true;
 	}
 
 	pm_runtime_set_active(dev);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 6/9] phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (4 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 5/9] phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 7/9] arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible Sandeep Maheswaram
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Added support for overriding bias-ctrl-value,charge-ctrl-value and
hsdisc-trim-value params for QUSB2 V2 PHY

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 44841c9..3708d43 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -66,6 +66,14 @@
 #define IMP_RES_OFFSET_MASK			GENMASK(5, 0)
 #define IMP_RES_OFFSET_SHIFT			0x0
 
+/* QUSB2PHY_PLL_BIAS_CONTROL_2 register bits */
+#define BIAS_CTRL2_RES_OFFSET_MASK		GENMASK(5, 0)
+#define BIAS_CTRL2_RES_OFFSET_SHIFT		0x0
+
+/* QUSB2PHY_CHG_CONTROL_2 register bits */
+#define CHG_CTRL2_OFFSET_MASK			GENMASK(5, 4)
+#define CHG_CTRL2_OFFSET_SHIFT			0x4
+
 /* QUSB2PHY_PORT_TUNE1 register bits */
 #define HSTX_TRIM_MASK				GENMASK(7, 4)
 #define HSTX_TRIM_SHIFT				0x4
@@ -73,6 +81,10 @@
 #define PREEMPHASIS_EN_MASK			GENMASK(1, 0)
 #define PREEMPHASIS_EN_SHIFT			0x0
 
+/* QUSB2PHY_PORT_TUNE2 register bits */
+#define HSDISC_TRIM_MASK			GENMASK(1, 0)
+#define HSDISC_TRIM_SHIFT			0x0
+
 #define QUSB2PHY_PLL_ANALOG_CONTROLS_TWO	0x04
 #define QUSB2PHY_PLL_CLOCK_INVERTERS		0x18c
 #define QUSB2PHY_PLL_CMODE			0x2c
@@ -291,12 +303,18 @@ struct override_param {
  * @hstx_trim: HSTX_TRIM to be updated in TUNE1 register
  * @preemphasis: Amplitude Pre-Emphasis to be updated in TUNE1 register
  * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ * @bias_ctrl: bias ctrl to be updated in BIAS_CONTROL_2 register
+ * @charge_ctrl: charge ctrl to be updated in CHG_CTRL2 register
+ * @hsdisc_trim: disconnect threshold to be updated in TUNE2 register
  */
 struct override_params {
 	struct override_param imp_res_offset;
 	struct override_param hstx_trim;
 	struct override_param preemphasis;
 	struct override_param preemphasis_width;
+	struct override_param bias_ctrl;
+	struct override_param charge_ctrl;
+	struct override_param hsdisc_trim;
 };
 
 /**
@@ -409,6 +427,16 @@ static void qusb2_phy_override_phy_params(struct qusb2_phy *qphy)
 		or->imp_res_offset.value << IMP_RES_OFFSET_SHIFT,
 			     IMP_RES_OFFSET_MASK);
 
+	if (or->bias_ctrl.override)
+		qusb2_write_mask(qphy->base, QUSB2PHY_PLL_BIAS_CONTROL_2,
+		or->bias_ctrl.value << BIAS_CTRL2_RES_OFFSET_SHIFT,
+			   BIAS_CTRL2_RES_OFFSET_MASK);
+
+	if (or->charge_ctrl.override)
+		qusb2_write_mask(qphy->base, QUSB2PHY_CHG_CTRL2,
+		or->charge_ctrl.value << CHG_CTRL2_OFFSET_SHIFT,
+			     CHG_CTRL2_OFFSET_MASK);
+
 	if (or->hstx_trim.override)
 		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
 		or->hstx_trim.value << HSTX_TRIM_SHIFT,
@@ -430,6 +458,11 @@ static void qusb2_phy_override_phy_params(struct qusb2_phy *qphy)
 				      cfg->regs[QUSB2PHY_PORT_TUNE1],
 				      PREEMPH_WIDTH_HALF_BIT);
 	}
+
+	if (or->hsdisc_trim.override)
+		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2],
+		or->hsdisc_trim.value << HSDISC_TRIM_SHIFT,
+				 HSDISC_TRIM_MASK);
 }
 
 /*
@@ -879,6 +912,18 @@ static int qusb2_phy_probe(struct platform_device *pdev)
 		or->imp_res_offset.override = true;
 	}
 
+	if (!of_property_read_u32(dev->of_node, "qcom,bias-ctrl-value",
+				  &value)) {
+		or->bias_ctrl.value = (u8)value;
+		or->bias_ctrl.override = true;
+	}
+
+	if (!of_property_read_u32(dev->of_node, "qcom,charge-ctrl-value",
+				  &value)) {
+		or->charge_ctrl.value = (u8)value;
+		or->charge_ctrl.override = true;
+	}
+
 	if (!of_property_read_u32(dev->of_node, "qcom,hstx-trim-value",
 				  &value)) {
 		or->hstx_trim.value = (u8)value;
@@ -897,6 +942,12 @@ static int qusb2_phy_probe(struct platform_device *pdev)
 		or->preemphasis_width.override = true;
 	}
 
+	if (!of_property_read_u32(dev->of_node, "qcom,hsdisc-trim-value",
+				  &value)) {
+		or->hsdisc_trim.value = (u8)value;
+		or->hsdisc_trim.override = true;
+	}
+
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
 	/*
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 7/9] arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (5 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 6/9] phy: qcom-qusb2: Add new " Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09  9:53 ` [PATCH v5 8/9] arm64: dts: qcom: sdm845: " Sandeep Maheswaram
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Use generic QUSB2 V2 Phy configuration for SC7180.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 253274d..1d1e09d 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -1277,7 +1277,7 @@
 		};
 
 		usb_1_hsphy: phy@88e3000 {
-			compatible = "qcom,sc7180-qusb2-phy";
+			compatible = "qcom,sc7180-qusb2-phy", "qcom,qusb2-v2-phy";
 			reg = <0 0x088e3000 0 0x400>;
 			status = "disabled";
 			#phy-cells = <0>;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 8/9] arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (6 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 7/9] arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-04-06 23:48   ` Doug Anderson
  2020-03-09  9:53 ` [PATCH v5 9/9] arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP device Sandeep Maheswaram
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Use generic QUSB2 V2 Phy configuration for sdm845.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 061f49f..5ed51c0 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -2603,7 +2603,7 @@
 		};
 
 		usb_1_hsphy: phy@88e2000 {
-			compatible = "qcom,sdm845-qusb2-phy";
+			compatible = "qcom,sdm845-qusb2-phy", "qcom,qusb2-v2-phy";
 			reg = <0 0x088e2000 0 0x400>;
 			status = "disabled";
 			#phy-cells = <0>;
@@ -2618,7 +2618,7 @@
 		};
 
 		usb_2_hsphy: phy@88e3000 {
-			compatible = "qcom,sdm845-qusb2-phy";
+			compatible = "qcom,sdm845-qusb2-phy", "qcom,qusb2-v2-phy";
 			reg = <0 0x088e3000 0 0x400>;
 			status = "disabled";
 			#phy-cells = <0>;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH v5 9/9] arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP device
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (7 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 8/9] arm64: dts: qcom: sdm845: " Sandeep Maheswaram
@ 2020-03-09  9:53 ` Sandeep Maheswaram
  2020-03-09 19:29 ` [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Bjorn Andersson
  2020-03-20  6:05 ` Kishon Vijay Abraham I
  10 siblings, 0 replies; 26+ messages in thread
From: Sandeep Maheswaram @ 2020-03-09  9:53 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam, Sandeep Maheswaram

Overriding the QUSB2 V2 Phy tuning parameters for SC7180 IDP device.

Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 arch/arm64/boot/dts/qcom/sc7180-idp.dts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-idp.dts b/arch/arm64/boot/dts/qcom/sc7180-idp.dts
index 043c9b9..4dd8ebc 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-idp.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-idp.dts
@@ -310,9 +310,11 @@
 	vdda-pll-supply = <&vreg_l11a_1p8>;
 	vdda-phy-dpdm-supply = <&vreg_l17a_3p0>;
 	qcom,imp-res-offset-value = <8>;
-	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
-	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
+	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_15_PERCENT>;
 	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
+	qcom,bias-ctrl-value = <0x22>;
+	qcom,charge-ctrl-value = <3>;
+	qcom,hsdisc-trim-value = <0>;
 };
 
 &usb_1_qmpphy {
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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

* Re: [PATCH v5 0/9] Add QUSB2 PHY support for SC7180
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (8 preceding siblings ...)
  2020-03-09  9:53 ` [PATCH v5 9/9] arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP device Sandeep Maheswaram
@ 2020-03-09 19:29 ` Bjorn Andersson
  2020-03-20  6:05 ` Kishon Vijay Abraham I
  10 siblings, 0 replies; 26+ messages in thread
From: Bjorn Andersson @ 2020-03-09 19:29 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Sandeep Maheswaram, Andy Gross, Rob Herring, Mark Rutland,
	Stephen Boyd, Doug Anderson, Matthias Kaehlcke, linux-arm-msm,
	linux-kernel, devicetree, Manu Gautam

On Mon 09 Mar 02:53 PDT 2020, Sandeep Maheswaram wrote:

Kishon, let me know if/when you're picking up patch 1-6 and I can pick
the dts patches through the qcom soc tree.

Regards,
Bjorn

> Converting dt binding to yaml.
> Adding compatible for SC7180 in dt bindings.
> Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.
> 
> Changes in v5:
> *Added the dt bindings which are applicable only to QUSB2 V2 PHY in 
>  separate block as per comments from Matthias in patch 1/9 and patch 4/9
>  and addressed Rob's comment in patch 1/9.
> *Separated the patch for new override params and added a local variable
>  to access overrides as per comments from Matthias patch 5/9 and 6/9.
> 
> Changes in v4:
> *Addressed Rob Herrings comments in dt bindings.
> *Added new structure for all the overriding tuning params.
> *Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy. 
> *Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845. 
> 
> Changes in v3:
> *Using the generic phy cfg table for QUSB2 V2 phy.
> *Added support for overriding tuning parameters in QUSB2 V2 PHY
> from device tree.
> 
> Changes in v2:
> Sorted the compatible in driver.
> Converted dt binding to yaml.
> Added compatible in yaml.
> 
> Sandeep Maheswaram (9):
>   dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
>   dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
>     SC7180
>   phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
>   dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
>     parameters
>   phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
>     V2 PHY
>   phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
>   arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
>   arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
>   arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
>     device
> 
>  .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    | 187 +++++++++++++++++++++
>  .../devicetree/bindings/phy/qcom-qusb2-phy.txt     |  68 --------
>  arch/arm64/boot/dts/qcom/sc7180-idp.dts            |   6 +-
>  arch/arm64/boot/dts/qcom/sc7180.dtsi               |   2 +-
>  arch/arm64/boot/dts/qcom/sdm845.dtsi               |   4 +-
>  drivers/phy/qualcomm/phy-qcom-qusb2.c              | 144 +++++++++++-----
>  6 files changed, 297 insertions(+), 114 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
>  delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
> 
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> 

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

* Re: [PATCH v5 0/9] Add QUSB2 PHY support for SC7180
  2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
                   ` (9 preceding siblings ...)
  2020-03-09 19:29 ` [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Bjorn Andersson
@ 2020-03-20  6:05 ` Kishon Vijay Abraham I
  10 siblings, 0 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2020-03-20  6:05 UTC (permalink / raw)
  To: Sandeep Maheswaram, Andy Gross, Bjorn Andersson, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke
  Cc: linux-arm-msm, linux-kernel, devicetree, Manu Gautam

Hi,

On 3/9/2020 3:23 PM, Sandeep Maheswaram wrote:
> Converting dt binding to yaml.
> Adding compatible for SC7180 in dt bindings.
> Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.
> 
> Changes in v5:
> *Added the dt bindings which are applicable only to QUSB2 V2 PHY in 
>  separate block as per comments from Matthias in patch 1/9 and patch 4/9
>  and addressed Rob's comment in patch 1/9.
> *Separated the patch for new override params and added a local variable
>  to access overrides as per comments from Matthias patch 5/9 and 6/9.
> 
> Changes in v4:
> *Addressed Rob Herrings comments in dt bindings.
> *Added new structure for all the overriding tuning params.
> *Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy. 
> *Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845. 
> 
> Changes in v3:
> *Using the generic phy cfg table for QUSB2 V2 phy.
> *Added support for overriding tuning parameters in QUSB2 V2 PHY
> from device tree.
> 
> Changes in v2:
> Sorted the compatible in driver.
> Converted dt binding to yaml.
> Added compatible in yaml.
> 
> Sandeep Maheswaram (9):
>   dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
>   dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
>     SC7180
>   phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
>   dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
>     parameters
>   phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
>     V2 PHY
>   phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY

merged the above patches to phy -next.

Thanks
Kishon
>   arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
>   arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
>   arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
>     device
> 
>  .../devicetree/bindings/phy/qcom,qusb2-phy.yaml    | 187 +++++++++++++++++++++
>  .../devicetree/bindings/phy/qcom-qusb2-phy.txt     |  68 --------
>  arch/arm64/boot/dts/qcom/sc7180-idp.dts            |   6 +-
>  arch/arm64/boot/dts/qcom/sc7180.dtsi               |   2 +-
>  arch/arm64/boot/dts/qcom/sdm845.dtsi               |   4 +-
>  drivers/phy/qualcomm/phy-qcom-qusb2.c              | 144 +++++++++++-----
>  6 files changed, 297 insertions(+), 114 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
>  delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
> 

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

* Re: [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180
  2020-03-09  9:53 ` [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180 Sandeep Maheswaram
@ 2020-03-20 17:55   ` Rob Herring
  0 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2020-03-20 17:55 UTC (permalink / raw)
  To: Sandeep Maheswaram
  Cc: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke,
	linux-arm-msm, linux-kernel, devicetree, Manu Gautam,
	Sandeep Maheswaram

On Mon,  9 Mar 2020 15:23:02 +0530, Sandeep Maheswaram wrote:
> Add compatibles for generic QUSB2 V2 phy which can be used for
> sdm845 and sc7180.
> 
> Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
  2020-03-09  9:53 ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Sandeep Maheswaram
@ 2020-04-02 21:39   ` John Stultz
  2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
  2020-04-02 22:58     ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Doug Anderson
  0 siblings, 2 replies; 26+ messages in thread
From: John Stultz @ 2020-04-02 21:39 UTC (permalink / raw)
  To: Sandeep Maheswaram
  Cc: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Doug Anderson, Matthias Kaehlcke,
	linux-arm-msm, Linux Kernel Mailing List, devicetree,
	Manu Gautam, YongQin Liu

On Mon, Mar 9, 2020 at 2:54 AM Sandeep Maheswaram <sanm@codeaurora.org> wrote:
> @@ -774,8 +774,8 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
>                 .compatible     = "qcom,msm8998-qusb2-phy",
>                 .data           = &msm8998_phy_cfg,
>         }, {
> -               .compatible     = "qcom,sdm845-qusb2-phy",
> -               .data           = &sdm845_phy_cfg,
> +               .compatible     = "qcom,qusb2-v2-phy",
> +               .data           = &qusb2_v2_phy_cfg,
>         },
>         { },
>  };

Just as a heads up, Yongqin (cc'ed) reported this patch (now upstream)
seems to be causing trouble on the db845c.

It seems like its removing support for the "qcom,sdm845-qusb2-phy"
compatible string, which is documented:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml#n23

and already in use:
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845.dtsi#n2389

Should this instead have been an addition of the "qcom,qusb2-v2-phy",
line instead of replacing "qcom,sdm845-qusb2-phy"?

thanks
-john

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

* [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 21:39   ` John Stultz
@ 2020-04-02 22:37     ` John Stultz
  2020-04-02 22:56       ` Doug Anderson
                         ` (2 more replies)
  2020-04-02 22:58     ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Doug Anderson
  1 sibling, 3 replies; 26+ messages in thread
From: John Stultz @ 2020-04-02 22:37 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Andy Gross, Bjorn Andersson, Rob Herring,
	Mark Rutland, Doug Anderson, Manu Gautam, Sandeep Maheswaram,
	Matthias Kaehlcke, Stephen Boyd, Kishon Vijay Abraham I,
	linux-arm-msm, devicetree

In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
PHY support"), the change was made to add "qcom,qusb2-v2-phy"
as a generic compat string. However the change also removed
the "qcom,sdm845-qusb2-phy" compat string, which is documented
in the binding and already in use.

This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
which allows the driver to continue to work with existing dts
entries such as found on the db845c.

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Manu Gautam <mgautam@codeaurora.org>
Cc: Sandeep Maheswaram <sanm@codeaurora.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: devicetree@vger.kernel.org
Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 3708d43b7508..ab7941ce5d3a 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -815,6 +815,9 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 	}, {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
+	}, {
+		.compatible	= "qcom,sdm845-qusb2-phy",
+		.data		= &qusb2_v2_phy_cfg,
 	}, {
 		.compatible	= "qcom,qusb2-v2-phy",
 		.data		= &qusb2_v2_phy_cfg,
-- 
2.17.1


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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
@ 2020-04-02 22:56       ` Doug Anderson
  2020-04-02 23:08         ` John Stultz
  2020-04-02 23:18         ` Bjorn Andersson
  2020-04-02 23:01       ` Bjorn Andersson
  2020-04-02 23:44       ` [PATCH v2] " John Stultz
  2 siblings, 2 replies; 26+ messages in thread
From: Doug Anderson @ 2020-04-02 22:56 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Andy Gross, Bjorn Andersson, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi,

On Thu, Apr 2, 2020 at 3:37 PM John Stultz <john.stultz@linaro.org> wrote:
>
> In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> as a generic compat string. However the change also removed
> the "qcom,sdm845-qusb2-phy" compat string, which is documented
> in the binding and already in use.
>
> This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> which allows the driver to continue to work with existing dts
> entries such as found on the db845c.
>
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Manu Gautam <mgautam@codeaurora.org>
> Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
>  1 file changed, 3 insertions(+)

Do you have an out-of-tree dts file?  If not, I'd prefer that the fix
was for this patch to land instead:

https://lore.kernel.org/r/1583747589-17267-9-git-send-email-sanm@codeaurora.org

While we can land your patch if someone needs it for supporting an
out-of-tree dts, it gives people supporting future SoCs the idea that
they need to add themselves to this table too.  That's now discouraged
unless there's a specific quirk that needs to be handled just for this
SoC.

-Doug

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

* Re: [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
  2020-04-02 21:39   ` John Stultz
  2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
@ 2020-04-02 22:58     ` Doug Anderson
  1 sibling, 0 replies; 26+ messages in thread
From: Doug Anderson @ 2020-04-02 22:58 UTC (permalink / raw)
  To: John Stultz
  Cc: Sandeep Maheswaram, Andy Gross, Bjorn Andersson,
	Kishon Vijay Abraham I, Rob Herring, Mark Rutland, Stephen Boyd,
	Matthias Kaehlcke, linux-arm-msm, Linux Kernel Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Manu Gautam, YongQin Liu

Hi,

On Thu, Apr 2, 2020 at 2:39 PM John Stultz <john.stultz@linaro.org> wrote:
>
> On Mon, Mar 9, 2020 at 2:54 AM Sandeep Maheswaram <sanm@codeaurora.org> wrote:
> > @@ -774,8 +774,8 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
> >                 .compatible     = "qcom,msm8998-qusb2-phy",
> >                 .data           = &msm8998_phy_cfg,
> >         }, {
> > -               .compatible     = "qcom,sdm845-qusb2-phy",
> > -               .data           = &sdm845_phy_cfg,
> > +               .compatible     = "qcom,qusb2-v2-phy",
> > +               .data           = &qusb2_v2_phy_cfg,
> >         },
> >         { },
> >  };
>
> Just as a heads up, Yongqin (cc'ed) reported this patch (now upstream)
> seems to be causing trouble on the db845c.
>
> It seems like its removing support for the "qcom,sdm845-qusb2-phy"
> compatible string, which is documented:
>   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml#n23
>
> and already in use:
>    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845.dtsi#n2389
>
> Should this instead have been an addition of the "qcom,qusb2-v2-phy",
> line instead of replacing "qcom,sdm845-qusb2-phy"?

To avoid forking the discussion into two threads, I'll suggest that we
focus on keeping the discussion in reply to your newly proposed patch.
I've already replied there:

https://lore.kernel.org/r/CAD=FV=VGT75c4_ErQAJgNtcCd2Jzv0A2KpfEkS637GqOhamj9Q@mail.gmail.com

-Doug

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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
  2020-04-02 22:56       ` Doug Anderson
@ 2020-04-02 23:01       ` Bjorn Andersson
  2020-04-02 23:44       ` [PATCH v2] " John Stultz
  2 siblings, 0 replies; 26+ messages in thread
From: Bjorn Andersson @ 2020-04-02 23:01 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Andy Gross, Rob Herring, Mark Rutland, Doug Anderson,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm, devicetree

On Thu 02 Apr 15:37 PDT 2020, John Stultz wrote:

> In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> as a generic compat string. However the change also removed
> the "qcom,sdm845-qusb2-phy" compat string, which is documented
> in the binding and already in use.
> 
> This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> which allows the driver to continue to work with existing dts
> entries such as found on the db845c.
> 
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Manu Gautam <mgautam@codeaurora.org>
> Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> index 3708d43b7508..ab7941ce5d3a 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> @@ -815,6 +815,9 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
>  	}, {
>  		.compatible	= "qcom,msm8998-qusb2-phy",
>  		.data		= &msm8998_phy_cfg,
> +	}, {
> +		.compatible	= "qcom,sdm845-qusb2-phy",
> +		.data		= &qusb2_v2_phy_cfg,
>  	}, {
>  		.compatible	= "qcom,qusb2-v2-phy",
>  		.data		= &qusb2_v2_phy_cfg,
> -- 
> 2.17.1
> 

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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 22:56       ` Doug Anderson
@ 2020-04-02 23:08         ` John Stultz
  2020-04-02 23:19           ` Doug Anderson
  2020-04-02 23:18         ` Bjorn Andersson
  1 sibling, 1 reply; 26+ messages in thread
From: John Stultz @ 2020-04-02 23:08 UTC (permalink / raw)
  To: Doug Anderson
  Cc: lkml, Andy Gross, Bjorn Andersson, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Thu, Apr 2, 2020 at 3:56 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Thu, Apr 2, 2020 at 3:37 PM John Stultz <john.stultz@linaro.org> wrote:
> >
> > In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> > PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> > as a generic compat string. However the change also removed
> > the "qcom,sdm845-qusb2-phy" compat string, which is documented
> > in the binding and already in use.
> >
> > This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> > which allows the driver to continue to work with existing dts
> > entries such as found on the db845c.
> >
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Doug Anderson <dianders@chromium.org>
> > Cc: Manu Gautam <mgautam@codeaurora.org>
> > Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> > Cc: Matthias Kaehlcke <mka@chromium.org>
> > Cc: Stephen Boyd <swboyd@chromium.org>
> > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > Cc: linux-arm-msm@vger.kernel.org
> > Cc: devicetree@vger.kernel.org
> > Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> > Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > ---
> >  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
> >  1 file changed, 3 insertions(+)
>
> Do you have an out-of-tree dts file?  If not, I'd prefer that the fix
> was for this patch to land instead:
>
> https://lore.kernel.org/r/1583747589-17267-9-git-send-email-sanm@codeaurora.org

No, no out of tree dts.  The usage is already in tree:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845.dtsi#n2389


> While we can land your patch if someone needs it for supporting an
> out-of-tree dts, it gives people supporting future SoCs the idea that
> they need to add themselves to this table too.  That's now discouraged
> unless there's a specific quirk that needs to be handled just for this
> SoC.

My understanding with dts bindings is that they are effectively an
ABI. While maybe it makes sense to deprecate the
"qcom,sdm845-qusb2-phy" string in the Documentation to avoid new
users, I'd think we'd want to keep the support in the driver as we
aren't supposed to have tight coupling between the DTB and kernel (at
least for official bindings).

Granted, I've not gotten much experience with boards that were fully
upstream and thus didn't have an eternally evolving dts file that had
to be kept in sync with the kernel, so in practice either solution
does work for me, but in theory it seems like we should at least
pretend these things are stable. :)

thanks
-john

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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 22:56       ` Doug Anderson
  2020-04-02 23:08         ` John Stultz
@ 2020-04-02 23:18         ` Bjorn Andersson
  1 sibling, 0 replies; 26+ messages in thread
From: Bjorn Andersson @ 2020-04-02 23:18 UTC (permalink / raw)
  To: Doug Anderson
  Cc: John Stultz, lkml, Andy Gross, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Thu 02 Apr 15:56 PDT 2020, Doug Anderson wrote:

> Hi,
> 
> On Thu, Apr 2, 2020 at 3:37 PM John Stultz <john.stultz@linaro.org> wrote:
> >
> > In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> > PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> > as a generic compat string. However the change also removed
> > the "qcom,sdm845-qusb2-phy" compat string, which is documented
> > in the binding and already in use.
> >
> > This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> > which allows the driver to continue to work with existing dts
> > entries such as found on the db845c.
> >
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Doug Anderson <dianders@chromium.org>
> > Cc: Manu Gautam <mgautam@codeaurora.org>
> > Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> > Cc: Matthias Kaehlcke <mka@chromium.org>
> > Cc: Stephen Boyd <swboyd@chromium.org>
> > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > Cc: linux-arm-msm@vger.kernel.org
> > Cc: devicetree@vger.kernel.org
> > Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> > Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > ---
> >  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Do you have an out-of-tree dts file?  If not, I'd prefer that the fix
> was for this patch to land instead:
> 
> https://lore.kernel.org/r/1583747589-17267-9-git-send-email-sanm@codeaurora.org
> 
> While we can land your patch if someone needs it for supporting an
> out-of-tree dts, it gives people supporting future SoCs the idea that
> they need to add themselves to this table too.  That's now discouraged
> unless there's a specific quirk that needs to be handled just for this
> SoC.
> 

Afaict the compatible has been in use in the upstream sdm845.dtsi since
v4.20 and we do have an outspoken rule that we don't break backwards
compatibility with existing DTBs.

There are cases where it makes sense to break this rule, e.g. to fix
something that's clearly broken, but I don't see that this is such a
case.

Regards,
Bjorn

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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 23:08         ` John Stultz
@ 2020-04-02 23:19           ` Doug Anderson
  2020-04-02 23:54             ` John Stultz
  0 siblings, 1 reply; 26+ messages in thread
From: Doug Anderson @ 2020-04-02 23:19 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Andy Gross, Bjorn Andersson, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi,

On Thu, Apr 2, 2020 at 4:08 PM John Stultz <john.stultz@linaro.org> wrote:
>
> On Thu, Apr 2, 2020 at 3:56 PM Doug Anderson <dianders@chromium.org> wrote:
> >
> > Hi,
> >
> > On Thu, Apr 2, 2020 at 3:37 PM John Stultz <john.stultz@linaro.org> wrote:
> > >
> > > In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> > > PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> > > as a generic compat string. However the change also removed
> > > the "qcom,sdm845-qusb2-phy" compat string, which is documented
> > > in the binding and already in use.
> > >
> > > This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> > > which allows the driver to continue to work with existing dts
> > > entries such as found on the db845c.
> > >
> > > Cc: Andy Gross <agross@kernel.org>
> > > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > Cc: Rob Herring <robh+dt@kernel.org>
> > > Cc: Mark Rutland <mark.rutland@arm.com>
> > > Cc: Doug Anderson <dianders@chromium.org>
> > > Cc: Manu Gautam <mgautam@codeaurora.org>
> > > Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> > > Cc: Matthias Kaehlcke <mka@chromium.org>
> > > Cc: Stephen Boyd <swboyd@chromium.org>
> > > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > > Cc: linux-arm-msm@vger.kernel.org
> > > Cc: devicetree@vger.kernel.org
> > > Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> > > Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> > > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > > ---
> > >  drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> >
> > Do you have an out-of-tree dts file?  If not, I'd prefer that the fix
> > was for this patch to land instead:
> >
> > https://lore.kernel.org/r/1583747589-17267-9-git-send-email-sanm@codeaurora.org
>
> No, no out of tree dts.  The usage is already in tree:
>   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845.dtsi#n2389
>
>
> > While we can land your patch if someone needs it for supporting an
> > out-of-tree dts, it gives people supporting future SoCs the idea that
> > they need to add themselves to this table too.  That's now discouraged
> > unless there's a specific quirk that needs to be handled just for this
> > SoC.
>
> My understanding with dts bindings is that they are effectively an
> ABI. While maybe it makes sense to deprecate the
> "qcom,sdm845-qusb2-phy" string in the Documentation to avoid new
> users, I'd think we'd want to keep the support in the driver as we
> aren't supposed to have tight coupling between the DTB and kernel (at
> least for official bindings).

If nothing else if we're going to land your patch, can you at least
put a comment in there that says "only needed to support legacy device
trees that didn't include "qcom,qusb2-v2-phy" in the compatible
string.  Then the person who adds the next Qualcomm SoC will know not
to add themselves to the table too.


> Granted, I've not gotten much experience with boards that were fully
> upstream and thus didn't have an eternally evolving dts file that had
> to be kept in sync with the kernel, so in practice either solution
> does work for me, but in theory it seems like we should at least
> pretend these things are stable. :)

Yeah, I don't want to get into the whole stable ABI argument, but what
you say is the official word.  The bindings are supposed to be a
stable ABI and it's a good goal to strive for.

...but in reality most people are OK with it not being quite so stable
as long as it's not hurting anyone.  What should have happened here is
that the bindings and dts should have landed in one Linux version and
the driver change landed in the next Linux version.  Now we're stuck
with the breakage, though.  :(  In general for "new" architectures
it's considered more OK to break compatibility, though I guess you can
argue whether sdm845 is really new enough.  I guess to get at the meat
of the issue though: if you need a patch to fix your problem anyway,
why not land the patch that doesn't end up chewing extra up extra code
space and providing a bad example for someone to copy?

Now certainly if changing your DTS was an undue burden (like you've
already baked device trees into firmware) there's no question we
should land your patch.  I'm just not sure the lofty goal of "it's
supposed to be a stable ABI so let's add an entry to the table that
nobody will ever care about after the dts change lands" is enough of a
reason to land it now.

OK, I'll duck from the tomatoes now.

-Doug

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

* [PATCH v2] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
  2020-04-02 22:56       ` Doug Anderson
  2020-04-02 23:01       ` Bjorn Andersson
@ 2020-04-02 23:44       ` John Stultz
  2020-04-02 23:49         ` Doug Anderson
  2020-04-08  2:56         ` Stephen Boyd
  2 siblings, 2 replies; 26+ messages in thread
From: John Stultz @ 2020-04-02 23:44 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Andy Gross, Bjorn Andersson, Rob Herring,
	Mark Rutland, Doug Anderson, Manu Gautam, Sandeep Maheswaram,
	Matthias Kaehlcke, Stephen Boyd, Kishon Vijay Abraham I,
	linux-arm-msm, devicetree

In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
PHY support"), the change was made to add "qcom,qusb2-v2-phy"
as a generic compat string. However the change also removed
the "qcom,sdm845-qusb2-phy" compat string, which is documented
in the binding and already in use.

This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
which allows the driver to continue to work with existing dts
entries such as found on the db845c.

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Manu Gautam <mgautam@codeaurora.org>
Cc: Sandeep Maheswaram <sanm@codeaurora.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: devicetree@vger.kernel.org
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Add deprecation note on "qcom,sdm845-qusb2-phy" string
    as suggested by Doug.
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 3708d43b7508..393011a05b48 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -815,6 +815,13 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 	}, {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
+	}, {
+		/*
+		 * Deprecated. Only here to support legacy device
+		 * trees that didn't include "qcom,qusb2-v2-phy"
+		 */
+		.compatible	= "qcom,sdm845-qusb2-phy",
+		.data		= &qusb2_v2_phy_cfg,
 	}, {
 		.compatible	= "qcom,qusb2-v2-phy",
 		.data		= &qusb2_v2_phy_cfg,
-- 
2.17.1


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

* Re: [PATCH v2] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 23:44       ` [PATCH v2] " John Stultz
@ 2020-04-02 23:49         ` Doug Anderson
  2020-04-08  2:56         ` Stephen Boyd
  1 sibling, 0 replies; 26+ messages in thread
From: Doug Anderson @ 2020-04-02 23:49 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Andy Gross, Bjorn Andersson, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi,

On Thu, Apr 2, 2020 at 4:45 PM John Stultz <john.stultz@linaro.org> wrote:
>
> In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> as a generic compat string. However the change also removed
> the "qcom,sdm845-qusb2-phy" compat string, which is documented
> in the binding and already in use.
>
> This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> which allows the driver to continue to work with existing dts
> entries such as found on the db845c.
>
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Manu Gautam <mgautam@codeaurora.org>
> Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> v2: Add deprecation note on "qcom,sdm845-qusb2-phy" string
>     as suggested by Doug.
> ---
>  drivers/phy/qualcomm/phy-qcom-qusb2.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> index 3708d43b7508..393011a05b48 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> @@ -815,6 +815,13 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
>         }, {
>                 .compatible     = "qcom,msm8998-qusb2-phy",
>                 .data           = &msm8998_phy_cfg,
> +       }, {
> +               /*
> +                * Deprecated. Only here to support legacy device
> +                * trees that didn't include "qcom,qusb2-v2-phy"
> +                */
> +               .compatible     = "qcom,sdm845-qusb2-phy",
> +               .data           = &qusb2_v2_phy_cfg,

Thanks for adding the comment.  With that, I'll still grumble but I'm
OK with this if people really want it.

Reviewed-by: Douglas Anderson <dianders@chromium.org>

-Doug

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

* Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 23:19           ` Doug Anderson
@ 2020-04-02 23:54             ` John Stultz
  0 siblings, 0 replies; 26+ messages in thread
From: John Stultz @ 2020-04-02 23:54 UTC (permalink / raw)
  To: Doug Anderson
  Cc: lkml, Andy Gross, Bjorn Andersson, Rob Herring, Mark Rutland,
	Manu Gautam, Sandeep Maheswaram, Matthias Kaehlcke, Stephen Boyd,
	Kishon Vijay Abraham I, linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Thu, Apr 2, 2020 at 4:19 PM Doug Anderson <dianders@chromium.org> wrote:
> On Thu, Apr 2, 2020 at 4:08 PM John Stultz <john.stultz@linaro.org> wrote:
> > My understanding with dts bindings is that they are effectively an
> > ABI. While maybe it makes sense to deprecate the
> > "qcom,sdm845-qusb2-phy" string in the Documentation to avoid new
> > users, I'd think we'd want to keep the support in the driver as we
> > aren't supposed to have tight coupling between the DTB and kernel (at
> > least for official bindings).
>
> If nothing else if we're going to land your patch, can you at least
> put a comment in there that says "only needed to support legacy device
> trees that didn't include "qcom,qusb2-v2-phy" in the compatible
> string.  Then the person who adds the next Qualcomm SoC will know not
> to add themselves to the table too.

Done.


> > Granted, I've not gotten much experience with boards that were fully
> > upstream and thus didn't have an eternally evolving dts file that had
> > to be kept in sync with the kernel, so in practice either solution
> > does work for me, but in theory it seems like we should at least
> > pretend these things are stable. :)
>
> Yeah, I don't want to get into the whole stable ABI argument, but what
> you say is the official word.  The bindings are supposed to be a
> stable ABI and it's a good goal to strive for.
>
> ...but in reality most people are OK with it not being quite so stable
> as long as it's not hurting anyone.  What should have happened here is
> that the bindings and dts should have landed in one Linux version and
> the driver change landed in the next Linux version.  Now we're stuck
> with the breakage, though.  :(  In general for "new" architectures
> it's considered more OK to break compatibility, though I guess you can
> argue whether sdm845 is really new enough.  I guess to get at the meat
> of the issue though: if you need a patch to fix your problem anyway,
> why not land the patch that doesn't end up chewing extra up extra code
> space and providing a bad example for someone to copy?
>
> Now certainly if changing your DTS was an undue burden (like you've
> already baked device trees into firmware) there's no question we
> should land your patch.  I'm just not sure the lofty goal of "it's
> supposed to be a stable ABI so let's add an entry to the table that
> nobody will ever care about after the dts change lands" is enough of a
> reason to land it now.

Personally, I'm fine with either solution (as there's still dts
changes for db845c pending that we're carrying), but I also want to
make sure we're setting a good standard for future changes (as these
sorts of things seem to bite me far too frequently on the db845c,
sometimes even resulting in forced userland changes that we've so far
been able to adapt to, but are not ideal).

So I've resubmitted my version to let the maintainers decide.  :)

thanks
-john

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

* Re: [PATCH v5 8/9] arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
  2020-03-09  9:53 ` [PATCH v5 8/9] arm64: dts: qcom: sdm845: " Sandeep Maheswaram
@ 2020-04-06 23:48   ` Doug Anderson
  0 siblings, 0 replies; 26+ messages in thread
From: Doug Anderson @ 2020-04-06 23:48 UTC (permalink / raw)
  To: Sandeep Maheswaram
  Cc: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Rob Herring,
	Mark Rutland, Stephen Boyd, Matthias Kaehlcke, linux-arm-msm,
	LKML, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Manu Gautam, John Stultz

Hi,

On Mon, Mar 9, 2020 at 2:54 AM Sandeep Maheswaram <sanm@codeaurora.org> wrote:
>
> Use generic QUSB2 V2 Phy configuration for sdm845.
>
> Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Wouldn't hurt to add:

Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")

...in case this lands before the patch John Stultz sent out and thus
makes it to stable faster.

-Doug

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

* Re: [PATCH v2] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
  2020-04-02 23:44       ` [PATCH v2] " John Stultz
  2020-04-02 23:49         ` Doug Anderson
@ 2020-04-08  2:56         ` Stephen Boyd
  1 sibling, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2020-04-08  2:56 UTC (permalink / raw)
  To: John Stultz, lkml
  Cc: John Stultz, Andy Gross, Bjorn Andersson, Rob Herring,
	Mark Rutland, Doug Anderson, Manu Gautam, Sandeep Maheswaram,
	Matthias Kaehlcke, Kishon Vijay Abraham I, linux-arm-msm,
	devicetree

Quoting John Stultz (2020-04-02 16:44:55)
> In commit 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2
> PHY support"), the change was made to add "qcom,qusb2-v2-phy"
> as a generic compat string. However the change also removed
> the "qcom,sdm845-qusb2-phy" compat string, which is documented
> in the binding and already in use.
> 
> This patch re-adds the "qcom,sdm845-qusb2-phy" compat string
> which allows the driver to continue to work with existing dts
> entries such as found on the db845c.
> 
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Manu Gautam <mgautam@codeaurora.org>
> Cc: Sandeep Maheswaram <sanm@codeaurora.org>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Fixes: 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")
> Reported-by: YongQin Liu <yongqin.liu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

Might be worth it sending it outside of this thread in case it's missed.

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

end of thread, other threads:[~2020-04-08  2:56 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09  9:53 [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 1/9] dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180 Sandeep Maheswaram
2020-03-20 17:55   ` Rob Herring
2020-03-09  9:53 ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Sandeep Maheswaram
2020-04-02 21:39   ` John Stultz
2020-04-02 22:37     ` [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string John Stultz
2020-04-02 22:56       ` Doug Anderson
2020-04-02 23:08         ` John Stultz
2020-04-02 23:19           ` Doug Anderson
2020-04-02 23:54             ` John Stultz
2020-04-02 23:18         ` Bjorn Andersson
2020-04-02 23:01       ` Bjorn Andersson
2020-04-02 23:44       ` [PATCH v2] " John Stultz
2020-04-02 23:49         ` Doug Anderson
2020-04-08  2:56         ` Stephen Boyd
2020-04-02 22:58     ` [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support Doug Anderson
2020-03-09  9:53 ` [PATCH v5 4/9] dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning parameters Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 5/9] phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 6/9] phy: qcom-qusb2: Add new " Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 7/9] arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible Sandeep Maheswaram
2020-03-09  9:53 ` [PATCH v5 8/9] arm64: dts: qcom: sdm845: " Sandeep Maheswaram
2020-04-06 23:48   ` Doug Anderson
2020-03-09  9:53 ` [PATCH v5 9/9] arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP device Sandeep Maheswaram
2020-03-09 19:29 ` [PATCH v5 0/9] Add QUSB2 PHY support for SC7180 Bjorn Andersson
2020-03-20  6:05 ` Kishon Vijay Abraham I

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.