Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH 1/1] Termination resistor documentation
@ 2022-10-06 19:27 Daniel S. Trevitz
  2022-10-07  7:41 ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel S. Trevitz @ 2022-10-06 19:27 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde, Daniel Trevitz, Ryan Edwards

Add documentation for how to use and setup the switchable termination
resistor support for the can-controllers.

Signed-off-by: Daniel Trevitz <dan@sstrev.com>
---
 Documentation/networking/can.rst | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/networking/can.rst b/Documentation/networking/can.rst
index ebc822e605f5..bb39cfa4c502 100644
--- a/Documentation/networking/can.rst
+++ b/Documentation/networking/can.rst
@@ -1148,6 +1148,36 @@ tuning on deep embedded systems'. The author is running a MPC603e
 load without any problems ...


+Switchable Termination Resistors
+--------------------------------
+
+CAN bus requires a specific impedance across the differential pair,
+typically provided by two 120Ohm resistors on the farthest nodes of
+the bus. Some CAN controllers support activating / deactivating a
+termination resistor(s) to provide the correct impedance.::
+
+  - Query the available resistances:
+      $ ip -details link show can0
+      ...
+      termination 120 [ 0, 120
+
+  - Activate the terminating resistor:
+      $ ip link set dev can0 type can termination 120
+
+  - Deactivate the terminating resistor:
+      $ ip link set dev can0 type can termination 0
+
+To enable termination resistor support to a can-controller, either
+implement in the controller's struct can-priv::
+
+    termination_const
+    termination_const_cnt
+    do_set_termination
+
+or add gpio control with the device tree entries from
+Documentation/devicetree/bindings/net/can/can-controller.yaml
+
+
 The Virtual CAN Driver (vcan)
 -----------------------------

--
2.35.1





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Termination resistor documentation
  2022-10-06 19:27 [PATCH 1/1] Termination resistor documentation Daniel S. Trevitz
@ 2022-10-07  7:41 ` Marc Kleine-Budde
  2022-10-07 10:37   ` Daniel S. Trevitz
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-10-07  7:41 UTC (permalink / raw)
  To: Daniel S. Trevitz; +Cc: linux-can, Daniel Trevitz, Ryan Edwards

[-- Attachment #1: Type: text/plain, Size: 2342 bytes --]

On 06.10.2022 15:27:50, Daniel S. Trevitz wrote:
> Add documentation for how to use and setup the switchable termination
> resistor support for the can-controllers.
> 
> Signed-off-by: Daniel Trevitz <dan@sstrev.com>
> ---
>  Documentation/networking/can.rst | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/Documentation/networking/can.rst b/Documentation/networking/can.rst
> index ebc822e605f5..bb39cfa4c502 100644
> --- a/Documentation/networking/can.rst
> +++ b/Documentation/networking/can.rst
> @@ -1148,6 +1148,36 @@ tuning on deep embedded systems'. The author is running a MPC603e
>  load without any problems ...
> 
> 
> +Switchable Termination Resistors
> +--------------------------------
> +
> +CAN bus requires a specific impedance across the differential pair,
> +typically provided by two 120Ohm resistors on the farthest nodes of
> +the bus. Some CAN controllers support activating / deactivating a
> +termination resistor(s) to provide the correct impedance.::
> +
> +  - Query the available resistances:

You need double :: followed by a newline to mark as code.

> +      $ ip -details link show can0
> +      ...
> +      termination 120 [ 0, 120

The closing ] is missing, please add it, even if the current ip command
doesn't print it. I just noticed it got lost in a cleanup patch in
iproute2.

> +
> +  - Activate the terminating resistor:

same here

> +      $ ip link set dev can0 type can termination 120
> +
> +  - Deactivate the terminating resistor:

same here

> +      $ ip link set dev can0 type can termination 0
> +
> +To enable termination resistor support to a can-controller, either
> +implement in the controller's struct can-priv::
> +
> +    termination_const
> +    termination_const_cnt
> +    do_set_termination
> +
> +or add gpio control with the device tree entries from
> +Documentation/devicetree/bindings/net/can/can-controller.yaml
> +
> +
>  The Virtual CAN Driver (vcan)
>  -----------------------------

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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Termination resistor documentation
  2022-10-07  7:41 ` Marc Kleine-Budde
@ 2022-10-07 10:37   ` Daniel S. Trevitz
  2022-10-07 11:14     ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel S. Trevitz @ 2022-10-07 10:37 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Daniel Trevitz, Ryan Edwards

On Friday, October 7, 2022 3:41:17 AM EDT Marc Kleine-Budde wrote:
> On 06.10.2022 15:27:50, Daniel S. Trevitz wrote:
> > Add documentation for how to use and setup the switchable termination
> > resistor support for the can-controllers.
> > 
> > Signed-off-by: Daniel Trevitz <dan@sstrev.com>
> > ---
> > 
> >  Documentation/networking/can.rst | 30 ++++++++++++++++++++++++++++++
> >  1 file changed, 30 insertions(+)
> > 
> > diff --git a/Documentation/networking/can.rst
> > b/Documentation/networking/can.rst index ebc822e605f5..bb39cfa4c502
> > 100644
> > --- a/Documentation/networking/can.rst
> > +++ b/Documentation/networking/can.rst
> > @@ -1148,6 +1148,36 @@ tuning on deep embedded systems'. The author is
> > running a MPC603e> 
> >  load without any problems ...
> > 
> > +Switchable Termination Resistors
> > +--------------------------------
> > +
> > +CAN bus requires a specific impedance across the differential pair,
> > +typically provided by two 120Ohm resistors on the farthest nodes of
> > +the bus. Some CAN controllers support activating / deactivating a
> > +termination resistor(s) to provide the correct impedance.::
> > +
> 
> > +  - Query the available resistances:
> You need double :: followed by a newline to mark as code.
This whole section is a code block; :: is up three lines.
> 
> > +      $ ip -details link show can0
> > +      ...
> > +      termination 120 [ 0, 120
> 
> The closing ] is missing, please add it, even if the current ip command
> doesn't print it. I just noticed it got lost in a cleanup patch in
> iproute2.
Okay
> 
> > +
> 
> > +  - Activate the terminating resistor:
> same here
> 
> > +      $ ip link set dev can0 type can termination 120
> > +
> 
> > +  - Deactivate the terminating resistor:
> same here
> 
> > +      $ ip link set dev can0 type can termination 0
> > +
> > +To enable termination resistor support to a can-controller, either
> > +implement in the controller's struct can-priv::
> > +
> > +    termination_const
> > +    termination_const_cnt
> > +    do_set_termination
> > +
> > +or add gpio control with the device tree entries from
> > +Documentation/devicetree/bindings/net/can/can-controller.yaml
> > +
> > +
> > 
> >  The Virtual CAN Driver (vcan)
> >  -----------------------------
> 
> Marc

-Dan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Termination resistor documentation
  2022-10-07 10:37   ` Daniel S. Trevitz
@ 2022-10-07 11:14     ` Marc Kleine-Budde
  2022-10-07 11:50       ` Daniel S. Trevitz
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-10-07 11:14 UTC (permalink / raw)
  To: Daniel S. Trevitz; +Cc: linux-can, Daniel Trevitz, Ryan Edwards

[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]

On 07.10.2022 06:37:24, Daniel S. Trevitz wrote:
> On Friday, October 7, 2022 3:41:17 AM EDT Marc Kleine-Budde wrote:
> > On 06.10.2022 15:27:50, Daniel S. Trevitz wrote:
> > > Add documentation for how to use and setup the switchable termination
> > > resistor support for the can-controllers.
> > > 
> > > Signed-off-by: Daniel Trevitz <dan@sstrev.com>
> > > ---
> > > 
> > >  Documentation/networking/can.rst | 30 ++++++++++++++++++++++++++++++
> > >  1 file changed, 30 insertions(+)
> > > 
> > > diff --git a/Documentation/networking/can.rst
> > > b/Documentation/networking/can.rst index ebc822e605f5..bb39cfa4c502
> > > 100644
> > > --- a/Documentation/networking/can.rst
> > > +++ b/Documentation/networking/can.rst
> > > @@ -1148,6 +1148,36 @@ tuning on deep embedded systems'. The author is
> > > running a MPC603e> 
> > >  load without any problems ...
> > > 
> > > +Switchable Termination Resistors
> > > +--------------------------------
> > > +
> > > +CAN bus requires a specific impedance across the differential pair,
> > > +typically provided by two 120Ohm resistors on the farthest nodes of
> > > +the bus. Some CAN controllers support activating / deactivating a
> > > +termination resistor(s) to provide the correct impedance.::
> > > +
> > 
> > > +  - Query the available resistances:
> > You need double :: followed by a newline to mark as code.
> This whole section is a code block; :: is up three lines.

Yes, your're right. What about making only the individual commands code?

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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Termination resistor documentation
  2022-10-07 11:14     ` Marc Kleine-Budde
@ 2022-10-07 11:50       ` Daniel S. Trevitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel S. Trevitz @ 2022-10-07 11:50 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Daniel Trevitz, Ryan Edwards

On Friday, October 7, 2022 7:14:48 AM EDT Marc Kleine-Budde wrote:
> On 07.10.2022 06:37:24, Daniel S. Trevitz wrote:
> > On Friday, October 7, 2022 3:41:17 AM EDT Marc Kleine-Budde wrote:
> > > On 06.10.2022 15:27:50, Daniel S. Trevitz wrote:
> > > > Add documentation for how to use and setup the switchable termination
> > > > resistor support for the can-controllers.
> > > > 
> > > > Signed-off-by: Daniel Trevitz <dan@sstrev.com>
> > > > ---
> > > > 
> > > >  Documentation/networking/can.rst | 30 ++++++++++++++++++++++++++++++
> > > >  1 file changed, 30 insertions(+)
> > > > 
> > > > diff --git a/Documentation/networking/can.rst
> > > > b/Documentation/networking/can.rst index ebc822e605f5..bb39cfa4c502
> > > > 100644
> > > > --- a/Documentation/networking/can.rst
> > > > +++ b/Documentation/networking/can.rst
> > > > @@ -1148,6 +1148,36 @@ tuning on deep embedded systems'. The author is
> > > > running a MPC603e>
> > > > 
> > > >  load without any problems ...
> > > > 
> > > > +Switchable Termination Resistors
> > > > +--------------------------------
> > > > +
> > > > +CAN bus requires a specific impedance across the differential pair,
> > > > +typically provided by two 120Ohm resistors on the farthest nodes of
> > > > +the bus. Some CAN controllers support activating / deactivating a
> > > > +termination resistor(s) to provide the correct impedance.::
> > > > +
> > > 
> > > > +  - Query the available resistances:
> > > You need double :: followed by a newline to mark as code.
> > 
> > This whole section is a code block; :: is up three lines.
> 
> Yes, your're right. What about making only the individual commands code?
> 
> Marc
Tested, looks fine as individual blocks; v3 coming in hot.
-Daniel




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-07 11:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06 19:27 [PATCH 1/1] Termination resistor documentation Daniel S. Trevitz
2022-10-07  7:41 ` Marc Kleine-Budde
2022-10-07 10:37   ` Daniel S. Trevitz
2022-10-07 11:14     ` Marc Kleine-Budde
2022-10-07 11:50       ` Daniel S. Trevitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox