summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-dw.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-03-09 14:48:45 (GMT)
committerMark Brown <broonie@kernel.org>2015-03-09 18:11:13 (GMT)
commite31abce778bc05b94d406e8cbebd9953d12e84b8 (patch)
treea91c08786ebba08a6f443a2e731f09311a8aa8c1 /drivers/spi/spi-dw.c
parent0365fbd4bbc0b8f3fd3c78c16a8020ea83b3afcf (diff)
downloadlinux-e31abce778bc05b94d406e8cbebd9953d12e84b8.tar.xz
spi: dw-mid: convert value of dma_width to enum dma_slave_buswidth
DMAEngine has a specific type to be used for bus width. This patch converts the code to use the values of the specific type when configure DMA transfer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-dw.c')
-rw-r--r--drivers/spi/spi-dw.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 950bc50..f3e4092 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -315,7 +315,6 @@ static int dw_spi_transfer_one(struct spi_master *master,
{
struct dw_spi *dws = spi_master_get_devdata(master);
struct chip_data *chip = spi_get_ctldata(spi);
- u8 bits = 0;
u8 imask = 0;
u8 cs_change = 0;
u16 txlevel = 0;
@@ -357,9 +356,14 @@ static int dw_spi_transfer_one(struct spi_master *master,
}
}
if (transfer->bits_per_word) {
- bits = transfer->bits_per_word;
- dws->n_bytes = dws->dma_width = bits >> 3;
- cr0 = (bits - 1)
+ if (transfer->bits_per_word == 8) {
+ dws->n_bytes = 1;
+ dws->dma_width = 1;
+ } else if (transfer->bits_per_word == 16) {
+ dws->n_bytes = 2;
+ dws->dma_width = 2;
+ }
+ cr0 = (transfer->bits_per_word - 1)
| (chip->type << SPI_FRF_OFFSET)
| (spi->mode << SPI_MODE_OFFSET)
| (chip->tmode << SPI_TMOD_OFFSET);