diff mbox series

[RFC,1/3] dt-bindings: usb: qcom,dwc3: Add support for multiple power-domains

Message ID 1709657858-8563-2-git-send-email-quic_sriramd@quicinc.com
State New
Headers show
Series Enable firmware-managed USB resources on Qcom targets | expand

Commit Message

Sriram Dash March 5, 2024, 4:57 p.m. UTC
Some target systems allow multiple resources to be managed by firmware.
On these targets, tasks related to clocks, regulators, resets, and
interconnects can be delegated to the firmware, while the remaining
responsibilities are handled by Linux.

To support the management of partial resources in Linux and leave the rest
to firmware, multiple power domains are introduced. Each power domain can
manage one or more resources, depending on the specific use case.

These power domains handle SCMI calls to the firmware, enabling the
activation and deactivation of firmware-managed resources.

Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
---
 .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
 .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
 .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
 3 files changed, 130 insertions(+), 30 deletions(-)

Comments

Krzysztof Kozlowski March 5, 2024, 5:07 p.m. UTC | #1
On 05/03/2024 17:57, Sriram Dash wrote:
> Some target systems allow multiple resources to be managed by firmware.
> On these targets, tasks related to clocks, regulators, resets, and
> interconnects can be delegated to the firmware, while the remaining
> responsibilities are handled by Linux.
> 
> To support the management of partial resources in Linux and leave the rest
> to firmware, multiple power domains are introduced. Each power domain can
> manage one or more resources, depending on the specific use case.
> 
> These power domains handle SCMI calls to the firmware, enabling the
> activation and deactivation of firmware-managed resources.
> 
> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
> ---
>  .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>  .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>  .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>  3 files changed, 130 insertions(+), 30 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> index 1e2d4dd..53b9ba9 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> @@ -44,7 +44,32 @@ properties:
>      maxItems: 5
>  
>    power-domains:
> -    maxItems: 1
> +    description: specifies a phandle to PM domain provider node

Please drop all redundant descriptions. Adding them is not even related
to this patch.

> +    minItems: 1
> +    maxItems: 2
> +
> +  power-domain-names:
> +    description:
> +      A list of power domain name strings sorted in the same order as the
> +      power-domains property.
> +
> +      For platforms where some resource are firmware managed, the name
> +      corresponding to the index of an SCMI domain provider can be
> +      "usb_core" or "usb_transfer".
> +    items:
> +      - const: usb_core
> +      - const: usb_transfer

How is this related to fw-managed? I fail to see it. Don't mix
independent problems in one patch.

> +
> +  qmp,fw-managed:

Please do not upstream vendor code directly, but perform basic
adjustment to upstream Linux kernel. There is no such company as gmp.

Run this first through your internal review process.

> +    description:
> +      Some targets allow multiple resources to be managed by firmware.

You miss clear mapping between compatibles and this property - allOf
restricting it to specific SoCs.

Is this different property than qcom,controlled-remotely?

Best regards,
Krzysztof
Sriram Dash March 5, 2024, 6:03 p.m. UTC | #2
On 3/5/2024 10:37 PM, Krzysztof Kozlowski wrote:
> On 05/03/2024 17:57, Sriram Dash wrote:
>> Some target systems allow multiple resources to be managed by firmware.
>> On these targets, tasks related to clocks, regulators, resets, and
>> interconnects can be delegated to the firmware, while the remaining
>> responsibilities are handled by Linux.
>>
>> To support the management of partial resources in Linux and leave the rest
>> to firmware, multiple power domains are introduced. Each power domain can
>> manage one or more resources, depending on the specific use case.
>>
>> These power domains handle SCMI calls to the firmware, enabling the
>> activation and deactivation of firmware-managed resources.
>>
>> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
>> ---
>>   .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>>   .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>>   .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>>   3 files changed, 130 insertions(+), 30 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> index 1e2d4dd..53b9ba9 100644
>> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> @@ -44,7 +44,32 @@ properties:
>>       maxItems: 5
>>   
>>     power-domains:
>> -    maxItems: 1
>> +    description: specifies a phandle to PM domain provider node
> 
> Please drop all redundant descriptions. Adding them is not even related
> to this patch.
> 

Thanks Krzysztof for the super quick response !
Sure. will drop the description for power-domain
and power-doamin-names.

>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  power-domain-names:
>> +    description:
>> +      A list of power domain name strings sorted in the same order as the
>> +      power-domains property.
>> +
>> +      For platforms where some resource are firmware managed, the name
>> +      corresponding to the index of an SCMI domain provider can be
>> +      "usb_core" or "usb_transfer".
>> +    items:
>> +      - const: usb_core
>> +      - const: usb_transfer
> 
> How is this related to fw-managed? I fail to see it. Don't mix
> independent problems in one patch.
> 

Some of the the resources like clocks, regulators, etc will be 
controlled by the firmware instead of OS. However, some resources
still will be controlled by OS (interrupts for example).

So, to support the management of partial resources in Linux, and
offload the other resource management to firmware, multiple power 
domains are introduced. They will be corresponding to different
hw blocks.

Do you suggest splitting the addition of power-domain-names and
addition of fw-managed property in separate patches for bindings!

>> +
>> +  qmp,fw-managed:
> 
> Please do not upstream vendor code directly, but perform basic
> adjustment to upstream Linux kernel. There is no such company as gmp.
> 
> Run this first through your internal review process.
> 

This property is newly introduced for the qmp superspeed phy and
similar dt properties are introduced for hsphy and dwc3 qcom
controller glue layer driver. It will govern the suspend/ resume
of the resources (by firmware or OS) as required.

>> +    description:
>> +      Some targets allow multiple resources to be managed by firmware.
> 
> You miss clear mapping between compatibles and this property - allOf
> restricting it to specific SoCs.
> 
> Is this different property than qcom,controlled-remotely?
> 

No. unlike "qcom,controlled-remotely", which lets the OS know only to
consume the resources, "qmp,fw-managed" property will decide the
resource management and trigger the suspend/ resume from OS, which
will be handled by the firmware.

