diff mbox series

[RFC] dt-bindings: can: convert tcan4x5x.txt to DT schema

Message ID 20241104085616.469862-1-sean@geanix.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [RFC] dt-bindings: can: convert tcan4x5x.txt to DT schema | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Sean Nyekjaer Nov. 4, 2024, 8:56 a.m. UTC
Convert binding doc tcan4x5x.txt to yaml.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---

Can we somehow reference bosch,mram-cfg from the bosch,m_can.yaml?
I have searched for yaml files that tries the same, but it's usually
includes a whole node.

I have also tried:
$ref: /schema/bosch,m_can.yaml#/properties/bosch,mram-cfg

Any hints to share a property?

 .../devicetree/bindings/net/can/tcan4x5x.txt  | 48 ---------
 .../bindings/net/can/ti,tcan4x5x.yaml         | 97 +++++++++++++++++++
 2 files changed, 97 insertions(+), 48 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/can/tcan4x5x.txt
 create mode 100644 Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml

Comments

Krzysztof Kozlowski Nov. 4, 2024, 9:27 a.m. UTC | #1
On 04/11/2024 09:56, Sean Nyekjaer wrote:
> Convert binding doc tcan4x5x.txt to yaml.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> 
> Can we somehow reference bosch,mram-cfg from the bosch,m_can.yaml?
> I have searched for yaml files that tries the same, but it's usually
> includes a whole node.
> 
> I have also tried:
> $ref: /schema/bosch,m_can.yaml#/properties/bosch,mram-cfg

Yes, this would work just with full path, so /schemas/net/can/...

See:
Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml

But you can also just copy it. Ideally this should be moved to common
schema or replaced with more generic property, but these do not have to
be part of this conversion.

> 
> Any hints to share a property?
> 
>  .../devicetree/bindings/net/can/tcan4x5x.txt  | 48 ---------
>  .../bindings/net/can/ti,tcan4x5x.yaml         | 97 +++++++++++++++++++
>  2 files changed, 97 insertions(+), 48 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/net/can/tcan4x5x.txt
>  create mode 100644 Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> 

...

> diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> new file mode 100644
> index 000000000000..62c108fac6b3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Texas Instruments TCAN4x5x CAN Controller
> +
> +maintainers:
> +  - Marc Kleine-Budde <mkl@pengutronix.de>
> +
> +allOf:
> +  - $ref: can-controller.yaml#
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - enum:
> +          - ti,tcan4552
> +          - ti,tcan4553
> +          - ti,tcan4x5x

That's not really what old binding said.

It said for example:
"ti,tcan4552", "ti,tcan4x5x"

Which is not allowed above. You need list. Considering there are no
in-tree users of ti,tcan4x5x alone, I would allow only lists followed by
ti,tcan4x5x. IOW: disallow ti,tcan4x5x alone.

Mention this change to the binding in the commit message.


> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  vdd-supply:
> +    description: Regulator that powers the CAN controller.
> +
> +  xceiver-supply:
> +    description: Regulator that powers the CAN transceiver.

You need to mention all changes done to the binding in the commit msg.

> +
> +  reset-gpios:
> +    description: Hardwired output GPIO. If not defined then software reset.
> +    maxItems: 1
> +
> +  device-state-gpios:
> +    description: Input GPIO that indicates if the device is in a sleep state or if the device is active.
> +      Not available with tcan4552/4553.
> +    maxItems: 1
> +
> +  device-wake-gpios:
> +    description: Wake up GPIO to wake up the TCAN device. Not available with tcan4552/4553.
> +    maxItems: 1
> +
> +  bosch,mram-cfg:
> +    $ref: bosch,m_can.yaml#
> +
> +  spi-max-frequency:
> +    description:
> +      Must be half or less of "clocks" frequency.
> +    maximum: 10000000

Old binding said 18 MHz?

> +
> +  wakeup-source:
> +    $ref: /schemas/types.yaml#/definitions/flag
> +    description:
> +      Enable CAN remote wakeup.
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - bosch,mram-cfg
> +

Missing allOf: with $ref to spi-peripheral-props. See other SPI devices.


> +additionalProperties: false

And this becomes unevaluatedProperties: false

