can: mcp251xfd: ring: prepare to change order of TX and RX FIFOs
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 3 Aug 2021 14:32:01 +0000 (16:32 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 24 Feb 2022 07:46:59 +0000 (08:46 +0100)
commit617283b9c4dbc1384b063f59c840e1d1ab612108
tree87c033d1d674a7e55fd174647611a11028495494
parentd2d5397fcae17d75f84ba6fab2a52795445a2388
can: mcp251xfd: ring: prepare to change order of TX and RX FIFOs

This patch improves the initialization of the TX and RX rings. The
initialization functions are now called with pointers to the next free
address (in the on chip RAM) and next free hardware FIFO. The rings
are initialized using these values and the pointers are modified to
point to the next free elements.

This means the order of the mcp251xfd_ring_init_*() functions
specifies the order of the rings in the hardware FIFO. This makes it
possible to change the order of the TX and RX FIFOs, which is done in
the next patch.

This gives the opportunity to minimize the number of SPI transfers in
the IRQ handler. The read of the IRQ status register and RX FIFO
status registers can be combined into single SPI transfer. If the RX
ring uses FIFO 1, the overall length of the transfer is smaller than
in the original layout, where the RX FIFO comes after the TX FIFO.

Link: https://lore.kernel.org/all/20220217103826.2299157-4-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
drivers/net/can/spi/mcp251xfd/mcp251xfd.h