Can we reuse the property "qcom,controlled-remotely" here? If so,
we can replace the aformentioned property with qmp phy, hsphy, and
controller glue layer property. Please suggest.

> Best regards,
> Krzysztof
>
Dmitry Baryshkov March 5, 2024, 7:03 p.m. UTC | #3
On Tue, 5 Mar 2024 at 18:58, Sriram Dash <quic_sriramd@quicinc.com> wrote:
>
> Some target systems allow multiple resources to be managed by firmware.
> On these targets, tasks related to clocks, regulators, resets, and
> interconnects can be delegated to the firmware, while the remaining
> responsibilities are handled by Linux.
>
> To support the management of partial resources in Linux and leave the rest
> to firmware, multiple power domains are introduced. Each power domain can
> manage one or more resources, depending on the specific use case.
>
> These power domains handle SCMI calls to the firmware, enabling the
> activation and deactivation of firmware-managed resources.
>
> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
> ---
>  .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>  .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>  .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>  3 files changed, 130 insertions(+), 30 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> index 1e2d4dd..53b9ba9 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> @@ -44,7 +44,32 @@ properties:
>      maxItems: 5
>
>    power-domains:
> -    maxItems: 1
> +    description: specifies a phandle to PM domain provider node
> +    minItems: 1
> +    maxItems: 2
> +
> +  power-domain-names:
> +    description:
> +      A list of power domain name strings sorted in the same order as the
> +      power-domains property.
> +
> +      For platforms where some resource are firmware managed, the name
> +      corresponding to the index of an SCMI domain provider can be
> +      "usb_core" or "usb_transfer".
> +    items:
> +      - const: usb_core
> +      - const: usb_transfer
> +
> +  qmp,fw-managed:
> +    description:
> +      Some targets allow multiple resources to be managed by firmware.
> +      On these targets, tasks related to clocks, regulators, resets, and
> +      interconnects can be delegated to the firmware, while the remaining
> +      responsibilities are handled by Linux.
> +
> +      Decide if the target resources will be managed by firmware or High level
> +      OS.
> +    type: boolean
>
>    resets:
>      maxItems: 2
> @@ -70,14 +95,6 @@ properties:
>  required:
>    - compatible
>    - reg
> -  - clocks
> -  - clock-names
> -  - resets
> -  - reset-names
> -  - vdda-phy-supply
> -  - vdda-pll-supply
> -  - "#clock-cells"
> -  - clock-output-names
>    - "#phy-cells"
>
>  allOf:
> @@ -86,6 +103,33 @@ allOf:
>          compatible:
>            contains:
>              enum:
> +              - qcom,sa8775p-qmp-usb3-uni-phy
> +              - qcom,sc8280xp-qmp-usb3-uni-phy
> +              - qcom,x1e80100-qmp-usb3-uni-phy
> +    then:
> +      required:
> +        - power-domains
> +
> +  - if:
> +      not:
> +        required:
> +          - qmp,fw-managed
> +    then:
> +      required:
> +        - clocks
> +        - clock-names
> +        - resets
> +        - reset-names
> +        - vdda-phy-supply
> +        - vdda-pll-supply
> +        - clock-output-names
> +        - "#clock-cells"
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
>                - qcom,ipq6018-qmp-usb3-phy
>                - qcom,ipq8074-qmp-usb3-phy
>                - qcom,ipq9574-qmp-usb3-phy
> @@ -144,18 +188,6 @@ allOf:
>              - const: com_aux
>              - const: pipe
>
> -  - if:
> -      properties:
> -        compatible:
> -          contains:
> -            enum:
> -              - qcom,sa8775p-qmp-usb3-uni-phy
> -              - qcom,sc8280xp-qmp-usb3-uni-phy
> -              - qcom,x1e80100-qmp-usb3-uni-phy
> -    then:
> -      required:
> -        - power-domains
> -
>  additionalProperties: false
>
>  examples:
> diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> index 0f200e3..ad2f08f 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> @@ -49,6 +49,34 @@ properties:
>      items:
>        - const: ref
>
> +  power-domains:
> +    description: specifies a phandle to PM domain provider node
> +    minItems: 1
> +    maxItems: 2
> +
> +  power-domain-names:
> +    description:
> +      A list of power domain name strings sorted in the same order as the
> +      power-domains property.
> +
> +      For platforms where some resource are firmware managed, the name
> +      corresponding to the index of an SCMI domain provider can be
> +      "usb_core" or "usb_transfer".
> +    items:
> +      - const: usb_core
> +      - const: usb_transfer
> +
> +  hsphy,fw-managed:
> +    description:
> +      Some targets allow multiple resources to be managed by firmware.
> +      On these targets, tasks related to clocks, regulators, resets, and
> +      interconnects can be delegated to the firmware, while the remaining
> +      responsibilities are handled by Linux.
> +
> +      Decide if the target resources will be managed by firmware or High level
> +      OS.
> +    type: boolean
> +
>    resets:
>      items:
>        - description: PHY core reset
> @@ -154,12 +182,21 @@ required:
>    - compatible
>    - reg
>    - "#phy-cells"
> -  - clocks
> -  - clock-names
> -  - resets
> -  - vdda-pll-supply
> -  - vdda18-supply
> -  - vdda33-supply
> +
> +
> +allOf:
> +  - if:
> +      not:
> +        required:
> +          - hsphy,fw-managed
> +    then:
> +      required:
> +        - clocks
> +        - clock-names
> +        - resets
> +        - vdda-pll-supply
> +        - vdda18-supply
> +        - vdda33-supply
>
>  additionalProperties: false
>
> diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> index 63d150b..5bf3a29 100644
> --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> @@ -64,7 +64,31 @@ properties:
>
>    power-domains:
>      description: specifies a phandle to PM domain provider node
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
> +
> +  power-domain-names:
> +    description:
> +      A list of power domain name strings sorted in the same order as the
> +      power-domains property.
> +
> +      For platforms where some resource are firmware managed, the name
> +      corresponding to the index of an SCMI domain provider can be
> +      "usb_core" or "usb_transfer".
> +    items:
> +      - const: usb_core
> +      - const: usb_transfer
> +
> +  qcom,fw-managed:
> +    description:
> +      Some targets allow multiple resources to be managed by firmware.
> +      On these targets, tasks related to clocks, regulators, resets, and
> +      interconnects can be delegated to the firmware, while the remaining
> +      responsibilities are handled by Linux.
> +
> +      Decide if the target resources will be managed by firmware or High level
> +      OS.
> +    type: boolean

