can: m_can: Add hrtimer to generate software interrupt
authorJudith Mendez <jm@ti.com>
Fri, 7 Jul 2023 20:47:14 +0000 (15:47 -0500)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 17 Jul 2023 14:02:24 +0000 (16:02 +0200)
commitb382380c0d2da427aaffca931e4a3b831048cace
tree4fb811bd212d47e893694f5d0d6a4b48f13cd6c3
parentbb410c03b999a361ab4e11e103d88707b4155bf9
can: m_can: Add hrtimer to generate software interrupt

Introduce timer polling method to MCAN since some SoCs may not
have M_CAN interrupt routed to A53 Linux and do not have
interrupt property in device tree M_CAN node.

On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
routed to A53 Linux, instead they will use timer polling method.

Add an hrtimer to MCAN class device. Each MCAN will have its own
hrtimer instantiated if there is no hardware interrupt found in
device tree M_CAN node. The timer will generate a software
interrupt every 1 ms. In hrtimer callback, we check if there is
a transaction pending by reading a register, then process by
calling the isr if there is.

Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Toradex Verdin AM62
Reviewed-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Judith Mendez <jm@ti.com>
Link: https://lore.kernel.org/all/20230707204714.62964-3-jm@ti.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can.c
drivers/net/can/m_can/m_can.h
drivers/net/can/m_can/m_can_platform.c