diff mbox series

[v4,1/4] dt-bindings: net: can: Add poll-interval for MCAN

Message ID 20230501224624.13866-2-jm@ti.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Enable multiple MCAN on AM62x | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 64 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Judith Mendez May 1, 2023, 10:46 p.m. UTC
On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
routed to A53 Linux, instead they will use software interrupt by
hrtimer. To enable timer method, interrupts should be optional so
remove interrupts property from required section and introduce
poll-interval property.

Signed-off-by: Judith Mendez <jm@ti.com>
---
Changelog:
v3:
 1. Move binding patch to first in series
 2. Update description for poll-interval
 3. Add oneOf to specify using interrupts/interrupt-names or poll-interval
 4. Fix example property: add comment below 'example'

v2:
  1. Add poll-interval property to enable timer polling method
  2. Add example using poll-interval property
  
 .../bindings/net/can/bosch,m_can.yaml         | 36 +++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

Comments

Rob Herring (Arm) May 5, 2023, 9:29 p.m. UTC | #1
On Mon, May 01, 2023 at 05:46:21PM -0500, Judith Mendez wrote:
> On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
> routed to A53 Linux, instead they will use software interrupt by
> hrtimer. To enable timer method, interrupts should be optional so
> remove interrupts property from required section and introduce
> poll-interval property.
> 
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
> Changelog:
> v3:
>  1. Move binding patch to first in series
>  2. Update description for poll-interval
>  3. Add oneOf to specify using interrupts/interrupt-names or poll-interval
>  4. Fix example property: add comment below 'example'
> 
> v2:
>   1. Add poll-interval property to enable timer polling method
>   2. Add example using poll-interval property
>   
>  .../bindings/net/can/bosch,m_can.yaml         | 36 +++++++++++++++++--
>  1 file changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> index 67879aab623b..c024ee49962c 100644
> --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> @@ -14,6 +14,13 @@ maintainers:
>  allOf:
>    - $ref: can-controller.yaml#
>  
> +oneOf:
> +  - required:
> +      - interrupts
> +      - interrupt-names
> +  - required:
> +      - poll-interval

Move this next to 'required'.

> +
>  properties:
>    compatible:
>      const: bosch,m_can
> @@ -40,6 +47,14 @@ properties:
>        - const: int1
>      minItems: 1
>  
> +  poll-interval:
> +    $ref: /schemas/types.yaml#/definitions/flag

This is a common property already defined as a uint32. You shouldn't 
define a new type.

A flag doesn't even make sense. If that's all you need, then just enable 
polling if no interrupt is present.

> +    description: Enable hrtimer polling method for an M_CAN device.
> +      If this property is defined in MCAN node, it tells the driver to
> +      enable polling method for an MCAN device. If for an MCAN device,
> +      hardware interrupt is found and hrtimer polling method is enabled,

What's hrtimer? (Don't put Linuxisms in bindings)

> +      the driver will use hardware interrupt method.
> +
>    clocks:
>      items:
>        - description: peripheral clock
> @@ -122,8 +137,6 @@ required:
>    - compatible
>    - reg
>    - reg-names
> -  - interrupts
> -  - interrupt-names
>    - clocks
>    - clock-names
>    - bosch,mram-cfg
> @@ -132,6 +145,7 @@ additionalProperties: false
>  
>  examples:
>    - |
> +    // Example with interrupts
>      #include <dt-bindings/clock/imx6sx-clock.h>
>      can@20e8000 {
>        compatible = "bosch,m_can";
> @@ -149,4 +163,22 @@ examples:
>        };
>      };
>  
> +  - |
> +    // Example with timer polling
> +    #include <dt-bindings/clock/imx6sx-clock.h>
> +    can@20e8000 {
> +      compatible = "bosch,m_can";
> +      reg = <0x020e8000 0x4000>, <0x02298000 0x4000>;
> +      reg-names = "m_can", "message_ram";
> +      poll-interval;
> +      clocks = <&clks IMX6SX_CLK_CANFD>,
> +               <&clks IMX6SX_CLK_CANFD>;
> +      clock-names = "hclk", "cclk";
> +      bosch,mram-cfg = <0x0 0 0 32 0 0 0 1>;
> +
> +      can-transceiver {
> +        max-bitrate = <5000000>;
> +      };
> +    };
> +
>  ...
> -- 
> 2.17.1
>
Marc Kleine-Budde May 9, 2023, 12:27 p.m. UTC | #2
On 05.05.2023 16:29:48, Rob Herring wrote:
> On Mon, May 01, 2023 at 05:46:21PM -0500, Judith Mendez wrote:
> > On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
> > routed to A53 Linux, instead they will use software interrupt by
> > hrtimer. To enable timer method, interrupts should be optional so
> > remove interrupts property from required section and introduce
> > poll-interval property.
> > 
> > Signed-off-by: Judith Mendez <jm@ti.com>
> > ---
> > Changelog:
> > v3:
> >  1. Move binding patch to first in series
> >  2. Update description for poll-interval
> >  3. Add oneOf to specify using interrupts/interrupt-names or poll-interval
> >  4. Fix example property: add comment below 'example'
> > 
> > v2:
> >   1. Add poll-interval property to enable timer polling method
> >   2. Add example using poll-interval property
> >   
> >  .../bindings/net/can/bosch,m_can.yaml         | 36 +++++++++++++++++--
> >  1 file changed, 34 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> > index 67879aab623b..c024ee49962c 100644
> > --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> > +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> > @@ -14,6 +14,13 @@ maintainers:
> >  allOf:
> >    - $ref: can-controller.yaml#
> >  
> > +oneOf:
> > +  - required:
> > +      - interrupts
> > +      - interrupt-names
> > +  - required:
> > +      - poll-interval
> 
> Move this next to 'required'.
> 
> > +
> >  properties:
> >    compatible:
> >      const: bosch,m_can
> > @@ -40,6 +47,14 @@ properties:
> >        - const: int1
> >      minItems: 1
> >  
> > +  poll-interval:
> > +    $ref: /schemas/types.yaml#/definitions/flag
> 
> This is a common property already defined as a uint32. You shouldn't 
> define a new type.
> 
> A flag doesn't even make sense. If that's all you need, then just enable 
> polling if no interrupt is present.