Best regards,
Krzysztof
Rob Herring Nov. 4, 2024, 10:22 a.m. UTC | #2
On Mon, 04 Nov 2024 09:56:15 +0100, Sean Nyekjaer wrote:
> Convert binding doc tcan4x5x.txt to yaml.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> 
> Can we somehow reference bosch,mram-cfg from the bosch,m_can.yaml?
> I have searched for yaml files that tries the same, but it's usually
> includes a whole node.
> 
> I have also tried:
> $ref: /schema/bosch,m_can.yaml#/properties/bosch,mram-cfg
> 
> Any hints to share a property?
> 
>  .../devicetree/bindings/net/can/tcan4x5x.txt  | 48 ---------
>  .../bindings/net/can/ti,tcan4x5x.yaml         | 97 +++++++++++++++++++
>  2 files changed, 97 insertions(+), 48 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/net/can/tcan4x5x.txt
>  create mode 100644 Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml: properties:bosch,mram-cfg: 'anyOf' conditional failed, one must be fixed:
	'description' is a dependency of '$ref'
	'bosch,m_can.yaml#' does not match 'types.yaml#/definitions/'
		hint: A vendor property needs a $ref to types.yaml
	'bosch,m_can.yaml#' does not match '^#/(definitions|\\$defs)/'
		hint: A vendor property can have a $ref to a a $defs schema
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.example.dtb: can@0: bosch,mram-cfg: [0, 0, 0, 16, 0, 0, 1, 1] is not of type 'object'
	from schema $id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.example.dtb: can@0: bosch,mram-cfg: [0, 0, 0, 16, 0, 0, 1, 1] is not of type 'object'
	from schema $id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241104085616.469862-1-sean@geanix.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

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 after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Marc Kleine-Budde Nov. 4, 2024, 10:31 a.m. UTC | #3
On 04.11.2024 10:27:04, Krzysztof Kozlowski wrote:
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - enum:
> > +          - ti,tcan4552
> > +          - ti,tcan4553
> > +          - ti,tcan4x5x
> 
> That's not really what old binding said.
> 
> It said for example:
> "ti,tcan4552", "ti,tcan4x5x"
> 
> Which is not allowed above. You need list. Considering there are no
> in-tree users of ti,tcan4x5x alone, I would allow only lists followed by
> ti,tcan4x5x. IOW: disallow ti,tcan4x5x alone.

I'd like to keep the old binding.

> Mention this change to the binding in the commit message.

The tcan4x5x chip family has 2 registers for automatic detection of the
chip variant. While the ID2 register of the tcan4550 is 0x0, the
registers for the tcan4552 and tcan4553 contain 4552 and 4553
respectively in ASCII.

The driver was originally added for the tcan4550 chip, but currently
only has a compatible for "ti,tcan4x5x".

Marc
Krzysztof Kozlowski Nov. 4, 2024, 10:40 a.m. UTC | #4
On 04/11/2024 11:31, Marc Kleine-Budde wrote:
> On 04.11.2024 10:27:04, Krzysztof Kozlowski wrote:
>>> +properties:
>>> +  compatible:
>>> +    oneOf:
>>> +      - enum:
>>> +          - ti,tcan4552
>>> +          - ti,tcan4553
>>> +          - ti,tcan4x5x
>>
>> That's not really what old binding said.
>>
>> It said for example:
>> "ti,tcan4552", "ti,tcan4x5x"
>>
>> Which is not allowed above. You need list. Considering there are no
>> in-tree users of ti,tcan4x5x alone, I would allow only lists followed by
>> ti,tcan4x5x. IOW: disallow ti,tcan4x5x alone.
> 
> I'd like to keep the old binding.

Any reason why? It's against of bindings policies. If this was a new
binding, it would be a clear NAK, so here due to lack of user we can
make it correct.

> 
>> Mention this change to the binding in the commit message.
> 
> The tcan4x5x chip family has 2 registers for automatic detection of the
> chip variant. While the ID2 register of the tcan4550 is 0x0, the
> registers for the tcan4552 and tcan4553 contain 4552 and 4553
> respectively in ASCII.

This does not grant exception for wildcards. This only says that one
model should be used as fallback.

> 
> The driver was originally added for the tcan4550 chip, but currently
> only has a compatible for "ti,tcan4x5x".

That's not really related to discussion. We do not talk about changing
driver.

