OSDN Git Service

spi: imx: Add support for SPI Slave mode
authorjiada wang <jiada_wang@mentor.com>
Tue, 5 Sep 2017 05:12:32 +0000 (14:12 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 19 Sep 2017 15:01:43 +0000 (16:01 +0100)
commit71abd29057cb17b6b9532421821dc443427399ed
treea95746fc7dc1c10a78b48746095f4aa90ee05b66
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
spi: imx: Add support for SPI Slave mode

Previously i.MX SPI controller only works in Master mode.
This patch adds support to i.MX51, i.MX53 and i.MX6 ECSPI
controller to work also in Slave mode.

Currently SPI Slave mode support patch has the following limitations:
1. The stale data in RXFIFO will be dropped when the Slave does any new
   transfer.
2. One transfer can be finished only after all transfer->len data been
   transferred to master device
3. Slave device only accepts transfer->len data. Any data longer than this
   from master device will be dropped. Any data shorter than this from
   master will cause SPI to stuck due to mentioned HW limitation 2.
4. Only PIO transfer is supported in Slave mode.
5. Dynamic burst size adjust isn't supported in Slave mode.

Following HW limitation applies:
1.  ECSPI has a HW issue when works in Slave mode, after 64
    words written to TXFIFO, even TXFIFO becomes empty,
    ECSPI_TXDATA keeps shift out the last word data,
    so we have to disable ECSPI when in slave mode after the
    transfer completes
2.  Due to Freescale errata ERR003775 "eCSPI: Burst completion by Chip
    Select (SS) signal in Slave mode is not functional" burst size must
    be set exactly to the size of the transfer. This limit SPI transaction
    with maximum 2^12 bits. This errata affects i.MX53 and i.MX6 ECSPI
    controllers.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c