aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/spi/spi-bus.txt2
-rw-r--r--drivers/spi/Kconfig4
-rw-r--r--drivers/spi/spi-dw-pci.c2
-rw-r--r--drivers/spi/spi-fsl-espi.c63
-rw-r--r--drivers/spi/spi-gpio.c8
-rw-r--r--drivers/spi/spi-mpc512x-psc.c18
-rw-r--r--drivers/spi/spi-nuc900.c56
-rw-r--r--drivers/spi/spi-oc-tiny.c62
-rw-r--r--drivers/spi/spi-omap-100k.c20
-rw-r--r--drivers/spi/spi-omap2-mcspi.c38
-rw-r--r--drivers/spi/spi-orion.c4
-rw-r--r--drivers/spi/spi-pxa2xx-pci.c2
-rw-r--r--drivers/spi/spi-sh-hspi.c2
-rw-r--r--drivers/spi/spi-sh-msiof.c60
-rw-r--r--drivers/spi/spi-topcliff-pch.c2
-rw-r--r--include/linux/platform_data/spi-nuc900.h8
16 files changed, 155 insertions, 196 deletions
diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 800dafe5b01b..e5a4d1b4acfe 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -67,7 +67,7 @@ only 1(SINGLE), 2(DUAL) and 4(QUAD).
67Dual/Quad mode is not allowed when 3-wire mode is used. 67Dual/Quad mode is not allowed when 3-wire mode is used.
68 68
69If a gpio chipselect is used for the SPI slave the gpio number will be passed 69If a gpio chipselect is used for the SPI slave the gpio number will be passed
70via the cs_gpio 70via the SPI master node cs-gpios property.
71 71
72SPI example for an MPC5200 SPI bus: 72SPI example for an MPC5200 SPI bus:
73 spi@f00 { 73 spi@f00 {
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 94964af1428d..710599f54cc5 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -307,6 +307,7 @@ config SPI_OMAP_UWIRE
307 307
308config SPI_OMAP24XX 308config SPI_OMAP24XX
309 tristate "McSPI driver for OMAP" 309 tristate "McSPI driver for OMAP"
310 depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SH
310 depends on ARCH_OMAP2PLUS || COMPILE_TEST 311 depends on ARCH_OMAP2PLUS || COMPILE_TEST
311 help 312 help
312 SPI master controller for OMAP24XX and later Multichannel SPI 313 SPI master controller for OMAP24XX and later Multichannel SPI
@@ -413,7 +414,8 @@ config SPI_SC18IS602
413 414
414config SPI_SH_MSIOF 415config SPI_SH_MSIOF
415 tristate "SuperH MSIOF SPI controller" 416 tristate "SuperH MSIOF SPI controller"
416 depends on (SUPERH || ARCH_SHMOBILE) && HAVE_CLK 417 depends on HAVE_CLK
418 depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
417 select SPI_BITBANG 419 select SPI_BITBANG
418 help 420 help
419 SPI driver for SuperH and SH Mobile MSIOF blocks. 421 SPI driver for SuperH and SH Mobile MSIOF blocks.
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c
index d4603efbd9bf..3f3dc1226edf 100644
--- a/drivers/spi/spi-dw-pci.c
+++ b/drivers/spi/spi-dw-pci.c
@@ -125,7 +125,7 @@ static int spi_resume(struct pci_dev *pdev)
125#define spi_resume NULL 125#define spi_resume NULL
126#endif 126#endif
127 127
128static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { 128static const struct pci_device_id pci_ids[] = {
129 /* Intel MID platform SPI controller 0 */ 129 /* Intel MID platform SPI controller 0 */
130 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) }, 130 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) },
131 {}, 131 {},
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 80d8f40f7e05..428dc7a6b62e 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -705,7 +705,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
705 goto err; 705 goto err;
706 706
707 irq = irq_of_parse_and_map(np, 0); 707 irq = irq_of_parse_and_map(np, 0);
708 if (!ret) { 708 if (!irq) {
709 ret = -EINVAL; 709 ret = -EINVAL;
710 goto err; 710 goto err;
711 } 711 }
@@ -727,6 +727,66 @@ static int of_fsl_espi_remove(struct platform_device *dev)
727 return mpc8xxx_spi_remove(&dev->dev); 727 return mpc8xxx_spi_remove(&dev->dev);
728} 728}
729 729
730#ifdef CONFIG_PM_SLEEP
731static int of_fsl_espi_suspend(struct device *dev)
732{
733 struct spi_master *master = dev_get_drvdata(dev);
734 struct mpc8xxx_spi *mpc8xxx_spi;
735 struct fsl_espi_reg *reg_base;
736 u32 regval;
737 int ret;
738
739 mpc8xxx_spi = spi_master_get_devdata(master);
740 reg_base = mpc8xxx_spi->reg_base;
741
742 ret = spi_master_suspend(master);
743 if (ret) {
744 dev_warn(dev, "cannot suspend master\n");
745 return ret;
746 }
747
748 regval = mpc8xxx_spi_read_reg(&reg_base->mode);
749 regval &= ~SPMODE_ENABLE;
750 mpc8xxx_spi_write_reg(&reg_base->mode, regval);
751
752 return 0;
753}
754
755static int of_fsl_espi_resume(struct device *dev)
756{
757 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
758 struct spi_master *master = dev_get_drvdata(dev);
759 struct mpc8xxx_spi *mpc8xxx_spi;
760 struct fsl_espi_reg *reg_base;
761 u32 regval;
762 int i;
763
764 mpc8xxx_spi = spi_master_get_devdata(master);
765 reg_base = mpc8xxx_spi->reg_base;
766
767 /* SPI controller initializations */
768 mpc8xxx_spi_write_reg(&reg_base->mode, 0);
769 mpc8xxx_spi_write_reg(&reg_base->mask, 0);
770 mpc8xxx_spi_write_reg(&reg_base->command, 0);
771 mpc8xxx_spi_write_reg(&reg_base->event, 0xffffffff);
772
773 /* Init eSPI CS mode register */
774 for (i = 0; i < pdata->max_chipselect; i++)
775 mpc8xxx_spi_write_reg(&reg_base->csmode[i], CSMODE_INIT_VAL);
776
777 /* Enable SPI interface */
778 regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;
779
780 mpc8xxx_spi_write_reg(&reg_base->mode, regval);
781
782 return spi_master_resume(master);
783}
784#endif /* CONFIG_PM_SLEEP */
785
786static const struct dev_pm_ops espi_pm = {
787 SET_SYSTEM_SLEEP_PM_OPS(of_fsl_espi_suspend, of_fsl_espi_resume)
788};
789
730static const struct of_device_id of_fsl_espi_match[] = { 790static const struct of_device_id of_fsl_espi_match[] = {
731 { .compatible = "fsl,mpc8536-espi" }, 791 { .compatible = "fsl,mpc8536-espi" },
732 {} 792 {}
@@ -738,6 +798,7 @@ static struct platform_driver fsl_espi_driver = {
738 .name = "fsl_espi", 798 .name = "fsl_espi",
739 .owner = THIS_MODULE, 799 .owner = THIS_MODULE,
740 .of_match_table = of_fsl_espi_match, 800 .of_match_table = of_fsl_espi_match,
801 .pm = &espi_pm,
741 }, 802 },
742 .probe = of_fsl_espi_probe, 803 .probe = of_fsl_espi_probe,
743 .remove = of_fsl_espi_remove, 804 .remove = of_fsl_espi_remove,
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 3fb09f981980..7beeb29472ac 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -115,17 +115,17 @@ spi_to_pdata(const struct spi_device *spi)
115 115
116static inline void setsck(const struct spi_device *spi, int is_on) 116static inline void setsck(const struct spi_device *spi, int is_on)
117{ 117{
118 gpio_set_value(SPI_SCK_GPIO, is_on); 118 gpio_set_value_cansleep(SPI_SCK_GPIO, is_on);
119} 119}
120 120
121static inline void setmosi(const struct spi_device *spi, int is_on) 121static inline void setmosi(const struct spi_device *spi, int is_on)
122{ 122{
123 gpio_set_value(SPI_MOSI_GPIO, is_on); 123 gpio_set_value_cansleep(SPI_MOSI_GPIO, is_on);
124} 124}
125 125
126static inline int getmiso(const struct spi_device *spi) 126static inline int getmiso(const struct spi_device *spi)
127{ 127{
128 return !!gpio_get_value(SPI_MISO_GPIO); 128 return !!gpio_get_value_cansleep(SPI_MISO_GPIO);
129} 129}
130 130
131#undef pdata 131#undef pdata
@@ -229,7 +229,7 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
229 229
230 if (cs != SPI_GPIO_NO_CHIPSELECT) { 230 if (cs != SPI_GPIO_NO_CHIPSELECT) {
231 /* SPI is normally active-low */ 231 /* SPI is normally active-low */
232 gpio_set_value(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); 232 gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
233 } 233 }
234} 234}
235 235
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 87676587d783..46d2313f7c6f 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -504,7 +504,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
504 master->cleanup = mpc512x_psc_spi_cleanup; 504 master->cleanup = mpc512x_psc_spi_cleanup;
505 master->dev.of_node = dev->of_node; 505 master->dev.of_node = dev->of_node;
506 506
507 tempp = ioremap(regaddr, size); 507 tempp = devm_ioremap(dev, regaddr, size);
508 if (!tempp) { 508 if (!tempp) {
509 dev_err(dev, "could not ioremap I/O port range\n"); 509 dev_err(dev, "could not ioremap I/O port range\n");
510 ret = -EFAULT; 510 ret = -EFAULT;
@@ -513,9 +513,8 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
513 mps->psc = tempp; 513 mps->psc = tempp;
514 mps->fifo = 514 mps->fifo =
515 (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc)); 515 (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc));
516 516 ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED,
517 ret = request_irq(mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED, 517 "mpc512x-psc-spi", mps);
518 "mpc512x-psc-spi", mps);
519 if (ret) 518 if (ret)
520 goto free_master; 519 goto free_master;
521 init_completion(&mps->txisrdone); 520 init_completion(&mps->txisrdone);
@@ -525,11 +524,11 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
525 clk = devm_clk_get(dev, clk_name); 524 clk = devm_clk_get(dev, clk_name);
526 if (IS_ERR(clk)) { 525 if (IS_ERR(clk)) {
527 ret = PTR_ERR(clk); 526 ret = PTR_ERR(clk);
528 goto free_irq; 527 goto free_master;
529 } 528 }
530 ret = clk_prepare_enable(clk); 529 ret = clk_prepare_enable(clk);
531 if (ret) 530 if (ret)
532 goto free_irq; 531 goto free_master;
533 mps->clk_mclk = clk; 532 mps->clk_mclk = clk;
534 mps->mclk_rate = clk_get_rate(clk); 533 mps->mclk_rate = clk_get_rate(clk);
535 534
@@ -545,11 +544,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
545 544
546free_clock: 545free_clock:
547 clk_disable_unprepare(mps->clk_mclk); 546 clk_disable_unprepare(mps->clk_mclk);
548free_irq:
549 free_irq(mps->irq, mps);
550free_master: 547free_master:
551 if (mps->psc)
552 iounmap(mps->psc);
553 spi_master_put(master); 548 spi_master_put(master);
554 549
555 return ret; 550 return ret;
@@ -561,9 +556,6 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
561 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); 556 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
562 557
563 clk_disable_unprepare(mps->clk_mclk); 558 clk_disable_unprepare(mps->clk_mclk);
564 free_irq(mps->irq, mps);
565 if (mps->psc)
566 iounmap(mps->psc);
567 559
568 return 0; 560 return 0;
569} 561}
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c
index e0c32bc69ee2..50406306bc20 100644
--- a/drivers/spi/spi-nuc900.c
+++ b/drivers/spi/spi-nuc900.c
@@ -57,7 +57,6 @@ struct nuc900_spi {
57 const unsigned char *tx; 57 const unsigned char *tx;
58 unsigned char *rx; 58 unsigned char *rx;
59 struct clk *clk; 59 struct clk *clk;
60 struct resource *ioarea;
61 struct spi_master *master; 60 struct spi_master *master;
62 struct spi_device *curdev; 61 struct spi_device *curdev;
63 struct device *dev; 62 struct device *dev;
@@ -344,8 +343,7 @@ static int nuc900_spi_probe(struct platform_device *pdev)
344 master = spi_alloc_master(&pdev->dev, sizeof(struct nuc900_spi)); 343 master = spi_alloc_master(&pdev->dev, sizeof(struct nuc900_spi));
345 if (master == NULL) { 344 if (master == NULL) {
346 dev_err(&pdev->dev, "No memory for spi_master\n"); 345 dev_err(&pdev->dev, "No memory for spi_master\n");
347 err = -ENOMEM; 346 return -ENOMEM;
348 goto err_nomem;
349 } 347 }
350 348
351 hw = spi_master_get_devdata(master); 349 hw = spi_master_get_devdata(master);
@@ -370,46 +368,31 @@ static int nuc900_spi_probe(struct platform_device *pdev)
370 hw->bitbang.txrx_bufs = nuc900_spi_txrx; 368 hw->bitbang.txrx_bufs = nuc900_spi_txrx;
371 369
372 hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 370 hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
373 if (hw->res == NULL) { 371 hw->regs = devm_ioremap_resource(&pdev->dev, hw->res);
374 dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); 372 if (IS_ERR(hw->regs)) {
375 err = -ENOENT; 373 err = PTR_ERR(hw->regs);
376 goto err_pdata;
377 }
378
379 hw->ioarea = request_mem_region(hw->res->start,
380 resource_size(hw->res), pdev->name);
381
382 if (hw->ioarea == NULL) {
383 dev_err(&pdev->dev, "Cannot reserve region\n");
384 err = -ENXIO;
385 goto err_pdata; 374 goto err_pdata;
386 } 375 }
387 376
388 hw->regs = ioremap(hw->res->start, resource_size(hw->res));
389 if (hw->regs == NULL) {
390 dev_err(&pdev->dev, "Cannot map IO\n");
391 err = -ENXIO;
392 goto err_iomap;
393 }
394
395 hw->irq = platform_get_irq(pdev, 0); 377 hw->irq = platform_get_irq(pdev, 0);
396 if (hw->irq < 0) { 378 if (hw->irq < 0) {
397 dev_err(&pdev->dev, "No IRQ specified\n"); 379 dev_err(&pdev->dev, "No IRQ specified\n");
398 err = -ENOENT; 380 err = -ENOENT;
399 goto err_irq; 381 goto err_pdata;
400 } 382 }
401 383
402 err = request_irq(hw->irq, nuc900_spi_irq, 0, pdev->name, hw); 384 err = devm_request_irq(&pdev->dev, hw->irq, nuc900_spi_irq, 0,
385 pdev->name, hw);
403 if (err) { 386 if (err) {
404 dev_err(&pdev->dev, "Cannot claim IRQ\n"); 387 dev_err(&pdev->dev, "Cannot claim IRQ\n");
405 goto err_irq; 388 goto err_pdata;
406 } 389 }
407 390
408 hw->clk = clk_get(&pdev->dev, "spi"); 391 hw->clk = devm_clk_get(&pdev->dev, "spi");
409 if (IS_ERR(hw->clk)) { 392 if (IS_ERR(hw->clk)) {
410 dev_err(&pdev->dev, "No clock for device\n"); 393 dev_err(&pdev->dev, "No clock for device\n");
411 err = PTR_ERR(hw->clk); 394 err = PTR_ERR(hw->clk);
412 goto err_clk; 395 goto err_pdata;
413 } 396 }
414 397
415 mfp_set_groupg(&pdev->dev, NULL); 398 mfp_set_groupg(&pdev->dev, NULL);
@@ -425,17 +408,8 @@ static int nuc900_spi_probe(struct platform_device *pdev)
425 408
426err_register: 409err_register:
427 clk_disable(hw->clk); 410 clk_disable(hw->clk);
428 clk_put(hw->clk);
429err_clk:
430 free_irq(hw->irq, hw);
431err_irq:
432 iounmap(hw->regs);
433err_iomap:
434 release_mem_region(hw->res->start, resource_size(hw->res));
435 kfree(hw->ioarea);
436err_pdata: 411err_pdata:
437 spi_master_put(hw->master); 412 spi_master_put(hw->master);
438err_nomem:
439 return err; 413 return err;
440} 414}
441 415
@@ -443,18 +417,8 @@ static int nuc900_spi_remove(struct platform_device *dev)
443{ 417{
444 struct nuc900_spi *hw = platform_get_drvdata(dev); 418 struct nuc900_spi *hw = platform_get_drvdata(dev);
445 419
446 free_irq(hw->irq, hw);
447
448 spi_bitbang_stop(&hw->bitbang); 420 spi_bitbang_stop(&hw->bitbang);
449
450 clk_disable(hw->clk); 421 clk_disable(hw->clk);
451 clk_put(hw->clk);
452
453 iounmap(hw->regs);
454
455 release_mem_region(hw->res->start, resource_size(hw->res));
456 kfree(hw->ioarea);
457
458 spi_master_put(hw->master); 422 spi_master_put(hw->master);
459 return 0; 423 return 0;
460} 424}
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 91c668596202..f7c896e2981e 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -153,62 +153,22 @@ static int tiny_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
153 } 153 }
154 154
155 wait_for_completion(&hw->done); 155 wait_for_completion(&hw->done);
156 } else if (txp && rxp) {
157 /* we need to tighten the transfer loop */
158 writeb(*txp++, hw->base + TINY_SPI_TXDATA);
159 if (t->len > 1) {
160 writeb(*txp++, hw->base + TINY_SPI_TXDATA);
161 for (i = 2; i < t->len; i++) {
162 u8 rx, tx = *txp++;
163 tiny_spi_wait_txr(hw);
164 rx = readb(hw->base + TINY_SPI_TXDATA);
165 writeb(tx, hw->base + TINY_SPI_TXDATA);
166 *rxp++ = rx;
167 }
168 tiny_spi_wait_txr(hw);
169 *rxp++ = readb(hw->base + TINY_SPI_TXDATA);
170 }
171 tiny_spi_wait_txe(hw);
172 *rxp++ = readb(hw->base + TINY_SPI_RXDATA);
173 } else if (rxp) {
174 writeb(0, hw->base + TINY_SPI_TXDATA);
175 if (t->len > 1) {
176 writeb(0,
177 hw->base + TINY_SPI_TXDATA);
178 for (i = 2; i < t->len; i++) {
179 u8 rx;
180 tiny_spi_wait_txr(hw);
181 rx = readb(hw->base + TINY_SPI_TXDATA);
182 writeb(0, hw->base + TINY_SPI_TXDATA);
183 *rxp++ = rx;
184 }
185 tiny_spi_wait_txr(hw);
186 *rxp++ = readb(hw->base + TINY_SPI_TXDATA);
187 }
188 tiny_spi_wait_txe(hw);
189 *rxp++ = readb(hw->base + TINY_SPI_RXDATA);
190 } else if (txp) {
191 writeb(*txp++, hw->base + TINY_SPI_TXDATA);
192 if (t->len > 1) {
193 writeb(*txp++, hw->base + TINY_SPI_TXDATA);
194 for (i = 2; i < t->len; i++) {
195 u8 tx = *txp++;
196 tiny_spi_wait_txr(hw);
197 writeb(tx, hw->base + TINY_SPI_TXDATA);
198 }
199 }
200 tiny_spi_wait_txe(hw);
201 } else { 156 } else {
202 writeb(0, hw->base + TINY_SPI_TXDATA); 157 /* we need to tighten the transfer loop */
203 if (t->len > 1) { 158 writeb(txp ? *txp++ : 0, hw->base + TINY_SPI_TXDATA);
204 writeb(0, hw->base + TINY_SPI_TXDATA); 159 for (i = 1; i < t->len; i++) {
205 for (i = 2; i < t->len; i++) { 160 writeb(txp ? *txp++ : 0, hw->base + TINY_SPI_TXDATA);
161
162 if (rxp || (i != t->len - 1))
206 tiny_spi_wait_txr(hw); 163 tiny_spi_wait_txr(hw);
207 writeb(0, hw->base + TINY_SPI_TXDATA); 164 if (rxp)
208 } 165 *rxp++ = readb(hw->base + TINY_SPI_TXDATA);
209 } 166 }
210 tiny_spi_wait_txe(hw); 167 tiny_spi_wait_txe(hw);
168 if (rxp)
169 *rxp++ = readb(hw->base + TINY_SPI_RXDATA);
211 } 170 }
171
212 return t->len; 172 return t->len;
213} 173}
214 174
diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
index b6ed82beb01d..0d32054bfc0d 100644
--- a/drivers/spi/spi-omap-100k.c
+++ b/drivers/spi/spi-omap-100k.c
@@ -470,31 +470,12 @@ err:
470 return status; 470 return status;
471} 471}
472 472
473static int omap1_spi100k_remove(struct platform_device *pdev)
474{
475 struct spi_master *master;
476 struct omap1_spi100k *spi100k;
477 struct resource *r;
478 int status = 0;
479
480 master = platform_get_drvdata(pdev);
481 spi100k = spi_master_get_devdata(master);
482
483 if (status != 0)
484 return status;
485
486 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
487
488 return 0;
489}
490
491static struct platform_driver omap1_spi100k_driver = { 473static struct platform_driver omap1_spi100k_driver = {
492 .driver = { 474 .driver = {
493 .name = "omap1_spi100k", 475 .name = "omap1_spi100k",
494 .owner = THIS_MODULE, 476 .owner = THIS_MODULE,
495 }, 477 },
496 .probe = omap1_spi100k_probe, 478 .probe = omap1_spi100k_probe,
497 .remove = omap1_spi100k_remove,
498}; 479};
499 480
500module_platform_driver(omap1_spi100k_driver); 481module_platform_driver(omap1_spi100k_driver);
@@ -502,4 +483,3 @@ module_platform_driver(omap1_spi100k_driver);
502MODULE_DESCRIPTION("OMAP7xx SPI 100k controller driver"); 483MODULE_DESCRIPTION("OMAP7xx SPI 100k controller driver");
503MODULE_AUTHOR("Fabrice Crohas <fcrohas@gmail.com>"); 484MODULE_AUTHOR("Fabrice Crohas <fcrohas@gmail.com>");
504MODULE_LICENSE("GPL"); 485MODULE_LICENSE("GPL");
505
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 443df39840bc..a72127f08e39 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -157,14 +157,14 @@ static inline void mcspi_write_reg(struct spi_master *master,
157{ 157{
158 struct omap2_mcspi *mcspi = spi_master_get_devdata(master); 158 struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
159 159
160 __raw_writel(val, mcspi->base + idx); 160 writel_relaxed(val, mcspi->base + idx);
161} 161}
162 162
163static inline u32 mcspi_read_reg(struct spi_master *master, int idx) 163static inline u32 mcspi_read_reg(struct spi_master *master, int idx)
164{ 164{
165 struct omap2_mcspi *mcspi = spi_master_get_devdata(master); 165 struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
166 166
167 return __raw_readl(mcspi->base + idx); 167 return readl_relaxed(mcspi->base + idx);
168} 168}
169 169
170static inline void mcspi_write_cs_reg(const struct spi_device *spi, 170static inline void mcspi_write_cs_reg(const struct spi_device *spi,
@@ -172,14 +172,14 @@ static inline void mcspi_write_cs_reg(const struct spi_device *spi,
172{ 172{
173 struct omap2_mcspi_cs *cs = spi->controller_state; 173 struct omap2_mcspi_cs *cs = spi->controller_state;
174 174
175 __raw_writel(val, cs->base + idx); 175 writel_relaxed(val, cs->base + idx);
176} 176}
177 177
178static inline u32 mcspi_read_cs_reg(const struct spi_device *spi, int idx) 178static inline u32 mcspi_read_cs_reg(const struct spi_device *spi, int idx)
179{ 179{
180 struct omap2_mcspi_cs *cs = spi->controller_state; 180 struct omap2_mcspi_cs *cs = spi->controller_state;
181 181
182 return __raw_readl(cs->base + idx); 182 return readl_relaxed(cs->base + idx);
183} 183}
184 184
185static inline u32 mcspi_cached_chconf0(const struct spi_device *spi) 185static inline u32 mcspi_cached_chconf0(const struct spi_device *spi)
@@ -338,7 +338,7 @@ static void omap2_mcspi_restore_ctx(struct omap2_mcspi *mcspi)
338 mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_WAKEUPENABLE, ctx->wakeupenable); 338 mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_WAKEUPENABLE, ctx->wakeupenable);
339 339
340 list_for_each_entry(cs, &ctx->cs, node) 340 list_for_each_entry(cs, &ctx->cs, node)
341 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); 341 writel_relaxed(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
342} 342}
343 343
344static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit) 344static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit)
@@ -346,9 +346,9 @@ static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit)
346 unsigned long timeout; 346 unsigned long timeout;
347 347
348 timeout = jiffies + msecs_to_jiffies(1000); 348 timeout = jiffies + msecs_to_jiffies(1000);
349 while (!(__raw_readl(reg) & bit)) { 349 while (!(readl_relaxed(reg) & bit)) {
350 if (time_after(jiffies, timeout)) { 350 if (time_after(jiffies, timeout)) {
351 if (!(__raw_readl(reg) & bit)) 351 if (!(readl_relaxed(reg) & bit))
352 return -ETIMEDOUT; 352 return -ETIMEDOUT;
353 else 353 else
354 return 0; 354 return 0;
@@ -675,7 +675,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
675 } 675 }
676 dev_vdbg(&spi->dev, "write-%d %02x\n", 676 dev_vdbg(&spi->dev, "write-%d %02x\n",
677 word_len, *tx); 677 word_len, *tx);
678 __raw_writel(*tx++, tx_reg); 678 writel_relaxed(*tx++, tx_reg);
679 } 679 }
680 if (rx != NULL) { 680 if (rx != NULL) {
681 if (mcspi_wait_for_reg_bit(chstat_reg, 681 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -687,7 +687,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
687 if (c == 1 && tx == NULL && 687 if (c == 1 && tx == NULL &&
688 (l & OMAP2_MCSPI_CHCONF_TURBO)) { 688 (l & OMAP2_MCSPI_CHCONF_TURBO)) {
689 omap2_mcspi_set_enable(spi, 0); 689 omap2_mcspi_set_enable(spi, 0);
690 *rx++ = __raw_readl(rx_reg); 690 *rx++ = readl_relaxed(rx_reg);
691 dev_vdbg(&spi->dev, "read-%d %02x\n", 691 dev_vdbg(&spi->dev, "read-%d %02x\n",
692 word_len, *(rx - 1)); 692 word_len, *(rx - 1));
693 if (mcspi_wait_for_reg_bit(chstat_reg, 693 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -701,7 +701,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
701 omap2_mcspi_set_enable(spi, 0); 701 omap2_mcspi_set_enable(spi, 0);
702 } 702 }
703 703
704 *rx++ = __raw_readl(rx_reg); 704 *rx++ = readl_relaxed(rx_reg);
705 dev_vdbg(&spi->dev, "read-%d %02x\n", 705 dev_vdbg(&spi->dev, "read-%d %02x\n",
706 word_len, *(rx - 1)); 706 word_len, *(rx - 1));
707 } 707 }
@@ -722,7 +722,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
722 } 722 }
723 dev_vdbg(&spi->dev, "write-%d %04x\n", 723 dev_vdbg(&spi->dev, "write-%d %04x\n",
724 word_len, *tx); 724 word_len, *tx);
725 __raw_writel(*tx++, tx_reg); 725 writel_relaxed(*tx++, tx_reg);
726 } 726 }
727 if (rx != NULL) { 727 if (rx != NULL) {
728 if (mcspi_wait_for_reg_bit(chstat_reg, 728 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -734,7 +734,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
734 if (c == 2 && tx == NULL && 734 if (c == 2 && tx == NULL &&
735 (l & OMAP2_MCSPI_CHCONF_TURBO)) { 735 (l & OMAP2_MCSPI_CHCONF_TURBO)) {
736 omap2_mcspi_set_enable(spi, 0); 736 omap2_mcspi_set_enable(spi, 0);
737 *rx++ = __raw_readl(rx_reg); 737 *rx++ = readl_relaxed(rx_reg);
738 dev_vdbg(&spi->dev, "read-%d %04x\n", 738 dev_vdbg(&spi->dev, "read-%d %04x\n",
739 word_len, *(rx - 1)); 739 word_len, *(rx - 1));
740 if (mcspi_wait_for_reg_bit(chstat_reg, 740 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -748,7 +748,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
748 omap2_mcspi_set_enable(spi, 0); 748 omap2_mcspi_set_enable(spi, 0);
749 } 749 }
750 750
751 *rx++ = __raw_readl(rx_reg); 751 *rx++ = readl_relaxed(rx_reg);
752 dev_vdbg(&spi->dev, "read-%d %04x\n", 752 dev_vdbg(&spi->dev, "read-%d %04x\n",
753 word_len, *(rx - 1)); 753 word_len, *(rx - 1));
754 } 754 }
@@ -769,7 +769,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
769 } 769 }
770 dev_vdbg(&spi->dev, "write-%d %08x\n", 770 dev_vdbg(&spi->dev, "write-%d %08x\n",
771 word_len, *tx); 771 word_len, *tx);
772 __raw_writel(*tx++, tx_reg); 772 writel_relaxed(*tx++, tx_reg);
773 } 773 }
774 if (rx != NULL) { 774 if (rx != NULL) {
775 if (mcspi_wait_for_reg_bit(chstat_reg, 775 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -781,7 +781,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
781 if (c == 4 && tx == NULL && 781 if (c == 4 && tx == NULL &&
782 (l & OMAP2_MCSPI_CHCONF_TURBO)) { 782 (l & OMAP2_MCSPI_CHCONF_TURBO)) {
783 omap2_mcspi_set_enable(spi, 0); 783 omap2_mcspi_set_enable(spi, 0);
784 *rx++ = __raw_readl(rx_reg); 784 *rx++ = readl_relaxed(rx_reg);
785 dev_vdbg(&spi->dev, "read-%d %08x\n", 785 dev_vdbg(&spi->dev, "read-%d %08x\n",
786 word_len, *(rx - 1)); 786 word_len, *(rx - 1));
787 if (mcspi_wait_for_reg_bit(chstat_reg, 787 if (mcspi_wait_for_reg_bit(chstat_reg,
@@ -795,7 +795,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
795 omap2_mcspi_set_enable(spi, 0); 795 omap2_mcspi_set_enable(spi, 0);
796 } 796 }
797 797
798 *rx++ = __raw_readl(rx_reg); 798 *rx++ = readl_relaxed(rx_reg);
799 dev_vdbg(&spi->dev, "read-%d %08x\n", 799 dev_vdbg(&spi->dev, "read-%d %08x\n",
800 word_len, *(rx - 1)); 800 word_len, *(rx - 1));
801 } 801 }
@@ -1107,7 +1107,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
1107 1107
1108 /* RX_ONLY mode needs dummy data in TX reg */ 1108 /* RX_ONLY mode needs dummy data in TX reg */
1109 if (t->tx_buf == NULL) 1109 if (t->tx_buf == NULL)
1110 __raw_writel(0, cs->base 1110 writel_relaxed(0, cs->base
1111 + OMAP2_MCSPI_TX0); 1111 + OMAP2_MCSPI_TX0);
1112 1112
1113 if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) && 1113 if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) &&
@@ -1470,9 +1470,9 @@ static int omap2_mcspi_resume(struct device *dev)
1470 * change in account. 1470 * change in account.
1471 */ 1471 */
1472 cs->chconf0 |= OMAP2_MCSPI_CHCONF_FORCE; 1472 cs->chconf0 |= OMAP2_MCSPI_CHCONF_FORCE;
1473 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); 1473 writel_relaxed(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1474 cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE; 1474 cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE;
1475 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); 1475 writel_relaxed(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1476 } 1476 }
1477 } 1477 }
1478 pm_runtime_mark_last_busy(mcspi->dev); 1478 pm_runtime_mark_last_busy(mcspi->dev);
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index 744841e095e4..7f2121fe2622 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -434,7 +434,7 @@ static int orion_spi_probe(struct platform_device *pdev)
434 spi = spi_master_get_devdata(master); 434 spi = spi_master_get_devdata(master);
435 spi->master = master; 435 spi->master = master;
436 436
437 spi->clk = clk_get(&pdev->dev, NULL); 437 spi->clk = devm_clk_get(&pdev->dev, NULL);
438 if (IS_ERR(spi->clk)) { 438 if (IS_ERR(spi->clk)) {
439 status = PTR_ERR(spi->clk); 439 status = PTR_ERR(spi->clk);
440 goto out; 440 goto out;
@@ -465,7 +465,6 @@ static int orion_spi_probe(struct platform_device *pdev)
465 465
466out_rel_clk: 466out_rel_clk:
467 clk_disable_unprepare(spi->clk); 467 clk_disable_unprepare(spi->clk);
468 clk_put(spi->clk);
469out: 468out:
470 spi_master_put(master); 469 spi_master_put(master);
471 return status; 470 return status;
@@ -481,7 +480,6 @@ static int orion_spi_remove(struct platform_device *pdev)
481 spi = spi_master_get_devdata(master); 480 spi = spi_master_get_devdata(master);
482 481
483 clk_disable_unprepare(spi->clk); 482 clk_disable_unprepare(spi->clk);
484 clk_put(spi->clk);
485 483
486 return 0; 484 return 0;
487} 485}
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 74bc18775658..3f006d3ed2a8 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -62,7 +62,7 @@ static void ce4100_spi_remove(struct pci_dev *dev)
62 platform_device_unregister(pdev); 62 platform_device_unregister(pdev);
63} 63}
64 64
65static DEFINE_PCI_DEVICE_TABLE(ce4100_spi_devices) = { 65static const struct pci_device_id ce4100_spi_devices[] = {
66 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, 66 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) },
67 { }, 67 { },
68}; 68};
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index 40179d201966..82d2f922ffa0 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -197,7 +197,7 @@ static int hspi_transfer_one_message(struct spi_master *master,
197 197
198 hspi_write(hspi, SPTBR, tx); 198 hspi_write(hspi, SPTBR, tx);
199 199
200 /* wait recive */ 200 /* wait receive */
201 ret = hspi_status_check_timeout(hspi, 0x4, 0x4); 201 ret = hspi_status_check_timeout(hspi, 0x4, 0x4);
202 if (ret < 0) 202 if (ret < 0)
203 break; 203 break;
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index ac8795f2e700..81cc02f5f9b0 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -169,7 +169,7 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
169 169
170static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p, 170static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
171 u32 cpol, u32 cpha, 171 u32 cpol, u32 cpha,
172 u32 tx_hi_z, u32 lsb_first) 172 u32 tx_hi_z, u32 lsb_first, u32 cs_high)
173{ 173{
174 u32 tmp; 174 u32 tmp;
175 int edge; 175 int edge;
@@ -182,8 +182,12 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
182 * 1 1 11 11 1 1 182 * 1 1 11 11 1 1
183 */ 183 */
184 sh_msiof_write(p, FCTR, 0); 184 sh_msiof_write(p, FCTR, 0);
185 sh_msiof_write(p, TMDR1, 0xe2000005 | (lsb_first << 24)); 185
186 sh_msiof_write(p, RMDR1, 0x22000005 | (lsb_first << 24)); 186 tmp = 0;
187 tmp |= !cs_high << 25;
188 tmp |= lsb_first << 24;
189 sh_msiof_write(p, TMDR1, 0xe0000005 | tmp);
190 sh_msiof_write(p, RMDR1, 0x20000005 | tmp);
187 191
188 tmp = 0xa0000000; 192 tmp = 0xa0000000;
189 tmp |= cpol << 30; /* TSCKIZ */ 193 tmp |= cpol << 30; /* TSCKIZ */
@@ -417,11 +421,12 @@ static void sh_msiof_spi_chipselect(struct spi_device *spi, int is_on)
417 sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL), 421 sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL),
418 !!(spi->mode & SPI_CPHA), 422 !!(spi->mode & SPI_CPHA),
419 !!(spi->mode & SPI_3WIRE), 423 !!(spi->mode & SPI_3WIRE),
420 !!(spi->mode & SPI_LSB_FIRST)); 424 !!(spi->mode & SPI_LSB_FIRST),
425 !!(spi->mode & SPI_CS_HIGH));
421 } 426 }
422 427
423 /* use spi->controller data for CS (same strategy as spi_gpio) */ 428 /* use spi->controller data for CS (same strategy as spi_gpio) */
424 gpio_set_value((unsigned)spi->controller_data, value); 429 gpio_set_value((uintptr_t)spi->controller_data, value);
425 430
426 if (is_on == BITBANG_CS_INACTIVE) { 431 if (is_on == BITBANG_CS_INACTIVE) {
427 if (test_and_clear_bit(0, &p->flags)) { 432 if (test_and_clear_bit(0, &p->flags)) {
@@ -635,8 +640,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
635 master = spi_alloc_master(&pdev->dev, sizeof(struct sh_msiof_spi_priv)); 640 master = spi_alloc_master(&pdev->dev, sizeof(struct sh_msiof_spi_priv));
636 if (master == NULL) { 641 if (master == NULL) {
637 dev_err(&pdev->dev, "failed to allocate spi master\n"); 642 dev_err(&pdev->dev, "failed to allocate spi master\n");
638 ret = -ENOMEM; 643 return -ENOMEM;
639 goto err0;
640 } 644 }
641 645
642 p = spi_master_get_devdata(master); 646 p = spi_master_get_devdata(master);
@@ -655,32 +659,38 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
655 659
656 init_completion(&p->done); 660 init_completion(&p->done);
657 661
658 p->clk = clk_get(&pdev->dev, NULL); 662 p->clk = devm_clk_get(&pdev->dev, NULL);
659 if (IS_ERR(p->clk)) { 663 if (IS_ERR(p->clk)) {
660 dev_err(&pdev->dev, "cannot get clock\n"); 664 dev_err(&pdev->dev, "cannot get clock\n");
661 ret = PTR_ERR(p->clk); 665 ret = PTR_ERR(p->clk);
662 goto err1; 666 goto err1;
663 } 667 }
664 668
665 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
666 i = platform_get_irq(pdev, 0); 669 i = platform_get_irq(pdev, 0);
667 if (!r || i < 0) { 670 if (i < 0) {
668 dev_err(&pdev->dev, "cannot get platform resources\n"); 671 dev_err(&pdev->dev, "cannot get platform IRQ\n");
669 ret = -ENOENT; 672 ret = -ENOENT;
670 goto err2; 673 goto err1;
671 } 674 }
672 p->mapbase = ioremap_nocache(r->start, resource_size(r)); 675
673 if (!p->mapbase) { 676 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
674 dev_err(&pdev->dev, "unable to ioremap\n"); 677 p->mapbase = devm_ioremap_resource(&pdev->dev, r);
675 ret = -ENXIO; 678 if (IS_ERR(p->mapbase)) {
676 goto err2; 679 ret = PTR_ERR(p->mapbase);
680 goto err1;
677 } 681 }
678 682
679 ret = request_irq(i, sh_msiof_spi_irq, 0, 683 ret = devm_request_irq(&pdev->dev, i, sh_msiof_spi_irq, 0,
680 dev_name(&pdev->dev), p); 684 dev_name(&pdev->dev), p);
681 if (ret) { 685 if (ret) {
682 dev_err(&pdev->dev, "unable to request irq\n"); 686 dev_err(&pdev->dev, "unable to request irq\n");
683 goto err3; 687 goto err1;
688 }
689
690 ret = clk_prepare(p->clk);
691 if (ret < 0) {
692 dev_err(&pdev->dev, "unable to prepare clock\n");
693 goto err1;
684 } 694 }
685 695
686 p->pdev = pdev; 696 p->pdev = pdev;
@@ -719,13 +729,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
719 return 0; 729 return 0;
720 730
721 pm_runtime_disable(&pdev->dev); 731 pm_runtime_disable(&pdev->dev);
722 err3: 732 clk_unprepare(p->clk);
723 iounmap(p->mapbase);
724 err2:
725 clk_put(p->clk);
726 err1: 733 err1:
727 spi_master_put(master); 734 spi_master_put(master);
728 err0:
729 return ret; 735 return ret;
730} 736}
731 737
@@ -737,9 +743,7 @@ static int sh_msiof_spi_remove(struct platform_device *pdev)
737 ret = spi_bitbang_stop(&p->bitbang); 743 ret = spi_bitbang_stop(&p->bitbang);
738 if (!ret) { 744 if (!ret) {
739 pm_runtime_disable(&pdev->dev); 745 pm_runtime_disable(&pdev->dev);
740 free_irq(platform_get_irq(pdev, 0), p); 746 clk_unprepare(p->clk);
741 iounmap(p->mapbase);
742 clk_put(p->clk);
743 spi_master_put(p->bitbang.master); 747 spi_master_put(p->bitbang.master);
744 } 748 }
745 return ret; 749 return ret;
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 9322de9e13fb..2e7f38c7a961 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -217,7 +217,7 @@ struct pch_pd_dev_save {
217 struct pch_spi_board_data *board_dat; 217 struct pch_spi_board_data *board_dat;
218}; 218};
219 219
220static DEFINE_PCI_DEVICE_TABLE(pch_spi_pcidev_id) = { 220static const struct pci_device_id pch_spi_pcidev_id[] = {
221 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_GE_SPI), 1, }, 221 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_GE_SPI), 1, },
222 { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_SPI), 2, }, 222 { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_SPI), 2, },
223 { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_SPI), 1, }, 223 { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_SPI), 1, },
diff --git a/include/linux/platform_data/spi-nuc900.h b/include/linux/platform_data/spi-nuc900.h
index 2c4e0c128501..4b3f46832e19 100644
--- a/include/linux/platform_data/spi-nuc900.h
+++ b/include/linux/platform_data/spi-nuc900.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/mach-w90x900/include/mach/nuc900_spi.h
3 *
4 * Copyright (c) 2009 Nuvoton technology corporation. 2 * Copyright (c) 2009 Nuvoton technology corporation.
5 * 3 *
6 * Wan ZongShun <mcuos.com@gmail.com> 4 * Wan ZongShun <mcuos.com@gmail.com>
@@ -11,8 +9,8 @@
11 * 9 *
12 */ 10 */
13 11
14#ifndef __ASM_ARCH_SPI_H 12#ifndef __SPI_NUC900_H
15#define __ASM_ARCH_SPI_H 13#define __SPI_NUC900_H
16 14
17extern void mfp_set_groupg(struct device *dev, const char *subname); 15extern void mfp_set_groupg(struct device *dev, const char *subname);
18 16
@@ -32,4 +30,4 @@ struct nuc900_spi_chip {
32 unsigned char bits_per_word; 30 unsigned char bits_per_word;
33}; 31};
34 32
35#endif /* __ASM_ARCH_SPI_H */ 33#endif /* __SPI_NUC900_H */