Best regards,
Krzysztof
Sean Nyekjaer Nov. 4, 2024, 10:54 a.m. UTC | #5
On Mon, Nov 04, 2024 at 10:27:04AM +0100, Krzysztof Kozlowski wrote:
> On 04/11/2024 09:56, Sean Nyekjaer wrote:
> > Convert binding doc tcan4x5x.txt to yaml.
> > 
> > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > ---
> > 
> > Can we somehow reference bosch,mram-cfg from the bosch,m_can.yaml?
> > I have searched for yaml files that tries the same, but it's usually
> > includes a whole node.
> > 
> > I have also tried:
> > $ref: /schema/bosch,m_can.yaml#/properties/bosch,mram-cfg
> 
> Yes, this would work just with full path, so /schemas/net/can/...
> 
> See:
> Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml
> 
> But you can also just copy it. Ideally this should be moved to common
> schema or replaced with more generic property, but these do not have to
>be part of this conversion.


diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
index 9ff52b8b3063..0fc37b10e899 100644
--- a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
+++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
@@ -50,7 +50,7 @@ properties:
     maxItems: 1

   bosch,mram-cfg:
-    $ref: bosch,m_can.yaml#
+    $ref: /schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg

   spi-max-frequency:
     description:

Still results in:
% make dt_binding_check DT_SCHEMA_FILES=ti,tcan4x5x.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json
  CHKDT   Documentation/devicetree/bindings
Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml: properties:bosch,mram-cfg: 'anyOf' conditional failed, one must be fixed:
        'description' is a dependency of '$ref'
        '/schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg' does not match 'types.yaml#/definitions/'
                hint: A vendor property needs a $ref to types.yaml
        '/schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg' does not match '^#/(definitions|\\$defs)/'
                hint: A vendor property can have a $ref to a a $defs schema
        hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
        from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#

> 
> > 
> > Any hints to share a property?
> > 
> >  .../devicetree/bindings/net/can/tcan4x5x.txt  | 48 ---------
> >  .../bindings/net/can/ti,tcan4x5x.yaml         | 97 +++++++++++++++++++
> >  2 files changed, 97 insertions(+), 48 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/net/can/tcan4x5x.txt
> >  create mode 100644 Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> > 
> 
> ...
> 
> > diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> > new file mode 100644
> > index 000000000000..62c108fac6b3
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> > @@ -0,0 +1,97 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Texas Instruments TCAN4x5x CAN Controller
> > +
> > +maintainers:
> > +  - Marc Kleine-Budde <mkl@pengutronix.de>
> > +
> > +allOf:
> > +  - $ref: can-controller.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - enum:
> > +          - ti,tcan4552
> > +          - ti,tcan4553
> > +          - ti,tcan4x5x
> 
> That's not really what old binding said.
> 
> It said for example:
> "ti,tcan4552", "ti,tcan4x5x"
> 
> Which is not allowed above. You need list. Considering there are no
> in-tree users of ti,tcan4x5x alone, I would allow only lists followed by
> ti,tcan4x5x. IOW: disallow ti,tcan4x5x alone.
> 
> Mention this change to the binding in the commit message.
> 
> 

I would prefer to not change anything other that doing the conversion to
DT schema.

> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    maxItems: 1
> > +
> > +  vdd-supply:
> > +    description: Regulator that powers the CAN controller.
> > +
> > +  xceiver-supply:
> > +    description: Regulator that powers the CAN transceiver.
> 
> You need to mention all changes done to the binding in the commit msg.
> 
Is this a change? It existed in the old doc aswell...

> > +
> > +  reset-gpios:
> > +    description: Hardwired output GPIO. If not defined then software reset.
> > +    maxItems: 1
> > +
> > +  device-state-gpios:
> > +    description: Input GPIO that indicates if the device is in a sleep state or if the device is active.
> > +      Not available with tcan4552/4553.
> > +    maxItems: 1
> > +
> > +  device-wake-gpios:
> > +    description: Wake up GPIO to wake up the TCAN device. Not available with tcan4552/4553.
> > +    maxItems: 1
> > +
> > +  bosch,mram-cfg:
> > +    $ref: bosch,m_can.yaml#
> > +
> > +  spi-max-frequency:
> > +    description:
> > +      Must be half or less of "clocks" frequency.
> > +    maximum: 10000000
> 
> Old binding said 18 MHz?
> 