Ok, then it's implicit. No IRQs -> polling.

Marc
Judith Mendez May 9, 2023, 5:02 p.m. UTC | #3
Hello all,

On 5/9/23 07:27, Marc Kleine-Budde wrote:
> On 05.05.2023 16:29:48, Rob Herring wrote:
>> On Mon, May 01, 2023 at 05:46:21PM -0500, Judith Mendez wrote:
>>> On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
>>> routed to A53 Linux, instead they will use software interrupt by
>>> hrtimer. To enable timer method, interrupts should be optional so
>>> remove interrupts property from required section and introduce
>>> poll-interval property.
>>>
>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>> ---
>>> Changelog:
>>> v3:
>>>  1. Move binding patch to first in series
>>>  2. Update description for poll-interval
>>>  3. Add oneOf to specify using interrupts/interrupt-names or poll-interval
>>>  4. Fix example property: add comment below 'example'
>>>
>>> v2:
>>>   1. Add poll-interval property to enable timer polling method
>>>   2. Add example using poll-interval property
>>>   
>>>  .../bindings/net/can/bosch,m_can.yaml         | 36 +++++++++++++++++--
>>>  1 file changed, 34 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
>>> index 67879aab623b..c024ee49962c 100644
>>> --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
>>> +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
>>> @@ -14,6 +14,13 @@ maintainers:
>>>  allOf:
>>>    - $ref: can-controller.yaml#
>>>  
>>> +oneOf:
>>> +  - required:
>>> +      - interrupts
>>> +      - interrupt-names
>>> +  - required:
>>> +      - poll-interval
>>
>> Move this next to 'required'.
>>
>>> +
>>>  properties:
>>>    compatible:
>>>      const: bosch,m_can
>>> @@ -40,6 +47,14 @@ properties:
>>>        - const: int1
>>>      minItems: 1
>>>  
>>> +  poll-interval:
>>> +    $ref: /schemas/types.yaml#/definitions/flag
>>
>> This is a common property already defined as a uint32. You shouldn't 
>> define a new type.
>>
>> A flag doesn't even make sense. If that's all you need, then just enable 
>> polling if no interrupt is present.
> 
> Ok, then it's implicit. No IRQs -> polling.

Ok, will send out a v5 with these updates. Thanks.

regards,
Judith
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
index 67879aab623b..c024ee49962c 100644
--- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
+++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
@@ -14,6 +14,13 @@  maintainers:
 allOf:
   - $ref: can-controller.yaml#
 
+oneOf:
+  - required:
+      - interrupts
+      - interrupt-names
+  - required:
+      - poll-interval
+
 properties:
   compatible:
     const: bosch,m_can
@@ -40,6 +47,14 @@  properties:
       - const: int1
     minItems: 1
 
+  poll-interval:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Enable hrtimer polling method for an M_CAN device.
+      If this property is defined in MCAN node, it tells the driver to
+      enable polling method for an MCAN device. If for an MCAN device,
+      hardware interrupt is found and hrtimer polling method is enabled,
+      the driver will use hardware interrupt method.
+
   clocks:
     items:
       - description: peripheral clock
@@ -122,8 +137,6 @@  required:
   - compatible
   - reg
   - reg-names
-  - interrupts
-  - interrupt-names
   - clocks
   - clock-names
   - bosch,mram-cfg
@@ -132,6 +145,7 @@  additionalProperties: false
 
 examples:
   - |
+    // Example with interrupts
     #include <dt-bindings/clock/imx6sx-clock.h>
     can@20e8000 {
       compatible = "bosch,m_can";
@@ -149,4 +163,22 @@  examples:
       };
     };
 
+  - |
+    // Example with timer polling
+    #include <dt-bindings/clock/imx6sx-clock.h>
+    can@20e8000 {
+      compatible = "bosch,m_can";
+      reg = <0x020e8000 0x4000>, <0x02298000 0x4000>;
+      reg-names = "m_can", "message_ram";
+      poll-interval;
+      clocks = <&clks IMX6SX_CLK_CANFD>,
+               <&clks IMX6SX_CLK_CANFD>;
+      clock-names = "hclk", "cclk";
+      bosch,mram-cfg = <0x0 0 0 32 0 0 0 1>;
+
+      can-transceiver {
+        max-bitrate = <5000000>;
+      };
+    };
+
 ...