[PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver

Dimitri Fedrau via B4 Relay posted 2 patches 2 months, 1 week ago
There is a newer version of this series
[PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
Posted by Dimitri Fedrau via B4 Relay 2 months, 1 week ago
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>

Adding documentation for NXPs TJA1145 CAN transceiver.

Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
 .../devicetree/bindings/phy/nxp,tja1145-can.yaml   | 79 ++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TJA1145 CAN transceiver
+
+maintainers:
+  - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    const: nxp,tja1145
+
+  "#phy-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 4000000
+
+  spi-cpha: true
+
+  spi-cs-setup-delay-ns:
+    minimum: 50
+    default: 50
+
+  spi-cs-hold-delay-ns:
+    minimum: 50
+    default: 50
+
+  spi-cs-inactive-delay-ns:
+    minimum: 250
+    default: 250
+
+  vcc-supply:
+    description:
+      CAN transceiver supply voltage
+
+  vio-supply:
+    description:
+      Supply voltage for I/O level adaptor
+
+  vbat-supply:
+    description:
+      Battery supply voltage
+
+required:
+  - compatible
+  - "#phy-cells"
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        canphy@0 {
+            compatible = "nxp,tja1145";
+            #phy-cells = <0>;
+            reg = <0>;
+            spi-max-frequency = <4000000>;
+            spi-cpha;
+            spi-cs-setup-delay-ns = <50>;
+            spi-cs-hold-delay-ns = <50>;
+            spi-cs-inactive-delay-ns = <250>;
+            vcc-supply = <&reg_5v0>;
+            vio-supply = <&reg_3v3>;
+            vbat-supply = <&reg_24v0>;
+        };
+    };

-- 
2.39.5
Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
Posted by Krzysztof Kozlowski 2 months, 1 week ago
On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> Adding documentation for NXPs TJA1145 CAN transceiver.
> 
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> ---
>  .../devicetree/bindings/phy/nxp,tja1145-can.yaml   | 79 ++++++++++++++++++++++

Why isn't this in can directory with rest of CAN bindings?

>  1 file changed, 79 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml

Filename should match compatible.

> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TJA1145 CAN transceiver
> +
> +maintainers:
> +  - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> +
> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#

Missing ref to transceiver properties. Look at other CAN bindings.

> +
> +properties:
> +  compatible:
> +    const: nxp,tja1145
> +
> +  "#phy-cells":
> +    const: 0
> +
> +  reg:
> +    maxItems: 1

reg is the second property, also in "required:" block.

> +
> +  spi-max-frequency:
> +    maximum: 4000000
> +
> +  spi-cpha: true
> +
> +  spi-cs-setup-delay-ns:
> +    minimum: 50
> +    default: 50
> +
> +  spi-cs-hold-delay-ns:
> +    minimum: 50
> +    default: 50
> +
> +  spi-cs-inactive-delay-ns:
> +    minimum: 250
> +    default: 250
> +
> +  vcc-supply:
> +    description:
> +      CAN transceiver supply voltage
> +
> +  vio-supply:
> +    description:
> +      Supply voltage for I/O level adaptor
> +
> +  vbat-supply:
> +    description:
> +      Battery supply voltage
> +
> +required:
> +  - compatible
> +  - "#phy-cells"
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        canphy@0 {

can-phy if something like this exist. If not, then probably can-transceiver

> +            compatible = "nxp,tja1145";
> +            #phy-cells = <0>;
> +            reg = <0>;

Please follow DTS coding style.

Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
Posted by Dimitri Fedrau 2 months ago
Hi Krzysztof,

Am Wed, Jul 30, 2025 at 09:35:12AM +0200 schrieb Krzysztof Kozlowski:
> On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> > Adding documentation for NXPs TJA1145 CAN transceiver.
> > 
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> >  .../devicetree/bindings/phy/nxp,tja1145-can.yaml   | 79 ++++++++++++++++++++++
> 
> Why isn't this in can directory with rest of CAN bindings?
> 
The directory contains CAN controller bindings. This is a CAN transceiver
binding. And the only CAN transceiver binding I could find so far is this:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
The driver uses the generic PHY framework as the driver for the tja1145
does.

> >  1 file changed, 79 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> 
> Filename should match compatible.
> 
Ok, will fix this.

> > @@ -0,0 +1,79 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: TJA1145 CAN transceiver
> > +
> > +maintainers:
> > +  - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > +
> > +allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> 
> Missing ref to transceiver properties. Look at other CAN bindings.
>
There is only one transceiver property(max-bitrate) which I don't need
because the max-bitrate is known for the device. So why should I add it
to the DT ?
I'm only aware of CAN controller bindings making use of the transceiver
property which I think is because the PHYs they are supporting with this
are very simple which need no or little configuration to operate and the
max-bitrate property is needed to limit the bitrate.

> > +
> > +properties:
> > +  compatible:
> > +    const: nxp,tja1145
> > +
> > +  "#phy-cells":
> > +    const: 0
> > +
> > +  reg:
> > +    maxItems: 1
> 
> reg is the second property, also in "required:" block.
> 
Will fix this.

> > +
> > +  spi-max-frequency:
> > +    maximum: 4000000
> > +
> > +  spi-cpha: true
> > +
> > +  spi-cs-setup-delay-ns:
> > +    minimum: 50
> > +    default: 50
> > +
> > +  spi-cs-hold-delay-ns:
> > +    minimum: 50
> > +    default: 50
> > +
> > +  spi-cs-inactive-delay-ns:
> > +    minimum: 250
> > +    default: 250
> > +
> > +  vcc-supply:
> > +    description:
> > +      CAN transceiver supply voltage
> > +
> > +  vio-supply:
> > +    description:
> > +      Supply voltage for I/O level adaptor
> > +
> > +  vbat-supply:
> > +    description:
> > +      Battery supply voltage
> > +
> > +required:
> > +  - compatible
> > +  - "#phy-cells"
> > +  - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +        canphy@0 {
> 
> can-phy if something like this exist. If not, then probably can-transceiver
>
Will fix this.

> > +            compatible = "nxp,tja1145";
> > +            #phy-cells = <0>;
> > +            reg = <0>;
> 
> Please follow DTS coding style.
>
Ok.

Best regards,
Dimitri Fedrau
Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
Posted by Krzysztof Kozlowski 2 months ago
On 31/07/2025 06:48, Dimitri Fedrau wrote:
>>> +allOf:
>>> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
>>
>> Missing ref to transceiver properties. Look at other CAN bindings.
>>
> There is only one transceiver property(max-bitrate) which I don't need
> because the max-bitrate is known for the device. So why should I add it
> to the DT ?
> I'm only aware of CAN controller bindings making use of the transceiver
> property which I think is because the PHYs they are supporting with this
> are very simple which need no or little configuration to operate and the
> max-bitrate property is needed to limit the bitrate.

It's fine then, I guess.



Best regards,
Krzysztof