Message ID | 1648617651-9004-6-git-send-email-hayashi.kunihiko@socionext.com |
---|---|
State | Superseded |
Headers | show |
Series | dt-bindings: phy: Fix uniphier descriptions | expand |
On 30/03/2022 07:20, Kunihiko Hayashi wrote: > Instead of "oneOf:" choices, use "allOf:" and "if:" to define clock-names > and reset-names that can be taken by the compatible string. > > The order of clock-names and reset-names doesn't change here. > > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> > --- > .../phy/socionext,uniphier-ahci-phy.yaml | 73 ++++++++++++------ > .../phy/socionext,uniphier-pcie-phy.yaml | 37 ++++++--- > .../phy/socionext,uniphier-usb3hs-phy.yaml | 75 +++++++++++++----- > .../phy/socionext,uniphier-usb3ss-phy.yaml | 77 ++++++++++++++----- > 4 files changed, 188 insertions(+), 74 deletions(-) > > diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml > index 14f7579e7daa..61d9306e1852 100644 > --- a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml > +++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml > @@ -30,33 +30,62 @@ properties: > minItems: 1 > maxItems: 2 > > - clock-names: > - oneOf: > - - items: # for PXs2 > - - const: link > - - items: # for Pro4 > - - const: link > - - const: gio > - - items: # for others > - - const: link > - - const: phy > + clock-names: true > > resets: > minItems: 2 > maxItems: 6 > > - reset-names: > - oneOf: > - - items: # for Pro4 > - - const: link > - - const: gio > - - const: phy > - - const: pm > - - const: tx > - - const: rx > - - items: # for others > - - const: link > - - const: phy > + reset-names: true > + > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: socionext,uniphier-pro4-ahci-phy > + then: > + properties: > + clock-names: > + items: > + - const: link > + - const: gio > + reset-names: > + items: > + - const: link > + - const: gio > + - const: phy > + - const: pm > + - const: tx > + - const: rx Constrain also everywhere clocks and resets, so here should be: resets: minItems: 6 maxItems: 6 etc. Best regards, Krzysztof
Hi Krzysztof, On 2022/03/30 17:13, Krzysztof Kozlowski wrote: > On 30/03/2022 07:20, Kunihiko Hayashi wrote: >> Instead of "oneOf:" choices, use "allOf:" and "if:" to define clock-names >> and reset-names that can be taken by the compatible string. >> >> The order of clock-names and reset-names doesn't change here. >> >> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> >> --- >> .../phy/socionext,uniphier-ahci-phy.yaml | 73 ++++++++++++------ >> .../phy/socionext,uniphier-pcie-phy.yaml | 37 ++++++--- >> .../phy/socionext,uniphier-usb3hs-phy.yaml | 75 +++++++++++++----- >> .../phy/socionext,uniphier-usb3ss-phy.yaml | 77 ++++++++++++++----- >> 4 files changed, 188 insertions(+), 74 deletions(-) >> >> diff --git >> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >> index 14f7579e7daa..61d9306e1852 100644 >> --- >> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >> +++ >> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >> @@ -30,33 +30,62 @@ properties: >> minItems: 1 >> maxItems: 2 >> >> - clock-names: >> - oneOf: >> - - items: # for PXs2 >> - - const: link >> - - items: # for Pro4 >> - - const: link >> - - const: gio >> - - items: # for others >> - - const: link >> - - const: phy >> + clock-names: true >> >> resets: >> minItems: 2 >> maxItems: 6 >> >> - reset-names: >> - oneOf: >> - - items: # for Pro4 >> - - const: link >> - - const: gio >> - - const: phy >> - - const: pm >> - - const: tx >> - - const: rx >> - - items: # for others >> - - const: link >> - - const: phy >> + reset-names: true >> + >> +allOf: >> + - if: >> + properties: >> + compatible: >> + contains: >> + const: socionext,uniphier-pro4-ahci-phy >> + then: >> + properties: >> + clock-names: >> + items: >> + - const: link >> + - const: gio >> + reset-names: >> + items: >> + - const: link >> + - const: gio >> + - const: phy >> + - const: pm >> + - const: tx >> + - const: rx > > Constrain also everywhere clocks and resets, so here should be: > resets: > minItems: 6 > maxItems: 6 If I put the constraint here, it would conflict with the original one. Should I also replace the original resets resets: minItems: 2 maxItems: 6 with "resets: true"? Thank you, --- Best Regards Kunihiko Hayashi
On 30/03/2022 11:16, Kunihiko Hayashi wrote: > Hi Krzysztof, > > On 2022/03/30 17:13, Krzysztof Kozlowski wrote: >> On 30/03/2022 07:20, Kunihiko Hayashi wrote: >>> Instead of "oneOf:" choices, use "allOf:" and "if:" to define clock-names >>> and reset-names that can be taken by the compatible string. >>> >>> The order of clock-names and reset-names doesn't change here. >>> >>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> >>> --- >>> .../phy/socionext,uniphier-ahci-phy.yaml | 73 ++++++++++++------ >>> .../phy/socionext,uniphier-pcie-phy.yaml | 37 ++++++--- >>> .../phy/socionext,uniphier-usb3hs-phy.yaml | 75 +++++++++++++----- >>> .../phy/socionext,uniphier-usb3ss-phy.yaml | 77 ++++++++++++++----- >>> 4 files changed, 188 insertions(+), 74 deletions(-) >>> >>> diff --git >>> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>> index 14f7579e7daa..61d9306e1852 100644 >>> --- >>> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>> +++ >>> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>> @@ -30,33 +30,62 @@ properties: >>> minItems: 1 >>> maxItems: 2 >>> >>> - clock-names: >>> - oneOf: >>> - - items: # for PXs2 >>> - - const: link >>> - - items: # for Pro4 >>> - - const: link >>> - - const: gio >>> - - items: # for others >>> - - const: link >>> - - const: phy >>> + clock-names: true >>> >>> resets: >>> minItems: 2 >>> maxItems: 6 >>> >>> - reset-names: >>> - oneOf: >>> - - items: # for Pro4 >>> - - const: link >>> - - const: gio >>> - - const: phy >>> - - const: pm >>> - - const: tx >>> - - const: rx >>> - - items: # for others >>> - - const: link >>> - - const: phy >>> + reset-names: true >>> + >>> +allOf: >>> + - if: >>> + properties: >>> + compatible: >>> + contains: >>> + const: socionext,uniphier-pro4-ahci-phy >>> + then: >>> + properties: >>> + clock-names: >>> + items: >>> + - const: link >>> + - const: gio >>> + reset-names: >>> + items: >>> + - const: link >>> + - const: gio >>> + - const: phy >>> + - const: pm >>> + - const: tx >>> + - const: rx >> >> Constrain also everywhere clocks and resets, so here should be: >> resets: >> minItems: 6 >> maxItems: 6 > > If I put the constraint here, it would conflict with the original one. > Should I also replace the original resets > > resets: > minItems: 2 > maxItems: 6 > > with "resets: true"? It should not conflict. Check the bindings for Samsung Exynos clock I sent you last time. In the main "properties" you put the widest constraints, like you have now (2-6). Then for each compatible you narrow it (2-2, 6-6). You can later test it by adding/removing clocks to check if constraints are properly working. Best regards, Krzysztof
Hi Krzysztof, On 2022/03/30 18:45, Krzysztof Kozlowski wrote: > On 30/03/2022 11:16, Kunihiko Hayashi wrote: >> Hi Krzysztof, >> >> On 2022/03/30 17:13, Krzysztof Kozlowski wrote: >>> On 30/03/2022 07:20, Kunihiko Hayashi wrote: >>>> Instead of "oneOf:" choices, use "allOf:" and "if:" to define >>>> clock-names >>>> and reset-names that can be taken by the compatible string. >>>> >>>> The order of clock-names and reset-names doesn't change here. >>>> >>>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> >>>> --- >>>> .../phy/socionext,uniphier-ahci-phy.yaml | 73 ++++++++++++------ >>>> .../phy/socionext,uniphier-pcie-phy.yaml | 37 ++++++--- >>>> .../phy/socionext,uniphier-usb3hs-phy.yaml | 75 +++++++++++++----- >>>> .../phy/socionext,uniphier-usb3ss-phy.yaml | 77 ++++++++++++++----- >>>> 4 files changed, 188 insertions(+), 74 deletions(-) >>>> >>>> diff --git >>>> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>>> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>>> index 14f7579e7daa..61d9306e1852 100644 >>>> --- >>>> a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>>> +++ >>>> b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml >>>> @@ -30,33 +30,62 @@ properties: >>>> minItems: 1 >>>> maxItems: 2 >>>> >>>> - clock-names: >>>> - oneOf: >>>> - - items: # for PXs2 >>>> - - const: link >>>> - - items: # for Pro4 >>>> - - const: link >>>> - - const: gio >>>> - - items: # for others >>>> - - const: link >>>> - - const: phy >>>> + clock-names: true >>>> >>>> resets: >>>> minItems: 2 >>>> maxItems: 6 >>>> >>>> - reset-names: >>>> - oneOf: >>>> - - items: # for Pro4 >>>> - - const: link >>>> - - const: gio >>>> - - const: phy >>>> - - const: pm >>>> - - const: tx >>>> - - const: rx >>>> - - items: # for others >>>> - - const: link >>>> - - const: phy >>>> + reset-names: true >>>> + >>>> +allOf: >>>> + - if: >>>> + properties: >>>> + compatible: >>>> + contains: >>>> + const: socionext,uniphier-pro4-ahci-phy >>>> + then: >>>> + properties: >>>> + clock-names: >>>> + items: >>>> + - const: link >>>> + - const: gio >>>> + reset-names: >>>> + items: >>>> + - const: link >>>> + - const: gio >>>> + - const: phy >>>> + - const: pm >>>> + - const: tx >>>> + - const: rx >>> >>> Constrain also everywhere clocks and resets, so here should be: >>> resets: >>> minItems: 6 >>> maxItems: 6 >> >> If I put the constraint here, it would conflict with the original one. >> Should I also replace the original resets >> >> resets: >> minItems: 2 >> maxItems: 6 >> >> with "resets: true"? > > It should not conflict. Check the bindings for Samsung Exynos clock I > sent you last time. In the main "properties" you put the widest > constraints, like you have now (2-6). Then for each compatible you > narrow it (2-2, 6-6). > > You can later test it by adding/removing clocks to check if constraints > are properly working. I understand. The main "properties" should be the widest constraints, and I checked that Exynos clock is set to the widest (1-10). I'll add the constraints. Thank you, --- Best Regards Kunihiko Hayashi
diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml index 14f7579e7daa..61d9306e1852 100644 --- a/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml +++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml @@ -30,33 +30,62 @@ properties: minItems: 1 maxItems: 2 - clock-names: - oneOf: - - items: # for PXs2 - - const: link - - items: # for Pro4 - - const: link - - const: gio - - items: # for others - - const: link - - const: phy + clock-names: true resets: minItems: 2 maxItems: 6 - reset-names: - oneOf: - - items: # for Pro4 - - const: link - - const: gio - - const: phy - - const: pm - - const: tx - - const: rx - - items: # for others - - const: link - - const: phy + reset-names: true + +allOf: + - if: + properties: + compatible: + contains: + const: socionext,uniphier-pro4-ahci-phy + then: + properties: + clock-names: + items: + - const: link + - const: gio + reset-names: + items: + - const: link + - const: gio + - const: phy + - const: pm + - const: tx + - const: rx + - if: + properties: + compatible: + contains: + const: socionext,uniphier-pxs2-ahci-phy + then: + properties: + clock-names: + const: link + reset-names: + items: + - const: link + - const: phy + - if: + properties: + compatible: + contains: + const: socionext,uniphier-pxs3-ahci-phy + then: + properties: + clock-names: + items: + - const: link + - const: phy + reset-names: + items: + - const: link + - const: phy required: - compatible diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-pcie-phy.yaml index fbb71d6dd531..e45489a9bf1a 100644 --- a/Documentation/devicetree/bindings/phy/socionext,uniphier-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-pcie-phy.yaml @@ -31,28 +31,41 @@ properties: minItems: 1 maxItems: 2 - clock-names: - oneOf: - - items: # for Pro5 - - const: gio - - const: link - - const: link # for others + clock-names: true resets: minItems: 1 maxItems: 2 - reset-names: - oneOf: - - items: # for Pro5 - - const: gio - - const: link - - const: link # for others + reset-names: true socionext,syscon: $ref: /schemas/types.yaml#/definitions/phandle description: A phandle to system control to set configurations for phy +allOf: + - if: + properties: + compatible: + contains: + const: socionext,uniphier-pro5-pcie-phy + then: + properties: + clock-names: + items: + - const: gio + - const: link + reset-names: + items: + - const: gio + - const: link + else: + properties: + clock-names: + const: link + reset-names: + const: link + required: - compatible - reg diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml index 1bbd164f2527..a37205242dc1 100644 --- a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml +++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml @@ -34,30 +34,12 @@ properties: minItems: 2 maxItems: 3 - clock-names: - oneOf: - - items: # for Pro5 - - const: gio - - const: link - - items: # for PXs3 with phy-ext - - const: link - - const: phy - - const: phy-ext - - items: # for others - - const: link - - const: phy + clock-names: true resets: maxItems: 2 - reset-names: - oneOf: - - items: # for Pro5 - - const: gio - - const: link - - items: # for others - - const: link - - const: phy + reset-names: true vbus-supply: description: A phandle to the regulator for USB VBUS @@ -80,6 +62,59 @@ properties: required for each port, if any one is omitted, the trimming data of the port will not be set at all. +allOf: + - if: + properties: + compatible: + contains: + const: socionext,uniphier-pro5-usb3-hsphy + then: + properties: + clock-names: + items: + - const: gio + - const: link + reset-names: + items: + - const: gio + - const: link + - if: + properties: + compatible: + contains: + enum: + - socionext,uniphier-pxs2-usb3-hsphy + - socionext,uniphier-ld20-usb3-hsphy + then: + properties: + clock-names: + items: + - const: link + - const: phy + reset-names: + items: + - const: link + - const: phy + - if: + properties: + compatible: + contains: + enum: + - socionext,uniphier-pxs3-usb3-hsphy + - socionext,uniphier-nx1-usb3-hsphy + then: + properties: + clock-names: + minItems: 2 + items: + - const: link + - const: phy + - const: phy-ext + reset-names: + items: + - const: link + - const: phy + required: - compatible - reg diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3ss-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3ss-phy.yaml index 06c957d52d23..dd6ebee6377f 100644 --- a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3ss-phy.yaml +++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3ss-phy.yaml @@ -35,34 +35,71 @@ properties: minItems: 2 maxItems: 3 - clock-names: - oneOf: - - items: # for Pro4, Pro5 - - const: gio - - const: link - - items: # for PXs3 with phy-ext - - const: link - - const: phy - - const: phy-ext - - items: # for others - - const: link - - const: phy + clock-names: true resets: maxItems: 2 - reset-names: - oneOf: - - items: # for Pro4,Pro5 - - const: gio - - const: link - - items: # for others - - const: link - - const: phy + reset-names: true vbus-supply: description: A phandle to the regulator for USB VBUS, only for USB host +allOf: + - if: + properties: + compatible: + contains: + enum: + - socionext,uniphier-pro4-usb3-ssphy + - socionext,uniphier-pro5-usb3-ssphy + then: + properties: + clock-names: + items: + - const: gio + - const: link + reset-names: + items: + - const: gio + - const: link + - if: + properties: + compatible: + contains: + enum: + - socionext,uniphier-pxs2-usb3-ssphy + - socionext,uniphier-ld20-usb3-ssphy + then: + properties: + clock-names: + items: + - const: link + - const: phy + reset-names: + items: + - const: link + - const: phy + - if: + properties: + compatible: + contains: + enum: + - socionext,uniphier-pxs3-usb3-ssphy + - socionext,uniphier-nx1-usb3-ssphy + then: + properties: + clock-names: + minItems: 2 + items: + - const: link + - const: phy + - const: phy-ext + reset-names: + items: + - const: link + - const: phy + required: - compatible - reg
Instead of "oneOf:" choices, use "allOf:" and "if:" to define clock-names and reset-names that can be taken by the compatible string. The order of clock-names and reset-names doesn't change here. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> --- .../phy/socionext,uniphier-ahci-phy.yaml | 73 ++++++++++++------ .../phy/socionext,uniphier-pcie-phy.yaml | 37 ++++++--- .../phy/socionext,uniphier-usb3hs-phy.yaml | 75 +++++++++++++----- .../phy/socionext,uniphier-usb3ss-phy.yaml | 77 ++++++++++++++----- 4 files changed, 188 insertions(+), 74 deletions(-)