diff mbox series

[v2,4/5] dt-bindings: net: Add documentation for optional regulators

Message ID 20220518200939.689308-5-clabbe@baylibre.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series arm64: add ethernet to orange pi 3 | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: f.fainelli@gmail.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Corentin LABBE May 18, 2022, 8:09 p.m. UTC
Add entries for the new optional regulators.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 Documentation/devicetree/bindings/net/ethernet-phy.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Rob Herring May 19, 2022, 12:08 a.m. UTC | #1
On Wed, 18 May 2022 20:09:38 +0000, Corentin Labbe wrote:
> Add entries for the new optional regulators.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  Documentation/devicetree/bindings/net/ethernet-phy.yaml | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

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/net/ethernet-phy.yaml:149:8: [warning] wrong indentation: expected 6 but found 7 (indentation)

dtschema/dtc warnings/errors:

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.
Krzysztof Kozlowski May 19, 2022, 9:55 a.m. UTC | #2
On 18/05/2022 22:09, Corentin Labbe wrote:
> Add entries for the new optional regulators.

Please explain why do you need it.

> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  Documentation/devicetree/bindings/net/ethernet-phy.yaml | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> index ed1415a4381f..bd59e5cc0a55 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> @@ -153,6 +153,15 @@ properties:
>        used. The absence of this property indicates the muxers
>        should be configured so that the external PHY is used.
>  
> +  regulators:
> +    description:
> +       List of phandle to regulators needed for the PHY

I don't understand that... is your PHY defining the regulators or using
supplies? If it needs a regulator (as a supply), you need to document
supplies, using existing bindings.

> +
> +  regulator-names:
> +    description:
> +      List of regulator name strings sorted in the same order as the
> +      regulators property.
> +
>    resets:
>      maxItems: 1
>  


Best regards,
Krzysztof
Mark Brown May 19, 2022, 11:31 a.m. UTC | #3
On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
> On 18/05/2022 22:09, Corentin Labbe wrote:

> > +  regulators:
> > +    description:
> > +       List of phandle to regulators needed for the PHY

> I don't understand that... is your PHY defining the regulators or using
> supplies? If it needs a regulator (as a supply), you need to document
> supplies, using existing bindings.

They're trying to have a generic driver which works with any random PHY
so the binding has no idea what supplies it might need.
Krzysztof Kozlowski May 19, 2022, 11:33 a.m. UTC | #4
On 19/05/2022 13:31, Mark Brown wrote:
> On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
>> On 18/05/2022 22:09, Corentin Labbe wrote:
> 
>>> +  regulators:
>>> +    description:
>>> +       List of phandle to regulators needed for the PHY
> 
>> I don't understand that... is your PHY defining the regulators or using
>> supplies? If it needs a regulator (as a supply), you need to document
>> supplies, using existing bindings.
> 
> They're trying to have a generic driver which works with any random PHY
> so the binding has no idea what supplies it might need.

OK, that makes sense, but then question is why not using existing
naming, so "supplies" and "supply-names"?

Best regards,
Krzysztof
Andrew Lunn May 19, 2022, 11:58 a.m. UTC | #5
On Thu, May 19, 2022 at 01:33:21PM +0200, Krzysztof Kozlowski wrote:
> On 19/05/2022 13:31, Mark Brown wrote:
> > On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
> >> On 18/05/2022 22:09, Corentin Labbe wrote:
> > 
> >>> +  regulators:
> >>> +    description:
> >>> +       List of phandle to regulators needed for the PHY
> > 
> >> I don't understand that... is your PHY defining the regulators or using
> >> supplies? If it needs a regulator (as a supply), you need to document
> >> supplies, using existing bindings.
> > 
> > They're trying to have a generic driver which works with any random PHY
> > so the binding has no idea what supplies it might need.
> 
> OK, that makes sense, but then question is why not using existing
> naming, so "supplies" and "supply-names"?

I'm not saying it is not possible, but in general, the names are not
interesting. All that is needed is that they are all on, or
potentially all off to save power on shutdown. We don't care how many
there are, or what order they are enabled.

Ethernet PHY can have multiple supplies. For example there can be two
digital voltages and one analogue. Most designs just hard wire them
always on. It would not be unreasonable to have one GPIO which
controls all three. Or there could be one GPIO for the two digital
supplies, and one for the analogue. Or potentially, three GPIOs.

