aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_imx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi_imx.c')
-rw-r--r--drivers/spi/spi_imx.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 0671aeef5792..c195e45f7f35 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1171,9 +1171,6 @@ msg_rejected:
1171 return -EINVAL; 1171 return -EINVAL;
1172} 1172}
1173 1173
1174/* the spi->mode bits understood by this driver: */
1175#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
1176
1177/* On first setup bad values must free chip_data memory since will cause 1174/* On first setup bad values must free chip_data memory since will cause
1178 spi_new_device to fail. Bad value setup from protocol driver are simply not 1175 spi_new_device to fail. Bad value setup from protocol driver are simply not
1179 applied and notified to the calling driver. */ 1176 applied and notified to the calling driver. */
@@ -1186,12 +1183,6 @@ static int setup(struct spi_device *spi)
1186 u32 tmp; 1183 u32 tmp;
1187 int status = 0; 1184 int status = 0;
1188 1185
1189 if (spi->mode & ~MODEBITS) {
1190 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
1191 spi->mode & ~MODEBITS);
1192 return -EINVAL;
1193 }
1194
1195 /* Get controller data */ 1186 /* Get controller data */
1196 chip_info = spi->controller_data; 1187 chip_info = spi->controller_data;
1197 1188
@@ -1286,10 +1277,7 @@ static int setup(struct spi_device *spi)
1286 1277
1287 /* SPI word width */ 1278 /* SPI word width */
1288 tmp = spi->bits_per_word; 1279 tmp = spi->bits_per_word;
1289 if (tmp == 0) { 1280 if (tmp > 16) {
1290 tmp = 8;
1291 spi->bits_per_word = 8;
1292 } else if (tmp > 16) {
1293 status = -EINVAL; 1281 status = -EINVAL;
1294 dev_err(&spi->dev, 1282 dev_err(&spi->dev,
1295 "setup - " 1283 "setup - "
@@ -1481,6 +1469,9 @@ static int __init spi_imx_probe(struct platform_device *pdev)
1481 drv_data->master_info = platform_info; 1469 drv_data->master_info = platform_info;
1482 drv_data->pdev = pdev; 1470 drv_data->pdev = pdev;
1483 1471
1472 /* the spi->mode bits understood by this driver: */
1473 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1474
1484 master->bus_num = pdev->id; 1475 master->bus_num = pdev->id;
1485 master->num_chipselect = platform_info->num_chipselect; 1476 master->num_chipselect = platform_info->num_chipselect;
1486 master->dma_alignment = DMA_ALIGNMENT; 1477 master->dma_alignment = DMA_ALIGNMENT;