OSDN Git Service

can: mcp251xfd: add HW timestamp infrastructure
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 2 Mar 2021 14:58:18 +0000 (15:58 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 30 Mar 2021 09:14:50 +0000 (11:14 +0200)
commitefd8d98dfb900f96370cc7722ccb7959e58557c7
tree6ef8f9f08f4c3042b2c29179ecea7c37f1c7149b
parentdc09e7e37152d1d18511cd590980d3982a3a0daa
can: mcp251xfd: add HW timestamp infrastructure

This patch add the HW timestamping infrastructure. The mcp251xfd has a
free running timer of 32 bit width, running at max 40MHz, which wraps
around every 107 seconds. The current timestamp is latched into RX and
TEF objects automatically be the CAN controller.

This patch sets up a cyclecounter, timecounter and delayed worker
infrastructure (which runs every 45 seconds) to convert the timer into
a proper 64 bit based ns timestamp.

Link: https://lore.kernel.org/r/20210304160328.2752293-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251xfd/Makefile
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c [new file with mode: 0644]
drivers/net/can/spi/mcp251xfd/mcp251xfd.h