Message ID | 20210812204116.2303617-3-pgwipeout@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | phy-rockchip-inno-usb2: support rk356x usb2phy | expand |
Hi Peter, Some comments. Have a look if it's useful. On 8/12/21 10:41 PM, Peter Geis wrote: > The rk3568 usb2phy node is a standalone node with a single muxed > interrupt. > Add documentation for it to phy-rockchip-inno-usb2. > > Signed-off-by: Peter Geis <pgwipeout@gmail.com> > --- > .../bindings/phy/phy-rockchip-inno-usb2.yaml | 31 ++++++++++++++++--- > 1 file changed, 27 insertions(+), 4 deletions(-) > > diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > index 5bebd86bf8b6..d2a749c3f9a3 100644 > --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > @@ -18,6 +18,7 @@ properties: > - rockchip,rk3328-usb2phy > - rockchip,rk3366-usb2phy > - rockchip,rk3399-usb2phy > + - rockchip,rk3568-usb2phy > - rockchip,rv1108-usb2phy > > reg: > @@ -50,6 +51,9 @@ properties: > description: > Phandle to the extcon device providing the cable state for the otg phy. > > + interrupts: > + description: Muxed interrupt for both ports > + This allows every Rockchip SoC dtsi to add an interrupt here. You have only restricted the requirements. The goal is to restrict things and filter bogus properties. If it was done because it doesn't compile, maybe could you try/test/use something like the rockchip-io-domain.yaml $defs format. === unevaluatedProperties: false allOf: - $ref: "#/$defs/rk3568" $defs: rk3568: if: properties: compatible: contains: const: rockchip,rk3568-usb2phy then: properties: interrupts: maxItems: 1 required: - interrupts else: properties: host-port: properties: interrupts: description: host linestate interrupt interrupt-names: const: linestate required: - interrupts - interrupt-names otg-port: properties: interrupts: minItems: 1 maxItems: 3 interrupt-names: oneOf: - const: linestate - const: otg-mux - items: - const: otg-bvalid - const: otg-id - const: linestate required: - interrupts - interrupt-names > rockchip,usbgrf: > $ref: /schemas/types.yaml#/definitions/phandle > description: > @@ -78,8 +82,6 @@ properties: > > required: > - "#phy-cells" > - - interrupts > - - interrupt-names Also remove them as properties in this part when a separate $defs is used. > > otg-port: > type: object > @@ -109,8 +111,6 @@ properties: > > required: > - "#phy-cells" > - - interrupts > - - interrupt-names dito > > required: > - compatible > @@ -120,6 +120,29 @@ required: > - host-port > - otg-port > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: rockchip,rk3568-usb2phy > + then: Test "if then else" alignment with yamllint > + properties: > + interrupts: > + maxItems: 1 > + required: > + - interrupts > + else: alignment > + properties: > + host-port: > + required: > + - interrupts > + - interrupt-names > + otg-port: > + required: > + - interrupts > + - interrupt-names > + > additionalProperties: false additionalProperties does workn't with allOf: - $ref. Use unevaluatedProperties. > > examples: >
On Tue, Aug 17, 2021 at 06:52:15PM +0200, Johan Jonker wrote: > Hi Peter, > > Some comments. Have a look if it's useful. > > On 8/12/21 10:41 PM, Peter Geis wrote: > > The rk3568 usb2phy node is a standalone node with a single muxed > > interrupt. > > Add documentation for it to phy-rockchip-inno-usb2. > > > > Signed-off-by: Peter Geis <pgwipeout@gmail.com> > > --- > > .../bindings/phy/phy-rockchip-inno-usb2.yaml | 31 ++++++++++++++++--- > > 1 file changed, 27 insertions(+), 4 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > > index 5bebd86bf8b6..d2a749c3f9a3 100644 > > --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > > +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml > > @@ -18,6 +18,7 @@ properties: > > - rockchip,rk3328-usb2phy > > - rockchip,rk3366-usb2phy > > - rockchip,rk3399-usb2phy > > + - rockchip,rk3568-usb2phy > > - rockchip,rv1108-usb2phy > > > > reg: > > @@ -50,6 +51,9 @@ properties: > > description: > > Phandle to the extcon device providing the cable state for the otg phy. > > > > > + interrupts: > > + description: Muxed interrupt for both ports > > + > > This allows every Rockchip SoC dtsi to add an interrupt here. > You have only restricted the requirements. > The goal is to restrict things and filter bogus properties. > If it was done because it doesn't compile, maybe could you try/test/use > something like the rockchip-io-domain.yaml $defs format. Don't use $defs unless there's more than 1 copy needed of something. If it happens to bypass some checks, it's only a matter of time til I fix that. This may be better solved with another schema file rather than a long if/then schema. It's a judgement call. > > === > > unevaluatedProperties: false > > allOf: > - $ref: "#/$defs/rk3568" > > $defs: > rk3568: > if: > properties: > compatible: > contains: > const: rockchip,rk3568-usb2phy > > then: > properties: > interrupts: > maxItems: 1 > > required: > - interrupts > > else: > properties: > host-port: > properties: > interrupts: > description: host linestate interrupt > > interrupt-names: > const: linestate > > required: > - interrupts > - interrupt-names > > otg-port: > properties: > > interrupts: > minItems: 1 > maxItems: 3 > > interrupt-names: > oneOf: > - const: linestate > - const: otg-mux > - items: > - const: otg-bvalid > - const: otg-id > - const: linestate > > required: > - interrupts > - interrupt-names > > > rockchip,usbgrf: > > $ref: /schemas/types.yaml#/definitions/phandle > > description: > > @@ -78,8 +82,6 @@ properties: > > > > required: > > - "#phy-cells" > > > - - interrupts > > - - interrupt-names > > Also remove them as properties in this part when a separate $defs is used. > > > > > otg-port: > > type: object > > @@ -109,8 +111,6 @@ properties: > > > > required: > > - "#phy-cells" > > > - - interrupts > > - - interrupt-names > > dito > > > > > required: > > - compatible > > @@ -120,6 +120,29 @@ required: > > - host-port > > - otg-port > > > > +allOf: > > + - if: > > + properties: > > + compatible: > > + contains: > > + const: rockchip,rk3568-usb2phy > > > + then: > > Test "if then else" alignment with yamllint yamllint is not going to help there. What's needed is a meta-schema that adds the dependencies. > > > + properties: > > + interrupts: > > + maxItems: 1 > > + required: > > + - interrupts > > > + else: > > alignment > > > + properties: > > + host-port: > > + required: > > + - interrupts > > + - interrupt-names > > + otg-port: > > + required: > > + - interrupts > > + - interrupt-names > > + > > > additionalProperties: false > > additionalProperties does workn't with allOf: - $ref. Use > unevaluatedProperties. > > > > > examples: > > >
diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml index 5bebd86bf8b6..d2a749c3f9a3 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml @@ -18,6 +18,7 @@ properties: - rockchip,rk3328-usb2phy - rockchip,rk3366-usb2phy - rockchip,rk3399-usb2phy + - rockchip,rk3568-usb2phy - rockchip,rv1108-usb2phy reg: @@ -50,6 +51,9 @@ properties: description: Phandle to the extcon device providing the cable state for the otg phy. + interrupts: + description: Muxed interrupt for both ports + rockchip,usbgrf: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -78,8 +82,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names otg-port: type: object @@ -109,8 +111,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names required: - compatible @@ -120,6 +120,29 @@ required: - host-port - otg-port +allOf: + - if: + properties: + compatible: + contains: + const: rockchip,rk3568-usb2phy + then: + properties: + interrupts: + maxItems: 1 + required: + - interrupts + else: + properties: + host-port: + required: + - interrupts + - interrupt-names + otg-port: + required: + - interrupts + - interrupt-names + additionalProperties: false examples:
The rk3568 usb2phy node is a standalone node with a single muxed interrupt. Add documentation for it to phy-rockchip-inno-usb2. Signed-off-by: Peter Geis <pgwipeout@gmail.com> --- .../bindings/phy/phy-rockchip-inno-usb2.yaml | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-)