aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-altera.c6
-rw-r--r--drivers/spi/spi-atmel.c26
-rw-r--r--drivers/spi/spi-au1550.c30
-rw-r--r--drivers/spi/spi-bcm63xx-hsspi.c5
-rw-r--r--drivers/spi/spi-bcm63xx.c2
-rw-r--r--drivers/spi/spi-bfin-v3.c3
-rw-r--r--drivers/spi/spi-bfin5xx.c8
-rw-r--r--drivers/spi/spi-bitbang.c4
-rw-r--r--drivers/spi/spi-butterfly.c3
-rw-r--r--drivers/spi/spi-gpio.c5
-rw-r--r--drivers/spi/spi-omap-uwire.c5
-rw-r--r--drivers/spi/spi-ti-qspi.c3
12 files changed, 30 insertions, 70 deletions
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index 5d7deaf62867..09df64950234 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -200,7 +200,6 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
200 200
201static int altera_spi_probe(struct platform_device *pdev) 201static int altera_spi_probe(struct platform_device *pdev)
202{ 202{
203 struct altera_spi_platform_data *platp = dev_get_platdata(&pdev->dev);
204 struct altera_spi *hw; 203 struct altera_spi *hw;
205 struct spi_master *master; 204 struct spi_master *master;
206 struct resource *res; 205 struct resource *res;
@@ -214,6 +213,8 @@ static int altera_spi_probe(struct platform_device *pdev)
214 master->bus_num = pdev->id; 213 master->bus_num = pdev->id;
215 master->num_chipselect = 16; 214 master->num_chipselect = 16;
216 master->mode_bits = SPI_CS_HIGH; 215 master->mode_bits = SPI_CS_HIGH;
216 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
217 master->dev.of_node = pdev->dev.of_node;
217 218
218 hw = spi_master_get_devdata(master); 219 hw = spi_master_get_devdata(master);
219 platform_set_drvdata(pdev, hw); 220 platform_set_drvdata(pdev, hw);
@@ -245,9 +246,6 @@ static int altera_spi_probe(struct platform_device *pdev)
245 if (err) 246 if (err)
246 goto exit; 247 goto exit;
247 } 248 }
248 /* find platform data */
249 if (!platp)
250 hw->bitbang.master->dev.of_node = pdev->dev.of_node;
251 249
252 /* register our spi controller */ 250 /* register our spi controller */
253 err = spi_bitbang_start(&hw->bitbang); 251 err = spi_bitbang_start(&hw->bitbang);
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 5d7b07f08326..bc879930470b 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/pinctrl/consumer.h>
29 30
30/* SPI register offsets */ 31/* SPI register offsets */
31#define SPI_CR 0x0000 32#define SPI_CR 0x0000
@@ -1087,14 +1088,6 @@ static int atmel_spi_one_transfer(struct spi_master *master,
1087 } 1088 }
1088 } 1089 }
1089 1090
1090 if (xfer->bits_per_word > 8) {
1091 if (xfer->len % 2) {
1092 dev_dbg(&spi->dev,
1093 "buffer len should be 16 bits aligned\n");
1094 return -EINVAL;
1095 }
1096 }
1097
1098 /* 1091 /*
1099 * DMA map early, for performance (empties dcache ASAP) and 1092 * DMA map early, for performance (empties dcache ASAP) and
1100 * better fault reporting. 1093 * better fault reporting.
@@ -1221,9 +1214,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
1221 dev_dbg(&spi->dev, "new message %p submitted for %s\n", 1214 dev_dbg(&spi->dev, "new message %p submitted for %s\n",
1222 msg, dev_name(&spi->dev)); 1215 msg, dev_name(&spi->dev));
1223 1216
1224 if (unlikely(list_empty(&msg->transfers)))
1225 return -EINVAL;
1226
1227 atmel_spi_lock(as); 1217 atmel_spi_lock(as);
1228 cs_activate(as, spi); 1218 cs_activate(as, spi);
1229 1219
@@ -1244,10 +1234,10 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
1244 1234
1245 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 1235 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
1246 dev_dbg(&spi->dev, 1236 dev_dbg(&spi->dev,
1247 " xfer %p: len %u tx %p/%08x rx %p/%08x\n", 1237 " xfer %p: len %u tx %p/%pad rx %p/%pad\n",
1248 xfer, xfer->len, 1238 xfer, xfer->len,
1249 xfer->tx_buf, xfer->tx_dma, 1239 xfer->tx_buf, &xfer->tx_dma,
1250 xfer->rx_buf, xfer->rx_dma); 1240 xfer->rx_buf, &xfer->rx_dma);
1251 } 1241 }
1252 1242
1253msg_done: 1243msg_done:
@@ -1303,6 +1293,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
1303 struct spi_master *master; 1293 struct spi_master *master;
1304 struct atmel_spi *as; 1294 struct atmel_spi *as;
1305 1295
1296 /* Select default pin state */
1297 pinctrl_pm_select_default_state(&pdev->dev);
1298
1306 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1299 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1307 if (!regs) 1300 if (!regs)
1308 return -ENXIO; 1301 return -ENXIO;
@@ -1465,6 +1458,9 @@ static int atmel_spi_suspend(struct device *dev)
1465 } 1458 }
1466 1459
1467 clk_disable_unprepare(as->clk); 1460 clk_disable_unprepare(as->clk);
1461
1462 pinctrl_pm_select_sleep_state(dev);
1463
1468 return 0; 1464 return 0;
1469} 1465}
1470 1466
@@ -1474,6 +1470,8 @@ static int atmel_spi_resume(struct device *dev)
1474 struct atmel_spi *as = spi_master_get_devdata(master); 1470 struct atmel_spi *as = spi_master_get_devdata(master);
1475 int ret; 1471 int ret;
1476 1472
1473 pinctrl_pm_select_default_state(dev);
1474
1477 clk_prepare_enable(as->clk); 1475 clk_prepare_enable(as->clk);
1478 1476
1479 /* Start the queue running */ 1477 /* Start the queue running */
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c
index c4141c92bcff..aafb812d7ea6 100644
--- a/drivers/spi/spi-au1550.c
+++ b/drivers/spi/spi-au1550.c
@@ -55,8 +55,6 @@ struct au1550_spi {
55 55
56 volatile psc_spi_t __iomem *regs; 56 volatile psc_spi_t __iomem *regs;
57 int irq; 57 int irq;
58 unsigned freq_max;
59 unsigned freq_min;
60 58
61 unsigned len; 59 unsigned len;
62 unsigned tx_count; 60 unsigned tx_count;
@@ -248,11 +246,8 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
248 hz = t->speed_hz; 246 hz = t->speed_hz;
249 } 247 }
250 248
251 if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) { 249 if (!hz)
252 dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n",
253 hz);
254 return -EINVAL; 250 return -EINVAL;
255 }
256 251
257 au1550_spi_bits_handlers_set(hw, spi->bits_per_word); 252 au1550_spi_bits_handlers_set(hw, spi->bits_per_word);
258 253
@@ -287,23 +282,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
287 return 0; 282 return 0;
288} 283}
289 284
290static int au1550_spi_setup(struct spi_device *spi)
291{
292 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
293
294 if (spi->max_speed_hz == 0)
295 spi->max_speed_hz = hw->freq_max;
296 if (spi->max_speed_hz > hw->freq_max
297 || spi->max_speed_hz < hw->freq_min)
298 return -EINVAL;
299 /*
300 * NOTE: cannot change speed and other hw settings immediately,
301 * otherwise sharing of spi bus is not possible,
302 * so do not call setupxfer(spi, NULL) here
303 */
304 return 0;
305}
306
307/* 285/*
308 * for dma spi transfers, we have to setup rx channel, otherwise there is 286 * for dma spi transfers, we have to setup rx channel, otherwise there is
309 * no reliable way how to recognize that spi transfer is done 287 * no reliable way how to recognize that spi transfer is done
@@ -838,7 +816,6 @@ static int au1550_spi_probe(struct platform_device *pdev)
838 hw->bitbang.master = hw->master; 816 hw->bitbang.master = hw->master;
839 hw->bitbang.setup_transfer = au1550_spi_setupxfer; 817 hw->bitbang.setup_transfer = au1550_spi_setupxfer;
840 hw->bitbang.chipselect = au1550_spi_chipsel; 818 hw->bitbang.chipselect = au1550_spi_chipsel;
841 hw->bitbang.master->setup = au1550_spi_setup;
842 hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs; 819 hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs;
843 820
844 if (hw->usedma) { 821 if (hw->usedma) {
@@ -909,8 +886,9 @@ static int au1550_spi_probe(struct platform_device *pdev)
909 { 886 {
910 int min_div = (2 << 0) * (2 * (4 + 1)); 887 int min_div = (2 << 0) * (2 * (4 + 1));
911 int max_div = (2 << 3) * (2 * (63 + 1)); 888 int max_div = (2 << 3) * (2 * (63 + 1));
912 hw->freq_max = hw->pdata->mainclk_hz / min_div; 889 master->max_speed_hz = hw->pdata->mainclk_hz / min_div;
913 hw->freq_min = hw->pdata->mainclk_hz / (max_div + 1) + 1; 890 master->min_speed_hz =
891 hw->pdata->mainclk_hz / (max_div + 1) + 1;
914 } 892 }
915 893
916 au1550_spi_setup_psc_as_spi(hw); 894 au1550_spi_setup_psc_as_spi(hw);
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index b528f9fc8bc0..13bbce349ed9 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -453,9 +453,8 @@ static int bcm63xx_hsspi_resume(struct device *dev)
453} 453}
454#endif 454#endif
455 455
456static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { 456static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend,
457 SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume) 457 bcm63xx_hsspi_resume);
458};
459 458
460static struct platform_driver bcm63xx_hsspi_driver = { 459static struct platform_driver bcm63xx_hsspi_driver = {
461 .driver = { 460 .driver = {
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 77286aef2adf..b3d719a9667a 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -35,8 +35,6 @@
35 35
36#include <bcm63xx_dev_spi.h> 36#include <bcm63xx_dev_spi.h>
37 37
38#define PFX KBUILD_MODNAME
39
40#define BCM63XX_SPI_MAX_PREPEND 15 38#define BCM63XX_SPI_MAX_PREPEND 15
41 39
42struct bcm63xx_spi { 40struct bcm63xx_spi {
diff --git a/drivers/spi/spi-bfin-v3.c b/drivers/spi/spi-bfin-v3.c
index 8f8598834b30..4089d0e0d84e 100644
--- a/drivers/spi/spi-bfin-v3.c
+++ b/drivers/spi/spi-bfin-v3.c
@@ -822,7 +822,8 @@ static int bfin_spi_probe(struct platform_device *pdev)
822 master->cleanup = bfin_spi_cleanup; 822 master->cleanup = bfin_spi_cleanup;
823 master->setup = bfin_spi_setup; 823 master->setup = bfin_spi_setup;
824 master->transfer_one_message = bfin_spi_transfer_one_message; 824 master->transfer_one_message = bfin_spi_transfer_one_message;
825 master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1); 825 master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
826 SPI_BPW_MASK(8);
826 827
827 drv_data = spi_master_get_devdata(master); 828 drv_data = spi_master_get_devdata(master);
828 drv_data->master = master; 829 drv_data->master = master;
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index f0f195af75d4..55e57c3eb9bd 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -350,7 +350,6 @@ static void *bfin_spi_next_transfer(struct bfin_spi_master_data *drv_data)
350static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data) 350static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
351{ 351{
352 struct bfin_spi_slave_data *chip = drv_data->cur_chip; 352 struct bfin_spi_slave_data *chip = drv_data->cur_chip;
353 struct spi_transfer *last_transfer;
354 unsigned long flags; 353 unsigned long flags;
355 struct spi_message *msg; 354 struct spi_message *msg;
356 355
@@ -362,9 +361,6 @@ static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
362 queue_work(drv_data->workqueue, &drv_data->pump_messages); 361 queue_work(drv_data->workqueue, &drv_data->pump_messages);
363 spin_unlock_irqrestore(&drv_data->lock, flags); 362 spin_unlock_irqrestore(&drv_data->lock, flags);
364 363
365 last_transfer = list_entry(msg->transfers.prev,
366 struct spi_transfer, transfer_list);
367
368 msg->state = NULL; 364 msg->state = NULL;
369 365
370 if (!drv_data->cs_change) 366 if (!drv_data->cs_change)
@@ -1030,10 +1026,6 @@ static int bfin_spi_setup(struct spi_device *spi)
1030 } 1026 }
1031 1027
1032 /* translate common spi framework into our register */ 1028 /* translate common spi framework into our register */
1033 if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) {
1034 dev_err(&spi->dev, "unsupported spi modes detected\n");
1035 goto error;
1036 }
1037 if (spi->mode & SPI_CPOL) 1029 if (spi->mode & SPI_CPOL)
1038 chip->ctl_reg |= BIT_CTL_CPOL; 1030 chip->ctl_reg |= BIT_CTL_CPOL;
1039 if (spi->mode & SPI_CPHA) 1031 if (spi->mode & SPI_CPHA)
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
index bd222f6b677d..67aead248753 100644
--- a/drivers/spi/spi-bitbang.c
+++ b/drivers/spi/spi-bitbang.c
@@ -467,11 +467,9 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start);
467/** 467/**
468 * spi_bitbang_stop - stops the task providing spi communication 468 * spi_bitbang_stop - stops the task providing spi communication
469 */ 469 */
470int spi_bitbang_stop(struct spi_bitbang *bitbang) 470void spi_bitbang_stop(struct spi_bitbang *bitbang)
471{ 471{
472 spi_unregister_master(bitbang->master); 472 spi_unregister_master(bitbang->master);
473
474 return 0;
475} 473}
476EXPORT_SYMBOL_GPL(spi_bitbang_stop); 474EXPORT_SYMBOL_GPL(spi_bitbang_stop);
477 475
diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c
index 8081f96bd1d5..ee4f91ccd8fd 100644
--- a/drivers/spi/spi-butterfly.c
+++ b/drivers/spi/spi-butterfly.c
@@ -309,7 +309,6 @@ done:
309static void butterfly_detach(struct parport *p) 309static void butterfly_detach(struct parport *p)
310{ 310{
311 struct butterfly *pp; 311 struct butterfly *pp;
312 int status;
313 312
314 /* FIXME this global is ugly ... but, how to quickly get from 313 /* FIXME this global is ugly ... but, how to quickly get from
315 * the parport to the "struct butterfly" associated with it? 314 * the parport to the "struct butterfly" associated with it?
@@ -321,7 +320,7 @@ static void butterfly_detach(struct parport *p)
321 butterfly = NULL; 320 butterfly = NULL;
322 321
323 /* stop() unregisters child devices too */ 322 /* stop() unregisters child devices too */
324 status = spi_bitbang_stop(&pp->bitbang); 323 spi_bitbang_stop(&pp->bitbang);
325 324
326 /* turn off VCC */ 325 /* turn off VCC */
327 parport_write_data(pp->port, 0); 326 parport_write_data(pp->port, 0);
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 7beeb29472ac..b189b958432b 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -503,13 +503,12 @@ static int spi_gpio_remove(struct platform_device *pdev)
503{ 503{
504 struct spi_gpio *spi_gpio; 504 struct spi_gpio *spi_gpio;
505 struct spi_gpio_platform_data *pdata; 505 struct spi_gpio_platform_data *pdata;
506 int status;
507 506
508 spi_gpio = platform_get_drvdata(pdev); 507 spi_gpio = platform_get_drvdata(pdev);
509 pdata = dev_get_platdata(&pdev->dev); 508 pdata = dev_get_platdata(&pdev->dev);
510 509
511 /* stop() unregisters child devices too */ 510 /* stop() unregisters child devices too */
512 status = spi_bitbang_stop(&spi_gpio->bitbang); 511 spi_bitbang_stop(&spi_gpio->bitbang);
513 512
514 if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) 513 if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO)
515 gpio_free(SPI_MISO_GPIO); 514 gpio_free(SPI_MISO_GPIO);
@@ -518,7 +517,7 @@ static int spi_gpio_remove(struct platform_device *pdev)
518 gpio_free(SPI_SCK_GPIO); 517 gpio_free(SPI_SCK_GPIO);
519 spi_master_put(spi_gpio->bitbang.master); 518 spi_master_put(spi_gpio->bitbang.master);
520 519
521 return status; 520 return 0;
522} 521}
523 522
524MODULE_ALIAS("platform:" DRIVER_NAME); 523MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c
index 9313fd3b413d..a4d7bb557792 100644
--- a/drivers/spi/spi-omap-uwire.c
+++ b/drivers/spi/spi-omap-uwire.c
@@ -539,14 +539,13 @@ static int uwire_probe(struct platform_device *pdev)
539static int uwire_remove(struct platform_device *pdev) 539static int uwire_remove(struct platform_device *pdev)
540{ 540{
541 struct uwire_spi *uwire = platform_get_drvdata(pdev); 541 struct uwire_spi *uwire = platform_get_drvdata(pdev);
542 int status;
543 542
544 // FIXME remove all child devices, somewhere ... 543 // FIXME remove all child devices, somewhere ...
545 544
546 status = spi_bitbang_stop(&uwire->bitbang); 545 spi_bitbang_stop(&uwire->bitbang);
547 uwire_off(uwire); 546 uwire_off(uwire);
548 iounmap(uwire_base); 547 iounmap(uwire_base);
549 return status; 548 return 0;
550} 549}
551 550
552/* work with hotplug and coldplug */ 551/* work with hotplug and coldplug */
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 3d09265b5133..7eb2cef739b6 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -435,7 +435,8 @@ static int ti_qspi_probe(struct platform_device *pdev)
435 master->auto_runtime_pm = true; 435 master->auto_runtime_pm = true;
436 master->transfer_one_message = ti_qspi_start_transfer_one; 436 master->transfer_one_message = ti_qspi_start_transfer_one;
437 master->dev.of_node = pdev->dev.of_node; 437 master->dev.of_node = pdev->dev.of_node;
438 master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1); 438 master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
439 SPI_BPW_MASK(8);
439 440
440 if (!of_property_read_u32(np, "num-cs", &num_cs)) 441 if (!of_property_read_u32(np, "num-cs", &num_cs))
441 master->num_chipselect = num_cs; 442 master->num_chipselect = num_cs;