I think this is an overkill. You know that SA8775 is going to use
SCMI-based clocks / PD management. Thus I'd suggest adding new
bindings file targeting qcom,sa8775-dwc3. Also you can drop the
qcom,fw-managed property at all, let the driver decide basing on the
compat string.


>
>    required-opps:
>      maxItems: 1
> @@ -148,13 +172,20 @@ required:
>    - "#address-cells"
>    - "#size-cells"
>    - ranges
> -  - clocks
> -  - clock-names
>    - interrupts
>    - interrupt-names
>
>  allOf:
>    - if:
> +      not:
> +        required:
> +          - qcom,fw-managed
> +    then:
> +      required:
> +        - clocks
> +        - clock-names
> +
> +  - if:
>        properties:
>          compatible:
>            contains:
> --
> 2.7.4
>
>


--
With best wishes
Dmitry
Krzysztof Kozlowski March 6, 2024, 7:03 a.m. UTC | #4
On 05/03/2024 19:03, Sriram Dash wrote:
> On 3/5/2024 10:37 PM, Krzysztof Kozlowski wrote:
>> On 05/03/2024 17:57, Sriram Dash wrote:
>>> Some target systems allow multiple resources to be managed by firmware.
>>> On these targets, tasks related to clocks, regulators, resets, and
>>> interconnects can be delegated to the firmware, while the remaining
>>> responsibilities are handled by Linux.
>>>
>>> To support the management of partial resources in Linux and leave the rest
>>> to firmware, multiple power domains are introduced. Each power domain can
>>> manage one or more resources, depending on the specific use case.
>>>
>>> These power domains handle SCMI calls to the firmware, enabling the
>>> activation and deactivation of firmware-managed resources.
>>>
>>> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
>>> ---
>>>   .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>>>   .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>>>   .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>>>   3 files changed, 130 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>> index 1e2d4dd..53b9ba9 100644
>>> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>> @@ -44,7 +44,32 @@ properties:
>>>       maxItems: 5
>>>   
>>>     power-domains:
>>> -    maxItems: 1
>>> +    description: specifies a phandle to PM domain provider node
>>
>> Please drop all redundant descriptions. Adding them is not even related
>> to this patch.
>>
> 
> Thanks Krzysztof for the super quick response !
> Sure. will drop the description for power-domain
> and power-doamin-names.
> 
>>> +    minItems: 1
>>> +    maxItems: 2
>>> +
>>> +  power-domain-names:
>>> +    description:
>>> +      A list of power domain name strings sorted in the same order as the
>>> +      power-domains property.
>>> +
>>> +      For platforms where some resource are firmware managed, the name
>>> +      corresponding to the index of an SCMI domain provider can be
>>> +      "usb_core" or "usb_transfer".
>>> +    items:
>>> +      - const: usb_core
>>> +      - const: usb_transfer
>>
>> How is this related to fw-managed? I fail to see it. Don't mix
>> independent problems in one patch.
>>
> 
> Some of the the resources like clocks, regulators, etc will be 
> controlled by the firmware instead of OS. However, some resources
> still will be controlled by OS (interrupts for example).
> 
> So, to support the management of partial resources in Linux, and
> offload the other resource management to firmware, multiple power 
> domains are introduced. They will be corresponding to different
> hw blocks.
> 
> Do you suggest splitting the addition of power-domain-names and
> addition of fw-managed property in separate patches for bindings!
> 
>>> +
>>> +  qmp,fw-managed:
>>
>> Please do not upstream vendor code directly, but perform basic
>> adjustment to upstream Linux kernel. There is no such company as gmp.
>>
>> Run this first through your internal review process.
>>
> 
> This property is newly introduced for the qmp superspeed phy and
> similar dt properties are introduced for hsphy and dwc3 qcom
> controller glue layer driver. It will govern the suspend/ resume
> of the resources (by firmware or OS) as required.

So that's your answer to "there is no such company as gmp"? It's not
relevant at all.

Please run it through internal review first.