Given all the different ways the board could be designed, i doubt any
driver is going to want to control its supplies in an way other than
all on, or all off. 802.3 clause 22 defines a standardized way to put
a PHY into a low power mode. Using that one bit is much simpler than
trying to figure out how a board is wired.

However, the API/binding should be generic, usable for other use
cases. Nobody has needed an API like this before, but it is not to say
it might have other uses in the future. So maybe "supplies" and
"supply-names" is useful, but we still need a way to enumerate them as
a list without caring how many there are, or what their names are.

  Andrew
Mark Brown May 19, 2022, 3:49 p.m. UTC | #6
On Thu, May 19, 2022 at 01:58:18PM +0200, Andrew Lunn wrote:
> On Thu, May 19, 2022 at 01:33:21PM +0200, Krzysztof Kozlowski wrote:
> > On 19/05/2022 13:31, Mark Brown wrote:
> > > On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
> > >> On 18/05/2022 22:09, Corentin Labbe wrote:

> > >>> +  regulators:
> > >>> +    description:
> > >>> +       List of phandle to regulators needed for the PHY

> > >> I don't understand that... is your PHY defining the regulators or using
> > >> supplies? If it needs a regulator (as a supply), you need to document
> > >> supplies, using existing bindings.

> > > They're trying to have a generic driver which works with any random PHY
> > > so the binding has no idea what supplies it might need.

> > OK, that makes sense, but then question is why not using existing
> > naming, so "supplies" and "supply-names"?

> I'm not saying it is not possible, but in general, the names are not
> interesting. All that is needed is that they are all on, or
> potentially all off to save power on shutdown. We don't care how many
> there are, or what order they are enabled.

I think Krzysztof is referring to the name of the property rather than
the contents of the -names property there.
Rob Herring May 19, 2022, 8:17 p.m. UTC | #7
On Thu, May 19, 2022 at 01:58:18PM +0200, Andrew Lunn wrote:
> On Thu, May 19, 2022 at 01:33:21PM +0200, Krzysztof Kozlowski wrote:
> > On 19/05/2022 13:31, Mark Brown wrote:
> > > On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
> > >> On 18/05/2022 22:09, Corentin Labbe wrote:
> > > 
> > >>> +  regulators:
> > >>> +    description:
> > >>> +       List of phandle to regulators needed for the PHY
> > > 
> > >> I don't understand that... is your PHY defining the regulators or using
> > >> supplies? If it needs a regulator (as a supply), you need to document
> > >> supplies, using existing bindings.
> > > 
> > > They're trying to have a generic driver which works with any random PHY
> > > so the binding has no idea what supplies it might need.
> > 
> > OK, that makes sense, but then question is why not using existing
> > naming, so "supplies" and "supply-names"?
> 
> I'm not saying it is not possible, but in general, the names are not
> interesting. All that is needed is that they are all on, or
> potentially all off to save power on shutdown. We don't care how many
> there are, or what order they are enabled.
> 
> Ethernet PHY can have multiple supplies. For example there can be two
> digital voltages and one analogue. Most designs just hard wire them
> always on. It would not be unreasonable to have one GPIO which
> controls all three. Or there could be one GPIO for the two digital
> supplies, and one for the analogue. Or potentially, three GPIOs.

Again, it's not just supplies...

> 
> Given all the different ways the board could be designed, i doubt any
> driver is going to want to control its supplies in an way other than
> all on, or all off. 802.3 clause 22 defines a standardized way to put
> a PHY into a low power mode. Using that one bit is much simpler than
> trying to figure out how a board is wired.
> 
> However, the API/binding should be generic, usable for other use
> cases. 

The binding should not be generic as I explained here and many times 
before...

> Nobody has needed an API like this before, but it is not to say
> it might have other uses in the future. So maybe "supplies" and
> "supply-names" is useful, but we still need a way to enumerate them as
> a list without caring how many there are, or what their names are.

There's 2 standard patterns for how producer/consumer bindings work 
There's how gpio and regulators are done and then there's the
foo/foo-names style. Regulators when with the former and we're not going 
to do both.

You can still do what you want by retrieving all properties ending with 
'-supply'. Not as easy to implement, but works for existing users.

