diff mbox series

[2/6] dt-bindings: can: mcp25xxfd: document device tree bindings

Message ID 20200910133806.25077-3-manivannan.sadhasivam@linaro.org
State New
Headers show
Series Add support for MCP25XXFD SPI-CAN Network driver | expand

Commit Message

Manivannan Sadhasivam Sept. 10, 2020, 1:38 p.m. UTC
From: Oleksij Rempel <o.rempel@pengutronix.de>


This patch adds the device-tree binding documentation for the Microchip
MCP25xxFD SPI CAN controller family.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

---
 .../bindings/net/can/microchip,mcp25xxfd.yaml | 79 +++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

-- 
2.17.1

Comments

Rob Herring Sept. 22, 2020, 7:32 p.m. UTC | #1
On Thu, Sep 10, 2020 at 07:08:02PM +0530, Manivannan Sadhasivam wrote:
> From: Oleksij Rempel <o.rempel@pengutronix.de>

> 

> This patch adds the device-tree binding documentation for the Microchip

> MCP25xxFD SPI CAN controller family.

> 

> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

> ---

>  .../bindings/net/can/microchip,mcp25xxfd.yaml | 79 +++++++++++++++++++

>  1 file changed, 79 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

> 

> diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

> new file mode 100644

> index 000000000000..aa2cad14d6d7

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

> @@ -0,0 +1,79 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/net/can/microchip,mcp25xxfd.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title:

> +  Microchip MCP2517FD and MCP2518FD stand-alone CAN controller device tree

> +  bindings

> +

> +maintainers:

> +  - Marc Kleine-Budde <mkl@pengutronix.de>

> +

> +properties:

> +  compatible:

> +    oneOf:

> +      - const: microchip,mcp2517fd

> +        description: for MCP2517FD

> +      - const: microchip,mcp2518fd

> +        description: for MCP2518FD

> +      - const: microchip,mcp25xxfd

> +        description: to autodetect chip variant

> +

> +  reg:

> +    maxItems: 1

> +

> +  interrupts-extended:


Use 'interrupts'. (interrupts-extended will automagically be supported 
by the tools)

> +    maxItems: 1

> +

> +  clocks:

> +    maxItems: 1

> +

> +  vdd-supply:

> +    description: Regulator that powers the CAN controller.

> +    maxItems: 1


-supply is always a single item. Drop.

> +

> +  xceiver-supply:

> +    description: Regulator that powers the CAN transceiver.

> +    maxItems: 1


ditto

> +

> +  microchip,rx-int-gpios:

> +    description:

> +      GPIO phandle of GPIO connected to to INT1 pin of the MCP25XXFD, which

> +      signals a pending RX interrupt.

> +    maxItems: 1

> +

> +  spi-max-frequency:

> +    description:

> +      Must be half or less of "clocks" frequency.

> +    maximum: 20000000

> +

> +required:

> +  - compatible

> +  - reg

> +  - interrupts-extended


interrupts

> +  - clocks


Add:

additionalProperties: false

> +

> +examples:

> +  - |

> +    #include <dt-bindings/gpio/gpio.h>

> +    #include <dt-bindings/interrupt-controller/irq.h>

> +

> +    spi0 {

> +        #address-cells = <1>;

> +        #size-cells = <0>;

> +

> +        can@0 {

> +            compatible = "microchip,mcp25xxfd";

> +            reg = <0>;

> +            clocks = <&can0_osc>;

> +            pinctrl-names = "default";

> +            pinctrl-0 = <&can0_pins>;

> +            spi-max-frequency = <20000000>;

> +            interrupts-extended = <&gpio 13 IRQ_TYPE_LEVEL_LOW>;

> +            microchip,rx-int-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;

> +            vdd-supply = <&reg5v0>;

> +            xceiver-supply = <&reg5v0>;

> +        };

> +    };

> -- 

> 2.17.1

