This patch enables word transfer for s3c64xx spi driver. User can set bits_per_word to 32 before calling spi_setup, which would enable the word transfer mode. Signed-off-by: Rajeshwari S Shinde <rajeshwari.s@xxxxxxxxxxx> --- drivers/spi/spi-s3c64xx.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 512b889..893361b 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -498,6 +498,17 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd, chcfg = readl(regs + S3C64XX_SPI_CH_CFG); chcfg &= ~S3C64XX_SPI_CH_TXCH_ON; + if(sdd->cur_bpw == 32) { + /* For word transfer we need to swap bytes */ + u32 swapcfg = (S3C64XX_SPI_SWAP_TX_EN | S3C64XX_SPI_SWAP_TX_BYTE | + S3C64XX_SPI_SWAP_TX_HALF_WORD | + S3C64XX_SPI_SWAP_RX_EN | + S3C64XX_SPI_SWAP_RX_BYTE | + S3C64XX_SPI_SWAP_RX_HALF_WORD); + writel(swapcfg, regs + S3C64XX_SPI_SWAP_CFG); + } else + writel(0, regs + S3C64XX_SPI_SWAP_CFG); + if (dma_mode) { chcfg &= ~S3C64XX_SPI_CH_RXCH_ON; } else { @@ -905,19 +916,16 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master, bpw = xfer->bits_per_word; speed = xfer->speed_hz ? : spi->max_speed_hz; - if (xfer->len % (bpw / 8)) { - dev_err(&spi->dev, - "Xfer length(%u) not a multiple of word size(%u)\n", - xfer->len, bpw / 8); - status = -EIO; - goto out; + if (speed != sdd->cur_speed) { + sdd->cur_speed = speed; } - if (bpw != sdd->cur_bpw || speed != sdd->cur_speed) { + if (xfer->len % (bpw / 8)) + sdd->cur_bpw = 8; + else sdd->cur_bpw = bpw; - sdd->cur_speed = speed; - s3c64xx_spi_config(sdd); - } + + s3c64xx_spi_config(sdd); /* Polling method for xfers not bigger than FIFO capacity */ use_dma = 0; -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html