Some boards use SJA1105 Ethernet Switch with SPI CPHA, while ones with
SJA1110 use SPI CPOL, so document this to fix dtbs_check warnings:
arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dtb: ethernet-switch@0: Unevaluated properties are not allowed ('spi-cpol' was unexpected)
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
Changes since v3:
1. Rebase.
2. Require cpha/cpol properties on respective variants (thus update
example).
Changes since v2:
1. Add allOf:if:then, based on feedback from Vladimir.
Changes since v1:
1. Add also cpha.
---
.../bindings/net/dsa/nxp,sja1105.yaml | 32 ++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index 9a64ed658745..991448962c93 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -12,10 +12,6 @@ description:
cs_sck_delay of 500ns. Ensuring that this SPI timing requirement is observed
depends on the SPI bus master driver.
-allOf:
- - $ref: dsa.yaml#/$defs/ethernet-ports
- - $ref: /schemas/spi/spi-peripheral-props.yaml#
-
maintainers:
- Vladimir Oltean <[email protected]>
@@ -36,6 +32,9 @@ properties:
reg:
maxItems: 1
+ spi-cpha: true
+ spi-cpol: true
+
# Optional container node for the 2 internal MDIO buses of the SJA1110
# (one for the internal 100base-T1 PHYs and the other for the single
# 100base-TX PHY). The "reg" property does not have physical significance.
@@ -109,6 +108,30 @@ $defs:
1860, 1880, 1900, 1920, 1940, 1960, 1980, 2000, 2020, 2040, 2060, 2080,
2100, 2120, 2140, 2160, 2180, 2200, 2220, 2240, 2260]
+allOf:
+ - $ref: dsa.yaml#/$defs/ethernet-ports
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+ - if:
+ properties:
+ compatible:
+ enum:
+ - nxp,sja1105e
+ - nxp,sja1105t
+ - nxp,sja1105p
+ - nxp,sja1105q
+ - nxp,sja1105r
+ - nxp,sja1105s
+ then:
+ properties:
+ spi-cpol: false
+ required:
+ - spi-cpha
+ else:
+ properties:
+ spi-cpha: false
+ required:
+ - spi-cpol
+
unevaluatedProperties: false
examples:
@@ -120,6 +143,7 @@ examples:
ethernet-switch@1 {
reg = <0x1>;
compatible = "nxp,sja1105t";
+ spi-cpha;
ethernet-ports {
#address-cells = <1>;
--
2.34.1
On Sun, May 14, 2023 at 01:57:41PM +0200, Krzysztof Kozlowski wrote:
> +allOf:
> + - $ref: dsa.yaml#/$defs/ethernet-ports
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
> + - if:
> + properties:
> + compatible:
> + enum:
> + - nxp,sja1105e
> + - nxp,sja1105t
Is there a particular reason you did not put the "t" variant after the
"s" one?
> + - nxp,sja1105p
> + - nxp,sja1105q
> + - nxp,sja1105r
> + - nxp,sja1105s
Otherwise,
Reviewed-by: Conor Dooley <[email protected]>
Thanks,
Conor.
On 14/05/2023 20:32, Conor Dooley wrote:
> On Sun, May 14, 2023 at 01:57:41PM +0200, Krzysztof Kozlowski wrote:
>
>> +allOf:
>> + - $ref: dsa.yaml#/$defs/ethernet-ports
>> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>> + - if:
>> + properties:
>> + compatible:
>> + enum:
>> + - nxp,sja1105e
>> + - nxp,sja1105t
>
> Is there a particular reason you did not put the "t" variant after the
> "s" one?
Order is the same as in compatible list. I could sort them here, less
changes in the future.
Best regards,
Krzysztof
On Mon, May 15, 2023 at 08:21:40AM +0200, Krzysztof Kozlowski wrote:
> On 14/05/2023 20:32, Conor Dooley wrote:
> > On Sun, May 14, 2023 at 01:57:41PM +0200, Krzysztof Kozlowski wrote:
> >
> >> +allOf:
> >> + - $ref: dsa.yaml#/$defs/ethernet-ports
> >> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
> >> + - if:
> >> + properties:
> >> + compatible:
> >> + enum:
> >> + - nxp,sja1105e
> >> + - nxp,sja1105t
> >
> > Is there a particular reason you did not put the "t" variant after the
> > "s" one?
>
> Order is the same as in compatible list. I could sort them here, less
> changes in the future.
They are sorted chronologically, by generation.