From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Max Staudt <max@enpas.org>,
linux-kernel@vger.kernel.org, linux-can@vger.kernel.org,
Oliver Hartkopp <socketcan@hartkopp.net>,
michael@amarulasolutions.com,
Amarula patchwork <linux-amarula@amarulasolutions.com>,
Jeroen Hofstee <jhofstee@victronenergy.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wolfgang Grandegger <wg@grandegger.com>,
netdev@vger.kernel.org
Subject: Re: [RFC PATCH v3 8/9] can: slcan: add support to set bit time register (btr)
Date: Fri, 29 Jul 2022 09:33:52 +0200 [thread overview]
Message-ID: <20220729073352.rfxdyjvttjp7rnfk@pengutronix.de> (raw)
In-Reply-To: <CABGWkvo0B8XM+5qLhz3zY2DzyUrEQtQyJnd91VweUWDUcjyr5A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3401 bytes --]
On 29.07.2022 08:52:07, Dario Binacchi wrote:
> Hello Marc and Max,
>
> On Thu, Jul 28, 2022 at 12:57 PM Max Staudt <max@enpas.org> wrote:
> >
> > On Thu, 28 Jul 2022 12:50:49 +0200
> > Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> >
> > > On 28.07.2022 12:23:04, Dario Binacchi wrote:
> > > > > > Does it make sense to use the device tree
> > > > >
> > > > > The driver doesn't support DT and DT only works for static serial
> > > > > interfaces.
> > >
> > > Have you seen my remarks about Device Tree?
> >
> > Dario, there seems to be a misunderstanding about the Device Tree.
> >
> > It is used *only* for hardware that is permanently attached, present at
> > boot, and forever after. Not for dyamically added stuff, and definitely
> > not for ldiscs that have to be attached manually by the user.
> >
> >
> > The only exception to this is if you have an embedded device with an
> > slcan adapter permanently attached to one of its UARTs. Then you can
> > use the serdev ldisc adapter to attach the ldisc automatically at boot.
>
> It is evident that I am lacking some skills (I will try to fix it :)).
We're all here to learn something!
> I think it is equally clear that it is not worth going down this path.
If you have a static attached serial devices serdev is the way to go.
But slcan has so many drawbacks compared to "real" CAN adapters that I
hope the no one uses them in such a scenario.
> > If you are actively developing for such a use case, please let us know,
> > so we know what you're after and can help you better :)
>
> I don't have a use case, other than to try, if possible, to make the driver
> autonomous from slcand / slcan_attach for the CAN bus setup.
From my point of view your job is done!
> Returning to Marc's previous analysis:
> "... Some USB CAN drivers query the bit timing const from the USB device."
>
> Can we think of taking the gs_usb driver as inspiration for getting/setting the
> bit timings?
>
> https://elixir.bootlin.com/linux/latest/source/drivers/net/can/usb/gs_usb.c#L951
> https://elixir.bootlin.com/linux/latest/source/drivers/net/can/usb/gs_usb.c#L510
>
> and, as done with patches:
>
> can: slcan: extend the protocol with CAN state info
> can: slcan: extend the protocol with error info
You can define a way to query bit timing constants and CAN clock rate,
but you have to get this into the "official" firmware. You have to roll
out a firmware update to all devices. What about non official firmware?
> further extend the protocol to get/set the bit timing from / to the adapter ?
> In the case of non-standard bit rates, the driver would try, depending on the
> firmware of the adapter, to calculate and set the bit timings autonomously.
If an adapter follows 100% the official firmware doc the BTR registers
are interpreted as SJA1000 with 8 MHz CAN clock.
See
| https://lore.kernel.org/all/20220728105049.43gbjuctezxzmm4j@pengutronix.de
where I compare the 125 Kbit/s BTR config of the documentation with the
bit timing calculated by the kernel algorithm.
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 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-07-29 7:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 21:02 [RFC PATCH v3 0/9] can: slcan: extend supported features (step 2) Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 1/9] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 2/9] can: slcan: remove useless header inclusions Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 3/9] can: slcan: remove legacy infrastructure Dario Binacchi
2022-07-27 17:09 ` Max Staudt
2022-07-26 21:02 ` [RFC PATCH v3 4/9] can: slcan: change every `slc' occurrence in `slcan' Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 5/9] can: slcan: use the generic can_change_mtu() Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 6/9] can: slcan: add support for listen-only mode Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 7/9] ethtool: add support to get/set CAN bit time register Dario Binacchi
2022-07-26 21:02 ` [RFC PATCH v3 8/9] can: slcan: add support to set bit time register (btr) Dario Binacchi
2022-07-27 11:30 ` Marc Kleine-Budde
2022-07-27 15:55 ` Dario Binacchi
2022-07-27 17:21 ` Marc Kleine-Budde
2022-07-27 17:28 ` Dario Binacchi
2022-07-27 17:33 ` Max Staudt
2022-07-27 18:23 ` Dario Binacchi
2022-07-27 17:28 ` Max Staudt
2022-07-27 18:24 ` Marc Kleine-Budde
2022-07-27 20:12 ` Oliver Hartkopp
2022-07-28 6:56 ` Marc Kleine-Budde
2022-07-28 7:36 ` Dario Binacchi
2022-07-28 9:02 ` Marc Kleine-Budde
2022-07-28 10:23 ` Dario Binacchi
2022-07-28 10:50 ` Marc Kleine-Budde
2022-07-28 10:57 ` Max Staudt
2022-07-29 6:52 ` Dario Binacchi
2022-07-29 7:33 ` Marc Kleine-Budde [this message]
2022-07-31 15:54 ` Dario Binacchi
2022-07-31 18:58 ` Marc Kleine-Budde
2022-07-26 21:02 ` [RFC PATCH v3 9/9] MAINTAINERS: Add maintainer for the slcan driver Dario Binacchi
2022-07-27 18:31 ` [RFC PATCH v3 0/9] can: slcan: extend supported features (step 2) Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220729073352.rfxdyjvttjp7rnfk@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=dario.binacchi@amarulasolutions.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhofstee@victronenergy.com \
--cc=kuba@kernel.org \
--cc=linux-amarula@amarulasolutions.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=max@enpas.org \
--cc=michael@amarulasolutions.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox