phy: qcom-qmp-combo: fix sc8280xp binding (set 3/3)
cover phy: qcom-qmp-combo: fix sc8280xp binding (set 3/3)
This series fixes the USB-DP PHY devicetree binding for SC8280XP and adds support for the new updated binding to the driver.
As the full series including the preparatory parts is over forty patches and I've been posting this in three parts of which this is the last one. In an effort to get all of these into 6.2, I've also submitted all three series before waiting for the previous ones to be applied. Parts one and two can be found here:
https://lore.kernel.org/lkml/[email protected]/ https://lore.kernel.org/lkml/[email protected]/
This last series adds a new binding for SC8280XP that drops the legacy child node and the (incomplete) description of register subregions.
As the current bindings are both incomplete and incorrect it may be a good idea to update also the other platforms currently supported by this driver to the new binding scheme. The driver can support both schemes during a transitions period before removing the corresponding code (dt parsing and clock-provider registration).
Johan
Johan Hovold (14):
dt-bindings: phy: qcom,qmp-usb3-dp: rename current bindings
dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
phy: qcom-qmp-combo: drop v4 reference-clock source
phy: qcom-qmp-combo: restructure PHY creation
phy: qcom-qmp-combo: register clocks sooner
phy: qcom-qmp-combo: generate pipe clock name
phy: qcom-qmp-combo: drop redundant clock structure
phy: qcom-qmp-combo: drop redundant clock allocation
phy: qcom-qmp-combo: add clock registration helper
phy: qcom-qmp-combo: separate clock and provider registration
phy: qcom-qmp-combo: clean up DP clock callbacks
phy: qcom-qmp-combo: rename common-register pointers
phy: qcom-qmp-combo: rename DP_PHY register pointer
phy: qcom-qmp-combo: add support for updated sc8280xp binding
....yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} | 23 +-
.../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 111 ++++
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 532 +++++++++++-------
3 files changed, 441 insertions(+), 225 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb3-dp-phy.yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} (92%)
create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yamlSignature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 1/14 dt-bindings: phy: qcom,qmp-usb3-dp: rename current bindings
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS_LANE registers).
In preparation for adding new bindings for SC8280XP which further bindings can be based on, rename the current schema file after SC7180, which was the first supported platform, and add a reference to the SC8280XP bindings.
---
...3-dp-phy.yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb3-dp-phy.yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} (92%)Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml renamed from Documentation/devicetree/bindings/phy/qcom,qmp-usb3-dp-phy.yaml +9 -2
@@ -2,10 +2,17 @@ %YAML 1.2 --- -$id: "http://devicetree.org/schemas/phy/qcom,qmp-usb3-dp-phy.yaml#" +$id: "http://devicetree.org/schemas/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml#" $schema: "http://devicetree.org/meta-schemas/core.yaml#" -title: Qualcomm QMP USB3 DP PHY controller +title: Qualcomm QMP USB3 DP PHY controller (SC7180) + +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + Note that these bindings are for SoCs up to SC8180X. For newer SoCs, see + qcom,sc8280xp-qmp-usb43dp-phy.yaml. maintainers: - Wesley Cheng <[email protected]>
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 01/14] dt-bindings: phy: qcom,qmp-usb3-dp: rename current bindings
Quoted 39 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the
PCS_LANEregisters).In preparation for adding new bindings for SC8280XP which further bindings can be based on, rename the current schema file after SC7180, which was the first supported platform, and add a reference to the SC8280XP bindings.
Signed-off-by Johan Hovold <[email protected]>--- ...3-dp-phy.yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb3-dp-phy.yaml => qcom,sc7180-qmp-usb3-dp-phy.yaml} (92%)Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml renamed from Documentation/devicetree/bindings/phy/qcom,qmp-usb3-dp-phy.yaml +0
-0
Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml line 6
Quoted 6 lines
Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml renamed from Documentation/devicetree/bindings/phy/qcom,qmp-usb3-dp-phy.yaml +1
-1@@ -2,10 +2,17 @@ %YAML 1.2 --- -$id: "http://devicetree.org/schemas/phy/qcom,qmp-usb3-dp-phy.yaml#" +$id: "http://devicetree.org/schemas/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml#" $schema: "http://devicetree.org/meta-schemas/core.yaml#"
Since you are touching one line here, maybe let's drop the quotes from both of them?
In any case:
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 2/14 dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
In reply to Johan HovoldThe current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS LANE registers).
This is specifically true for later USB4-USB3-DP QMP PHYs where the TX registers are used by both the USB3 and DP parts of the PHY (and where the USB4 part of the PHY was not covered by the binding at all). Notably there are also no DP "RX" (sic) registers as described by the current bindings and the DP "PCS" region is really a set of DP_PHY registers.
Add a new binding for the USB4-USB3-DP QMP PHYs found on SC8280XP which further bindings can be based on.
Note that the binding uses a PHY type index to access either the USB3 or DP part of the PHY and that this can later be used also for the USB4 part if needed.
Similarly, the clock inputs and outputs can later be extended to support USB4.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and would not allow for supporting DP mode.
--- .../phy/qcom,sc7180-qmp-usb3-dp-phy.yaml | 12 -- .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml
Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml +0 -12
@@ -23,7 +23,6 @@ properties: - qcom,sc7180-qmp-usb3-dp-phy - qcom,sc7280-qmp-usb3-dp-phy - qcom,sc8180x-qmp-usb3-dp-phy - - qcom,sc8280xp-qmp-usb43dp-phy - qcom,sdm845-qmp-usb3-dp-phy - qcom,sm8250-qmp-usb3-dp-phy reg:
@@ -169,17 +168,6 @@ required: additionalProperties: false -allOf: - - if: - properties: - compatible: - contains: - enum: - - qcom,sc8280xp-qmp-usb43dp-phy - then: - required: - - power-domains - examples: - | #include <dt-bindings/clock/qcom,gcc-sdm845.h>
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +111 -0
111 lines not on this page · raw message
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 10 lines · Johan Hovold
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +7
-0@@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm QMP USB4-USB3-DP PHY controller (SC8280XP)
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 17
Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ +maintainers: + - Vinod Koul <[email protected]> + +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + See also: + - include/dt-bindings/dt-bindings/phy/phy.h
This trips up the binding checker which I failed to rerun after adding this reference.
Apparently I missed adding a literal block marker '|' to the description. Will add in v2.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
In reply to Johan HovoldQuoted 40 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS LANE registers).
This is specifically true for later USB4-USB3-DP QMP PHYs where the TX registers are used by both the USB3 and DP parts of the PHY (and where the USB4 part of the PHY was not covered by the binding at all). Notably there are also no DP "RX" (sic) registers as described by the current bindings and the DP "PCS" region is really a set of
DP_PHYregisters.Add a new binding for the USB4-USB3-DP QMP PHYs found on SC8280XP which further bindings can be based on.
Note that the binding uses a PHY type index to access either the USB3 or DP part of the PHY and that this can later be used also for the USB4 part if needed.
Similarly, the clock inputs and outputs can later be extended to support USB4.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and would not allow for supporting DP mode.
Quoted 7 lines
Signed-off-by Johan Hovold <[email protected]>--- .../phy/qcom,sc7180-qmp-usb3-dp-phy.yaml | 12 -- .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml:16:11: [error] syntax error: mapping values are not allowed here (syntax)
dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.example.dts' Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml:16:11: mapping values are not allowed here
make[1]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.example.dts] Error 1 make[1]: *** Waiting for unfinished jobs.... ./Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml:16:11: mapping values are not allowed here /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml: ignoring, error parsing file
make: *** [Makefile:1492: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
In reply to Johan HovoldQuoted 4 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 10
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +3
-0+ +maintainers: + - Vinod Koul <[email protected]>
Maybe you want to add also yourself?
Quoted 39 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +39
-0+ +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + See also: + - include/dt-bindings/dt-bindings/phy/phy.h + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-usb43dp-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: ref + - const: com_aux + - const: usb3_pipe + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy + - const: common + + vdda-phy-supply: true +
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ vdda-pll-supply: true + + "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_div
Why defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 10
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +3
-0+ +maintainers: + - Vinod Koul <[email protected]>Maybe you want to add also yourself?
Due to the lack of public documentation for these platforms and the amount of work involved in effectively reverse-engineering the corresponding details from random vendor-kernel trees, it's probably best to leave maintainence with Vinod who at least has access to some documentation.
Quoted 46 lines
Quoted 46 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +46
-0+ +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + See also: + - include/dt-bindings/dt-bindings/phy/phy.h + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-usb43dp-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: ref + - const: com_aux + - const: usb3_pipe + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy + - const: common + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#clock-cells": + const: 1 + + clock-output-names: + items:
Quoted 8 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +3
-0+ - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
I'm only using these names as documentation of the indexes. The driver doesn't use these names, but that's a Linux-specific implementation detail.
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
On the other hand reproducing this list in each node is admittedly a bit redundant.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
Note that for SC8280XP this list may later get extended with clocks for USB4 (once we understand how to use them), but those would not apply to the older USB3-DP PHYs, so we'd still need to describe that in the binding somehow.
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 77 lines · Johan Hovold
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 10
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +3
-0+ +maintainers: + - Vinod Koul <[email protected]>Maybe you want to add also yourself?
Due to the lack of public documentation for these platforms and the amount of work involved in effectively reverse-engineering the corresponding details from random vendor-kernel trees, it's probably best to leave maintainence with Vinod who at least has access to some documentation.
Quoted 46 lines
Quoted 46 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +46
-0+ +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + See also: + - include/dt-bindings/dt-bindings/phy/phy.h + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-usb43dp-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: ref + - const: com_aux + - const: usb3_pipe + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy + - const: common + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#clock-cells": + const: 1 + + clock-output-names: + items:Quoted 8 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +3
-0+ - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Quoted 1 line
I'm only using these names as documentation of the indexes. The driver
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
Quoted 8 lines
doesn't use these names, but that's a Linux-specific implementation detail.
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Headers for the names? I do not recall such but that does not seem right.
Quoted 9 lines
On the other hand reproducing this list in each node is admittedly a bit redundant.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
Quoted 4 lines
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
What are these about? To remind - we talk about names of clocks this device creates. The output names. Whatever IDs you have are not related to the names.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Johan Hovold
Quoted 18 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 12 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +8
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Quoted 4 lines
Quoted 1 line
I'm only using these names as documentation of the indexes. The driver
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
I'm using this property as documentation of the valid indexes that can be used when referring to clocks provided by this device.
There are currently three and the mapping is described by the 'clock-output-names' property.
Quoted 10 lines
Quoted 8 lines
doesn't use these names, but that's a Linux-specific implementation detail.
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Headers for the names? I do not recall such but that does not seem right.
Headers for the indexes.
Quoted 9 lines
Quoted 9 lines
On the other hand reproducing this list in each node is admittedly a bit redundant.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
Quoted 8 lines
Quoted 4 lines
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2What are these about? To remind - we talk about names of clocks this device creates. The output names. Whatever IDs you have are not related to the names.
As I mentioned above, this is not about the names that Linux gives to its representation of these clocks. Its just about defining the valid indexes in the binding.
If you think that that using 'clock-output-names' for this is a bit too unconventional, I can add back the header with defines like the above instead.
Note that the clock schema has:
clock-output-names:
description: |
Recommended to be a list of strings of clock output signal names indexed by the first cell in the clock specifier. However, the meaning of clock-output-names is domain specific to the clock provider, ...
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 42 lines · Johan Hovold
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Johan Hovold
Quoted 18 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 12 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +8
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Quoted 4 lines
Quoted 1 line
I'm only using these names as documentation of the indexes. The driver
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
I'm using this property as documentation of the valid indexes that can be used when referring to clocks provided by this device.
There are currently three and the mapping is described by the 'clock-output-names' property.
Quoted 9 lines
Quoted 8 lines
doesn't use these names, but that's a Linux-specific implementation detail.
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Quoted 17 lines
Quoted 1 line
Headers for the names? I do not recall such but that does not seem right.
Headers for the indexes.
Quoted 13 lines
Quoted 13 lines
On the other hand reproducing this list in each node is admittedly a bit redundant.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
Maybe QMP_COMBO_USB3_PIPE_CLK, QMP_COMBO_DP_LINK_CLK, QMP_COMBO_DP_VCO_DIV_CLK?
I'll then extend this header with QMP_UFS_RX_SYMBOL_0_CLK QMP_UFS_RX_SYMBOL_1_CLK and QMP_UFS_TX_SYMBOL_0_CLK.
Quoted 23 lines
Quoted 4 lines
What are these about? To remind - we talk about names of clocks this device creates. The output names. Whatever IDs you have are not related to the names.
As I mentioned above, this is not about the names that Linux gives to its representation of these clocks. Its just about defining the valid indexes in the binding.
If you think that that using 'clock-output-names' for this is a bit too unconventional, I can add back the header with defines like the above instead.
Note that the clock schema has:
clock-output-names:
description: |
Recommended to be a list of strings of clock output signal names indexed by the first cell in the clock specifier. However, the meaning of clock-output-names is domain specific to the clock provider, ...Johan
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Johan Hovold
Quoted 1 line · Krzysztof Kozlowski
On 11/11/2022 10:24, Johan Hovold wrote:
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2Maybe
QMP_COMBO_USB3_PIPE_CLK,QMP_COMBO_DP_LINK_CLK,QMP_COMBO_DP_VCO_DIV_CLK?
"COMBO" is just the name of the Linux driver and does not belong in the binding.
Quoted 2 lines
I'll then extend this header with
QMP_UFS_RX_SYMBOL_0_CLKQMP_UFS_RX_SYMBOL_1_CLKandQMP_UFS_TX_SYMBOL_0_CLK.
Yeah, I had those in mind when creating the header and using a generic QMP prefix (even if I didn't end up using the header in v1).
This could just be mapping of (arbitrary) QMP indexes to clocks and we use it for USB3, DP, UFS and later also USB4.
This will however mean that the indexes are not necessarily zero-based and consecutive for a specific SoC and PHY. But that's perhaps a non-issue (cf. the PHY_TYPE defines).
We'd still need to describe which clocks are available on a particular SoC and PHY, and that's partly why I used 'clock-output-names' to fix the mapping in the binding. Guess we can just list the valid defines in the property description as I did for #phy-cells.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 23 lines · Johan Hovold
Quoted 22 lines · Dmitry Baryshkov
Quoted 20 lines · Johan Hovold
Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · Johan Hovold
Quoted 1 line · Krzysztof Kozlowski
On 11/11/2022 10:24, Johan Hovold wrote:
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
Quoted 5 lines
Quoted 2 lines
Maybe
QMP_COMBO_USB3_PIPE_CLK,QMP_COMBO_DP_LINK_CLK,QMP_COMBO_DP_VCO_DIV_CLK?"COMBO" is just the name of the Linux driver and does not belong in the binding.
We do not have any standard (iow, coming from the docs) name, so we can invent it on our own.
Quoted 7 lines
Quoted 3 lines
I'll then extend this header with
QMP_UFS_RX_SYMBOL_0_CLKQMP_UFS_RX_SYMBOL_1_CLKandQMP_UFS_TX_SYMBOL_0_CLK.Yeah, I had those in mind when creating the header and using a generic QMP prefix (even if I didn't end up using the header in v1).
Quoted 6 lines
This could just be mapping of (arbitrary) QMP indexes to clocks and we use it for USB3, DP, UFS and later also USB4.
This will however mean that the indexes are not necessarily zero-based and consecutive for a specific SoC and PHY. But that's perhaps a non-issue (cf. the
PHY_TYPEdefines).
Ugh. Please, no. We have symbol clocks for UFS PHY, USB+DP clocks for USB+DP PHY, but let's not go for the unified clocks index definition.
Quoted 7 lines
We'd still need to describe which clocks are available on a particular SoC and PHY, and that's partly why I used 'clock-output-names' to fix the mapping in the binding. Guess we can just list the valid defines in the property description as I did for #phy-cells.
Johan
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 24 lines · Dmitry Baryshkov
Quoted 23 lines · Johan Hovold
Quoted 22 lines · Dmitry Baryshkov
Quoted 20 lines · Johan Hovold
Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · Johan Hovold
Quoted 1 line · Krzysztof Kozlowski
On 11/11/2022 10:24, Johan Hovold wrote:
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Maybe
QMP_COMBO_USB3_PIPE_CLK,QMP_COMBO_DP_LINK_CLK,QMP_COMBO_DP_VCO_DIV_CLK?"COMBO" is just the name of the Linux driver and does not belong in the binding.
We do not have any standard (iow, coming from the docs) name, so we can invent it on our own.
I still think the naming should reflect the hardware and not the Linux implementation if this is going into the binding.
And the USB4_USB3_DP defines are going to be a superset of USB3_DP (as far we know know).
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
I'll then extend this header with
QMP_UFS_RX_SYMBOL_0_CLKQMP_UFS_RX_SYMBOL_1_CLKandQMP_UFS_TX_SYMBOL_0_CLK.Yeah, I had those in mind when creating the header and using a generic QMP prefix (even if I didn't end up using the header in v1).
This could just be mapping of (arbitrary) QMP indexes to clocks and we use it for USB3, DP, UFS and later also USB4.
Quoted 6 lines
Quoted 3 lines
This will however mean that the indexes are not necessarily zero-based and consecutive for a specific SoC and PHY. But that's perhaps a non-issue (cf. the
PHY_TYPEdefines).Ugh. Please, no. We have symbol clocks for UFS PHY, USB+DP clocks for USB+DP PHY, but let's not go for the unified clocks index definition.
Yeah, this is the kind of issues I wanted to avoid by not using a per SoC header for three clocks which will almost always use the same indexes.
Because how can you be sure that your unified per-PHY type defines will never have to be amended? Or some index left out?
The only way then is to have per-SoC defines which is a pain to maintain (just consider that driver mapping table when some odd SoC shows up).
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 28 lines · Johan Hovold
Quoted 27 lines · Dmitry Baryshkov
Quoted 26 lines · Johan Hovold
Quoted 24 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Johan Hovold
Quoted 1 line · Krzysztof Kozlowski
On 11/11/2022 10:24, Johan Hovold wrote:
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2Maybe
QMP_COMBO_USB3_PIPE_CLK,QMP_COMBO_DP_LINK_CLK,QMP_COMBO_DP_VCO_DIV_CLK?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
"COMBO" is just the name of the Linux driver and does not belong in the binding.
We do not have any standard (iow, coming from the docs) name, so we can invent it on our own.
I still think the naming should reflect the hardware and not the Linux implementation if this is going into the binding.
Well, I always viewed docs as
Quoted 24 lines
And the
USB4_USB3_DPdefines are going to be a superset ofUSB3_DP(as far we know know).Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
I'll then extend this header with
QMP_UFS_RX_SYMBOL_0_CLKQMP_UFS_RX_SYMBOL_1_CLKandQMP_UFS_TX_SYMBOL_0_CLK.Yeah, I had those in mind when creating the header and using a generic QMP prefix (even if I didn't end up using the header in v1).
This could just be mapping of (arbitrary) QMP indexes to clocks and we use it for USB3, DP, UFS and later also USB4.
Quoted 6 lines
Quoted 3 lines
This will however mean that the indexes are not necessarily zero-based and consecutive for a specific SoC and PHY. But that's perhaps a non-issue (cf. the
PHY_TYPEdefines).Ugh. Please, no. We have symbol clocks for UFS PHY, USB+DP clocks for USB+DP PHY, but let's not go for the unified clocks index definition.
Yeah, this is the kind of issues I wanted to avoid by not using a per SoC header for three clocks which will almost always use the same indexes.
Quoted 6 lines
Because how can you be sure that your unified per-PHY type defines will never have to be amended? Or some index left out?
The only way then is to have per-SoC defines which is a pain to maintain (just consider that driver mapping table when some odd SoC shows up).
My vote is definitely against a per-SoC defines.
Quoted 2 lines
Johan
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 10 lines · Dmitry Baryshkov
Quoted 9 lines · Johan Hovold
Quoted 2 lines · Dmitry Baryshkov
Ugh. Please, no. We have symbol clocks for UFS PHY, USB+DP clocks for USB+DP PHY, but let's not go for the unified clocks index definition.
Yeah, this is the kind of issues I wanted to avoid by not using a per SoC header for three clocks which will almost always use the same indexes.
Quoted 8 lines
Quoted 6 lines
Because how can you be sure that your unified per-PHY type defines will never have to be amended? Or some index left out?
The only way then is to have per-SoC defines which is a pain to maintain (just consider that driver mapping table when some odd SoC shows up).
My vote is definitely against a per-SoC defines.
Simply stating that doesn't address the problem I was trying to describe.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
In reply to Johan HovoldQuoted 24 lines · Johan Hovold
Quoted 23 lines · Krzysztof Kozlowski
Quoted 21 lines · Johan Hovold
Quoted 14 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 12 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +8
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_divQuoted 4 lines
Why defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
I'm only using these names as documentation of the indexes. The driver
Quoted 8 lines
Quoted 2 lines
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
I'm using this property as documentation of the valid indexes that can be used when referring to clocks provided by this device.
There are currently three and the mapping is described by the 'clock-output-names' property.
That's not the purpose of this property. Drop it then. The names do not define the ABI and do not document it, actually. You require now that every DTB, if providing clock-output-names, will have exactly such names instead of having fixed IDs. DTBs are not for defining the ABI.
Quoted 28 lines
Quoted 11 lines
Quoted 9 lines
doesn't use these names, but that's a Linux-specific implementation detail.
I noticed that several bindings leave the clock indexes unspecified, or have header files defining some or all of them. I first added a QMP header but that seemed like overkill, especially if we'd end up with one header per SoC (cf. the GCC headers) due to (known and potential) platform differences.
Headers for the names? I do not recall such but that does not seem right.
Headers for the indexes.
Quoted 14 lines
Quoted 13 lines
On the other hand reproducing this list in each node is admittedly a bit redundant.
Shall I add back a shared header for all PHYs handled by this driver (another implementation detail) even if this could eventually lead to describing clocks not supported by a particular SoC (so such constraints would still need to be described by the binding somehow):
/* QMP clocks */ #define QMP_USB3_PIPE_CLK 0 #define QMP_DP_LINK_CLK 1 #define QMP_DP_VCO_DIV_CLK 2
Quoted 7 lines
Quoted 3 lines
What are these about? To remind - we talk about names of clocks this device creates. The output names. Whatever IDs you have are not related to the names.
As I mentioned above, this is not about the names that Linux gives to its representation of these clocks. Its just about defining the valid indexes in the binding.
With or without the header, the IDs are part of ABI and are fixed. The headers are I think always encouraged because it makes above sentence explicit. Without the headers developers might want to change the IDs.
Quoted 11 lines
If you think that that using 'clock-output-names' for this is a bit too unconventional, I can add back the header with defines like the above instead.
Note that the clock schema has:
clock-output-names:
description: |
Recommended to be a list of strings of clock output signal names indexed by the first cell in the clock specifier.
Exactly. Not to describe the ABI behind the ID.
Quoted 2 lines
However, the meaning of clock-output-names is domain specific to the clock provider, ...
... because you might have more cells. Just because clock-output-names do not fit some drivers it does not mean you can use it any way you wish. It is still for names of provided clocks.
Best regards,
Krzysztof
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 31 lines · Krzysztof Kozlowski
Quoted 30 lines · Johan Hovold
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Johan Hovold
Quoted 18 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 59
Quoted 12 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +8
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Quoted 4 lines
Quoted 1 line
I'm only using these names as documentation of the indexes. The driver
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
I'm using this property as documentation of the valid indexes that can be used when referring to clocks provided by this device.
Quoted 7 lines
Quoted 2 lines
There are currently three and the mapping is described by the 'clock-output-names' property.
That's not the purpose of this property. Drop it then. The names do not define the ABI and do not document it, actually. You require now that every DTB, if providing clock-output-names, will have exactly such names instead of having fixed IDs. DTBs are not for defining the ABI.
Fair enough, I'll drop it. But there doesn't seem to be a good way to describe the indexes currently and most bindings simply ignore to do so.
So what is the preference then? Just leave things undocumented, listing indexes in a free-text 'description', or adding a free-text reference to a binding header file and using those define names in a free-text 'description'?
And if going with the last option, does this mean that every SoC and PHY type needs its own header for those three clocks or so to avoid having a common dumping ground header file where indexes will not necessarily be 0-based and consecutive.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 40 lines · Johan Hovold
Quoted 31 lines · Krzysztof Kozlowski
Quoted 30 lines · Johan Hovold
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Johan Hovold
Quoted 18 lines · Krzysztof Kozlowski
Review
Quoted 12 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
(quoted diff) +8
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_divWhy defining here fixed names? The purpose of this field is to actually allow customizing these - at least in most cases. If these have to be fixed, then driver should just instantiate these clocks with such names, right?
Quoted 4 lines
Quoted 1 line
I'm only using these names as documentation of the indexes. The driver
What do you mean by documentation of indexes? You require these specific entries and do not allow anything else.
I'm using this property as documentation of the valid indexes that can be used when referring to clocks provided by this device.
Quoted 7 lines
Quoted 2 lines
There are currently three and the mapping is described by the 'clock-output-names' property.
That's not the purpose of this property. Drop it then. The names do not define the ABI and do not document it, actually. You require now that every DTB, if providing clock-output-names, will have exactly such names instead of having fixed IDs. DTBs are not for defining the ABI.
Quoted 7 lines
Fair enough, I'll drop it. But there doesn't seem to be a good way to describe the indexes currently and most bindings simply ignore to do so.
So what is the preference then? Just leave things undocumented, listing indexes in a free-text 'description', or adding a free-text reference to a binding header file and using those define names in a free-text 'description'?
Either 2 or 3. Several bindings for small number of constants choose option 2.
Quoted 5 lines
And if going with the last option, does this mean that every SoC and PHY type needs its own header for those three clocks or so to avoid having a common dumping ground header file where indexes will not necessarily be 0-based and consecutive.
phy-qcom-qmp-combo.c has one qcom_qmp_dp_clks_hw_get(), so why would you have many of header files?
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Johan Hovold
Fair enough, I'll drop it. But there doesn't seem to be a good way to describe the indexes currently and most bindings simply ignore to do so.
Quoted 7 lines
Quoted 4 lines
So what is the preference then? Just leave things undocumented, listing indexes in a free-text 'description', or adding a free-text reference to a binding header file and using those define names in a free-text 'description'?
Either 2 or 3. Several bindings for small number of constants choose option 2.
Ok, we have three now, but USB4 will bump this to ten or so.
Quoted 7 lines
Quoted 4 lines
And if going with the last option, does this mean that every SoC and PHY type needs its own header for those three clocks or so to avoid having a common dumping ground header file where indexes will not necessarily be 0-based and consecutive.
phy-qcom-qmp-combo.chas oneqcom_qmp_dp_clks_hw_get(), so why would you have many of header files?
We don't know what kind of clock outputs later revisions of these PHYs will have. The only way to guarantee 0-based consecutive indexes appears to be to use per-SoC defines (e.g. as for the GCC bindings).
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Johan Hovold
Fair enough, I'll drop it. But there doesn't seem to be a good way to describe the indexes currently and most bindings simply ignore to do so.
So what is the preference then? Just leave things undocumented, listing indexes in a free-text 'description', or adding a free-text reference to a binding header file and using those define names in a free-text 'description'?
Quoted 4 lines
Quoted 2 lines
Either 2 or 3. Several bindings for small number of constants choose option 2.
Ok, we have three now, but USB4 will bump this to ten or so.
Then probably header file is the way to go.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
And if going with the last option, does this mean that every SoC and PHY type needs its own header for those three clocks or so to avoid having a common dumping ground header file where indexes will not necessarily be 0-based and consecutive.
Quoted 6 lines
Quoted 2 lines
phy-qcom-qmp-combo.chas oneqcom_qmp_dp_clks_hw_get(), so why would you have many of header files?We don't know what kind of clock outputs later revisions of these PHYs will have. The only way to guarantee 0-based consecutive indexes appears to be to use per-SoC defines (e.g. as for the GCC bindings).
Which is also fine. I don't understand still why it is a problem - even if you have multiple files, one for each SoC/phy. If USB4 brings here 10 more clocks and other SoCs/phys might bring many more options, then what else can you do? Grow the binding file with big text-based mapping of IDs? It's not a viable solution. Header or headers is the only maintainable way for such cases.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 32 lines · Krzysztof Kozlowski
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Johan Hovold
Fair enough, I'll drop it. But there doesn't seem to be a good way to describe the indexes currently and most bindings simply ignore to do so.
So what is the preference then? Just leave things undocumented, listing indexes in a free-text 'description', or adding a free-text reference to a binding header file and using those define names in a free-text 'description'?
Quoted 4 lines
Quoted 2 lines
Either 2 or 3. Several bindings for small number of constants choose option 2.
Ok, we have three now, but USB4 will bump this to ten or so.
Then probably header file is the way to go.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
And if going with the last option, does this mean that every SoC and PHY type needs its own header for those three clocks or so to avoid having a common dumping ground header file where indexes will not necessarily be 0-based and consecutive.
Quoted 6 lines
Quoted 2 lines
phy-qcom-qmp-combo.chas oneqcom_qmp_dp_clks_hw_get(), so why would you have many of header files?We don't know what kind of clock outputs later revisions of these PHYs will have. The only way to guarantee 0-based consecutive indexes appears to be to use per-SoC defines (e.g. as for the GCC bindings).
Quoted 6 lines
Which is also fine. I don't understand still why it is a problem - even if you have multiple files, one for each SoC/phy. If USB4 brings here 10 more clocks and other SoCs/phys might bring many more options, then what else can you do? Grow the binding file with big text-based mapping of IDs? It's not a viable solution. Header or headers is the only maintainable way for such cases.
So then we must add per-SoC (and PHY type) headers even if we can possibly reuse defines from one platform for another as long as they appear to be similar enough? For example, using a "SC7180_USB3_DP" infix for the current platforms and add a new series of indexes for SC8280XP:
QMP_SC7180_USB3_DP_USB3_PIPE 0 QMP_SC7180_USB3_DP_DP_LINK 1 QMP_SC7180_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB3_PIPE 0 QMP_SC8280XP_USB4_USB3_DP_DP_LINK 1 QMP_SC8280XP_USB4_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB4_PCIE_PIPE 3 ... QMP_SC8280XP_USB4_USB3_DP_USB4_RX1 9
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 11 lines · Johan Hovold
Quoted 7 lines
Which is also fine. I don't understand still why it is a problem - even if you have multiple files, one for each SoC/phy. If USB4 brings here 10 more clocks and other SoCs/phys might bring many more options, then what else can you do? Grow the binding file with big text-based mapping of IDs? It's not a viable solution. Header or headers is the only maintainable way for such cases.
So then we must add per-SoC (and PHY type) headers even if we can possibly reuse defines from one platform for another as long as they appear to be similar enough?
No, you don't have to. I just got impression that future devices will bring so many changes that anyway you will end up with per-SoC defines.
Quoted 13 lines
For example, using a "
SC7180_USB3_DP" infix
for the current platforms and add a new series of indexes for SC8280XP:QMP_SC7180_USB3_DP_USB3_PIPE 0 QMP_SC7180_USB3_DP_DP_LINK 1 QMP_SC7180_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB3_PIPE 0 QMP_SC8280XP_USB4_USB3_DP_DP_LINK 1 QMP_SC8280XP_USB4_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB4_PCIE_PIPE 3 ... QMP_SC8280XP_USB4_USB3_DP_USB4_RX1 9
The names are just a names, you can even use QMP_SC7180_* on SC8280XP. You can skip the SoC part and have something shared. We already have such patterns - although maybe more often for outside components (like PMICs). The differences are:
1. For per-SoC name it's quite obvious which clock is supported on fiven SoC,
2. With shared names, you should document somewhere mapping between supported clocks and SoCs. Also what to do if new device comes with 10 new clocks entirely different - re-use/map existing defines or add completely new set of 10 of them?
Best regards,
Krzysztof
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 30 lines · Krzysztof Kozlowski
Quoted 11 lines · Johan Hovold
Quoted 7 lines
Which is also fine. I don't understand still why it is a problem - even if you have multiple files, one for each SoC/phy. If USB4 brings here 10 more clocks and other SoCs/phys might bring many more options, then what else can you do? Grow the binding file with big text-based mapping of IDs? It's not a viable solution. Header or headers is the only maintainable way for such cases.
So then we must add per-SoC (and PHY type) headers even if we can possibly reuse defines from one platform for another as long as they appear to be similar enough?
No, you don't have to. I just got impression that future devices will bring so many changes that anyway you will end up with per-SoC defines.
Quoted 13 lines
For example, using a "
SC7180_USB3_DP" infix
for the current platforms and add a new series of indexes for SC8280XP:QMP_SC7180_USB3_DP_USB3_PIPE 0 QMP_SC7180_USB3_DP_DP_LINK 1 QMP_SC7180_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB3_PIPE 0 QMP_SC8280XP_USB4_USB3_DP_DP_LINK 1 QMP_SC8280XP_USB4_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB4_PCIE_PIPE 3 ... QMP_SC8280XP_USB4_USB3_DP_USB4_RX1 9
Quoted 10 lines
The names are just a names, you can even use QMP_SC7180_* on SC8280XP. You can skip the SoC part and have something shared. We already have such patterns - although maybe more often for outside components (like PMICs). The differences are:
1. For per-SoC name it's quite obvious which clock is supported on fiven SoC,
2. With shared names, you should document somewhere mapping between supported clocks and SoCs. Also what to do if new device comes with 10 new clocks entirely different - re-use/map existing defines or add completely new set of 10 of them?
Ok, thanks. I'll go with a common prefix per PHY type for now, and we can worry about hypothetical hardware revisions later.
I'll use a "QMP_USB43DP_" prefix for the new SC8280XP binding, which can be reused also for the older SoCs with USB3-DP PHYs if/when we convert them as their indexes will be a subset of the SC8280XP ones:
/* QMP USB4-USB3-DP clocks */ #define QMP_USB43DP_USB3_PIPE_CLK 0 #define QMP_USB43DP_DP_LINK_CLK 1 #define QMP_USB43DP_DP_VCO_DIV_CLK 2
Since I'm adding a new header anyway, I decided to go with dedicated indexes also for the PHY selection (instead of using the PHY_TYPE defines):
/* QMP USB4-USB3-DP PHYs */ #define QMP_USB43DP_USB3_PHY 0 #define QMP_USB43DP_DP_PHY 1
I'll add these to a common dt-bindings/phy/phy-qcom-qmp.h header so that it can be used also for the UFS clocks (with a "QMP_UFS_" prefix).
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 58 lines · Johan Hovold
Quoted 30 lines · Krzysztof Kozlowski
Quoted 11 lines · Johan Hovold
Quoted 7 lines
Which is also fine. I don't understand still why it is a problem - even if you have multiple files, one for each SoC/phy. If USB4 brings here 10 more clocks and other SoCs/phys might bring many more options, then what else can you do? Grow the binding file with big text-based mapping of IDs? It's not a viable solution. Header or headers is the only maintainable way for such cases.
So then we must add per-SoC (and PHY type) headers even if we can possibly reuse defines from one platform for another as long as they appear to be similar enough?
No, you don't have to. I just got impression that future devices will bring so many changes that anyway you will end up with per-SoC defines.
Quoted 13 lines
For example, using a "
SC7180_USB3_DP" infix
for the current platforms and add a new series of indexes for SC8280XP:QMP_SC7180_USB3_DP_USB3_PIPE 0 QMP_SC7180_USB3_DP_DP_LINK 1 QMP_SC7180_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB3_PIPE 0 QMP_SC8280XP_USB4_USB3_DP_DP_LINK 1 QMP_SC8280XP_USB4_USB3_DP_DP_VCO_DIV 2 QMP_SC8280XP_USB4_USB3_DP_USB4_PCIE_PIPE 3 ... QMP_SC8280XP_USB4_USB3_DP_USB4_RX1 9Quoted 10 lines
The names are just a names, you can even use QMP_SC7180_* on SC8280XP. You can skip the SoC part and have something shared. We already have such patterns - although maybe more often for outside components (like PMICs). The differences are:
1. For per-SoC name it's quite obvious which clock is supported on fiven SoC,
2. With shared names, you should document somewhere mapping between supported clocks and SoCs. Also what to do if new device comes with 10 new clocks entirely different - re-use/map existing defines or add completely new set of 10 of them?Ok, thanks. I'll go with a common prefix per PHY type for now, and we can worry about hypothetical hardware revisions later.
I'll use a "
QMP_USB43DP_" prefix for the new SC8280XP binding, which can be reused also for the older SoCs with USB3-DP PHYs if/when we convert them as their indexes will be a subset of the SC8280XP ones:/* QMP USB4-USB3-DP clocks */ #define QMP_USB43DP_USB3_PIPE_CLK 0 #define QMP_USB43DP_DP_LINK_CLK 1 #define QMP_USB43DP_DP_VCO_DIV_CLK 2Since I'm adding a new header anyway, I decided to go with dedicated indexes also for the PHY selection (instead of using the
PHY_TYPEdefines):
Quoted 6 lines
/* QMP USB4-USB3-DP PHYs */ #define QMP_USB43DP_USB3_PHY 0 #define QMP_USB43DP_DP_PHY 1I'll add these to a common
dt-bindings/phy/phy-qcom-qmp.hheader so that it can be used also for the UFS clocks (with a "QMP_UFS_" prefix).
Sounds good, thanks.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
In reply to Johan HovoldQuoted 139 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS LANE registers).
This is specifically true for later USB4-USB3-DP QMP PHYs where the TX registers are used by both the USB3 and DP parts of the PHY (and where the USB4 part of the PHY was not covered by the binding at all). Notably there are also no DP "RX" (sic) registers as described by the current bindings and the DP "PCS" region is really a set of
DP_PHYregisters.Add a new binding for the USB4-USB3-DP QMP PHYs found on SC8280XP which further bindings can be based on.
Note that the binding uses a PHY type index to access either the USB3 or DP part of the PHY and that this can later be used also for the USB4 part if needed.
Similarly, the clock inputs and outputs can later be extended to support USB4.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and would not allow for supporting DP mode.
Signed-off-by Johan Hovold <[email protected]>--- .../phy/qcom,sc7180-qmp-usb3-dp-phy.yaml | 12 -- .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 12 deletions(-)create mode 100644
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yamlDocumentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml +0
-12@@ -23,7 +23,6 @@ properties: - qcom,sc7180-qmp-usb3-dp-phy - qcom,sc7280-qmp-usb3-dp-phy - qcom,sc8180x-qmp-usb3-dp-phy - - qcom,sc8280xp-qmp-usb43dp-phy - qcom,sdm845-qmp-usb3-dp-phy - qcom,sm8250-qmp-usb3-dp-phy reg:@@ -169,17 +168,6 @@ required: additionalProperties: false -allOf: - - if: - properties: - compatible: - contains: - enum: - - qcom,sc8280xp-qmp-usb43dp-phy - then: - required: - - power-domains - examples: - | #include <dt-bindings/clock/qcom,gcc-sdm845.h>Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +56
-0@@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm QMP USB4-USB3-DP PHY controller (SC8280XP) + +maintainers: + - Vinod Koul <[email protected]> + +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS and USB. + + See also: + - include/dt-bindings/dt-bindings/phy/phy.h + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-usb43dp-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: ref + - const: com_aux + - const: usb3_pipe + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy + - const: common + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#clock-cells": + const: 1 + + clock-output-names: + items:
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 66
Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ - const: usb3_pipe + - const: dp_link + - const: dp_vco_div + + "#phy-cells": + const: 1 + description: | + PHY index + - PHY_TYPE_USB3 + - PHY_TYPE_DP
I'm stepping on Rob's and Krzysztof's ground here, but it might be more logical and future proof to use indices instead of phy types.
Just for my understanding, would USB4 support add another qserdes+tx/rx construct or would it be the same USB3 register space?
Quoted 45 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +45
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + - resets + - reset-names + - vdda-phy-supply + - vdda-pll-supply + - "#clock-cells" + - clock-output-names + - "#phy-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sc8280xp.h> + + phy@88eb000 { + compatible = "qcom,sc8280xp-qmp-usb43dp-phy"; + reg = <0x088eb000 0x4000>; + + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, + <&gcc GCC_USB4_EUD_CLKREF_CLK>, + <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>, + <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; + clock-names = "aux", "ref", "com_aux", "usb3_pipe"; + + power-domains = <&gcc USB30_PRIM_GDSC>; + + resets = <&gcc GCC_USB3_PHY_PRIM_BCR>, + <&gcc GCC_USB4_DP_PHY_PRIM_BCR>; + reset-names = "phy", "common"; + + vdda-phy-supply = <&vreg_l9d>; + vdda-pll-supply = <&vreg_l4d>; + + #clock-cells = <1>; + clock-output-names = "usb3_pipe", "dp_link", "dp_vco_div"; + + #phy-cells = <1>; + };
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 54 lines · Dmitry Baryshkov
Quoted 53 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS LANE registers).
This is specifically true for later USB4-USB3-DP QMP PHYs where the TX registers are used by both the USB3 and DP parts of the PHY (and where the USB4 part of the PHY was not covered by the binding at all). Notably there are also no DP "RX" (sic) registers as described by the current bindings and the DP "PCS" region is really a set of
DP_PHYregisters.Add a new binding for the USB4-USB3-DP QMP PHYs found on SC8280XP which further bindings can be based on.
Note that the binding uses a PHY type index to access either the USB3 or DP part of the PHY and that this can later be used also for the USB4 part if needed.
Similarly, the clock inputs and outputs can later be extended to support USB4.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and would not allow for supporting DP mode.
Signed-off-by Johan Hovold <[email protected]>---
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_div + + "#phy-cells":
Quoted 8 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 66
Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +5
-0+ const: 1 + description: | + PHY index + - PHY_TYPE_USB3 + - PHY_TYPE_DPI'm stepping on Rob's and Krzysztof's ground here, but it might be more logical and future proof to use indices instead of phy types.
Why would that be more future-proof?
I initially added defines for these indexes to a QMP header, but noticed that we already have PHY drivers that use the PHY types for this. So there's already a precedent for this and I didn't see any real benefit to adding multiple per-SoC defines for the same thing.
Quoted 2 lines
Just for my understanding, would USB4 support add another qserdes+tx/rx construct or would it be the same USB3 register space?
The TX/RX registers are shared by the all three parts of the PHY (USB4, USB3, DP), while USB4 has two dedicated sets of PLL (serdes) and PCS registers.
Johan
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 64 lines · Johan Hovold
Quoted 54 lines · Dmitry Baryshkov
Quoted 53 lines · Johan Hovold
The current QMP USB3-DP PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB3-DP PHY block provides a single multi-protocol PHY and even if some resources are only used by either the USB or DP part of the device there is no real benefit in describing these resources in child nodes.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the PCS LANE registers).
This is specifically true for later USB4-USB3-DP QMP PHYs where the TX registers are used by both the USB3 and DP parts of the PHY (and where the USB4 part of the PHY was not covered by the binding at all). Notably there are also no DP "RX" (sic) registers as described by the current bindings and the DP "PCS" region is really a set of
DP_PHYregisters.Add a new binding for the USB4-USB3-DP QMP PHYs found on SC8280XP which further bindings can be based on.
Note that the binding uses a PHY type index to access either the USB3 or DP part of the PHY and that this can later be used also for the USB4 part if needed.
Similarly, the clock inputs and outputs can later be extended to support USB4.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and would not allow for supporting DP mode.
Signed-off-by Johan Hovold <[email protected]>---
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_div + + "#phy-cells":Quoted 8 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 66
Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +5
-0+ const: 1 + description: | + PHY index + - PHY_TYPE_USB3 + - PHY_TYPE_DPI'm stepping on Rob's and Krzysztof's ground here, but it might be more logical and future proof to use indices instead of phy types.
Quoted 6 lines
Why would that be more future-proof?
I initially added defines for these indexes to a QMP header, but noticed that we already have PHY drivers that use the PHY types for this. So there's already a precedent for this and I didn't see any real benefit to adding multiple per-SoC defines for the same thing.
As you guessed from my question, I was thinking about USB4 (for which we do not have a separate PHY_TYPE, but that probably shouldn't matter). Would it be a separate PHY here, or would it be a combo UBS3+USB4 plus separate DP phy?
Yes, we have other PHYs, which use types as an index, however it's slightly more common to have indices instead.
Anyway, this is a minor issue. It might be just that I'm more common to using indices everywhere (in other words, I have preference here, but it's not a strong requirement from my side).
Quoted 6 lines
Quoted 2 lines
Just for my understanding, would USB4 support add another qserdes+tx/rx construct or would it be the same USB3 register space?
The TX/RX registers are shared by the all three parts of the PHY (USB4, USB3, DP), while USB4 has two dedicated sets of PLL (serdes) and PCS registers.
Ack, thanks.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 02/14] dt-bindings: phy: qcom,qmp-usb3-dp: fix sc8280xp bindings
Quoted 25 lines · Dmitry Baryshkov
Quoted 24 lines · Johan Hovold
Quoted 12 lines · Dmitry Baryshkov
Quoted 10 lines · Johan Hovold
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +10
-0+ "#clock-cells": + const: 1 + + clock-output-names: + items: + - const: usb3_pipe + - const: dp_link + - const: dp_vco_div + + "#phy-cells":Quoted 8 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml line 66
Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml new file +5
-0+ const: 1 + description: | + PHY index + - PHY_TYPE_USB3 + - PHY_TYPE_DPI'm stepping on Rob's and Krzysztof's ground here, but it might be more logical and future proof to use indices instead of phy types.
Why would that be more future-proof?
Quoted 7 lines
Quoted 4 lines
I initially added defines for these indexes to a QMP header, but noticed that we already have PHY drivers that use the PHY types for this. So there's already a precedent for this and I didn't see any real benefit to adding multiple per-SoC defines for the same thing.
As you guessed from my question, I was thinking about USB4 (for which we do not have a separate
PHY_TYPE, but that probably shouldn't matter).
Yeah, that's easy enough to add.
Quoted 2 lines
Would it be a separate PHY here, or would it be a combo UBS3+USB4 plus separate DP phy?
We don't know yet.
Quoted 2 lines
Yes, we have other PHYs, which use types as an index, however it's slightly more common to have indices instead.
If you look at (yaml) bindings using a single phy-cell, the majority simply ignores describing what the index is used for and which values are valid. Of the few that do describe it, the cell index is either used for something which does not allow itself for mapping to PHY_TYPE or PHY_TYPE is used.
Quoted 3 lines
Anyway, this is a minor issue. It might be just that I'm more common to using indices everywhere (in other words, I have preference here, but it's not a strong requirement from my side).
I don't have a strong preference here either. Let's see what Krzysztof and Rob says.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 3/14 phy: qcom-qmp-combo: drop v4 reference-clock source
In reply to Johan HovoldThe source clock for the reference clock should not be described by the devicetree and instead this relationship should be modelled in the clock driver.
Drop the management of the source clock from the driver for SC8180X and SC8280XP. Note that support for the former is not yet in mainline.
Also note that the binding has never been updated to describe the v4 clocks for SC8180X.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1 -1
@@ -947,7 +947,7 @@ static const char * const qmp_v3_phy_clk_l[] = { };static const char *const qmp_v4_phy_clk_l[] = { -"aux" ,"ref_clk_src" ,"ref" ,"com_aux" , +"aux" ,"ref" ,"com_aux" , };/* the primary usb3 phy on sm8250 doesn't have a ref clock */
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 03/14] phy: qcom-qmp-combo: drop v4 reference-clock source
Quoted 3 lines · Johan Hovold
The source clock for the reference clock should not be described by the devicetree and instead this relationship should be modelled in the clock driver.
Do we have a fix for the gcc driver?
Quoted 25 lines
Drop the management of the source clock from the driver for SC8180X and SC8280XP. Note that support for the former is not yet in mainline.
Also note that the binding has never been updated to describe the v4 clocks for SC8180X.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1
-1@@ -947,7 +947,7 @@ static const char * const qmp_v3_phy_clk_l[] = { };static const char *const qmp_v4_phy_clk_l[] = { -"aux" ,"ref_clk_src" ,"ref" ,"com_aux" , +"aux" ,"ref" ,"com_aux" , };/* the primary usb3 phy on sm8250 doesn't have a ref clock */
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 03/14] phy: qcom-qmp-combo: drop v4 reference-clock source
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Johan Hovold
The source clock for the reference clock should not be described by the devicetree and instead this relationship should be modelled in the clock driver.
Do we have a fix for the gcc driver?
Bjorn is preparing one, but there's no need to wait for that to be merged in this case (we have a ton of references on CXO, we need to get the binding fixed in 6.2, and some other reasons which Bjorn may be able to share soon).
Johan
PATCH 4/14 phy: qcom-qmp-combo: restructure PHY creation
In reply to Johan HovoldIn preparation for supporting devicetree bindings which do not use child nodes, move the PHY creation to probe() proper and parse the serdes, dp_com and dp_serdes resources in a dedicated legacy devicetree helper.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 89 ++++++++++++----------- 1 file changed, 48 insertions(+), 41 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +48 -41
@@ -2483,12 +2483,10 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static int qmp_combo_create_dp (struct qmp_combo *qmp,struct device_node *np) +static int qmp_combo_parse_dt_lecacy_dp (struct qmp_combo *qmp,struct device_node *np) {const struct qmp_phy_cfg *cfg = qmp->cfg;struct device *dev = qmp->dev; -struct phy *generic_phy; -int ret;/* * Get memory resources for each PHY:
@@ -2512,25 +2510,13 @@ static int qmp_combo_create_dp(struct qmp_combo *qmp, struct device_node *np)return PTR_ERR (qmp->dp_tx2); } - generic_phy =devm_phy_create (dev, np, &qmp_combo_dp_phy_ops); -if (IS_ERR (generic_phy)) { - ret =PTR_ERR (generic_phy); -dev_err (dev,"failed to create DP PHY: %d\n" , ret); -return ret; - } - - qmp->dp_phy = generic_phy; -phy_set_drvdata (generic_phy, qmp); -return 0 ; } -static int qmp_combo_create_usb (struct qmp_combo *qmp,struct device_node *np) +static int qmp_combo_parse_dt_lecacy_usb (struct qmp_combo *qmp,struct device_node *np) {const struct qmp_phy_cfg *cfg = qmp->cfg;struct device *dev = qmp->dev; -struct phy *generic_phy; -int ret;/* * Get memory resources for each PHY:
@@ -2578,15 +2564,34 @@ static int qmp_combo_create_usb(struct qmp_combo *qmp, struct device_node *np) "failed to get pipe clock\n"); } - generic_phy =devm_phy_create (dev, np, &qmp_combo_usb_phy_ops); -if (IS_ERR (generic_phy)) { - ret =PTR_ERR (generic_phy); -dev_err (dev,"failed to create USB PHY: %d\n" , ret); +return 0 ; +} + +static int qmp_combo_parse_dt_legacy (struct qmp_combo *qmp,struct device_node *usb_np, +struct device_node *dp_np) +{ +struct platform_device *pdev =to_platform_device (qmp->dev); +int ret; + + qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (qmp->serdes)) +return PTR_ERR (qmp->serdes); + + qmp->dp_com =devm_platform_ioremap_resource (pdev,1 ); +if (IS_ERR (qmp->dp_com)) +return PTR_ERR (qmp->dp_com); + + qmp->dp_serdes =devm_platform_ioremap_resource (pdev,2 ); +if (IS_ERR (qmp->dp_serdes)) +return PTR_ERR (qmp->dp_serdes); + + ret =qmp_combo_parse_dt_lecacy_usb (qmp, usb_np); +if (ret)return ret; - } - qmp->usb_phy = generic_phy; -phy_set_drvdata (generic_phy, qmp); + ret =qmp_combo_parse_dt_lecacy_dp (qmp, dp_np); +if (ret) +return ret;return 0 ; }
@@ -2609,18 +2614,6 @@ static int qmp_combo_probe(struct platform_device *pdev)if (!qmp->cfg)return -EINVAL ; - qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (qmp->serdes)) -return PTR_ERR (qmp->serdes); - - qmp->dp_com =devm_platform_ioremap_resource (pdev,1 ); -if (IS_ERR (qmp->dp_com)) -return PTR_ERR (qmp->dp_com); - - qmp->dp_serdes =devm_platform_ioremap_resource (pdev,2 ); -if (IS_ERR (qmp->dp_serdes)) -return PTR_ERR (qmp->dp_serdes); -mutex_init (&qmp->phy_mutex); ret =qmp_combo_clk_init (qmp);
@@ -2645,6 +2638,10 @@ static int qmp_combo_probe(struct platform_device *pdev)return -EINVAL ; } + ret =qmp_combo_parse_dt_legacy (qmp, usb_np, dp_np); +if (ret) + goto err_node_put; +pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret)
@@ -2655,21 +2652,31 @@ static int qmp_combo_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =qmp_combo_create_usb (qmp, usb_np); + ret =phy_pipe_clk_register (qmp, usb_np);if (ret) goto err_node_put; - ret =phy_pipe_clk_register (qmp, usb_np); + ret =phy_dp_clks_register (qmp, dp_np);if (ret) goto err_node_put; - ret =qmp_combo_create_dp (qmp, dp_np); -if (ret) + qmp->usb_phy =devm_phy_create (dev, usb_np, &qmp_combo_usb_phy_ops); +if (IS_ERR (qmp->usb_phy)) { + ret =PTR_ERR (qmp->usb_phy); +dev_err (dev,"failed to create USB PHY: %d\n" , ret); goto err_node_put; + } - ret =phy_dp_clks_register (qmp, dp_np); -if (ret) +phy_set_drvdata (qmp->usb_phy, qmp); + + qmp->dp_phy =devm_phy_create (dev, dp_np, &qmp_combo_dp_phy_ops); +if (IS_ERR (qmp->dp_phy)) { + ret =PTR_ERR (qmp->dp_phy); +dev_err (dev,"failed to create DP PHY: %d\n" , ret); goto err_node_put; + } + +phy_set_drvdata (qmp->dp_phy, qmp); phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 04/14] phy: qcom-qmp-combo: restructure PHY creation
Quoted 5 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, move the PHY creation to
probe()proper and parse the serdes,dp_comanddp_serdesresources in a dedicated legacy devicetree helper.Signed-off-by Johan Hovold <[email protected]>
Please drop this first stray SoB line when applying (or I'll remove it for v2).
Quoted 1 line
Signed-off-by Johan Hovold <[email protected]>
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 04/14] phy: qcom-qmp-combo: restructure PHY creation
Quoted 9 lines · Johan Hovold
Quoted 5 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, move the PHY creation to
probe()proper and parse the serdes,dp_comanddp_serdesresources in a dedicated legacy devicetree helper.Signed-off-by Johan Hovold <[email protected]>Please drop this first stray SoB line when applying (or I'll remove it for v2).
You need to send a v2 anyway to have a clear check by Rob's bot, so drop it then.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 04/14] phy: qcom-qmp-combo: restructure PHY creation
In reply to Johan HovoldQuoted 9 lines · Johan Hovold
Quoted 5 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, move the PHY creation to
probe()proper and parse the serdes,dp_comanddp_serdesresources in a dedicated legacy devicetree helper.Signed-off-by Johan Hovold <[email protected]>Please drop this first stray SoB line when applying (or I'll remove it for v2).
You need to send a v2 anyway to have a clear check by Rob's bot, so drop it then.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 5/14 phy: qcom-qmp-combo: register clocks sooner
In reply to Johan HovoldRuntime PM should be enabled before registering the PHYs, but there is no reason that the clocks can not be registered before enabling runtime PM.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +8 -8
@@ -2642,6 +2642,14 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret) goto err_node_put; + ret =phy_pipe_clk_register (qmp, usb_np); +if (ret) + goto err_node_put; + + ret =phy_dp_clks_register (qmp, dp_np); +if (ret) + goto err_node_put; +pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret)
@@ -2652,14 +2660,6 @@ static int qmp_combo_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =phy_pipe_clk_register (qmp, usb_np); -if (ret) - goto err_node_put; - - ret =phy_dp_clks_register (qmp, dp_np); -if (ret) - goto err_node_put; - qmp->usb_phy =devm_phy_create (dev, usb_np, &qmp_combo_usb_phy_ops);if (IS_ERR (qmp->usb_phy)) { ret =PTR_ERR (qmp->usb_phy);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 05/14] phy: qcom-qmp-combo: register clocks sooner
Quoted 3 lines · Johan Hovold
Runtime PM should be enabled before registering the PHYs, but there is no reason that the clocks can not be registered before enabling runtime PM.
This will have a side effect of DP and pipe clocks not using runtime PM during the clocks operations (see the code handling rpm_enabled in drivers/clk/clk.c). If this is an intended change, it should be described in the commit message.
Quoted 40 lines
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +8
-8@@ -2642,6 +2642,14 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret) goto err_node_put; + ret =phy_pipe_clk_register (qmp, usb_np); +if (ret) + goto err_node_put; + + ret =phy_dp_clks_register (qmp, dp_np); +if (ret) + goto err_node_put; +pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret)@@ -2652,14 +2660,6 @@ static int qmp_combo_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =phy_pipe_clk_register (qmp, usb_np); -if (ret) - goto err_node_put; - - ret =phy_dp_clks_register (qmp, dp_np); -if (ret) - goto err_node_put; - qmp->usb_phy =devm_phy_create (dev, usb_np, &qmp_combo_usb_phy_ops);if (IS_ERR (qmp->usb_phy)) { ret =PTR_ERR (qmp->usb_phy);
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 05/14] phy: qcom-qmp-combo: register clocks sooner
Quoted 9 lines · Dmitry Baryshkov
Quoted 3 lines · Johan Hovold
Runtime PM should be enabled before registering the PHYs, but there is no reason that the clocks can not be registered before enabling runtime PM.
This will have a side effect of DP and pipe clocks not using runtime PM during the clocks operations (see the code handling
rpm_enabledindrivers/clk/clk.c). If this is an intended change, it should be described in the commit message.
Good catch. I'll drop this one.
Johan
PATCH 6/14 phy: qcom-qmp-combo: generate pipe clock name
In reply to Johan HovoldIn preparation for supporting devicetree bindings which do not use child nodes, generate also the USB3 pipe clock name based on the platform device name as is done for the DP clocks.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +3 -6
@@ -2259,18 +2259,15 @@ static int phy_pipe_clk_register(struct qmp_combo *qmp, struct device_node *np) {struct clk_fixed_rate *fixed;struct clk_init_data init = { }; +char name[64 ];int ret; - ret =of_property_read_string (np,"clock-output-names" , &init.name); -if (ret) { -dev_err (qmp->dev,"%pOFn: No clock-output-names\n" , np); -return ret; - } - fixed =devm_kzalloc (qmp->dev,sizeof (*fixed),GFP_KERNEL );if (!fixed)return -ENOMEM ; +snprintf (name,sizeof (name),"%s::pipe_clk" ,dev_name (qmp->dev)); + init.name = name; init.ops = &clk_fixed_rate_ops;/* controllers using QMP phys use 125MHz pipe clock interface */
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 06/14] phy: qcom-qmp-combo: generate pipe clock name
Quoted 5 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, generate also the USB3 pipe clock name based on the platform device name as is done for the DP clocks.
Signed-off-by Johan Hovold <[email protected]>
Signature · 2 lines
With best wishes Dmitry
PATCH 7/14 phy: qcom-qmp-combo: drop redundant clock structure
In reply to Johan HovoldDrop the unnecessary DP clock structure and instead store the clocks directly in the driver data.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 52 ++++++++--------------- 1 file changed, 17 insertions(+), 35 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +17 -35
@@ -861,12 +861,6 @@ struct qmp_phy_cfg { }; -struct qmp_phy_dp_clks { -struct qmp_combo *qmp; -struct clk_hw dp_link_hw; -struct clk_hw dp_pixel_hw; -}; -struct qmp_combo {struct device *dev;
@@ -902,7 +896,9 @@ struct qmp_combo {struct phy *dp_phy;unsigned int dp_aux_cfg;struct phy_configure_opts_dp dp_opts; -struct qmp_phy_dp_clks *dp_clks; + +struct clk_hw dp_link_hw; +struct clk_hw dp_pixel_hw; };static void qmp_v3_dp_aux_init (struct qmp_combo *qmp);
@@ -1398,7 +1394,6 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)static int qmp_v3_configure_dp_phy (struct qmp_combo *qmp) { -const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;unsigned long pixel_freq;
@@ -1431,8 +1426,8 @@ static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp) }writel (phy_vco_div, qmp->dp_pcs +QSERDES_V3_DP_PHY_VCO_DIV ); -clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 ); -clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); +clk_set_rate (qmp->dp_link_hw.clk, dp_opts->link_rate *100000 ); +clk_set_rate (qmp->dp_pixel_hw.clk, pixel_freq);writel (0x04 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 );writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );
@@ -1529,7 +1524,6 @@ static void qmp_v4_configure_dp_tx(struct qmp_combo *qmp)static int qmp_v45_configure_dp_phy (struct qmp_combo *qmp) { -const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;unsigned long pixel_freq;
@@ -1567,8 +1561,8 @@ static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp) }writel (phy_vco_div, qmp->dp_pcs +QSERDES_V4_DP_PHY_VCO_DIV ); -clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 ); -clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); +clk_set_rate (qmp->dp_link_hw.clk, dp_opts->link_rate *100000 ); +clk_set_rate (qmp->dp_pixel_hw.clk, pixel_freq);writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );writel (0x05 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );
@@ -2354,12 +2348,10 @@ static int qcom_qmp_dp_pixel_clk_determine_rate(struct clk_hw *hw,static unsigned long qcom_qmp_dp_pixel_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) { -const struct qmp_phy_dp_clks *dp_clks;const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts; - dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_pixel_hw); - qmp = dp_clks->qmp; + qmp = container_of(hw, struct qmp_combo, dp_pixel_hw); dp_opts = &qmp->dp_opts;switch (dp_opts->link_rate) {
@@ -2398,12 +2390,10 @@ static int qcom_qmp_dp_link_clk_determine_rate(struct clk_hw *hw,static unsigned long qcom_qmp_dp_link_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) { -const struct qmp_phy_dp_clks *dp_clks;const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts; - dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_link_hw); - qmp = dp_clks->qmp; + qmp = container_of(hw, struct qmp_combo, dp_link_hw); dp_opts = &qmp->dp_opts;switch (dp_opts->link_rate) {
@@ -2425,7 +2415,7 @@ static const struct clk_ops qcom_qmp_dp_link_clk_ops = {static struct clk_hw *qcom_qmp_dp_clks_hw_get (struct of_phandle_args *clkspec,void *data) { -struct qmp_phy_dp_clks *dp_clks = data; +struct qmp_combo *qmp = data;unsigned int idx = clkspec->args[0 ];if (idx >=2 ) {
@@ -2434,42 +2424,34 @@ qcom_qmp_dp_clks_hw_get(struct of_phandle_args *clkspec, void *data) }if (idx ==0 ) -return &dp_clks->dp_link_hw; +return &qmp->dp_link_hw; -return &dp_clks->dp_pixel_hw; +return &qmp->dp_pixel_hw; }static int phy_dp_clks_register (struct qmp_combo *qmp,struct device_node *np) {struct clk_init_data init = { }; -struct qmp_phy_dp_clks *dp_clks;char name[64 ];int ret; - dp_clks =devm_kzalloc (qmp->dev,sizeof (*dp_clks),GFP_KERNEL ); -if (!dp_clks) -return -ENOMEM ; - - dp_clks->qmp = qmp; - qmp->dp_clks = dp_clks; -snprintf (name,sizeof (name),"%s::link_clk" ,dev_name (qmp->dev)); init.ops = &qcom_qmp_dp_link_clk_ops; init.name = name; - dp_clks->dp_link_hw.init = &init; - ret =devm_clk_hw_register (qmp->dev, &dp_clks->dp_link_hw); + qmp->dp_link_hw.init = &init; + ret =devm_clk_hw_register (qmp->dev, &qmp->dp_link_hw);if (ret)return ret;snprintf (name,sizeof (name),"%s::vco_div_clk" ,dev_name (qmp->dev)); init.ops = &qcom_qmp_dp_pixel_clk_ops; init.name = name; - dp_clks->dp_pixel_hw.init = &init; - ret =devm_clk_hw_register (qmp->dev, &dp_clks->dp_pixel_hw); + qmp->dp_pixel_hw.init = &init; + ret =devm_clk_hw_register (qmp->dev, &qmp->dp_pixel_hw);if (ret)return ret; - ret =of_clk_add_hw_provider (np, qcom_qmp_dp_clks_hw_get, dp_clks); + ret =of_clk_add_hw_provider (np, qcom_qmp_dp_clks_hw_get, qmp);if (ret)return ret;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 07/14] phy: qcom-qmp-combo: drop redundant clock structure
Quoted 7 lines · Johan Hovold
Drop the unnecessary DP clock structure and instead store the clocks directly in the driver data.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 52 ++++++++--------------- 1 file changed, 17 insertions(+), 35 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 8/14 phy: qcom-qmp-combo: drop redundant clock allocation
In reply to Johan HovoldSince the QMP driver split, there is no reason to allocate the fixed-rate pipe clock structure separately from the driver data.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +2 -5
@@ -897,6 +897,7 @@ struct qmp_combo {unsigned int dp_aux_cfg;struct phy_configure_opts_dp dp_opts; +struct clk_fixed_rate pipe_clk_fixed;struct clk_hw dp_link_hw;struct clk_hw dp_pixel_hw; };
@@ -2251,15 +2252,11 @@ static void phy_clk_release_provider(void *res)*/ static int phy_pipe_clk_register (struct qmp_combo *qmp,struct device_node *np) { -struct clk_fixed_rate *fixed; +struct clk_fixed_rate *fixed = &qmp->pipe_clk_fixed;struct clk_init_data init = { };char name[64 ];int ret; - fixed =devm_kzalloc (qmp->dev,sizeof (*fixed),GFP_KERNEL ); -if (!fixed) -return -ENOMEM ; -snprintf (name,sizeof (name),"%s::pipe_clk" ,dev_name (qmp->dev)); init.name = name; init.ops = &clk_fixed_rate_ops;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 08/14] phy: qcom-qmp-combo: drop redundant clock allocation
Quoted 8 lines · Johan Hovold
Since the QMP driver split, there is no reason to allocate the fixed-rate pipe clock structure separately from the driver data.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Note: it would be nice to port these two patches to USB & PCIe QMP PHY drivers.
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 08/14] phy: qcom-qmp-combo: drop redundant clock allocation
Quoted 10 lines · Dmitry Baryshkov
Quoted 8 lines · Johan Hovold
Since the QMP driver split, there is no reason to allocate the fixed-rate pipe clock structure separately from the driver data.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Quoted 4 lines
Reviewed-by Dmitry Baryshkov <[email protected]>Note: it would be nice to port these two patches to USB & PCIe QMP PHY drivers.
Already done:
https://lore.kernel.org/lkml/[email protected]/
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 08/14] phy: qcom-qmp-combo: drop redundant clock allocation
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Dmitry Baryshkov
Quoted 8 lines · Johan Hovold
Since the QMP driver split, there is no reason to allocate the fixed-rate pipe clock structure separately from the driver data.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Quoted 8 lines
Quoted 4 lines
Reviewed-by Dmitry Baryshkov <[email protected]>Note: it would be nice to port these two patches to USB & PCIe QMP PHY drivers.
Already done:
https://lore.kernel.org/lkml/[email protected]/
Thanks!
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 9/14 phy: qcom-qmp-combo: add clock registration helper
In reply to Johan HovoldIn preparation for supporting devicetree bindings which do not use child nodes, add a clock registration helper to handle the registration of both the USB and DP clocks.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +17 -5
@@ -2459,6 +2459,22 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } +static int qmp_combo_register_clocks (struct qmp_combo *qmp,struct device_node *usb_np, +struct device_node *dp_np) +{ +int ret; + + ret =phy_pipe_clk_register (qmp, usb_np); +if (ret) +return ret; + + ret =phy_dp_clks_register (qmp, dp_np); +if (ret) +return ret; + +return 0 ; +} +static int qmp_combo_parse_dt_lecacy_dp (struct qmp_combo *qmp,struct device_node *np) {const struct qmp_phy_cfg *cfg = qmp->cfg;
@@ -2618,11 +2634,7 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret) goto err_node_put; - ret =phy_pipe_clk_register (qmp, usb_np); -if (ret) - goto err_node_put; - - ret =phy_dp_clks_register (qmp, dp_np); + ret =qmp_combo_register_clocks (qmp, usb_np, dp_np);if (ret) goto err_node_put;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 09/14] phy: qcom-qmp-combo: add clock registration helper
Quoted 8 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, add a clock registration helper to handle the registration of both the USB and DP clocks.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 10/14 phy: qcom-qmp-combo: separate clock and provider registration
In reply to Johan HovoldIn preparation for supporting devicetree bindings which do not use child nodes, separate clock registration from clock-provider registration.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 +++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +20 -24
@@ -2255,7 +2255,6 @@ static int phy_pipe_clk_register(struct qmp_combo *qmp, struct device_node *np)struct clk_fixed_rate *fixed = &qmp->pipe_clk_fixed;struct clk_init_data init = { };char name[64 ]; -int ret;snprintf (name,sizeof (name),"%s::pipe_clk" ,dev_name (qmp->dev)); init.name = name;
@@ -2265,19 +2264,7 @@ static int phy_pipe_clk_register(struct qmp_combo *qmp, struct device_node *np) fixed->fixed_rate =125000000 ; fixed->hw.init = &init; - ret =devm_clk_hw_register (qmp->dev, &fixed->hw); -if (ret) -return ret; - - ret =of_clk_add_hw_provider (np, of_clk_hw_simple_get, &fixed->hw); -if (ret) -return ret; - -/* -* Roll a devm action because the clock provider is the child node, but -* the child node is not actually a device. -*/ -return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); +return devm_clk_hw_register (qmp->dev, &fixed->hw); }/*
@@ -2448,15 +2435,7 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)if (ret)return ret; - ret =of_clk_add_hw_provider (np, qcom_qmp_dp_clks_hw_get, qmp); -if (ret) -return ret; - -/* -* Roll a devm action because the clock provider is the child node, but -* the child node is not actually a device. -*/ -return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); +return 0 ; } static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node *usb_np,
@@ -2472,7 +2451,24 @@ static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node *if (ret)return ret; -return 0 ; + ret =of_clk_add_hw_provider (usb_np, of_clk_hw_simple_get, + &qmp->pipe_clk_fixed.hw); +if (ret) +return ret; + +/* +* Roll a devm action because the clock provider is the child node, but +* the child node is not actually a device. +*/ + ret =devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, usb_np); +if (ret) +return ret; + + ret =of_clk_add_hw_provider (dp_np, qcom_qmp_dp_clks_hw_get, qmp); +if (ret) +return ret; + +return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, dp_np); }static int qmp_combo_parse_dt_lecacy_dp (struct qmp_combo *qmp,struct device_node *np)
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 10/14] phy: qcom-qmp-combo: separate clock and provider registration
Quoted 7 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use child nodes, separate clock registration from clock-provider registration.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 +++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 11/14 phy: qcom-qmp-combo: clean up DP clock callbacks
In reply to Johan HovoldClean up the DP clock callbacks somewhat by dropping the redundant "qcom" prefix and removing line breaks after type specifiers.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 33 ++++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +14 -19
@@ -2316,8 +2316,7 @@ static int phy_pipe_clk_register(struct qmp_combo *qmp, struct device_node *np)* for DP pixel clock * */ -static int qcom_qmp_dp_pixel_clk_determine_rate (struct clk_hw *hw, -struct clk_rate_request *req) +static int qmp_dp_pixel_clk_determine_rate (struct clk_hw *hw,struct clk_rate_request *req) {switch (req->rate) {case 1620000000UL /2 :
@@ -2329,8 +2328,7 @@ static int qcom_qmp_dp_pixel_clk_determine_rate(struct clk_hw *hw, } } -static unsigned long -qcom_qmp_dp_pixel_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) +static unsigned long qmp_dp_pixel_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts;
@@ -2352,13 +2350,12 @@ qcom_qmp_dp_pixel_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) } } -static const struct clk_ops qcom_qmp_dp_pixel_clk_ops = { - .determine_rate = qcom_qmp_dp_pixel_clk_determine_rate, - .recalc_rate = qcom_qmp_dp_pixel_clk_recalc_rate, +static const struct clk_ops qmp_dp_pixel_clk_ops = { + .determine_rate = qmp_dp_pixel_clk_determine_rate, + .recalc_rate = qmp_dp_pixel_clk_recalc_rate, }; -static int qcom_qmp_dp_link_clk_determine_rate (struct clk_hw *hw, -struct clk_rate_request *req) +static int qmp_dp_link_clk_determine_rate (struct clk_hw *hw,struct clk_rate_request *req) {switch (req->rate) {case 162000000 :
@@ -2371,8 +2368,7 @@ static int qcom_qmp_dp_link_clk_determine_rate(struct clk_hw *hw, } } -static unsigned long -qcom_qmp_dp_link_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) +static unsigned long qmp_dp_link_clk_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts;
@@ -2391,13 +2387,12 @@ qcom_qmp_dp_link_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) } } -static const struct clk_ops qcom_qmp_dp_link_clk_ops = { - .determine_rate = qcom_qmp_dp_link_clk_determine_rate, - .recalc_rate = qcom_qmp_dp_link_clk_recalc_rate, +static const struct clk_ops qmp_dp_link_clk_ops = { + .determine_rate = qmp_dp_link_clk_determine_rate, + .recalc_rate = qmp_dp_link_clk_recalc_rate, }; -static struct clk_hw * -qcom_qmp_dp_clks_hw_get (struct of_phandle_args *clkspec,void *data) +static struct clk_hw *qmp_dp_clks_hw_get (struct of_phandle_args *clkspec,void *data) {struct qmp_combo *qmp = data;unsigned int idx = clkspec->args[0 ];
@@ -2420,7 +2415,7 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)int ret;snprintf (name,sizeof (name),"%s::link_clk" ,dev_name (qmp->dev)); - init.ops = &qcom_qmp_dp_link_clk_ops; + init.ops = &qmp_dp_link_clk_ops; init.name = name; qmp->dp_link_hw.init = &init; ret =devm_clk_hw_register (qmp->dev, &qmp->dp_link_hw);
@@ -2428,7 +2423,7 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)return ret;snprintf (name,sizeof (name),"%s::vco_div_clk" ,dev_name (qmp->dev)); - init.ops = &qcom_qmp_dp_pixel_clk_ops; + init.ops = &qmp_dp_pixel_clk_ops; init.name = name; qmp->dp_pixel_hw.init = &init; ret =devm_clk_hw_register (qmp->dev, &qmp->dp_pixel_hw);
@@ -2464,7 +2459,7 @@ static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node *if (ret)return ret; - ret =of_clk_add_hw_provider (dp_np, qcom_qmp_dp_clks_hw_get, qmp); + ret =of_clk_add_hw_provider (dp_np, qmp_dp_clks_hw_get, qmp);if (ret)return ret;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 11/14] phy: qcom-qmp-combo: clean up DP clock callbacks
Quoted 8 lines · Johan Hovold
Clean up the DP clock callbacks somewhat by dropping the redundant "qcom" prefix and removing line breaks after type specifiers.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 33 ++++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 12/14 phy: qcom-qmp-combo: rename common-register pointers
In reply to Johan HovoldThe common registers are shared by the USB and DP parts of the PHY so drop the misleading "dp" prefix from the corresponding pointers.
Note that the "DP" prefix could also be dropped from the corresponding defines, but leave that in place for now.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +12 -12
@@ -866,7 +866,7 @@ struct qmp_combo {const struct qmp_phy_cfg *cfg; -void __iomem *dp_com; +void __iomem *com;void __iomem *serdes;void __iomem *tx;
@@ -1778,7 +1778,7 @@ static int qmp_combo_dp_calibrate(struct phy *phy)static int qmp_combo_com_init (struct qmp_combo *qmp) {const struct qmp_phy_cfg *cfg = qmp->cfg; -void __iomem *dp_com = qmp->dp_com; +void __iomem *com = qmp->com;int ret;mutex_lock (&qmp->phy_mutex);
@@ -1809,25 +1809,25 @@ static int qmp_combo_com_init(struct qmp_combo *qmp)if (ret) goto err_assert_reset; -qphy_setbits (dp_com,QPHY_V3_DP_COM_POWER_DOWN_CTRL ,SW_PWRDN ); +qphy_setbits (com,QPHY_V3_DP_COM_POWER_DOWN_CTRL ,SW_PWRDN );/* override hardware control for reset of qmp phy */ -qphy_setbits (dp_com,QPHY_V3_DP_COM_RESET_OVRD_CTRL , +qphy_setbits (com,QPHY_V3_DP_COM_RESET_OVRD_CTRL ,SW_DPPHY_RESET_MUX |SW_DPPHY_RESET |SW_USB3PHY_RESET_MUX |SW_USB3PHY_RESET );/* Default type-c orientation, i.e CC1 */ -qphy_setbits (dp_com,QPHY_V3_DP_COM_TYPEC_CTRL ,0x02 ); +qphy_setbits (com,QPHY_V3_DP_COM_TYPEC_CTRL ,0x02 ); -qphy_setbits (dp_com,QPHY_V3_DP_COM_PHY_MODE_CTRL ,USB3_MODE |DP_MODE ); +qphy_setbits (com,QPHY_V3_DP_COM_PHY_MODE_CTRL ,USB3_MODE |DP_MODE );/* bring both QMP USB and QMP DP PHYs PCS block out of reset */ -qphy_clrbits (dp_com,QPHY_V3_DP_COM_RESET_OVRD_CTRL , +qphy_clrbits (com,QPHY_V3_DP_COM_RESET_OVRD_CTRL ,SW_DPPHY_RESET_MUX |SW_DPPHY_RESET |SW_USB3PHY_RESET_MUX |SW_USB3PHY_RESET ); -qphy_clrbits (dp_com,QPHY_V3_DP_COM_SWI_CTRL ,0x03 ); -qphy_clrbits (dp_com,QPHY_V3_DP_COM_SW_RESET ,SW_RESET ); +qphy_clrbits (com,QPHY_V3_DP_COM_SWI_CTRL ,0x03 ); +qphy_clrbits (com,QPHY_V3_DP_COM_SW_RESET ,SW_RESET );qphy_setbits (qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ],SW_PWRDN );
@@ -2560,9 +2560,9 @@ static int qmp_combo_parse_dt_legacy(struct qmp_combo *qmp, struct device_node *if (IS_ERR (qmp->serdes))return PTR_ERR (qmp->serdes); - qmp->dp_com =devm_platform_ioremap_resource (pdev,1 ); -if (IS_ERR (qmp->dp_com)) -return PTR_ERR (qmp->dp_com); + qmp->com =devm_platform_ioremap_resource (pdev,1 ); +if (IS_ERR (qmp->com)) +return PTR_ERR (qmp->com); qmp->dp_serdes =devm_platform_ioremap_resource (pdev,2 );if (IS_ERR (qmp->dp_serdes))
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 12/14] phy: qcom-qmp-combo: rename common-register pointers
Quoted 10 lines · Johan Hovold
The common registers are shared by the USB and DP parts of the PHY so drop the misleading "dp" prefix from the corresponding pointers.
Note that the "DP" prefix could also be dropped from the corresponding defines, but leave that in place for now.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Note regarding the last phrase: I'd suggest leaving the DP prefix in register names, it makes it easier to visually note & verify the register block.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 12/14] phy: qcom-qmp-combo: rename common-register pointers
Quoted 12 lines · Dmitry Baryshkov
Quoted 10 lines · Johan Hovold
The common registers are shared by the USB and DP parts of the PHY so drop the misleading "dp" prefix from the corresponding pointers.
Note that the "DP" prefix could also be dropped from the corresponding defines, but leave that in place for now.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Quoted 5 lines
Reviewed-by Dmitry Baryshkov <[email protected]>Note regarding the last phrase: I'd suggest leaving the DP prefix in register names, it makes it easier to visually note & verify the register block.
My point is that "DP" was never part of the COM register block name. The confusion likely comes from the vendor driver naming these defines along the lines of
USB3_DP_COM_POWER_DOWN_CTRL
Here "USB3_DP" is the common prefix for all defines that apply to both "parts" of the PHY so the corresponding Linux define
QPHY_V3_DP_COM_POWER_DOWN_CTRL
should either include "USB3" or drop "DP".
This becomes more apparent on SC8280XP where the corresponding define is:
USB43DP_COM_POWER_DOWN_CTRL
Johan
Re: [PATCH 12/14] phy: qcom-qmp-combo: rename common-register pointers
Quoted 23 lines · Johan Hovold
Quoted 12 lines · Dmitry Baryshkov
Quoted 10 lines · Johan Hovold
The common registers are shared by the USB and DP parts of the PHY so drop the misleading "dp" prefix from the corresponding pointers.
Note that the "DP" prefix could also be dropped from the corresponding defines, but leave that in place for now.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)Quoted 5 lines
Reviewed-by Dmitry Baryshkov <[email protected]>Note regarding the last phrase: I'd suggest leaving the DP prefix in register names, it makes it easier to visually note & verify the register block.
My point is that "DP" was never part of the COM register block name. The confusion likely comes from the vendor driver naming these defines along the lines of
Quoted 8 lines
USB3_DP_COM_POWER_DOWN_CTRLHere "
USB3_DP" is the common prefix for all defines that apply to both "parts" of the PHY so the corresponding Linux define
QPHY_V3_DP_COM_POWER_DOWN_CTRLshould either include "USB3" or drop "DP".
My thought was that we already have too many _COM_ defines in the qmp headers. Having QPHY_Vn_COM_something would make it too easy to mix it with QSERDES_Vn_COM_foo. Thus I'd vote to leave DP_COM prefix in place. While it might be not fully accurate, it serves the point of identifying the register block.
Quoted 5 lines
This becomes more apparent on SC8280XP where the corresponding define is:
USB43DP_COM_POWER_DOWN_CTRL
I'd still use something like QPHY_V10_DP_COM_POWER_DOWN_CTRL here.
Quoted 2 lines
Johan
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 12/14] phy: qcom-qmp-combo: rename common-register pointers
Quoted 31 lines · Dmitry Baryshkov
Quoted 30 lines · Johan Hovold
Quoted 12 lines · Dmitry Baryshkov
Quoted 10 lines · Johan Hovold
The common registers are shared by the USB and DP parts of the PHY so drop the misleading "dp" prefix from the corresponding pointers.
Note that the "DP" prefix could also be dropped from the corresponding defines, but leave that in place for now.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)Quoted 5 lines
Reviewed-by Dmitry Baryshkov <[email protected]>Note regarding the last phrase: I'd suggest leaving the DP prefix in register names, it makes it easier to visually note & verify the register block.
My point is that "DP" was never part of the COM register block name. The confusion likely comes from the vendor driver naming these defines along the lines of
USB3_DP_COM_POWER_DOWN_CTRLHere "
USB3_DP" is the common prefix for all defines that apply to both "parts" of the PHY so the corresponding Linux define
QPHY_V3_DP_COM_POWER_DOWN_CTRL
Quoted 7 lines
Quoted 1 line
should either include "USB3" or drop "DP".
My thought was that we already have too many _COM_ defines in the qmp headers. Having
QPHY_Vn_COM_somethingwould make it too easy to mix it withQSERDES_Vn_COM_foo. Thus I'd vote to leaveDP_COMprefix in place. While it might be not fully accurate, it serves the point of identifying the register block.
I don't mind terribly and I didn't even consider trying to rename the current defines.
The lack of public conclusive documentation makes structuring this mess much harder than it should have to be.
That said, I don't really think that the risk of mixing up QPHY_Vn_COM_foo with QSERDES_Vn_COM_bar is something we need to worry about as you already have a separating "QSERDES" in there. Those sets of registers should be disjoint too if I remember correctly.
Quoted 6 lines
Quoted 4 lines
This becomes more apparent on SC8280XP where the corresponding define is:
USB43DP_COM_POWER_DOWN_CTRLI'd still use something like
QPHY_V10_DP_COM_POWER_DOWN_CTRLhere.
Yeah, but then you're just making names up. ;)
Johan
PATCH 13/14 phy: qcom-qmp-combo: rename DP_PHY register pointer
In reply to Johan HovoldThe DP_PHY registers have erroneously been referred to as "PCS" registers since DisplayPort support was added to the QMP drivers (including in the devicetree binding).
Rename the corresponding pointer to match the register names.
Note that the repeated "dp" in the field name is intentional and this DP register block is called "DP_PHY" (not just "PHY").
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 139 +++++++++++----------- 1 file changed, 70 insertions(+), 69 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +70 -69
@@ -880,7 +880,7 @@ struct qmp_combo {void __iomem *dp_serdes;void __iomem *dp_tx;void __iomem *dp_tx2; -void __iomem *dp_pcs; +void __iomem *dp_dp_phy;struct clk *pipe_clk;struct clk_bulk_data *clks;
@@ -1263,20 +1263,20 @@ static void qmp_v3_dp_aux_init(struct qmp_combo *qmp) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ writel (QSERDES_V3_COM_BIAS_EN |QSERDES_V3_COM_BIAS_EN_MUX |QSERDES_V3_COM_CLKBUF_L_EN |QSERDES_V3_COM_EN_SYSCLK_TX_SEL , qmp->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); -writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL );writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_LANE_0_1_PWRDN |DP_PHY_PD_CTL_LANE_2_3_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL ); writel(QSERDES_V3_COM_BIAS_EN | QSERDES_V3_COM_BIAS_EN_MUX | QSERDES_V3_COM_CLKBUF_R_EN |
@@ -1284,22 +1284,22 @@ static void qmp_v3_dp_aux_init(struct qmp_combo *qmp)QSERDES_V3_COM_CLKBUF_RX_DRIVE_L , qmp->dp_serdes + QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN); -writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0x24 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xbb , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0x24 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xbb , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG9 ); qmp->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qmp->dp_pcs +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); + qmp->dp_dp_phy +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); } static int qmp_combo_configure_dp_swing(struct qmp_combo *qmp,
@@ -1383,12 +1383,12 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)* if (lane_cnt == 4 || orientation == ORIENTATION_CC1) * val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; * if (orientation == ORIENTATION_CC2) -* writel(0x4c, qmp->dp_pcs + QSERDES_V3_DP_PHY_MODE); +* writel(0x4c, qmp->dp_dp_phy + QSERDES_V3_DP_PHY_MODE); */ val |=DP_PHY_PD_CTL_LANE_2_3_PWRDN ; -writel (val, qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (val, qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL ); -writel (0x5c , qmp->dp_pcs +QSERDES_DP_PHY_MODE ); +writel (0x5c , qmp->dp_dp_phy +QSERDES_DP_PHY_MODE );return reverse; }
@@ -1401,8 +1401,8 @@ static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp)qmp_combo_configure_dp_mode (qmp); -writel (0x05 , qmp->dp_pcs +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qmp->dp_pcs +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1425,16 +1425,16 @@ static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qmp->dp_pcs +QSERDES_V3_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qmp->dp_dp_phy +QSERDES_V3_DP_PHY_VCO_DIV );clk_set_rate (qmp->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (qmp->dp_pixel_hw.clk, pixel_freq); -writel (0x04 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x04 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x01 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x09 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG );writel (0x20 , qmp->dp_serdes +QSERDES_V3_COM_RESETSM_CNTRL );
@@ -1445,20 +1445,20 @@ static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp) 10000))return -ETIMEDOUT ; -writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V3_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_dp_phy +QSERDES_V3_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); - return readl_poll_timeout(qmp->dp_pcs + QSERDES_V3_DP_PHY_STATUS, + return readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V3_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1478,7 +1478,7 @@ static int qmp_v3_calibrate_dp_phy(struct qmp_combo *qmp) qmp->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); val = cfg1_settings[qmp->dp_aux_cfg]; -writel (val, qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; }
@@ -1487,27 +1487,27 @@ static void qmp_v4_dp_aux_init(struct qmp_combo *qmp) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_PSR_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ writel (0x17 , qmp->dp_serdes +QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN ); -writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xb7 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xb7 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG9 ); qmp->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qmp->dp_pcs +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); + qmp->dp_dp_phy +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); }static void qmp_v4_configure_dp_tx (struct qmp_combo *qmp)
@@ -1529,15 +1529,15 @@ static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp)u32 phy_vco_div, status;unsigned long pixel_freq; -writel (0x0f , qmp->dp_pcs +QSERDES_V4_DP_PHY_CFG_1 ); +writel (0x0f , qmp->dp_dp_phy +QSERDES_V4_DP_PHY_CFG_1 );qmp_combo_configure_dp_mode (qmp); -writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x13 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x05 , qmp->dp_pcs +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qmp->dp_pcs +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1560,15 +1560,15 @@ static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qmp->dp_pcs +QSERDES_V4_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qmp->dp_dp_phy +QSERDES_V4_DP_PHY_VCO_DIV );clk_set_rate (qmp->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (qmp->dp_pixel_hw.clk, pixel_freq); -writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x05 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +writel (0x09 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG );writel (0x20 , qmp->dp_serdes +QSERDES_V4_COM_RESETSM_CNTRL );
@@ -1593,16 +1593,16 @@ static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp) 10000))return -ETIMEDOUT ; -writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_dp_phy +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; - if (readl_poll_timeout(qmp->dp_pcs + QSERDES_V4_DP_PHY_STATUS, + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V4_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1651,11 +1651,11 @@ static int qmp_v4_configure_dp_phy(struct qmp_combo *qmp)writel (drvr1_en, qmp->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN );writel (bias1_en, qmp->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); - if (readl_poll_timeout(qmp->dp_pcs + QSERDES_V4_DP_PHY_STATUS, + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V4_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1708,11 +1708,11 @@ static int qmp_v5_configure_dp_phy(struct qmp_combo *qmp)writel (drvr1_en, qmp->dp_tx2 +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN );writel (bias1_en, qmp->dp_tx2 +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); - if (readl_poll_timeout(qmp->dp_pcs + QSERDES_V4_DP_PHY_STATUS, + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V4_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1744,7 +1744,7 @@ static int qmp_v4_calibrate_dp_phy(struct qmp_combo *qmp) qmp->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); val = cfg1_settings[qmp->dp_aux_cfg]; -writel (val, qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; }
@@ -1918,7 +1918,7 @@ static int qmp_combo_dp_power_off(struct phy *phy)struct qmp_combo *qmp =phy_get_drvdata (phy);/* Assert DP PHY power down */ -writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL );return 0 ; }
@@ -2477,15 +2477,16 @@ static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_nod* For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. * -* Note that only tx/tx2 and pcs are used by the DP implementation. +* Note that only tx/tx2 and pcs (dp_phy) are used by the DP +* implementation. */ qmp->dp_tx =devm_of_iomap (dev, np,0 ,NULL );if (IS_ERR (qmp->dp_tx))return PTR_ERR (qmp->dp_tx); - qmp->dp_pcs =devm_of_iomap (dev, np,2 ,NULL ); -if (IS_ERR (qmp->dp_pcs)) -return PTR_ERR (qmp->dp_pcs); + qmp->dp_dp_phy =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qmp->dp_dp_phy)) +return PTR_ERR (qmp->dp_dp_phy);if (cfg->lanes >=2 ) { qmp->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL );
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 13/14] phy: qcom-qmp-combo: rename DP_PHY register pointer
Quoted 6 lines · Johan Hovold
The
DP_PHYregisters have erroneously been referred to as "PCS" registers since DisplayPort support was added to the QMP drivers (including in the devicetree binding).Rename the corresponding pointer to match the register names.
Quoted 7 lines
Note that the repeated "dp" in the field name is intentional and this DP register block is called "
DP_PHY" (not just "PHY").Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 139 +++++++++++----------- 1 file changed, 70 insertions(+), 69 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 14/14 phy: qcom-qmp-combo: add support for updated sc8280xp binding
In reply to Johan HovoldAdd support for the new SC8280XP binding.
Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets.
Also note that (possibly) unlike on earlier platforms, the TX registers are used by both the USB and DP implementation.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 143 ++++++++++++++++++++-- 1 file changed, 133 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +133 -10
@@ -798,9 +798,25 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_combo ; +struct qmp_combo_offsets { +u16 com; +u16 txa; +u16 rxa; +u16 txb; +u16 rxb; +u16 usb3_serdes; +u16 usb3_pcs_misc; +u16 usb3_pcs; +u16 usb3_pcs_usb; +u16 dp_serdes; +u16 dp_dp_phy; +}; +struct qmp_phy_cfg {int lanes; +const struct qmp_combo_offsets *offsets; +/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl;int serdes_tbl_num;
@@ -961,6 +977,20 @@ static const char * const sc7180_usb3phy_reset_l[] = { "phy", }; +static const struct qmp_combo_offsets qmp_combo_offsets_v5 = { + .com =0x0000 , + .txa =0x0400 , + .rxa =0x0600 , + .txb =0x0a00 , + .rxb =0x0c00 , + .usb3_serdes =0x1000 , + .usb3_pcs_misc =0x1200 , + .usb3_pcs =0x1400 , + .usb3_pcs_usb =0x1700 , + .dp_serdes =0x2000 , + .dp_dp_phy =0x2200 , +}; +static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { .lanes =2 ,
@@ -1107,6 +1137,8 @@ static const struct qmp_phy_cfg sc8180x_usb3dpphy_cfg = {static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { .lanes =2 , + .offsets = &qmp_combo_offsets_v5, + .serdes_tbl = sc8280xp_usb43dp_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_serdes_tbl), .tx_tbl = sc8280xp_usb43dp_tx_tbl,
@@ -1147,7 +1179,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, - .pcs_usb_offset = 0x300, };static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = {
@@ -2433,6 +2464,22 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)return 0 ; } +static struct clk_hw *qmp_combo_clk_hw_get (struct of_phandle_args *clkspec,void *data) +{ +struct qmp_combo *qmp = data; + +switch (clkspec->args[0 ]) { +case 0 : +return &qmp->pipe_clk_fixed.hw; +case 1 : +return &qmp->dp_link_hw; +case 2 : +return &qmp->dp_pixel_hw; + } + +return ERR_PTR (-EINVAL ); +} +static int qmp_combo_register_clocks (struct qmp_combo *qmp,struct device_node *usb_np,struct device_node *dp_np) {
@@ -2446,6 +2493,15 @@ static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node *if (ret)return ret; +/* +* Register a single provider for bindings without child nodes. +*/ +if (usb_np == qmp->dev->of_node) +return devm_of_clk_add_hw_provider (qmp->dev, qmp_combo_clk_hw_get, qmp); + +/* +* Register multiple providers for legacy bindings with child nodes. +*/ ret =of_clk_add_hw_provider (usb_np, of_clk_hw_simple_get, &qmp->pipe_clk_fixed.hw);if (ret)
@@ -2580,6 +2636,63 @@ static int qmp_combo_parse_dt_legacy(struct qmp_combo *qmp, struct device_node *return 0 ; } +static int qmp_combo_parse_dt (struct qmp_combo *qmp) +{ +struct platform_device *pdev =to_platform_device (qmp->dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +const struct qmp_combo_offsets *offs = cfg->offsets; +struct device *dev = qmp->dev; +void __iomem *base; + +if (!offs) +return -EINVAL ; + + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + + qmp->com = base + offs->com; + qmp->tx = base + offs->txa; + qmp->rx = base + offs->rxa; + qmp->tx2 = base + offs->txb; + qmp->rx2 = base + offs->rxb; + + qmp->serdes = base + offs->usb3_serdes; + qmp->pcs_misc = base + offs->usb3_pcs_misc; + qmp->pcs = base + offs->usb3_pcs; + qmp->pcs_usb = base + offs->usb3_pcs_usb; + + qmp->dp_serdes = base + offs->dp_serdes; + qmp->dp_tx = base + offs->txa; + qmp->dp_tx2 = base + offs->txb; + qmp->dp_dp_phy = base + offs->dp_dp_phy; + + qmp->pipe_clk =devm_clk_get (dev,"usb3_pipe" ); +if (IS_ERR (qmp->pipe_clk)) { +return dev_err_probe (dev,PTR_ERR (qmp->pipe_clk), +"failed to get usb3_pipe clock\n" ); + } + +return 0 ; +} + +static struct phy *qmp_combo_phy_xlate (struct device *dev,struct of_phandle_args *args) +{ +struct qmp_combo *qmp =dev_get_drvdata (dev); + +if (args->args_count ==0 ) +return ERR_PTR (-EINVAL ); + +switch (args->args[0 ]) { +case PHY_TYPE_USB3 : +return qmp->usb_phy; +case PHY_TYPE_DP : +return qmp->dp_phy; + } + +return ERR_PTR (-EINVAL ); +} +static int qmp_combo_probe (struct platform_device *pdev) {struct qmp_combo *qmp;
@@ -2612,17 +2725,22 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret)return ret; +/* Check for legacy binding with child nodes. */ usb_np =of_get_child_by_name (dev->of_node,"usb3-phy" ); -if (!usb_np) -return -EINVAL ; +if (usb_np) { + dp_np =of_get_child_by_name (dev->of_node,"dp-phy" ); +if (!dp_np) { +of_node_put (usb_np); +return -EINVAL ; + } - dp_np =of_get_child_by_name (dev->of_node,"dp-phy" ); -if (!dp_np) { -of_node_put (usb_np); -return -EINVAL ; - } + ret =qmp_combo_parse_dt_legacy (qmp, usb_np, dp_np); + }else { + usb_np =of_node_get (dev->of_node); + dp_np =of_node_get (dev->of_node); - ret =qmp_combo_parse_dt_legacy (qmp, usb_np, dp_np); + ret =qmp_combo_parse_dt (qmp); + }if (ret) goto err_node_put;
@@ -2658,7 +2776,12 @@ static int qmp_combo_probe(struct platform_device *pdev)phy_set_drvdata (qmp->dp_phy, qmp); - phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); +dev_set_drvdata (dev, qmp); + +if (usb_np == dev->of_node) + phy_provider =devm_of_phy_provider_register (dev, qmp_combo_phy_xlate); +else + phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);of_node_put (usb_np);of_node_put (dp_np);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 14/14] phy: qcom-qmp-combo: add support for updated sc8280xp binding
Quoted 18 lines · Johan Hovold
Add support for the new SC8280XP binding.
Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets.
Also note that (possibly) unlike on earlier platforms, the TX registers are used by both the USB and DP implementation.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 143 ++++++++++++++++++++-- 1 file changed, 133 insertions(+), 10 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 806
Quoted 9 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6
-0@@ -798,9 +798,25 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_combo ; +struct qmp_combo_offsets { +u16 com; +u16 txa; +u16 rxa; +u16 txb; +u16 rxb;
Yes, txa/txb are more in spite of the vendor headers. I'd sill suggest to use tx/tx2 and rx/rx2 as used everywhere in the QMP driver.
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +8
-0+u16 usb3_serdes; +u16 usb3_pcs_misc; +u16 usb3_pcs; +u16 usb3_pcs_usb; +u16 dp_serdes; +u16 dp_dp_phy; +}; +
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 14/14] phy: qcom-qmp-combo: add support for updated sc8280xp binding
Quoted 22 lines · Dmitry Baryshkov
Quoted 21 lines · Johan Hovold
Add support for the new SC8280XP binding.
Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets.
Also note that (possibly) unlike on earlier platforms, the TX registers are used by both the USB and DP implementation.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 143 ++++++++++++++++++++-- 1 file changed, 133 insertions(+), 10 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -798,9 +798,25 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_combo ;
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 806
Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6
-0+struct qmp_combo_offsets { +u16 com; +u16 txa; +u16 rxa; +u16 txb; +u16 rxb;Yes, txa/txb are more in spite of the vendor headers. I'd sill suggest to use tx/tx2 and rx/rx2 as used everywhere in the QMP driver.
I don't see any reason for making up names when we can use names that match the hardware and do the conversion in one place when parsing the devicetree.
If anything we should probably rename tx/tx2 at some point (as either tx0/tx1 or txa/txb).
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 814
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +8
-0+u16 usb3_serdes; +u16 usb3_pcs_misc; +u16 usb3_pcs; +u16 usb3_pcs_usb; +u16 dp_serdes; +u16 dp_dp_phy; +}; +
Johan