From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
linux-can@vger.kernel.org, Robert Nawrath <mbro1689@gmail.com>
Subject: Re: [RFC PATCH 12/14] can: netlink: add CAN XL support
Date: Tue, 10 Dec 2024 12:58:59 +0100 [thread overview]
Message-ID: <20241210-alluring-cunning-swift-4bcd47-mkl@pengutronix.de> (raw)
In-Reply-To: <572d0fa8-e9df-4047-951f-2747571086db@hartkopp.net>
[-- Attachment #1: Type: text/plain, Size: 4237 bytes --]
On 09.12.2024 14:13:29, Oliver Hartkopp wrote:
>
>
> On 05.12.24 10:15, Marc Kleine-Budde wrote:
> > On 05.12.2024 09:16:44, Oliver Hartkopp wrote:
> > > On 04.12.24 12:44, Marc Kleine-Budde wrote:
> > > > On 04.12.2024 12:35:43, Oliver Hartkopp wrote:
> > > > > > > > Also, the main reason for not creating the nest was that I thought
> > > > > > > > that the current bittiming API was stable. I was not aware of the
> > > > > > > > current flaw on how to divide tseg1_min. Maybe we should first discuss
> > > > > > > > how to solve this issue for CAN FD?
> > > > > > >
> > > > > > > I like the current way how you added the CAN XL support.
> > > > > > > It maintains the known usage pattern - and the way how CAN XL bit timings
> > > > > > > are defined is identical to CAN FD (including TDC).
> > > > > > >
> > > > > > > Is the separation of propseg and tseg1 that relevant?
> > > > > > > Does it really need to be exposed to the user?
> > > > > >
> > > > > > There are IIRC at least 2 CAN-FD cores where the prop segment and phase
> > > > > > segment 1 for the data bit timing have not the same width. This means we
> > > > > > have to change the bittiming_const in the kernel.
> > >
> > > Sure?
> >
> > I'm sure the registers don't have the same width. And I'm sure about my
> > conclusion, but that's up for discussion :)
> >
> > https://elixir.bootlin.com/linux/v6.12.1/source/drivers/net/can/ctucanfd/ctucanfd_base.c#L197
> > https://elixir.bootlin.com/linux/v6.12.1/source/drivers/net/can/flexcan/flexcan-core.c#L1210
> >
> > > In the end (almost) every CAN controller has the tseg1 register which
> > > contains prop_seg + phase_seg1 as a sum of these.
> >
> > Some do (just a short grep): bxcan, esdacc, rcar_can, softing, hi311x,
> > ti_hecc. More controllers haven evenly divided prop_seg + phase_seg1.
> >
> > > The relevant point is behind prop_seg + phase_seg1 and I'm pretty sure these
> > > "2 CAN-FD cores" will add the values internally too.
> >
> > As the ctucanfd is open you can have a look :)
As far as I understand, it internally adds sync + prop + phase1:
https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core/-/blob/master/src/prescaler/bit_time_cfg_capture.vhd?ref_type=heads#L242
> > > I'm a bit concerned that after 40 years someone shows up with the idea to
> > > spend two registers for the tseg1 value instead of one.
> >
> > It doesn't matter if prop_seg and phase_seg1 are in the same register or
> > not, what matters is:
> > a) 1. does the IP core want separate prop_seg and phase_seg1 values
> > - or -
> > 2. does the IP core want a single "prop_seg + phase_seg1", a.k.a.
> > tseg1 value?
> > b) 1. what's the width of the prop_seg and phase_seg1?
> > 2. what's the width of tseg1?
> >
> > Currently the CAN infrastructure allows the driver to specify tseg1 only
> > and assumes the width of prop_seg and phase_seg1 to be the same, as it
> > distributes tseg1 evenly between prop_seg and phase_seg1:
> >
> > https://elixir.bootlin.com/linux/v6.12.1/source/drivers/net/can/dev/calc_bittiming.c#L155
> >
> > This leads to the workarounds in the CAN drivers, see above for links.
>
> Yes. But why don't we just let this as-is then?
>
> Even if prop_seg phase_seg1 registers have a different size, this split up
> can be done easily without changing the current bittiming API.
>
> Maybe a common helper function to split up the values based on given
> register sizes could simplify the handling for those CAN drivers.
Good idea!
What about adding the information about prop_seg and phase_seg1 to
bittiming_const and let the can_calc_bittiming() calculate it?
> I'm still not convinced that it brings some benefits for the user to extend
> the bittiming API. IMHO it just complicates the bitrate settings.
The benefit is, that the user knows about the limitation of prop_seg and
phase_seg1.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-12-10 11:59 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-10 15:55 [RFC PATCH 00/14] can: netlink: add CAN XL Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 01/14] can: dev: add struct data_bittiming_params to group FD parameters Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 02/14] can: netlink: replace tabulation by space in assignement Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 03/14] can: bittiming: rename CAN_CTRLMODE_TDC_MASK into CAN_CTRLMODE_FD_TDC_MASK Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 04/14] can: bittiming: rename can_tdc_is_enabled() into can_fd_tdc_is_enabled() Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 05/14] can: netlink: can_changelink(): rename tdc_mask into fd_tdc_flag_provided Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 06/14] can: netlink: make can_tdc_changelink() FD agnostic Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 07/14] can: netlink: add can_dtb_changelink() Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 08/14] can: netlink: add can_validate_tdc() Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 09/14] can: netlink: make can_tdc_get_size() FD agnostic Vincent Mailhol
2024-11-10 15:55 ` [RFC PATCH 10/14] can: netlink: make can_tdc_fill_info() " Vincent Mailhol
2024-11-10 15:56 ` [RFC PATCH 11/14] can: netlink: document which symbols are FD specific Vincent Mailhol
2024-11-10 15:56 ` [RFC PATCH 12/14] can: netlink: add CAN XL support Vincent Mailhol
2024-11-12 8:09 ` Marc Kleine-Budde
2024-11-12 8:31 ` Vincent Mailhol
2024-11-12 8:41 ` Marc Kleine-Budde
2024-12-04 10:56 ` Oliver Hartkopp
2024-12-04 11:15 ` Marc Kleine-Budde
2024-12-04 11:35 ` Oliver Hartkopp
2024-12-04 11:44 ` Marc Kleine-Budde
2024-12-05 8:16 ` Oliver Hartkopp
2024-12-05 9:15 ` Marc Kleine-Budde
2024-12-09 13:13 ` Oliver Hartkopp
2024-12-10 11:58 ` Marc Kleine-Budde [this message]
2024-12-15 8:05 ` Vincent Mailhol
2024-11-10 15:56 ` [RFC PATCH 13/14] can: netlink: add userland error messages Vincent Mailhol
2024-11-10 15:56 ` [RFC PATCH 14/14] !!! DO NOT MERGE !!! can: add dummyxl driver Vincent Mailhol
2024-11-11 14:08 ` [RFC PATCH 00/14] can: netlink: add CAN XL Oliver Hartkopp
2024-11-11 15:17 ` Vincent Mailhol
2024-11-11 15:32 ` Oliver Hartkopp
2024-11-21 20:10 ` Oliver Hartkopp
2024-12-01 11:32 ` Oliver Hartkopp
2024-12-03 9:45 ` Vincent Mailhol
2024-12-04 7:56 ` Oliver Hartkopp
2024-12-15 9:21 ` Vincent Mailhol
2024-12-17 9:53 ` Oliver Hartkopp
2024-12-17 18:17 ` Vincent Mailhol
2024-12-17 20:03 ` Oliver Hartkopp
2024-12-18 9:13 ` Oliver Hartkopp
2025-01-30 5:42 ` Vincent Mailhol
2025-01-30 7:34 ` Marc Kleine-Budde
2024-11-12 8:53 ` Marc Kleine-Budde
2024-11-12 9:24 ` Vincent Mailhol
2024-11-12 10:12 ` 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=20241210-alluring-cunning-swift-4bcd47-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mbro1689@gmail.com \
--cc=socketcan@hartkopp.net \
/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