>
Geert Uytterhoeven Sept. 29, 2020, 9:46 a.m. UTC | #2
Hi Manivannan, Oleksij,

On Thu, Sep 10, 2020 at 11:37 PM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
> From: Oleksij Rempel <o.rempel@pengutronix.de>

>

> This patch adds the device-tree binding documentation for the Microchip

> MCP25xxFD SPI CAN controller family.

>

> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Thanks for your patch, which is now commit 1b5a78e69c1fdae9
("dt-binding: can: mcp25xxfd: document device tree bindings") in net-next.

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

> @@ -0,0 +1,79 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/net/can/microchip,mcp25xxfd.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title:

> +  Microchip MCP2517FD and MCP2518FD stand-alone CAN controller device tree

> +  bindings

> +

> +maintainers:

> +  - Marc Kleine-Budde <mkl@pengutronix.de>

> +

> +properties:

> +  compatible:

> +    oneOf:

> +      - const: microchip,mcp2517fd

> +        description: for MCP2517FD

> +      - const: microchip,mcp2518fd

> +        description: for MCP2518FD

> +      - const: microchip,mcp25xxfd

> +        description: to autodetect chip variant


The last one is a wildcard?
When would you want to use it (oh, in the example below)?
Can you guarantee Microchip will not introduce other components that
match this wildcard, but are not compatible?

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Marc Kleine-Budde Sept. 29, 2020, 10:06 a.m. UTC | #3
On 9/29/20 11:46 AM, Geert Uytterhoeven wrote:
> Hi Manivannan, Oleksij,

> 

> On Thu, Sep 10, 2020 at 11:37 PM Manivannan Sadhasivam

> <manivannan.sadhasivam@linaro.org> wrote:

>> From: Oleksij Rempel <o.rempel@pengutronix.de>

>>

>> This patch adds the device-tree binding documentation for the Microchip

>> MCP25xxFD SPI CAN controller family.

>>

>> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

> 

> Thanks for your patch, which is now commit 1b5a78e69c1fdae9

> ("dt-binding: can: mcp25xxfd: document device tree bindings") in net-next.

> 

>> --- /dev/null

>> +++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml

>> @@ -0,0 +1,79 @@

>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

>> +%YAML 1.2

>> +---

>> +$id: http://devicetree.org/schemas/net/can/microchip,mcp25xxfd.yaml#

>> +$schema: http://devicetree.org/meta-schemas/core.yaml#

>> +

>> +title:

>> +  Microchip MCP2517FD and MCP2518FD stand-alone CAN controller device tree

>> +  bindings

>> +

>> +maintainers:

>> +  - Marc Kleine-Budde <mkl@pengutronix.de>

>> +

>> +properties:

>> +  compatible:

>> +    oneOf:

>> +      - const: microchip,mcp2517fd

>> +        description: for MCP2517FD

>> +      - const: microchip,mcp2518fd

>> +        description: for MCP2518FD

>> +      - const: microchip,mcp25xxfd

>> +        description: to autodetect chip variant

> 

> The last one is a wildcard?

> When would you want to use it (oh, in the example below)?


Im using it in overlays for several raspi hats, e.g. a raspi to click board
converter where I add mcp2517fd or mcp2518fd modules without the need to change
the overlay.

> Can you guarantee Microchip will not introduce other components that

> match this wildcard, but are not compatible?


Guarantee is quite a strong word :)

So far in that name space there are the mcp2510, mcp2515 and mcp25625. From the
SW point of view the 2515 and 25625 are identical while being compatible to the
mcp2510 but offer more features. There's a single drver (mcp251x) for these.
These chips implement the CAN-2.0 standard.

Regarding the mcp2517fd and mcp2518fd, the "fd" in the name references the
CAN-FD standard (successor to CAN-2.0).

Maybe Thomas Kopp (Cc'ed) from Microchip can say something to this.

We can rename the compatible to mcp251xfd to make it more specific.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
Thomas Kopp Sept. 29, 2020, 11:25 a.m. UTC | #4
> So far in that name space there are the mcp2510, mcp2515 and mcp25625.

> From the

> SW point of view the 2515 and 25625 are identical while being compatible

> to the

> mcp2510 but offer more features. There's a single drver (mcp251x) for

> these.

> These chips implement the CAN-2.0 standard.

> 

> Regarding the mcp2517fd and mcp2518fd, the "fd" in the name references

> the

> CAN-FD standard (successor to CAN-2.0).

> 

> Maybe Thomas Kopp (Cc'ed) from Microchip can say something to this.

> 

> We can rename the compatible to mcp251xfd to make it more specific.

I agree that mcp251xfd would be a good fit. We already have (theoretical)
conflicts for the xx in the namespace e.g. the MCP2542FD which is a 
transceiver without any controller functionality.

Although hard to guarantee I think it's fair to assume that no MCP251xFD 
will be released that is incompatible.

Thomas
Marc Kleine-Budde Sept. 29, 2020, 11:27 a.m. UTC | #5
On 9/29/20 1:25 PM, Thomas.Kopp@microchip.com wrote:
>> So far in that name space there are the mcp2510, mcp2515 and mcp25625.

>> From the

>> SW point of view the 2515 and 25625 are identical while being compatible

>> to the

>> mcp2510 but offer more features. There's a single drver (mcp251x) for

>> these.

>> These chips implement the CAN-2.0 standard.

>>

>> Regarding the mcp2517fd and mcp2518fd, the "fd" in the name references

>> the

>> CAN-FD standard (successor to CAN-2.0).

>>

>> Maybe Thomas Kopp (Cc'ed) from Microchip can say something to this.

>>

>> We can rename the compatible to mcp251xfd to make it more specific.

> I agree that mcp251xfd would be a good fit. We already have (theoretical)

> conflicts for the xx in the namespace e.g. the MCP2542FD which is a 

> transceiver without any controller functionality.

> 

> Although hard to guarantee I think it's fair to assume that no MCP251xFD 

> will be released that is incompatible.


Makes sense to me. Thomas, can you create a patch for this?

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
new file mode 100644
index 000000000000..aa2cad14d6d7
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
@@ -0,0 +1,79 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/microchip,mcp25xxfd.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title:
+  Microchip MCP2517FD and MCP2518FD stand-alone CAN controller device tree
+  bindings
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+properties:
+  compatible:
+    oneOf:
+      - const: microchip,mcp2517fd
+        description: for MCP2517FD
+      - const: microchip,mcp2518fd
+        description: for MCP2518FD
+      - const: microchip,mcp25xxfd
+        description: to autodetect chip variant
+
+  reg:
+    maxItems: 1
+
+  interrupts-extended:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator that powers the CAN controller.
+    maxItems: 1
+
+  xceiver-supply:
+    description: Regulator that powers the CAN transceiver.
+    maxItems: 1
+
+  microchip,rx-int-gpios:
+    description:
+      GPIO phandle of GPIO connected to to INT1 pin of the MCP25XXFD, which
+      signals a pending RX interrupt.
+    maxItems: 1
+
+  spi-max-frequency:
+    description:
+      Must be half or less of "clocks" frequency.
+    maximum: 20000000
+
+required:
+  - compatible
+  - reg
+  - interrupts-extended
+  - clocks
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spi0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        can@0 {
+            compatible = "microchip,mcp25xxfd";
+            reg = <0>;
+            clocks = <&can0_osc>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&can0_pins>;
+            spi-max-frequency = <20000000>;
+            interrupts-extended = <&gpio 13 IRQ_TYPE_LEVEL_LOW>;
+            microchip,rx-int-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
+            vdd-supply = <&reg5v0>;
+            xceiver-supply = <&reg5v0>;
+        };
+    };