Best regards,
Krzysztof
Krishna Kurapati March 6, 2024, 7:33 a.m. UTC | #5
On 3/6/2024 12:33 PM, Krzysztof Kozlowski wrote:
> On 05/03/2024 19:03, Sriram Dash wrote:
>> On 3/5/2024 10:37 PM, Krzysztof Kozlowski wrote:
>>> On 05/03/2024 17:57, Sriram Dash wrote:
>>>> Some target systems allow multiple resources to be managed by firmware.
>>>> On these targets, tasks related to clocks, regulators, resets, and
>>>> interconnects can be delegated to the firmware, while the remaining
>>>> responsibilities are handled by Linux.
>>>>
>>>> To support the management of partial resources in Linux and leave the rest
>>>> to firmware, multiple power domains are introduced. Each power domain can
>>>> manage one or more resources, depending on the specific use case.
>>>>
>>>> These power domains handle SCMI calls to the firmware, enabling the
>>>> activation and deactivation of firmware-managed resources.
>>>>
>>>> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
>>>> ---
>>>>    .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>>>>    .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>>>>    .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>>>>    3 files changed, 130 insertions(+), 30 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>> index 1e2d4dd..53b9ba9 100644
>>>> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>> @@ -44,7 +44,32 @@ properties:
>>>>        maxItems: 5
>>>>    
>>>>      power-domains:
>>>> -    maxItems: 1
>>>> +    description: specifies a phandle to PM domain provider node
>>>
>>> Please drop all redundant descriptions. Adding them is not even related
>>> to this patch.
>>>
>>
>> Thanks Krzysztof for the super quick response !
>> Sure. will drop the description for power-domain
>> and power-doamin-names.
>>
>>>> +    minItems: 1
>>>> +    maxItems: 2
>>>> +
>>>> +  power-domain-names:
>>>> +    description:
>>>> +      A list of power domain name strings sorted in the same order as the
>>>> +      power-domains property.
>>>> +
>>>> +      For platforms where some resource are firmware managed, the name
>>>> +      corresponding to the index of an SCMI domain provider can be
>>>> +      "usb_core" or "usb_transfer".
>>>> +    items:
>>>> +      - const: usb_core
>>>> +      - const: usb_transfer
>>>
>>> How is this related to fw-managed? I fail to see it. Don't mix
>>> independent problems in one patch.
>>>
>>
>> Some of the the resources like clocks, regulators, etc will be
>> controlled by the firmware instead of OS. However, some resources
>> still will be controlled by OS (interrupts for example).
>>
>> So, to support the management of partial resources in Linux, and
>> offload the other resource management to firmware, multiple power
>> domains are introduced. They will be corresponding to different
>> hw blocks.
>>
>> Do you suggest splitting the addition of power-domain-names and
>> addition of fw-managed property in separate patches for bindings!
>>
>>>> +
>>>> +  qmp,fw-managed:
>>>
>>> Please do not upstream vendor code directly, but perform basic
>>> adjustment to upstream Linux kernel. There is no such company as gmp.
>>>
>>> Run this first through your internal review process.
>>>
>>
>> This property is newly introduced for the qmp superspeed phy and
>> similar dt properties are introduced for hsphy and dwc3 qcom
>> controller glue layer driver. It will govern the suspend/ resume
>> of the resources (by firmware or OS) as required.
> 
> So that's your answer to "there is no such company as gmp"? It's not
> relevant at all.
> 
> Please run it through internal review first.
> 
> 
Hi Sriram,

  QMP indicates the driver name "QMP Phy" (for super speed mode of 
operation), not the company name. If this property is for identification 
of fw management to be done / (or not to be done) in QMP Phy, then 
please rename is appropriately. Check how other properties are defined 
in the QMP bindings and add "qcom" at beginning preferably. For 
reference as to how properties were added to femto phy driver: [1].

[1]: 
https://patchwork.kernel.org/project/linux-arm-msm/patch/1662480933-12326-2-git-send-email-quic_kriskura@quicinc.com/

Regards,
Krishna,
Sriram Dash March 6, 2024, 3:49 p.m. UTC | #6
On 3/6/2024 1:03 PM, Krishna Kurapati PSSNV wrote:
> 
> 
> On 3/6/2024 12:33 PM, Krzysztof Kozlowski wrote:
>> On 05/03/2024 19:03, Sriram Dash wrote:
>>> On 3/5/2024 10:37 PM, Krzysztof Kozlowski wrote:
>>>> On 05/03/2024 17:57, Sriram Dash wrote:
>>>>> Some target systems allow multiple resources to be managed by 
>>>>> firmware.
>>>>> On these targets, tasks related to clocks, regulators, resets, and
>>>>> interconnects can be delegated to the firmware, while the remaining
>>>>> responsibilities are handled by Linux.
>>>>>
>>>>> To support the management of partial resources in Linux and leave 
>>>>> the rest
>>>>> to firmware, multiple power domains are introduced. Each power 
>>>>> domain can
>>>>> manage one or more resources, depending on the specific use case.
>>>>>
>>>>> These power domains handle SCMI calls to the firmware, enabling the
>>>>> activation and deactivation of firmware-managed resources.
>>>>>
>>>>> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
>>>>> ---
>>>>>    .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 
>>>>> ++++++++++++++++------
>>>>>    .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 
>>>>> ++++++++++++--
>>>>>    .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>>>>>    3 files changed, 130 insertions(+), 30 deletions(-)
>>>>>
>>>>> diff --git 
>>>>> a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>>> index 1e2d4dd..53b9ba9 100644
>>>>> --- 
>>>>> a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>>> +++ 
>>>>> b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>>>>> @@ -44,7 +44,32 @@ properties:
>>>>>        maxItems: 5
>>>>>      power-domains:
>>>>> -    maxItems: 1
>>>>> +    description: specifies a phandle to PM domain provider node
>>>>
>>>> Please drop all redundant descriptions. Adding them is not even related
>>>> to this patch.
>>>>
>>>
>>> Thanks Krzysztof for the super quick response !
>>> Sure. will drop the description for power-domain
>>> and power-doamin-names.
>>>
>>>>> +    minItems: 1
>>>>> +    maxItems: 2
>>>>> +
>>>>> +  power-domain-names:
>>>>> +    description:
>>>>> +      A list of power domain name strings sorted in the same order 
>>>>> as the
>>>>> +      power-domains property.
>>>>> +
>>>>> +      For platforms where some resource are firmware managed, the 
>>>>> name
>>>>> +      corresponding to the index of an SCMI domain provider can be
>>>>> +      "usb_core" or "usb_transfer".
>>>>> +    items:
>>>>> +      - const: usb_core
>>>>> +      - const: usb_transfer
>>>>
>>>> How is this related to fw-managed? I fail to see it. Don't mix
>>>> independent problems in one patch.
>>>>
>>>
>>> Some of the the resources like clocks, regulators, etc will be
>>> controlled by the firmware instead of OS. However, some resources
>>> still will be controlled by OS (interrupts for example).
>>>
>>> So, to support the management of partial resources in Linux, and
>>> offload the other resource management to firmware, multiple power
>>> domains are introduced. They will be corresponding to different
>>> hw blocks.
>>>
>>> Do you suggest splitting the addition of power-domain-names and
>>> addition of fw-managed property in separate patches for bindings!
>>>
>>>>> +
>>>>> +  qmp,fw-managed:
>>>>
>>>> Please do not upstream vendor code directly, but perform basic
>>>> adjustment to upstream Linux kernel. There is no such company as gmp.
>>>>
>>>> Run this first through your internal review process.
>>>>
>>>
>>> This property is newly introduced for the qmp superspeed phy and
>>> similar dt properties are introduced for hsphy and dwc3 qcom
>>> controller glue layer driver. It will govern the suspend/ resume
>>> of the resources (by firmware or OS) as required.
>>
>> So that's your answer to "there is no such company as gmp"? It's not
>> relevant at all.
>>
>> Please run it through internal review first.
>>
>>
> Hi Sriram,
> 
>   QMP indicates the driver name "QMP Phy" (for super speed mode of 
> operation), not the company name. If this property is for identification 
> of fw management to be done / (or not to be done) in QMP Phy, then 
> please rename is appropriately. Check how other properties are defined 
> in the QMP bindings and add "qcom" at beginning preferably. For 
> reference as to how properties were added to femto phy driver: [1].
> 
> [1]: 
> https://patchwork.kernel.org/project/linux-arm-msm/patch/1662480933-12326-2-git-send-email-quic_kriskura@quicinc.com/
> 