Rob
Krzysztof Kozlowski May 20, 2022, 7:57 a.m. UTC | #8
On 19/05/2022 17:49, Mark Brown wrote:
> On Thu, May 19, 2022 at 01:58:18PM +0200, Andrew Lunn wrote:
>> On Thu, May 19, 2022 at 01:33:21PM +0200, Krzysztof Kozlowski wrote:
>>> On 19/05/2022 13:31, Mark Brown wrote:
>>>> On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
>>>>> On 18/05/2022 22:09, Corentin Labbe wrote:
> 
>>>>>> +  regulators:
>>>>>> +    description:
>>>>>> +       List of phandle to regulators needed for the PHY
> 
>>>>> I don't understand that... is your PHY defining the regulators or using
>>>>> supplies? If it needs a regulator (as a supply), you need to document
>>>>> supplies, using existing bindings.
> 
>>>> They're trying to have a generic driver which works with any random PHY
>>>> so the binding has no idea what supplies it might need.
> 
>>> OK, that makes sense, but then question is why not using existing
>>> naming, so "supplies" and "supply-names"?
> 
>> I'm not saying it is not possible, but in general, the names are not
>> interesting. All that is needed is that they are all on, or
>> potentially all off to save power on shutdown. We don't care how many
>> there are, or what order they are enabled.
> 
> I think Krzysztof is referring to the name of the property rather than
> the contents of the -names property there.

Yes, exactly. Existing pattern for single regulator supply is
"xxx-supply", so why this uses a bit different pattern instead of
something more consistent ("supplies" and "supply-names")?

Best regards,
Krzysztof
Corentin LABBE May 20, 2022, 8:15 a.m. UTC | #9
Le Fri, May 20, 2022 at 09:57:26AM +0200, Krzysztof Kozlowski a écrit :
> On 19/05/2022 17:49, Mark Brown wrote:
> > On Thu, May 19, 2022 at 01:58:18PM +0200, Andrew Lunn wrote:
> >> On Thu, May 19, 2022 at 01:33:21PM +0200, Krzysztof Kozlowski wrote:
> >>> On 19/05/2022 13:31, Mark Brown wrote:
> >>>> On Thu, May 19, 2022 at 11:55:28AM +0200, Krzysztof Kozlowski wrote:
> >>>>> On 18/05/2022 22:09, Corentin Labbe wrote:
> > 
> >>>>>> +  regulators:
> >>>>>> +    description:
> >>>>>> +       List of phandle to regulators needed for the PHY
> > 
> >>>>> I don't understand that... is your PHY defining the regulators or using
> >>>>> supplies? If it needs a regulator (as a supply), you need to document
> >>>>> supplies, using existing bindings.
> > 
> >>>> They're trying to have a generic driver which works with any random PHY
> >>>> so the binding has no idea what supplies it might need.
> > 
> >>> OK, that makes sense, but then question is why not using existing
> >>> naming, so "supplies" and "supply-names"?
> > 
> >> I'm not saying it is not possible, but in general, the names are not
> >> interesting. All that is needed is that they are all on, or
> >> potentially all off to save power on shutdown. We don't care how many
> >> there are, or what order they are enabled.
> > 
> > I think Krzysztof is referring to the name of the property rather than
> > the contents of the -names property there.
> 
> Yes, exactly. Existing pattern for single regulator supply is
> "xxx-supply", so why this uses a bit different pattern instead of
> something more consistent ("supplies" and "supply-names")?
> 

I agree that supplies and supply-names are better.
But in another answer Rob is against it, so if I understand well, we are stuck to use individual xxx-supply.
I will try to create a new regulator_get_bulk_all() which scan all properties matching xxx-supply
Krzysztof Kozlowski May 20, 2022, 10:19 a.m. UTC | #10
On 20/05/2022 10:15, LABBE Corentin wrote:
> 
> I agree that supplies and supply-names are better.
> But in another answer Rob is against it, so if I understand well, we are stuck to use individual xxx-supply.
> I will try to create a new regulator_get_bulk_all() which scan all properties matching xxx-supply

Yep.


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
index ed1415a4381f..bd59e5cc0a55 100644
--- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
@@ -153,6 +153,15 @@  properties:
       used. The absence of this property indicates the muxers
       should be configured so that the external PHY is used.
 
+  regulators:
+    description:
+       List of phandle to regulators needed for the PHY
+
+  regulator-names:
+    description:
+      List of regulator name strings sorted in the same order as the
+      regulators property.
+
   resets:
     maxItems: 1