Good catch.

> > +
> > +  wakeup-source:
> > +    $ref: /schemas/types.yaml#/definitions/flag
> > +    description:
> > +      Enable CAN remote wakeup.
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - interrupts
> > +  - clocks
> > +  - bosch,mram-cfg
> > +
> 
> Missing allOf: with $ref to spi-peripheral-props. See other SPI devices.
> 
> 

Added for v2.

> > +additionalProperties: false
> 
> And this becomes unevaluatedProperties: false
> 
> Best regards,
> Krzysztof
> 

Added for v2.

Br,
/Sean
Krzysztof Kozlowski Nov. 4, 2024, 11:37 a.m. UTC | #6
On 04/11/2024 11:54, Sean Nyekjaer wrote:
> 
> diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> index 9ff52b8b3063..0fc37b10e899 100644
> --- a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> +++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
> @@ -50,7 +50,7 @@ properties:
>      maxItems: 1
> 
>    bosch,mram-cfg:
> -    $ref: bosch,m_can.yaml#
> +    $ref: /schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg
> 
>    spi-max-frequency:
>      description:
> 
> Still results in:
> % make dt_binding_check DT_SCHEMA_FILES=ti,tcan4x5x.yaml
>   SCHEMA  Documentation/devicetree/bindings/processed-schema.json
>   CHKDT   Documentation/devicetree/bindings
> Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml: properties:bosch,mram-cfg: 'anyOf' conditional failed, one must be fixed:
>         'description' is a dependency of '$ref'
>         '/schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg' does not match 'types.yaml#/definitions/'
>                 hint: A vendor property needs a $ref to types.yaml
>         '/schemas/net/can/bosch,m_can.yaml#/properties/bosch,mram-cfg' does not match '^#/(definitions|\\$defs)/'
>                 hint: A vendor property can have a $ref to a a $defs schema
>         hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
>         from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#

Yeah, probably not much benefits of referencing other schema. Just copy
the property.

> 
>>
>>>
>>> Any hints to share a property?
>>>
>>>  .../devicetree/bindings/net/can/tcan4x5x.txt  | 48 ---------
>>>  .../bindings/net/can/ti,tcan4x5x.yaml         | 97 +++++++++++++++++++
>>>  2 files changed, 97 insertions(+), 48 deletions(-)
>>>  delete mode 100644 Documentation/devicetree/bindings/net/can/tcan4x5x.txt
>>>  create mode 100644 Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
>>>
>>
>> ...
>>
>>> diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
>>> new file mode 100644
>>> index 000000000000..62c108fac6b3
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
>>> @@ -0,0 +1,97 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Texas Instruments TCAN4x5x CAN Controller
>>> +
>>> +maintainers:
>>> +  - Marc Kleine-Budde <mkl@pengutronix.de>
>>> +
>>> +allOf:
>>> +  - $ref: can-controller.yaml#
>>> +
>>> +properties:
>>> +  compatible:
>>> +    oneOf:
>>> +      - enum:
>>> +          - ti,tcan4552
>>> +          - ti,tcan4553
>>> +          - ti,tcan4x5x
>>
>> That's not really what old binding said.
>>
>> It said for example:
>> "ti,tcan4552", "ti,tcan4x5x"
>>
>> Which is not allowed above. You need list. Considering there are no
>> in-tree users of ti,tcan4x5x alone, I would allow only lists followed by
>> ti,tcan4x5x. IOW: disallow ti,tcan4x5x alone.
>>
>> Mention this change to the binding in the commit message.
>>
>>
> 
> I would prefer to not change anything other that doing the conversion to
> DT schema.

Well, above you changed a lot :/, but fine - wildcard can stay. But
anyway compatible list has to be fixed.

> 
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  interrupts:
>>> +    maxItems: 1
>>> +
>>> +  clocks:
>>> +    maxItems: 1
>>> +
>>> +  vdd-supply:
>>> +    description: Regulator that powers the CAN controller.
>>> +
>>> +  xceiver-supply:
>>> +    description: Regulator that powers the CAN transceiver.
>>
>> You need to mention all changes done to the binding in the commit msg.
>>
> Is this a change? It existed in the old doc aswell...