Thanks for the references Krzysztof/Krishna.
I got suggestion from Dmitry on the use of the
property too. Indeed we will be the scmi based
clock/ PD management on SA8775. So, we will
introduce a new compatible string and take the
decision in driver accordingly.


> Regards,
> Krishna,
Sriram Dash March 6, 2024, 3:51 p.m. UTC | #7
On 3/6/2024 12:33 AM, Dmitry Baryshkov wrote:
> On Tue, 5 Mar 2024 at 18:58, Sriram Dash <quic_sriramd@quicinc.com> wrote:
>>
>> Some target systems allow multiple resources to be managed by firmware.
>> On these targets, tasks related to clocks, regulators, resets, and
>> interconnects can be delegated to the firmware, while the remaining
>> responsibilities are handled by Linux.
>>
>> To support the management of partial resources in Linux and leave the rest
>> to firmware, multiple power domains are introduced. Each power domain can
>> manage one or more resources, depending on the specific use case.
>>
>> These power domains handle SCMI calls to the firmware, enabling the
>> activation and deactivation of firmware-managed resources.
>>
>> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
>> ---
>>   .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
>>   .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
>>   .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
>>   3 files changed, 130 insertions(+), 30 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> index 1e2d4dd..53b9ba9 100644
>> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
>> @@ -44,7 +44,32 @@ properties:
>>       maxItems: 5
>>
>>     power-domains:
>> -    maxItems: 1
>> +    description: specifies a phandle to PM domain provider node
>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  power-domain-names:
>> +    description:
>> +      A list of power domain name strings sorted in the same order as the
>> +      power-domains property.
>> +
>> +      For platforms where some resource are firmware managed, the name
>> +      corresponding to the index of an SCMI domain provider can be
>> +      "usb_core" or "usb_transfer".
>> +    items:
>> +      - const: usb_core
>> +      - const: usb_transfer
>> +
>> +  qmp,fw-managed:
>> +    description:
>> +      Some targets allow multiple resources to be managed by firmware.
>> +      On these targets, tasks related to clocks, regulators, resets, and
>> +      interconnects can be delegated to the firmware, while the remaining
>> +      responsibilities are handled by Linux.
>> +
>> +      Decide if the target resources will be managed by firmware or High level
>> +      OS.
>> +    type: boolean
>>
>>     resets:
>>       maxItems: 2
>> @@ -70,14 +95,6 @@ properties:
>>   required:
>>     - compatible
>>     - reg
>> -  - clocks
>> -  - clock-names
>> -  - resets
>> -  - reset-names
>> -  - vdda-phy-supply
>> -  - vdda-pll-supply
>> -  - "#clock-cells"
>> -  - clock-output-names
>>     - "#phy-cells"
>>
>>   allOf:
>> @@ -86,6 +103,33 @@ allOf:
>>           compatible:
>>             contains:
>>               enum:
>> +              - qcom,sa8775p-qmp-usb3-uni-phy
>> +              - qcom,sc8280xp-qmp-usb3-uni-phy
>> +              - qcom,x1e80100-qmp-usb3-uni-phy
>> +    then:
>> +      required:
>> +        - power-domains
>> +
>> +  - if:
>> +      not:
>> +        required:
>> +          - qmp,fw-managed
>> +    then:
>> +      required:
>> +        - clocks
>> +        - clock-names
>> +        - resets
>> +        - reset-names
>> +        - vdda-phy-supply
>> +        - vdda-pll-supply
>> +        - clock-output-names
>> +        - "#clock-cells"
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>>                 - qcom,ipq6018-qmp-usb3-phy
>>                 - qcom,ipq8074-qmp-usb3-phy
>>                 - qcom,ipq9574-qmp-usb3-phy
>> @@ -144,18 +188,6 @@ allOf:
>>               - const: com_aux
>>               - const: pipe
>>
>> -  - if:
>> -      properties:
>> -        compatible:
>> -          contains:
>> -            enum:
>> -              - qcom,sa8775p-qmp-usb3-uni-phy
>> -              - qcom,sc8280xp-qmp-usb3-uni-phy
>> -              - qcom,x1e80100-qmp-usb3-uni-phy
>> -    then:
>> -      required:
>> -        - power-domains
>> -
>>   additionalProperties: false
>>
>>   examples:
>> diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
>> index 0f200e3..ad2f08f 100644
>> --- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
>> +++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
>> @@ -49,6 +49,34 @@ properties:
>>       items:
>>         - const: ref
>>
>> +  power-domains:
>> +    description: specifies a phandle to PM domain provider node
>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  power-domain-names:
>> +    description:
>> +      A list of power domain name strings sorted in the same order as the
>> +      power-domains property.
>> +
>> +      For platforms where some resource are firmware managed, the name
>> +      corresponding to the index of an SCMI domain provider can be
>> +      "usb_core" or "usb_transfer".
>> +    items:
>> +      - const: usb_core
>> +      - const: usb_transfer
>> +
>> +  hsphy,fw-managed:
>> +    description:
>> +      Some targets allow multiple resources to be managed by firmware.
>> +      On these targets, tasks related to clocks, regulators, resets, and
>> +      interconnects can be delegated to the firmware, while the remaining
>> +      responsibilities are handled by Linux.
>> +
>> +      Decide if the target resources will be managed by firmware or High level
>> +      OS.
>> +    type: boolean
>> +
>>     resets:
>>       items:
>>         - description: PHY core reset
>> @@ -154,12 +182,21 @@ required:
>>     - compatible
>>     - reg
>>     - "#phy-cells"
>> -  - clocks
>> -  - clock-names
>> -  - resets
>> -  - vdda-pll-supply
>> -  - vdda18-supply
>> -  - vdda33-supply
>> +
>> +
>> +allOf:
>> +  - if:
>> +      not:
>> +        required:
>> +          - hsphy,fw-managed
>> +    then:
>> +      required:
>> +        - clocks
>> +        - clock-names
>> +        - resets
>> +        - vdda-pll-supply
>> +        - vdda18-supply
>> +        - vdda33-supply
>>
>>   additionalProperties: false
>>
>> diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
>> index 63d150b..5bf3a29 100644
>> --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
>> +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
>> @@ -64,7 +64,31 @@ properties:
>>
>>     power-domains:
>>       description: specifies a phandle to PM domain provider node
>> -    maxItems: 1
>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  power-domain-names:
>> +    description:
>> +      A list of power domain name strings sorted in the same order as the
>> +      power-domains property.
>> +
>> +      For platforms where some resource are firmware managed, the name
>> +      corresponding to the index of an SCMI domain provider can be
>> +      "usb_core" or "usb_transfer".
>> +    items:
>> +      - const: usb_core
>> +      - const: usb_transfer
>> +
>> +  qcom,fw-managed:
>> +    description:
>> +      Some targets allow multiple resources to be managed by firmware.
>> +      On these targets, tasks related to clocks, regulators, resets, and
>> +      interconnects can be delegated to the firmware, while the remaining
>> +      responsibilities are handled by Linux.
>> +
>> +      Decide if the target resources will be managed by firmware or High level
>> +      OS.
>> +    type: boolean
> 
> I think this is an overkill. You know that SA8775 is going to use
> SCMI-based clocks / PD management. Thus I'd suggest adding new
> bindings file targeting qcom,sa8775-dwc3. Also you can drop the
> qcom,fw-managed property at all, let the driver decide basing on the
> compat string.
> 
> 

