spi: sc18is602: implement .max_{transfer,message}_size() for the controller
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 20 May 2021 13:12:38 +0000 (16:12 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 21 May 2021 12:13:33 +0000 (13:13 +0100)
commitb4e46c9954ad55092502e1e8c44ceb9b6744bade
tree0c0482213ecb626f3d53fd2d963ecf5b094b452f
parentbda7db1d952c3ff7c24c11bc295aa72aaeb98451
spi: sc18is602: implement .max_{transfer,message}_size() for the controller

Allow SPI peripherals attached to this controller to know what is the
maximum transfer size and message size, so they can limit their transfer
lengths properly in case they are otherwise capable of larger transfer
sizes. For the sc18is602, this is 200 bytes in both cases, since as far
as I understand, it isn't possible to tell the controller to keep the
chip select asserted after the STOP command is sent.

The controller can support SPI messages larger than 200 bytes if
cs_change is set for individual transfers such that the portions with
chip select asserted are never longer than 200 bytes. What is not
supported is just SPI messages with a continuous chip select larger than
200. I don't think it is possible to express this using the current API,
so drivers which do send SPI messages with cs_change can safely just
look at the max_transfer_size limit.

An example of user for this is sja1105_xfer() in
drivers/net/dsa/sja1105/sja1105_spi.c which sends by default 64 * 4 =
256 byte transfers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20210520131238.2903024-3-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sc18is602.c