Add QUSB2 PHY support for SC7180
Subsystems (5)
v5 cover Add QUSB2 PHY support for SC7180
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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 1/9 dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
Convert QUSB2 phy bindings to DT schema format using json-schema.
--- .../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
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml new file +149 -0
@@ -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 <[email protected]> + +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>; + };
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt deleted +0 -68
68 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 2/9 dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180
In reply to Sandeep MaheswaramAdd compatibles for generic QUSB2 V2 phy which can be used for sdm845 and sc7180.
--- Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml +10 -4
@@ -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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v5 2/9] dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and SC7180
Quoted 10 lines · Sandeep Maheswaram
Add compatibles for generic QUSB2 V2 phy which can be used for sdm845 and sc7180.
Signed-off-by Sandeep Maheswaram <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>Reviewed-by Stephen Boyd <[email protected]>--- Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
PATCH v5 3/9 phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
In reply to Sandeep MaheswaramAdd generic QUSB2 V2 PHY table so the respective phys can use the same table.
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +9 -9
@@ -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, }, { }, };
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
drivers/phy/qualcomm/phy-qcom-qusb2.c static const struct of_device_id qusb2_phy_of_match_table[] = { · line 781
Quoted 11 lines · Sandeep Maheswaram
drivers/phy/qualcomm/phy-qcom-qusb2.c +2
-2@@ -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
PATCH 1/1 phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
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.
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +3 -0
@@ -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,
Signature · 1 line
2.17.1
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
Hi,
Quoted 26 lines · John Stultz
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>
Quoted 3 lines
--- 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/[email protected]
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
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
Quoted 34 lines · Doug Anderson
Hi,
Quoted 26 lines · John Stultz
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>Quoted 3 lines
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 4 lines
Do you have an out-of-tree dts file? If not, I'd prefer that the fix was for this patch to land instead:
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
Quoted 5 lines
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
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
Hi,
Quoted 51 lines · John Stultz
Quoted 34 lines · Doug Anderson
Hi,
Quoted 26 lines · John Stultz
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>Quoted 3 lines
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 4 lines
Do you have an out-of-tree dts file? If not, I'd prefer that the fix was for this patch to land instead:
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#n2389Quoted 5 lines
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.
Quoted 6 lines
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.
Quoted 5 lines
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
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
Quoted 8 lines · Doug Anderson
Quoted 6 lines · John Stultz
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).
Quoted 5 lines
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.
Quoted 21 lines
Quoted 5 lines
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?
Quoted 6 lines
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
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
In reply to Doug AndersonQuoted 36 lines · Doug Anderson
Hi,
Quoted 26 lines · John Stultz
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>Quoted 3 lines
--- 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:
Quoted 8 lines
https://lore.kernel.org/r/[email protected]
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
Re: [PATCH] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
In reply to John StultzQuoted 10 lines · John Stultz
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.
Quoted 15 lines
Cc Andy Gross <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>
Regards,
Bjorn
Quoted 21 lines
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 3 +++ 1 file changed, 3 insertions(+)drivers/phy/qualcomm/phy-qcom-qusb2.c +3
-0@@ -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,Signature · 1 line
2.17.1
PATCH v2 1/1 phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
In reply to John StultzIn 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.
---
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(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +7 -0
@@ -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,
Signature · 1 line
2.17.1
Re: [PATCH v2] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
Hi,
Quoted 39 lines · John Stultz
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>---
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(+)drivers/phy/qualcomm/phy-qcom-qusb2.c +0
-0
drivers/phy/qualcomm/phy-qcom-qusb2.c static const struct of_device_id qusb2_phy_of_match_table[] = { · line 824
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qusb2.c +7
-0@@ -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.
-Doug
Re: [PATCH v2] phy: qcom-qusb2: Re add "qcom,sdm845-qusb2-phy" compat string
In reply to John StultzQuoting John Stultz (2020-04-02 16:44:55)
Quoted 26 lines
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 <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Doug Anderson <[email protected]>Cc Manu Gautam <[email protected]>Cc Sandeep Maheswaram <[email protected]>Cc Matthias Kaehlcke <[email protected]>Cc Stephen Boyd <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>Fixes 8fe75cd4cddf ("phy: qcom-qusb2: Add generic QUSB2 V2 PHY support")Reported-by YongQin Liu <[email protected]>Signed-off-by John Stultz <[email protected]>
Quoted 1 line
---
Might be worth it sending it outside of this thread in case it's missed.
Re: [PATCH v5 3/9] phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
In reply to John StultzHi,
Quoted 21 lines · John Stultz
drivers/phy/qualcomm/phy-qcom-qusb2.c static const struct of_device_id qusb2_phy_of_match_table[] = { · line 781
Quoted 11 lines · Sandeep Maheswaram
drivers/phy/qualcomm/phy-qcom-qusb2.c +2
-2@@ -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
Quoted 5 lines
and already in use:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845.dtsi#n2389Should 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
PATCH v5 4/9 dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning parameters
In reply to Sandeep MaheswaramAdd support for overriding QUSB2 V2 phy tuning parameters in device tree bindings.
--- .../devicetree/bindings/phy/qcom,qusb2-phy.yaml | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml +31 -1
@@ -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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 5/9 phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY
In reply to Sandeep MaheswaramAdded 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.
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 75 ++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 32 deletions(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +43 -32
@@ -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);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 6/9 phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
In reply to Sandeep MaheswaramAdded support for overriding bias-ctrl-value,charge-ctrl-value and hsdisc-trim-value params for QUSB2 V2 PHY
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +51 -0
@@ -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);/*
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 7/9 arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
In reply to Sandeep MaheswaramUse generic QUSB2 V2 Phy configuration for SC7180.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +1 -1
@@ -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>;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v5 8/9 arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
In reply to Sandeep MaheswaramUse generic QUSB2 V2 Phy configuration for sdm845.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +2 -2
@@ -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>;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v5 8/9] arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
Hi,
Quoted 9 lines · Sandeep Maheswaram
Use generic QUSB2 V2 Phy configuration for sdm845.
Signed-off-by Sandeep Maheswaram <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>Reviewed-by Stephen Boyd <[email protected]>--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Wouldn't hurt to add:
...in case this lands before the patch John Stultz sent out and thus makes it to stable faster.
-Doug
PATCH v5 9/9 arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP device
In reply to Sandeep MaheswaramOverriding the QUSB2 V2 Phy tuning parameters for SC7180 IDP device.
--- arch/arm64/boot/dts/qcom/sc7180-idp.dts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7180-idp.dts +4 -2
@@ -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 {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
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
Quoted 56 lines
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 andSC7180phy: 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.txtSignature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Hi,
Quoted 30 lines · 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
Quoted 7 lines
SC7180phy: 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
Quoted 15 lines
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