Thank you for the suggestion Dmitry. I will include
new compat string for SA8775 which will decide whether
to use scmi based clock/ PD.

>>
>>     required-opps:
>>       maxItems: 1
>> @@ -148,13 +172,20 @@ required:
>>     - "#address-cells"
>>     - "#size-cells"
>>     - ranges
>> -  - clocks
>> -  - clock-names
>>     - interrupts
>>     - interrupt-names
>>
>>   allOf:
>>     - if:
>> +      not:
>> +        required:
>> +          - qcom,fw-managed
>> +    then:
>> +      required:
>> +        - clocks
>> +        - clock-names
>> +
>> +  - if:
>>         properties:
>>           compatible:
>>             contains:
>> --
>> 2.7.4
>>
>>
> 
> 
> --
> With best wishes
> Dmitry
Dmitry Baryshkov March 6, 2024, 7:51 p.m. UTC | #8
On Wed, 6 Mar 2024 at 17:52, Sriram Dash <quic_sriramd@quicinc.com> wrote:
>
> On 3/6/2024 12:33 AM, Dmitry Baryshkov wrote:
> > On Tue, 5 Mar 2024 at 18:58, Sriram Dash <quic_sriramd@quicinc.com> wrote:
> >>
> >> Some target systems allow multiple resources to be managed by firmware.
> >> On these targets, tasks related to clocks, regulators, resets, and
> >> interconnects can be delegated to the firmware, while the remaining
> >> responsibilities are handled by Linux.
> >>
> >> To support the management of partial resources in Linux and leave the rest
> >> to firmware, multiple power domains are introduced. Each power domain can
> >> manage one or more resources, depending on the specific use case.
> >>
> >> These power domains handle SCMI calls to the firmware, enabling the
> >> activation and deactivation of firmware-managed resources.
> >>
> >> Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
> >> ---
> >>   .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml        | 74 ++++++++++++++++------
> >>   .../bindings/phy/qcom,usb-snps-femto-v2.yaml       | 49 ++++++++++++--
> >>   .../devicetree/bindings/usb/qcom,dwc3.yaml         | 37 ++++++++++-
> >>   3 files changed, 130 insertions(+), 30 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> >> index 1e2d4dd..53b9ba9 100644
> >> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> >> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
> >> @@ -44,7 +44,32 @@ properties:
> >>       maxItems: 5
> >>
> >>     power-domains:
> >> -    maxItems: 1
> >> +    description: specifies a phandle to PM domain provider node
> >> +    minItems: 1
> >> +    maxItems: 2
> >> +
> >> +  power-domain-names:
> >> +    description:
> >> +      A list of power domain name strings sorted in the same order as the
> >> +      power-domains property.
> >> +
> >> +      For platforms where some resource are firmware managed, the name
> >> +      corresponding to the index of an SCMI domain provider can be
> >> +      "usb_core" or "usb_transfer".
> >> +    items:
> >> +      - const: usb_core
> >> +      - const: usb_transfer
> >> +
> >> +  qmp,fw-managed:
> >> +    description:
> >> +      Some targets allow multiple resources to be managed by firmware.
> >> +      On these targets, tasks related to clocks, regulators, resets, and
> >> +      interconnects can be delegated to the firmware, while the remaining
> >> +      responsibilities are handled by Linux.
> >> +
> >> +      Decide if the target resources will be managed by firmware or High level
> >> +      OS.
> >> +    type: boolean
> >>
> >>     resets:
> >>       maxItems: 2
> >> @@ -70,14 +95,6 @@ properties:
> >>   required:
> >>     - compatible
> >>     - reg
> >> -  - clocks
> >> -  - clock-names
> >> -  - resets
> >> -  - reset-names
> >> -  - vdda-phy-supply
> >> -  - vdda-pll-supply
> >> -  - "#clock-cells"
> >> -  - clock-output-names
> >>     - "#phy-cells"
> >>
> >>   allOf:
> >> @@ -86,6 +103,33 @@ allOf:
> >>           compatible:
> >>             contains:
> >>               enum:
> >> +              - qcom,sa8775p-qmp-usb3-uni-phy
> >> +              - qcom,sc8280xp-qmp-usb3-uni-phy
> >> +              - qcom,x1e80100-qmp-usb3-uni-phy
> >> +    then:
> >> +      required:
> >> +        - power-domains
> >> +
> >> +  - if:
> >> +      not:
> >> +        required:
> >> +          - qmp,fw-managed
> >> +    then:
> >> +      required:
> >> +        - clocks
> >> +        - clock-names
> >> +        - resets
> >> +        - reset-names
> >> +        - vdda-phy-supply
> >> +        - vdda-pll-supply
> >> +        - clock-output-names
> >> +        - "#clock-cells"
> >> +
> >> +  - if:
> >> +      properties:
> >> +        compatible:
> >> +          contains:
> >> +            enum:
> >>                 - qcom,ipq6018-qmp-usb3-phy
> >>                 - qcom,ipq8074-qmp-usb3-phy
> >>                 - qcom,ipq9574-qmp-usb3-phy
> >> @@ -144,18 +188,6 @@ allOf:
> >>               - const: com_aux
> >>               - const: pipe
> >>
> >> -  - if:
> >> -      properties:
> >> -        compatible:
> >> -          contains:
> >> -            enum:
> >> -              - qcom,sa8775p-qmp-usb3-uni-phy
> >> -              - qcom,sc8280xp-qmp-usb3-uni-phy
> >> -              - qcom,x1e80100-qmp-usb3-uni-phy
> >> -    then:
> >> -      required:
> >> -        - power-domains
> >> -
> >>   additionalProperties: false
> >>
> >>   examples:
> >> diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> >> index 0f200e3..ad2f08f 100644
> >> --- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> >> +++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> >> @@ -49,6 +49,34 @@ properties:
> >>       items:
> >>         - const: ref
> >>
> >> +  power-domains:
> >> +    description: specifies a phandle to PM domain provider node
> >> +    minItems: 1
> >> +    maxItems: 2
> >> +
> >> +  power-domain-names:
> >> +    description:
> >> +      A list of power domain name strings sorted in the same order as the
> >> +      power-domains property.
> >> +
> >> +      For platforms where some resource are firmware managed, the name
> >> +      corresponding to the index of an SCMI domain provider can be
> >> +      "usb_core" or "usb_transfer".
> >> +    items:
> >> +      - const: usb_core
> >> +      - const: usb_transfer
> >> +
> >> +  hsphy,fw-managed:
> >> +    description:
> >> +      Some targets allow multiple resources to be managed by firmware.
> >> +      On these targets, tasks related to clocks, regulators, resets, and
> >> +      interconnects can be delegated to the firmware, while the remaining
> >> +      responsibilities are handled by Linux.
> >> +
> >> +      Decide if the target resources will be managed by firmware or High level
> >> +      OS.
> >> +    type: boolean
> >> +
> >>     resets:
> >>       items:
> >>         - description: PHY core reset
> >> @@ -154,12 +182,21 @@ required:
> >>     - compatible
> >>     - reg
> >>     - "#phy-cells"
> >> -  - clocks
> >> -  - clock-names
> >> -  - resets
> >> -  - vdda-pll-supply
> >> -  - vdda18-supply
> >> -  - vdda33-supply
> >> +
> >> +
> >> +allOf:
> >> +  - if:
> >> +      not:
> >> +        required:
> >> +          - hsphy,fw-managed
> >> +    then:
> >> +      required:
> >> +        - clocks
> >> +        - clock-names
> >> +        - resets
> >> +        - vdda-pll-supply
> >> +        - vdda18-supply
> >> +        - vdda33-supply
> >>
> >>   additionalProperties: false
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> >> index 63d150b..5bf3a29 100644
> >> --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> >> +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> >> @@ -64,7 +64,31 @@ properties:
> >>
> >>     power-domains:
> >>       description: specifies a phandle to PM domain provider node
> >> -    maxItems: 1
> >> +    minItems: 1
> >> +    maxItems: 2
> >> +
> >> +  power-domain-names:
> >> +    description:
> >> +      A list of power domain name strings sorted in the same order as the
> >> +      power-domains property.
> >> +
> >> +      For platforms where some resource are firmware managed, the name
> >> +      corresponding to the index of an SCMI domain provider can be
> >> +      "usb_core" or "usb_transfer".
> >> +    items:
> >> +      - const: usb_core
> >> +      - const: usb_transfer
> >> +
> >> +  qcom,fw-managed:
> >> +    description:
> >> +      Some targets allow multiple resources to be managed by firmware.
> >> +      On these targets, tasks related to clocks, regulators, resets, and
> >> +      interconnects can be delegated to the firmware, while the remaining
> >> +      responsibilities are handled by Linux.
> >> +
> >> +      Decide if the target resources will be managed by firmware or High level
> >> +      OS.
> >> +    type: boolean
> >
> > I think this is an overkill. You know that SA8775 is going to use
> > SCMI-based clocks / PD management. Thus I'd suggest adding new
> > bindings file targeting qcom,sa8775-dwc3. Also you can drop the
> > qcom,fw-managed property at all, let the driver decide basing on the
> > compat string.
> >
> >
>
> Thank you for the suggestion Dmitry. I will include
> new compat string for SA8775 which will decide whether
> to use scmi based clock/ PD.