Where? I pointed out that this is a change. I cannot find it. If you
disagree, please point to the patch. And it's tricky for me to prove my
point - to show that such thing did not exist...


Two more comments below:

> 
>>> +
>>> +  reset-gpios:
>>> +    description: Hardwired output GPIO. If not defined then software reset.
>>> +    maxItems: 1
>>> +
>>> +  device-state-gpios:
>>> +    description: Input GPIO that indicates if the device is in a sleep state or if the device is active.

Please wrap code according to coding style (checkpatch is not a coding
style description, but only a tool).


>>> +      Not available with tcan4552/4553.

Then you need if:then: inside allOf: block disallowing it for this variant.
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L223



Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt
deleted file mode 100644
index 20c0572c9853..000000000000
--- a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt
+++ /dev/null
@@ -1,48 +0,0 @@ 
-Texas Instruments TCAN4x5x CAN Controller
-================================================
-
-This file provides device node information for the TCAN4x5x interface contains.
-
-Required properties:
-	- compatible:
-		"ti,tcan4552", "ti,tcan4x5x"
-		"ti,tcan4553", "ti,tcan4x5x" or
-		"ti,tcan4x5x"
-	- reg: 0
-	- #address-cells: 1
-	- #size-cells: 0
-	- spi-max-frequency: Maximum frequency of the SPI bus the chip can
-			     operate at should be less than or equal to 18 MHz.
-	- interrupt-parent: the phandle to the interrupt controller which provides
-                    the interrupt.
-	- interrupts: interrupt specification for data-ready.
-
-See Documentation/devicetree/bindings/net/can/bosch,m_can.yaml for additional
-required property details.
-
-Optional properties:
-	- reset-gpios: Hardwired output GPIO. If not defined then software
-		       reset.
-	- device-state-gpios: Input GPIO that indicates if the device is in
-			      a sleep state or if the device is active. Not
-			      available with tcan4552/4553.
-	- device-wake-gpios: Wake up GPIO to wake up the TCAN device. Not
-			     available with tcan4552/4553.
-	- wakeup-source: Leave the chip running when suspended, and configure
-			 the RX interrupt to wake up the device.
-
-Example:
-tcan4x5x: tcan4x5x@0 {
-		compatible = "ti,tcan4x5x";
-		reg = <0>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-		spi-max-frequency = <10000000>;
-		bosch,mram-cfg = <0x0 0 0 16 0 0 1 1>;
-		interrupt-parent = <&gpio1>;
-		interrupts = <14 IRQ_TYPE_LEVEL_LOW>;
-		device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
-		device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
-		reset-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
-		wakeup-source;
-};
diff --git a/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
new file mode 100644
index 000000000000..62c108fac6b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml
@@ -0,0 +1,97 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/ti,tcan4x5x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments TCAN4x5x CAN Controller
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+allOf:
+  - $ref: can-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - ti,tcan4552
+          - ti,tcan4553
+          - ti,tcan4x5x
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator that powers the CAN controller.
+
+  xceiver-supply:
+    description: Regulator that powers the CAN transceiver.
+
+  reset-gpios:
+    description: Hardwired output GPIO. If not defined then software reset.
+    maxItems: 1
+
+  device-state-gpios:
+    description: Input GPIO that indicates if the device is in a sleep state or if the device is active.
+      Not available with tcan4552/4553.
+    maxItems: 1
+
+  device-wake-gpios:
+    description: Wake up GPIO to wake up the TCAN device. Not available with tcan4552/4553.
+    maxItems: 1
+
+  bosch,mram-cfg:
+    $ref: bosch,m_can.yaml#
+
+  spi-max-frequency:
+    description:
+      Must be half or less of "clocks" frequency.
+    maximum: 10000000
+
+  wakeup-source:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Enable CAN remote wakeup.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - bosch,mram-cfg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        can@0 {
+            compatible = "ti,tcan4x5x";
+            reg = <0>;
+            clocks = <&can0_osc>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&can0_pins>;
+            spi-max-frequency = <10000000>;
+            bosch,mram-cfg = <0x0 0 0 16 0 0 1 1>;
+            interrupt-parent = <&gpio1>;
+            interrupts = <14 IRQ_TYPE_LEVEL_LOW>;
+            device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
+            device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+            reset-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
+            wakeup-source;
+        };
+    };