linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] can: ctucanfd: RX timestamping implementation
@ 2022-05-12 23:27 Matej Vasilevski
  2022-05-12 23:27 ` [RFC PATCH 1/3] can: ctucanfd: add HW timestamps to RX and error CAN frames Matej Vasilevski
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Matej Vasilevski @ 2022-05-12 23:27 UTC (permalink / raw)
  To: linux-can, mkl, pisa
  Cc: devicetree, netdev, ondrej.ille, martin.jerabek01, matej.vasilevski

Hello,

I would like to upstream my timestamping patch for CTU CAN FD IP core,
but I guess it won't be that easy, so this is only an RFC.

I'm using the timecounter/cyclecounter structures as has been recommended
(basically copied from the mcp251xfd). But the hard part here is passing
information to the driver, because the timestaping counter width and
frequency isn't defined in the IP core specs.

So currently I take both the counter width and frequency from Device Tree.
The frequency can be specified in the form of second clock in "clocks"
property (which seems good to me, because then the timestamping clock
would be initialized and managed automatically, in case the clock isn't
the same as the main clock). Or directly in "ts-frequency" property.
Counter bit width is specified in the "ts-bit-width" property.
This means that PCI devices currently can't report timestamps (because
Device Tree isn't used for PCI devices).
Alternatively, I could use module parameters, but those are frowned
upon. Module_param also uses static variables, which means one parameter
would be shared across multiple ctucanfd devices, which isn't great
either.

This patch also introduces another Kconfig option:
CAN_CTUCANFD_PLATFORM_ENABLE_HW_TIMESTAMPS to control whether timestamps
are enabled by default. I've done this for cases when somebody would
like to disable timestamping (be it for performance reasons or
whatever). Seems to me better than having to run some script after
startup which would disable timestamping. I don't know which tool does
can do this (ethtool/ip-link?), but I guess it would require the
.ndo_eth_ioctl callback in the driver.

Looking forward to some comments/feedback.

Thank you, yours sincerely,
Matej Vasilevski




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

end of thread, other threads:[~2022-05-16 19:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 23:27 [RFC] can: ctucanfd: RX timestamping implementation Matej Vasilevski
2022-05-12 23:27 ` [RFC PATCH 1/3] can: ctucanfd: add HW timestamps to RX and error CAN frames Matej Vasilevski
2022-05-13 11:41   ` Marc Kleine-Budde
2022-05-13 19:02     ` Pavel Pisa
2022-05-14 19:36       ` Marc Kleine-Budde
2022-05-14  9:18     ` Matej Vasilevski
2022-05-14 20:13       ` Marc Kleine-Budde
2022-05-14 20:31       ` Marc Kleine-Budde
2022-05-12 23:27 ` [RFC PATCH 2/3] dt-bindings: can: ctucanfd: add properties for HW timestamping Matej Vasilevski
2022-05-16 16:02   ` Rob Herring
2022-05-16 16:34     ` Marc Kleine-Budde
2022-05-16 19:21       ` Pavel Pisa
2022-05-12 23:27 ` [RFC PATCH 3/3] doc: ctucanfd: RX frames timestamping for platform devices Matej Vasilevski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).