As a reminder:
- same hardware = same compatible string
- existing DT better to continue to work. Or ask for explicit
permission from Bjorn to break the ABI.

>
> >>
> >>     required-opps:
> >>       maxItems: 1
> >> @@ -148,13 +172,20 @@ required:
> >>     - "#address-cells"
> >>     - "#size-cells"
> >>     - ranges
> >> -  - clocks
> >> -  - clock-names
> >>     - interrupts
> >>     - interrupt-names
> >>
> >>   allOf:
> >>     - if:
> >> +      not:
> >> +        required:
> >> +          - qcom,fw-managed
> >> +    then:
> >> +      required:
> >> +        - clocks
> >> +        - clock-names
> >> +
> >> +  - if:
> >>         properties:
> >>           compatible:
> >>             contains:
> >> --
> >> 2.7.4
> >>
> >>
> >
> >
> > --
> > With best wishes
> > Dmitry
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
index 1e2d4dd..53b9ba9 100644
--- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
@@ -44,7 +44,32 @@  properties:
     maxItems: 5
 
   power-domains:
-    maxItems: 1
+    description: specifies a phandle to PM domain provider node
+    minItems: 1
+    maxItems: 2
+
+  power-domain-names:
+    description:
+      A list of power domain name strings sorted in the same order as the
+      power-domains property.
+
+      For platforms where some resource are firmware managed, the name
+      corresponding to the index of an SCMI domain provider can be
+      "usb_core" or "usb_transfer".
+    items:
+      - const: usb_core
+      - const: usb_transfer
+
+  qmp,fw-managed:
+    description:
+      Some targets allow multiple resources to be managed by firmware.
+      On these targets, tasks related to clocks, regulators, resets, and
+      interconnects can be delegated to the firmware, while the remaining
+      responsibilities are handled by Linux.
+
+      Decide if the target resources will be managed by firmware or High level
+      OS.
+    type: boolean
 
   resets:
     maxItems: 2
