aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/pxa2xx_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/pxa2xx_spi.c')
-rw-r--r--drivers/spi/pxa2xx_spi.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 3f3c08c6ba4e..d949dbf1141f 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1185,9 +1185,6 @@ static int transfer(struct spi_device *spi, struct spi_message *msg)
1185 return 0; 1185 return 0;
1186} 1186}
1187 1187
1188/* the spi->mode bits understood by this driver: */
1189#define MODEBITS (SPI_CPOL | SPI_CPHA)
1190
1191static int setup_cs(struct spi_device *spi, struct chip_data *chip, 1188static int setup_cs(struct spi_device *spi, struct chip_data *chip,
1192 struct pxa2xx_spi_chip *chip_info) 1189 struct pxa2xx_spi_chip *chip_info)
1193{ 1190{
@@ -1236,9 +1233,6 @@ static int setup(struct spi_device *spi)
1236 uint tx_thres = TX_THRESH_DFLT; 1233 uint tx_thres = TX_THRESH_DFLT;
1237 uint rx_thres = RX_THRESH_DFLT; 1234 uint rx_thres = RX_THRESH_DFLT;
1238 1235
1239 if (!spi->bits_per_word)
1240 spi->bits_per_word = 8;
1241
1242 if (drv_data->ssp_type != PXA25x_SSP 1236 if (drv_data->ssp_type != PXA25x_SSP
1243 && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) { 1237 && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) {
1244 dev_err(&spi->dev, "failed setup: ssp_type=%d, bits/wrd=%d " 1238 dev_err(&spi->dev, "failed setup: ssp_type=%d, bits/wrd=%d "
@@ -1255,12 +1249,6 @@ static int setup(struct spi_device *spi)
1255 return -EINVAL; 1249 return -EINVAL;
1256 } 1250 }
1257 1251
1258 if (spi->mode & ~MODEBITS) {
1259 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
1260 spi->mode & ~MODEBITS);
1261 return -EINVAL;
1262 }
1263
1264 /* Only alloc on first setup */ 1252 /* Only alloc on first setup */
1265 chip = spi_get_ctldata(spi); 1253 chip = spi_get_ctldata(spi);
1266 if (!chip) { 1254 if (!chip) {
@@ -1328,18 +1316,14 @@ static int setup(struct spi_device *spi)
1328 1316
1329 /* NOTE: PXA25x_SSP _could_ use external clocking ... */ 1317 /* NOTE: PXA25x_SSP _could_ use external clocking ... */
1330 if (drv_data->ssp_type != PXA25x_SSP) 1318 if (drv_data->ssp_type != PXA25x_SSP)
1331 dev_dbg(&spi->dev, "%d bits/word, %ld Hz, mode %d, %s\n", 1319 dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
1332 spi->bits_per_word,
1333 clk_get_rate(ssp->clk) 1320 clk_get_rate(ssp->clk)
1334 / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), 1321 / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),
1335 spi->mode & 0x3,
1336 chip->enable_dma ? "DMA" : "PIO"); 1322 chip->enable_dma ? "DMA" : "PIO");
1337 else 1323 else
1338 dev_dbg(&spi->dev, "%d bits/word, %ld Hz, mode %d, %s\n", 1324 dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
1339 spi->bits_per_word,
1340 clk_get_rate(ssp->clk) / 2 1325 clk_get_rate(ssp->clk) / 2
1341 / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), 1326 / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),
1342 spi->mode & 0x3,
1343 chip->enable_dma ? "DMA" : "PIO"); 1327 chip->enable_dma ? "DMA" : "PIO");
1344 1328
1345 if (spi->bits_per_word <= 8) { 1329 if (spi->bits_per_word <= 8) {
@@ -1500,6 +1484,9 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
1500 drv_data->pdev = pdev; 1484 drv_data->pdev = pdev;
1501 drv_data->ssp = ssp; 1485 drv_data->ssp = ssp;
1502 1486
1487 /* the spi->mode bits understood by this driver: */
1488 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1489
1503 master->bus_num = pdev->id; 1490 master->bus_num = pdev->id;
1504 master->num_chipselect = platform_info->num_chipselect; 1491 master->num_chipselect = platform_info->num_chipselect;
1505 master->dma_alignment = DMA_ALIGNMENT; 1492 master->dma_alignment = DMA_ALIGNMENT;