• jiada wang's avatar
    spi: imx: Add support for SPI Slave mode · 71abd290
    jiada wang authored
    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: default avatarJiada Wang <jiada_wang@mentor.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    71abd290
spi-imx.c 43.1 KB