]> git.baikalelectronics.ru Git - kernel.git/commit
can: tcan4x5x: rework SPI access
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 15 Dec 2020 23:17:45 +0000 (00:17 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 6 Jan 2021 14:15:41 +0000 (15:15 +0100)
commit7ac63bd1942e1ec3813496370c63958116e58dc3
tree77815ea8f69f6a3da38e335f7a405ffa58815f8d
parent04f9c53a8dc4bf42af0776978200b8078394eee0
can: tcan4x5x: rework SPI access

This patch reworks the SPI access and fixes several probems:
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
  Do not place variable "addr" on stack and use it as buffer for SPI
  transfer. Buffers for SPI transfers must be allocated from DMA save
  memory.
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
  Halfe number of SPI transfers by using a single buffer + memcpy().
  This improves the performance, especially on SPI controllers, which
  use interrupt based transfers.
- Use "8" bits per word, not "32". This makes it possible to use this
  driver on SoCs like the Raspberry Pi, which SPI host controller
  drivers only support 8 bits per word.

Note: this breaks half duplex only controllers. Support for them will be
re-added in the next patch.

Reviewed-by: Dan Murphy <dmurphy@ti.com>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20201215231746.1132907-16-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/tcan4x5x-core.c
drivers/net/can/m_can/tcan4x5x-regmap.c
drivers/net/can/m_can/tcan4x5x.h