diff options
Diffstat (limited to 'drivers/spi/davinci_spi.c')
-rw-r--r-- | drivers/spi/davinci_spi.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 31b9c2278dec..3dac2038b5a6 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c | |||
@@ -118,10 +118,6 @@ | |||
118 | #define SPIDEF 0x4c | 118 | #define SPIDEF 0x4c |
119 | #define SPIFMT0 0x50 | 119 | #define SPIFMT0 0x50 |
120 | 120 | ||
121 | struct davinci_spi_slave { | ||
122 | u32 bytes_per_word; | ||
123 | }; | ||
124 | |||
125 | /* We have 2 DMA channels per CS, one for RX and one for TX */ | 121 | /* We have 2 DMA channels per CS, one for RX and one for TX */ |
126 | struct davinci_spi_dma { | 122 | struct davinci_spi_dma { |
127 | int dma_tx_channel; | 123 | int dma_tx_channel; |
@@ -156,7 +152,7 @@ struct davinci_spi { | |||
156 | void (*get_rx)(u32 rx_data, struct davinci_spi *); | 152 | void (*get_rx)(u32 rx_data, struct davinci_spi *); |
157 | u32 (*get_tx)(struct davinci_spi *); | 153 | u32 (*get_tx)(struct davinci_spi *); |
158 | 154 | ||
159 | struct davinci_spi_slave slave[SPI_MAX_CHIPSELECT]; | 155 | u8 bytes_per_word[SPI_MAX_CHIPSELECT]; |
160 | }; | 156 | }; |
161 | 157 | ||
162 | static struct davinci_spi_config davinci_spi_default_cfg; | 158 | static struct davinci_spi_config davinci_spi_default_cfg; |
@@ -324,11 +320,11 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, | |||
324 | if (bits_per_word <= 8 && bits_per_word >= 2) { | 320 | if (bits_per_word <= 8 && bits_per_word >= 2) { |
325 | davinci_spi->get_rx = davinci_spi_rx_buf_u8; | 321 | davinci_spi->get_rx = davinci_spi_rx_buf_u8; |
326 | davinci_spi->get_tx = davinci_spi_tx_buf_u8; | 322 | davinci_spi->get_tx = davinci_spi_tx_buf_u8; |
327 | davinci_spi->slave[spi->chip_select].bytes_per_word = 1; | 323 | davinci_spi->bytes_per_word[spi->chip_select] = 1; |
328 | } else if (bits_per_word <= 16 && bits_per_word >= 2) { | 324 | } else if (bits_per_word <= 16 && bits_per_word >= 2) { |
329 | davinci_spi->get_rx = davinci_spi_rx_buf_u16; | 325 | davinci_spi->get_rx = davinci_spi_rx_buf_u16; |
330 | davinci_spi->get_tx = davinci_spi_tx_buf_u16; | 326 | davinci_spi->get_tx = davinci_spi_tx_buf_u16; |
331 | davinci_spi->slave[spi->chip_select].bytes_per_word = 2; | 327 | davinci_spi->bytes_per_word[spi->chip_select] = 2; |
332 | } else | 328 | } else |
333 | return -EINVAL; | 329 | return -EINVAL; |
334 | 330 | ||
@@ -632,7 +628,7 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t) | |||
632 | davinci_spi->rx = t->rx_buf; | 628 | davinci_spi->rx = t->rx_buf; |
633 | 629 | ||
634 | /* convert len to words based on bits_per_word */ | 630 | /* convert len to words based on bits_per_word */ |
635 | conv = davinci_spi->slave[spi->chip_select].bytes_per_word; | 631 | conv = davinci_spi->bytes_per_word[spi->chip_select]; |
636 | davinci_spi->count = t->len / conv; | 632 | davinci_spi->count = t->len / conv; |
637 | 633 | ||
638 | data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); | 634 | data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); |
@@ -764,7 +760,7 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t) | |||
764 | davinci_spi->rx = t->rx_buf; | 760 | davinci_spi->rx = t->rx_buf; |
765 | 761 | ||
766 | /* convert len to words based on bits_per_word */ | 762 | /* convert len to words based on bits_per_word */ |
767 | conv = davinci_spi->slave[spi->chip_select].bytes_per_word; | 763 | conv = davinci_spi->bytes_per_word[spi->chip_select]; |
768 | davinci_spi->count = t->len / conv; | 764 | davinci_spi->count = t->len / conv; |
769 | 765 | ||
770 | data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); | 766 | data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); |