@@ -70,14 +95,6 @@  properties:
 required:
   - compatible
   - reg
-  - clocks
-  - clock-names
-  - resets
-  - reset-names
-  - vdda-phy-supply
-  - vdda-pll-supply
-  - "#clock-cells"
-  - clock-output-names
   - "#phy-cells"
 
 allOf:
@@ -86,6 +103,33 @@  allOf:
         compatible:
           contains:
             enum:
+              - qcom,sa8775p-qmp-usb3-uni-phy
+              - qcom,sc8280xp-qmp-usb3-uni-phy
+              - qcom,x1e80100-qmp-usb3-uni-phy
+    then:
+      required:
+        - power-domains
+
+  - if:
+      not:
+        required:
+          - qmp,fw-managed
+    then:
+      required:
+        - clocks
+        - clock-names
+        - resets
+        - reset-names
+        - vdda-phy-supply
+        - vdda-pll-supply
+        - clock-output-names
+        - "#clock-cells"
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
               - qcom,ipq6018-qmp-usb3-phy
               - qcom,ipq8074-qmp-usb3-phy
               - qcom,ipq9574-qmp-usb3-phy
@@ -144,18 +188,6 @@  allOf:
             - const: com_aux
             - const: pipe
 
-  - if:
-      properties:
-        compatible:
-          contains:
-            enum:
-              - qcom,sa8775p-qmp-usb3-uni-phy
-              - qcom,sc8280xp-qmp-usb3-uni-phy
-              - qcom,x1e80100-qmp-usb3-uni-phy
-    then:
-      required:
-        - power-domains
-
 additionalProperties: false
 
 examples:
diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
index 0f200e3..ad2f08f 100644
--- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
@@ -49,6 +49,34 @@  properties:
     items:
       - const: ref
 
+  power-domains:
+    description: specifies a phandle to PM domain provider node
+    minItems: 1
+    maxItems: 2
+
+  power-domain-names:
+    description:
+      A list of power domain name strings sorted in the same order as the
+      power-domains property.
+
+      For platforms where some resource are firmware managed, the name
+      corresponding to the index of an SCMI domain provider can be
+      "usb_core" or "usb_transfer".
+    items:
+      - const: usb_core
+      - const: usb_transfer
+
+  hsphy,fw-managed:
+    description:
+      Some targets allow multiple resources to be managed by firmware.
+      On these targets, tasks related to clocks, regulators, resets, and
+      interconnects can be delegated to the firmware, while the remaining
+      responsibilities are handled by Linux.
+
+      Decide if the target resources will be managed by firmware or High level
+      OS.
+    type: boolean
+
   resets:
     items:
       - description: PHY core reset
@@ -154,12 +182,21 @@  required:
   - compatible
   - reg
   - "#phy-cells"
-  - clocks
-  - clock-names
-  - resets
-  - vdda-pll-supply
-  - vdda18-supply
-  - vdda33-supply
+
+
+allOf:
+  - if:
+      not:
+        required:
+          - hsphy,fw-managed
+    then:
+      required:
+        - clocks
+        - clock-names
+        - resets
+        - vdda-pll-supply
+        - vdda18-supply
+        - vdda33-supply
 
 additionalProperties: false
 
diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
index 63d150b..5bf3a29 100644
--- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
@@ -64,7 +64,31 @@  properties:
 
   power-domains:
     description: specifies a phandle to PM domain provider node
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+
+  power-domain-names:
+    description:
+      A list of power domain name strings sorted in the same order as the
+      power-domains property.
+
+      For platforms where some resource are firmware managed, the name
+      corresponding to the index of an SCMI domain provider can be
+      "usb_core" or "usb_transfer".
+    items:
+      - const: usb_core
+      - const: usb_transfer
+
+  qcom,fw-managed:
+    description:
+      Some targets allow multiple resources to be managed by firmware.
+      On these targets, tasks related to clocks, regulators, resets, and
+      interconnects can be delegated to the firmware, while the remaining
+      responsibilities are handled by Linux.
+
+      Decide if the target resources will be managed by firmware or High level
+      OS.
+    type: boolean
 
   required-opps:
     maxItems: 1
@@ -148,13 +172,20 @@  required:
   - "#address-cells"
   - "#size-cells"
   - ranges
-  - clocks
-  - clock-names
   - interrupts
   - interrupt-names
 
 allOf:
   - if:
+      not:
+        required:
+          - qcom,fw-managed
+    then:
+      required:
+        - clocks
+        - clock-names
+
+  - if:
       properties:
         compatible:
           contains: