All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matej Vasilevski <matej.vasilevski@seznam.cz>
To: linux-can@vger.kernel.org, mkl@pengutronix.de, pisa@cmp.felk.cvut.cz
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
	ondrej.ille@gmail.com, martin.jerabek01@gmail.com,
	matej.vasilevski@seznam.cz
Subject: [RFC] can: ctucanfd: RX timestamping implementation
Date: Fri, 13 May 2022 01:27:04 +0200	[thread overview]
Message-ID: <20220512232706.24575-1-matej.vasilevski@seznam.cz> (raw)

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




             reply	other threads:[~2022-05-12 23:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 23:27 Matej Vasilevski [this message]
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  6:45   ` kernel test robot
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

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=20220512232706.24575-1-matej.vasilevski@seznam.cz \
    --to=matej.vasilevski@seznam.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=martin.jerabek01@gmail.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=ondrej.ille@gmail.com \
    --cc=pisa@cmp.felk.cvut.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.