aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-29 10:28:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-29 10:28:36 -0400
commit18c0635363364ca2fc2d1cbd65bbf918daf89d1a (patch)
tree6fd1975977b4ab190b77952ee8e263f66e3dc5f7 /drivers/spi
parent41684f67af75b04152a1714e1a5375dfb00ee3da (diff)
parent940ab88962bc1aff3273a8356d64577a6e386736 (diff)
Merge branch 'spi/next' of git://git.secretlab.ca/git/linux-2.6
* 'spi/next' of git://git.secretlab.ca/git/linux-2.6: drivercore: Add helper macro for platform_driver boilerplate spi: irq: Remove IRQF_DISABLED OMAP: SPI: Fix the trying to free nonexistent resource error spi/spi-ep93xx: add module.h include spi/tegra: fix compilation error in spi-tegra.c spi: spi-dw: fix all sparse warnings spi/spi-pl022: Call pl022_dma_remove(pl022) only if enable_dma is true spi/spi-pl022: calculate_effective_freq() must set rate <= requested rate spi/spi-pl022: Don't allocate more sg than required. spi/spi-pl022: Use GFP_ATOMIC for allocation from tasklet spi/spi-pl022: Resolve formatting issues
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-altera.c13
-rw-r--r--drivers/spi/spi-ath79.c13
-rw-r--r--drivers/spi/spi-atmel.c13
-rw-r--r--drivers/spi/spi-bfin-sport.c13
-rw-r--r--drivers/spi/spi-bfin5xx.c2
-rw-r--r--drivers/spi/spi-coldfire-qspi.c16
-rw-r--r--drivers/spi/spi-davinci.c20
-rw-r--r--drivers/spi/spi-dw-mid.c9
-rw-r--r--drivers/spi/spi-dw-mmio.c14
-rw-r--r--drivers/spi/spi-dw.c62
-rw-r--r--drivers/spi/spi-dw.h97
-rw-r--r--drivers/spi/spi-ep93xx.c21
-rw-r--r--drivers/spi/spi-fsl-espi.c13
-rw-r--r--drivers/spi/spi-gpio.c21
-rw-r--r--drivers/spi/spi-imx.c14
-rw-r--r--drivers/spi/spi-mpc512x-psc.c13
-rw-r--r--drivers/spi/spi-mpc52xx-psc.c13
-rw-r--r--drivers/spi/spi-mpc52xx.c14
-rw-r--r--drivers/spi/spi-nuc900.c14
-rw-r--r--drivers/spi/spi-oc-tiny.c13
-rw-r--r--drivers/spi/spi-omap2-mcspi.c7
-rw-r--r--drivers/spi/spi-pl022.c146
-rw-r--r--drivers/spi/spi-ppc4xx.c15
-rw-r--r--drivers/spi/spi-s3c24xx.c21
-rw-r--r--drivers/spi/spi-sh-msiof.c15
-rw-r--r--drivers/spi/spi-sh-sci.c13
-rw-r--r--drivers/spi/spi-sh.c15
-rw-r--r--drivers/spi/spi-stmp.c13
-rw-r--r--drivers/spi/spi-tegra.c17
-rw-r--r--drivers/spi/spi-ti-ssp.c13
-rw-r--r--drivers/spi/spi-xilinx.c13
31 files changed, 213 insertions, 483 deletions
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index 4813a63ce6fb..881c1967741d 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -320,18 +320,7 @@ static struct platform_driver altera_spi_driver = {
320 .of_match_table = altera_spi_match, 320 .of_match_table = altera_spi_match,
321 }, 321 },
322}; 322};
323 323module_platform_driver(altera_spi_driver);
324static int __init altera_spi_init(void)
325{
326 return platform_driver_register(&altera_spi_driver);
327}
328module_init(altera_spi_init);
329
330static void __exit altera_spi_exit(void)
331{
332 platform_driver_unregister(&altera_spi_driver);
333}
334module_exit(altera_spi_exit);
335 324
336MODULE_DESCRIPTION("Altera SPI driver"); 325MODULE_DESCRIPTION("Altera SPI driver");
337MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>"); 326MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index 03019bf5a5e9..024b48aed5ca 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -273,18 +273,7 @@ static struct platform_driver ath79_spi_driver = {
273 .owner = THIS_MODULE, 273 .owner = THIS_MODULE,
274 }, 274 },
275}; 275};
276 276module_platform_driver(ath79_spi_driver);
277static __init int ath79_spi_init(void)
278{
279 return platform_driver_register(&ath79_spi_driver);
280}
281module_init(ath79_spi_init);
282
283static __exit void ath79_spi_exit(void)
284{
285 platform_driver_unregister(&ath79_spi_driver);
286}
287module_exit(ath79_spi_exit);
288 277
289MODULE_DESCRIPTION("SPI controller driver for Atheros AR71XX/AR724X/AR913X"); 278MODULE_DESCRIPTION("SPI controller driver for Atheros AR71XX/AR724X/AR913X");
290MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>"); 279MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index d3bff424286f..79665e2e6ec5 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1074,18 +1074,7 @@ static struct platform_driver atmel_spi_driver = {
1074 .resume = atmel_spi_resume, 1074 .resume = atmel_spi_resume,
1075 .remove = __exit_p(atmel_spi_remove), 1075 .remove = __exit_p(atmel_spi_remove),
1076}; 1076};
1077 1077module_platform_driver(atmel_spi_driver);
1078static int __init atmel_spi_init(void)
1079{
1080 return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
1081}
1082module_init(atmel_spi_init);
1083
1084static void __exit atmel_spi_exit(void)
1085{
1086 platform_driver_unregister(&atmel_spi_driver);
1087}
1088module_exit(atmel_spi_exit);
1089 1078
1090MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver"); 1079MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
1091MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); 1080MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c
index e557ff617b11..248a2cc671a9 100644
--- a/drivers/spi/spi-bfin-sport.c
+++ b/drivers/spi/spi-bfin-sport.c
@@ -938,15 +938,4 @@ static struct platform_driver bfin_sport_spi_driver = {
938 .suspend = bfin_sport_spi_suspend, 938 .suspend = bfin_sport_spi_suspend,
939 .resume = bfin_sport_spi_resume, 939 .resume = bfin_sport_spi_resume,
940}; 940};
941 941module_platform_driver(bfin_sport_spi_driver);
942static int __init bfin_sport_spi_init(void)
943{
944 return platform_driver_register(&bfin_sport_spi_driver);
945}
946module_init(bfin_sport_spi_init);
947
948static void __exit bfin_sport_spi_exit(void)
949{
950 platform_driver_unregister(&bfin_sport_spi_driver);
951}
952module_exit(bfin_sport_spi_exit);
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index b8d25f2b7038..3b83ff8b1e2b 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -1098,7 +1098,7 @@ static int bfin_spi_setup(struct spi_device *spi)
1098 1098
1099 if (chip->pio_interrupt && !drv_data->irq_requested) { 1099 if (chip->pio_interrupt && !drv_data->irq_requested) {
1100 ret = request_irq(drv_data->spi_irq, bfin_spi_pio_irq_handler, 1100 ret = request_irq(drv_data->spi_irq, bfin_spi_pio_irq_handler,
1101 IRQF_DISABLED, "BFIN_SPI", drv_data); 1101 0, "BFIN_SPI", drv_data);
1102 if (ret) { 1102 if (ret) {
1103 dev_err(&spi->dev, "Unable to register spi IRQ\n"); 1103 dev_err(&spi->dev, "Unable to register spi IRQ\n");
1104 goto error; 1104 goto error;
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index ae2cd1c1fda8..6eee64a5d240 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -487,7 +487,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev)
487 goto fail2; 487 goto fail2;
488 } 488 }
489 489
490 status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, IRQF_DISABLED, 490 status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, 0,
491 pdev->name, mcfqspi); 491 pdev->name, mcfqspi);
492 if (status) { 492 if (status) {
493 dev_dbg(&pdev->dev, "request_irq failed\n"); 493 dev_dbg(&pdev->dev, "request_irq failed\n");
@@ -621,20 +621,10 @@ static struct platform_driver mcfqspi_driver = {
621 .driver.name = DRIVER_NAME, 621 .driver.name = DRIVER_NAME,
622 .driver.owner = THIS_MODULE, 622 .driver.owner = THIS_MODULE,
623 .driver.pm = MCFQSPI_DEV_PM_OPS, 623 .driver.pm = MCFQSPI_DEV_PM_OPS,
624 .probe = mcfqspi_probe,
624 .remove = __devexit_p(mcfqspi_remove), 625 .remove = __devexit_p(mcfqspi_remove),
625}; 626};
626 627module_platform_driver(mcfqspi_driver);
627static int __init mcfqspi_init(void)
628{
629 return platform_driver_probe(&mcfqspi_driver, mcfqspi_probe);
630}
631module_init(mcfqspi_init);
632
633static void __exit mcfqspi_exit(void)
634{
635 platform_driver_unregister(&mcfqspi_driver);
636}
637module_exit(mcfqspi_exit);
638 628
639MODULE_AUTHOR("Steven King <sfking@fdwdc.com>"); 629MODULE_AUTHOR("Steven King <sfking@fdwdc.com>");
640MODULE_DESCRIPTION("Coldfire QSPI Controller Driver"); 630MODULE_DESCRIPTION("Coldfire QSPI Controller Driver");
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 1f0ed8005c91..31bfba805cf4 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -799,7 +799,7 @@ rx_dma_failed:
799 * It will invoke spi_bitbang_start to create work queue so that client driver 799 * It will invoke spi_bitbang_start to create work queue so that client driver
800 * can register transfer method to work queue. 800 * can register transfer method to work queue.
801 */ 801 */
802static int davinci_spi_probe(struct platform_device *pdev) 802static int __devinit davinci_spi_probe(struct platform_device *pdev)
803{ 803{
804 struct spi_master *master; 804 struct spi_master *master;
805 struct davinci_spi *dspi; 805 struct davinci_spi *dspi;
@@ -984,7 +984,7 @@ err:
984 * It will also call spi_bitbang_stop to destroy the work queue which was 984 * It will also call spi_bitbang_stop to destroy the work queue which was
985 * created by spi_bitbang_start. 985 * created by spi_bitbang_start.
986 */ 986 */
987static int __exit davinci_spi_remove(struct platform_device *pdev) 987static int __devexit davinci_spi_remove(struct platform_device *pdev)
988{ 988{
989 struct davinci_spi *dspi; 989 struct davinci_spi *dspi;
990 struct spi_master *master; 990 struct spi_master *master;
@@ -1011,20 +1011,10 @@ static struct platform_driver davinci_spi_driver = {
1011 .name = "spi_davinci", 1011 .name = "spi_davinci",
1012 .owner = THIS_MODULE, 1012 .owner = THIS_MODULE,
1013 }, 1013 },
1014 .remove = __exit_p(davinci_spi_remove), 1014 .probe = davinci_spi_probe,
1015 .remove = __devexit_p(davinci_spi_remove),
1015}; 1016};
1016 1017module_platform_driver(davinci_spi_driver);
1017static int __init davinci_spi_init(void)
1018{
1019 return platform_driver_probe(&davinci_spi_driver, davinci_spi_probe);
1020}
1021module_init(davinci_spi_init);
1022
1023static void __exit davinci_spi_exit(void)
1024{
1025 platform_driver_unregister(&davinci_spi_driver);
1026}
1027module_exit(davinci_spi_exit);
1028 1018
1029MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver"); 1019MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver");
1030MODULE_LICENSE("GPL"); 1020MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index 130e55537db6..e743a45ee92c 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -116,13 +116,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
116 /* 1. setup DMA related registers */ 116 /* 1. setup DMA related registers */
117 if (cs_change) { 117 if (cs_change) {
118 spi_enable_chip(dws, 0); 118 spi_enable_chip(dws, 0);
119 dw_writew(dws, dmardlr, 0xf); 119 dw_writew(dws, DW_SPI_DMARDLR, 0xf);
120 dw_writew(dws, dmatdlr, 0x10); 120 dw_writew(dws, DW_SPI_DMATDLR, 0x10);
121 if (dws->tx_dma) 121 if (dws->tx_dma)
122 dma_ctrl |= 0x2; 122 dma_ctrl |= 0x2;
123 if (dws->rx_dma) 123 if (dws->rx_dma)
124 dma_ctrl |= 0x1; 124 dma_ctrl |= 0x1;
125 dw_writew(dws, dmacr, dma_ctrl); 125 dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
126 spi_enable_chip(dws, 1); 126 spi_enable_chip(dws, 1);
127 } 127 }
128 128
@@ -200,7 +200,8 @@ static struct dw_spi_dma_ops mid_dma_ops = {
200 200
201int dw_spi_mid_init(struct dw_spi *dws) 201int dw_spi_mid_init(struct dw_spi *dws)
202{ 202{
203 u32 *clk_reg, clk_cdiv; 203 void __iomem *clk_reg;
204 u32 clk_cdiv;
204 205
205 clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16); 206 clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16);
206 if (!clk_reg) 207 if (!clk_reg)
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index 34eb66501dbf..fac399c3022c 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -127,24 +127,14 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
127} 127}
128 128
129static struct platform_driver dw_spi_mmio_driver = { 129static struct platform_driver dw_spi_mmio_driver = {
130 .probe = dw_spi_mmio_probe,
130 .remove = __devexit_p(dw_spi_mmio_remove), 131 .remove = __devexit_p(dw_spi_mmio_remove),
131 .driver = { 132 .driver = {
132 .name = DRIVER_NAME, 133 .name = DRIVER_NAME,
133 .owner = THIS_MODULE, 134 .owner = THIS_MODULE,
134 }, 135 },
135}; 136};
136 137module_platform_driver(dw_spi_mmio_driver);
137static int __init dw_spi_mmio_init(void)
138{
139 return platform_driver_probe(&dw_spi_mmio_driver, dw_spi_mmio_probe);
140}
141module_init(dw_spi_mmio_init);
142
143static void __exit dw_spi_mmio_exit(void)
144{
145 platform_driver_unregister(&dw_spi_mmio_driver);
146}
147module_exit(dw_spi_mmio_exit);
148 138
149MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>"); 139MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>");
150MODULE_DESCRIPTION("Memory-mapped I/O interface driver for DW SPI Core"); 140MODULE_DESCRIPTION("Memory-mapped I/O interface driver for DW SPI Core");
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 857cd30b44bb..296d94f4cf72 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -88,35 +88,35 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
88 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 88 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
89 "=================================\n"); 89 "=================================\n");
90 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 90 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
91 "CTRL0: \t\t0x%08x\n", dw_readl(dws, ctrl0)); 91 "CTRL0: \t\t0x%08x\n", dw_readl(dws, DW_SPI_CTRL0));
92 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 92 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
93 "CTRL1: \t\t0x%08x\n", dw_readl(dws, ctrl1)); 93 "CTRL1: \t\t0x%08x\n", dw_readl(dws, DW_SPI_CTRL1));
94 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 94 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
95 "SSIENR: \t0x%08x\n", dw_readl(dws, ssienr)); 95 "SSIENR: \t0x%08x\n", dw_readl(dws, DW_SPI_SSIENR));
96 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 96 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
97 "SER: \t\t0x%08x\n", dw_readl(dws, ser)); 97 "SER: \t\t0x%08x\n", dw_readl(dws, DW_SPI_SER));
98 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 98 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
99 "BAUDR: \t\t0x%08x\n", dw_readl(dws, baudr)); 99 "BAUDR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_BAUDR));
100 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 100 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
101 "TXFTLR: \t0x%08x\n", dw_readl(dws, txfltr)); 101 "TXFTLR: \t0x%08x\n", dw_readl(dws, DW_SPI_TXFLTR));
102 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 102 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
103 "RXFTLR: \t0x%08x\n", dw_readl(dws, rxfltr)); 103 "RXFTLR: \t0x%08x\n", dw_readl(dws, DW_SPI_RXFLTR));
104 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 104 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
105 "TXFLR: \t\t0x%08x\n", dw_readl(dws, txflr)); 105 "TXFLR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_TXFLR));
106 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 106 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
107 "RXFLR: \t\t0x%08x\n", dw_readl(dws, rxflr)); 107 "RXFLR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_RXFLR));
108 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 108 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
109 "SR: \t\t0x%08x\n", dw_readl(dws, sr)); 109 "SR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_SR));
110 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 110 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
111 "IMR: \t\t0x%08x\n", dw_readl(dws, imr)); 111 "IMR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_IMR));
112 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 112 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
113 "ISR: \t\t0x%08x\n", dw_readl(dws, isr)); 113 "ISR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_ISR));
114 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 114 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
115 "DMACR: \t\t0x%08x\n", dw_readl(dws, dmacr)); 115 "DMACR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_DMACR));
116 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 116 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
117 "DMATDLR: \t0x%08x\n", dw_readl(dws, dmatdlr)); 117 "DMATDLR: \t0x%08x\n", dw_readl(dws, DW_SPI_DMATDLR));
118 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 118 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
119 "DMARDLR: \t0x%08x\n", dw_readl(dws, dmardlr)); 119 "DMARDLR: \t0x%08x\n", dw_readl(dws, DW_SPI_DMARDLR));
120 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len, 120 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
121 "=================================\n"); 121 "=================================\n");
122 122
@@ -166,7 +166,7 @@ static inline u32 tx_max(struct dw_spi *dws)
166 u32 tx_left, tx_room, rxtx_gap; 166 u32 tx_left, tx_room, rxtx_gap;
167 167
168 tx_left = (dws->tx_end - dws->tx) / dws->n_bytes; 168 tx_left = (dws->tx_end - dws->tx) / dws->n_bytes;
169 tx_room = dws->fifo_len - dw_readw(dws, txflr); 169 tx_room = dws->fifo_len - dw_readw(dws, DW_SPI_TXFLR);
170 170
171 /* 171 /*
172 * Another concern is about the tx/rx mismatch, we 172 * Another concern is about the tx/rx mismatch, we
@@ -187,7 +187,7 @@ static inline u32 rx_max(struct dw_spi *dws)
187{ 187{
188 u32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes; 188 u32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes;
189 189
190 return min(rx_left, (u32)dw_readw(dws, rxflr)); 190 return min(rx_left, (u32)dw_readw(dws, DW_SPI_RXFLR));
191} 191}
192 192
193static void dw_writer(struct dw_spi *dws) 193static void dw_writer(struct dw_spi *dws)
@@ -203,7 +203,7 @@ static void dw_writer(struct dw_spi *dws)
203 else 203 else
204 txw = *(u16 *)(dws->tx); 204 txw = *(u16 *)(dws->tx);
205 } 205 }
206 dw_writew(dws, dr, txw); 206 dw_writew(dws, DW_SPI_DR, txw);
207 dws->tx += dws->n_bytes; 207 dws->tx += dws->n_bytes;
208 } 208 }
209} 209}
@@ -214,7 +214,7 @@ static void dw_reader(struct dw_spi *dws)
214 u16 rxw; 214 u16 rxw;
215 215
216 while (max--) { 216 while (max--) {
217 rxw = dw_readw(dws, dr); 217 rxw = dw_readw(dws, DW_SPI_DR);
218 /* Care rx only if the transfer's original "rx" is not null */ 218 /* Care rx only if the transfer's original "rx" is not null */
219 if (dws->rx_end - dws->len) { 219 if (dws->rx_end - dws->len) {
220 if (dws->n_bytes == 1) 220 if (dws->n_bytes == 1)
@@ -322,13 +322,13 @@ EXPORT_SYMBOL_GPL(dw_spi_xfer_done);
322 322
323static irqreturn_t interrupt_transfer(struct dw_spi *dws) 323static irqreturn_t interrupt_transfer(struct dw_spi *dws)
324{ 324{
325 u16 irq_status = dw_readw(dws, isr); 325 u16 irq_status = dw_readw(dws, DW_SPI_ISR);
326 326
327 /* Error handling */ 327 /* Error handling */
328 if (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) { 328 if (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) {
329 dw_readw(dws, txoicr); 329 dw_readw(dws, DW_SPI_TXOICR);
330 dw_readw(dws, rxoicr); 330 dw_readw(dws, DW_SPI_RXOICR);
331 dw_readw(dws, rxuicr); 331 dw_readw(dws, DW_SPI_RXUICR);
332 int_error_stop(dws, "interrupt_transfer: fifo overrun/underrun"); 332 int_error_stop(dws, "interrupt_transfer: fifo overrun/underrun");
333 return IRQ_HANDLED; 333 return IRQ_HANDLED;
334 } 334 }
@@ -352,7 +352,7 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
352static irqreturn_t dw_spi_irq(int irq, void *dev_id) 352static irqreturn_t dw_spi_irq(int irq, void *dev_id)
353{ 353{
354 struct dw_spi *dws = dev_id; 354 struct dw_spi *dws = dev_id;
355 u16 irq_status = dw_readw(dws, isr) & 0x3f; 355 u16 irq_status = dw_readw(dws, DW_SPI_ISR) & 0x3f;
356 356
357 if (!irq_status) 357 if (!irq_status)
358 return IRQ_NONE; 358 return IRQ_NONE;
@@ -520,11 +520,11 @@ static void pump_transfers(unsigned long data)
520 * 2. clk_div is changed 520 * 2. clk_div is changed
521 * 3. control value changes 521 * 3. control value changes
522 */ 522 */
523 if (dw_readw(dws, ctrl0) != cr0 || cs_change || clk_div || imask) { 523 if (dw_readw(dws, DW_SPI_CTRL0) != cr0 || cs_change || clk_div || imask) {
524 spi_enable_chip(dws, 0); 524 spi_enable_chip(dws, 0);
525 525
526 if (dw_readw(dws, ctrl0) != cr0) 526 if (dw_readw(dws, DW_SPI_CTRL0) != cr0)
527 dw_writew(dws, ctrl0, cr0); 527 dw_writew(dws, DW_SPI_CTRL0, cr0);
528 528
529 spi_set_clk(dws, clk_div ? clk_div : chip->clk_div); 529 spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
530 spi_chip_sel(dws, spi->chip_select); 530 spi_chip_sel(dws, spi->chip_select);
@@ -534,7 +534,7 @@ static void pump_transfers(unsigned long data)
534 if (imask) 534 if (imask)
535 spi_umask_intr(dws, imask); 535 spi_umask_intr(dws, imask);
536 if (txint_level) 536 if (txint_level)
537 dw_writew(dws, txfltr, txint_level); 537 dw_writew(dws, DW_SPI_TXFLTR, txint_level);
538 538
539 spi_enable_chip(dws, 1); 539 spi_enable_chip(dws, 1);
540 if (cs_change) 540 if (cs_change)
@@ -790,13 +790,13 @@ static void spi_hw_init(struct dw_spi *dws)
790 if (!dws->fifo_len) { 790 if (!dws->fifo_len) {
791 u32 fifo; 791 u32 fifo;
792 for (fifo = 2; fifo <= 257; fifo++) { 792 for (fifo = 2; fifo <= 257; fifo++) {
793 dw_writew(dws, txfltr, fifo); 793 dw_writew(dws, DW_SPI_TXFLTR, fifo);
794 if (fifo != dw_readw(dws, txfltr)) 794 if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
795 break; 795 break;
796 } 796 }
797 797
798 dws->fifo_len = (fifo == 257) ? 0 : fifo; 798 dws->fifo_len = (fifo == 257) ? 0 : fifo;
799 dw_writew(dws, txfltr, 0); 799 dw_writew(dws, DW_SPI_TXFLTR, 0);
800 } 800 }
801} 801}
802 802
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index 8b7b07bf6c3f..9c57c078031e 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -4,6 +4,33 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <linux/scatterlist.h> 5#include <linux/scatterlist.h>
6 6
7/* Register offsets */
8#define DW_SPI_CTRL0 0x00
9#define DW_SPI_CTRL1 0x04
10#define DW_SPI_SSIENR 0x08
11#define DW_SPI_MWCR 0x0c
12#define DW_SPI_SER 0x10
13#define DW_SPI_BAUDR 0x14
14#define DW_SPI_TXFLTR 0x18
15#define DW_SPI_RXFLTR 0x1c
16#define DW_SPI_TXFLR 0x20
17#define DW_SPI_RXFLR 0x24
18#define DW_SPI_SR 0x28
19#define DW_SPI_IMR 0x2c
20#define DW_SPI_ISR 0x30
21#define DW_SPI_RISR 0x34
22#define DW_SPI_TXOICR 0x38
23#define DW_SPI_RXOICR 0x3c
24#define DW_SPI_RXUICR 0x40
25#define DW_SPI_MSTICR 0x44
26#define DW_SPI_ICR 0x48
27#define DW_SPI_DMACR 0x4c
28#define DW_SPI_DMATDLR 0x50
29#define DW_SPI_DMARDLR 0x54
30#define DW_SPI_IDR 0x58
31#define DW_SPI_VERSION 0x5c
32#define DW_SPI_DR 0x60
33
7/* Bit fields in CTRLR0 */ 34/* Bit fields in CTRLR0 */
8#define SPI_DFS_OFFSET 0 35#define SPI_DFS_OFFSET 0
9 36
@@ -55,35 +82,6 @@ enum dw_ssi_type {
55 SSI_NS_MICROWIRE, 82 SSI_NS_MICROWIRE,
56}; 83};
57 84
58struct dw_spi_reg {
59 u32 ctrl0;
60 u32 ctrl1;
61 u32 ssienr;
62 u32 mwcr;
63 u32 ser;
64 u32 baudr;
65 u32 txfltr;
66 u32 rxfltr;
67 u32 txflr;
68 u32 rxflr;
69 u32 sr;
70 u32 imr;
71 u32 isr;
72 u32 risr;
73 u32 txoicr;
74 u32 rxoicr;
75 u32 rxuicr;
76 u32 msticr;
77 u32 icr;
78 u32 dmacr;
79 u32 dmatdlr;
80 u32 dmardlr;
81 u32 idr;
82 u32 version;
83 u32 dr; /* Currently oper as 32 bits,
84 though only low 16 bits matters */
85} __packed;
86
87struct dw_spi; 85struct dw_spi;
88struct dw_spi_dma_ops { 86struct dw_spi_dma_ops {
89 int (*dma_init)(struct dw_spi *dws); 87 int (*dma_init)(struct dw_spi *dws);
@@ -161,23 +159,34 @@ struct dw_spi {
161#endif 159#endif
162}; 160};
163 161
164#define dw_readl(dw, name) \ 162static inline u32 dw_readl(struct dw_spi *dws, u32 offset)
165 __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name)) 163{
166#define dw_writel(dw, name, val) \ 164 return __raw_readl(dws->regs + offset);
167 __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name)) 165}
168#define dw_readw(dw, name) \ 166
169 __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name)) 167static inline void dw_writel(struct dw_spi *dws, u32 offset, u32 val)
170#define dw_writew(dw, name, val) \ 168{
171 __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name)) 169 __raw_writel(val, dws->regs + offset);
170}
171
172static inline u16 dw_readw(struct dw_spi *dws, u32 offset)
173{
174 return __raw_readw(dws->regs + offset);
175}
176
177static inline void dw_writew(struct dw_spi *dws, u32 offset, u16 val)
178{
179 __raw_writew(val, dws->regs + offset);
180}
172 181
173static inline void spi_enable_chip(struct dw_spi *dws, int enable) 182static inline void spi_enable_chip(struct dw_spi *dws, int enable)
174{ 183{
175 dw_writel(dws, ssienr, (enable ? 1 : 0)); 184 dw_writel(dws, DW_SPI_SSIENR, (enable ? 1 : 0));
176} 185}
177 186
178static inline void spi_set_clk(struct dw_spi *dws, u16 div) 187static inline void spi_set_clk(struct dw_spi *dws, u16 div)
179{ 188{
180 dw_writel(dws, baudr, div); 189 dw_writel(dws, DW_SPI_BAUDR, div);
181} 190}
182 191
183static inline void spi_chip_sel(struct dw_spi *dws, u16 cs) 192static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
@@ -188,7 +197,7 @@ static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
188 if (dws->cs_control) 197 if (dws->cs_control)
189 dws->cs_control(1); 198 dws->cs_control(1);
190 199
191 dw_writel(dws, ser, 1 << cs); 200 dw_writel(dws, DW_SPI_SER, 1 << cs);
192} 201}
193 202
194/* Disable IRQ bits */ 203/* Disable IRQ bits */
@@ -196,8 +205,8 @@ static inline void spi_mask_intr(struct dw_spi *dws, u32 mask)
196{ 205{
197 u32 new_mask; 206 u32 new_mask;
198 207
199 new_mask = dw_readl(dws, imr) & ~mask; 208 new_mask = dw_readl(dws, DW_SPI_IMR) & ~mask;
200 dw_writel(dws, imr, new_mask); 209 dw_writel(dws, DW_SPI_IMR, new_mask);
201} 210}
202 211
203/* Enable IRQ bits */ 212/* Enable IRQ bits */
@@ -205,8 +214,8 @@ static inline void spi_umask_intr(struct dw_spi *dws, u32 mask)
205{ 214{
206 u32 new_mask; 215 u32 new_mask;
207 216
208 new_mask = dw_readl(dws, imr) | mask; 217 new_mask = dw_readl(dws, DW_SPI_IMR) | mask;
209 dw_writel(dws, imr, new_mask); 218 dw_writel(dws, DW_SPI_IMR, new_mask);
210} 219}
211 220
212/* 221/*
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index 1cf645479bfe..0a282e5fcc9c 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -24,6 +24,7 @@
24#include <linux/dmaengine.h> 24#include <linux/dmaengine.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/module.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28#include <linux/workqueue.h> 29#include <linux/workqueue.h>
29#include <linux/sched.h> 30#include <linux/sched.h>
@@ -1025,7 +1026,7 @@ static void ep93xx_spi_release_dma(struct ep93xx_spi *espi)
1025 free_page((unsigned long)espi->zeropage); 1026 free_page((unsigned long)espi->zeropage);
1026} 1027}
1027 1028
1028static int __init ep93xx_spi_probe(struct platform_device *pdev) 1029static int __devinit ep93xx_spi_probe(struct platform_device *pdev)
1029{ 1030{
1030 struct spi_master *master; 1031 struct spi_master *master;
1031 struct ep93xx_spi_info *info; 1032 struct ep93xx_spi_info *info;
@@ -1150,7 +1151,7 @@ fail_release_master:
1150 return error; 1151 return error;
1151} 1152}
1152 1153
1153static int __exit ep93xx_spi_remove(struct platform_device *pdev) 1154static int __devexit ep93xx_spi_remove(struct platform_device *pdev)
1154{ 1155{
1155 struct spi_master *master = platform_get_drvdata(pdev); 1156 struct spi_master *master = platform_get_drvdata(pdev);
1156 struct ep93xx_spi *espi = spi_master_get_devdata(master); 1157 struct ep93xx_spi *espi = spi_master_get_devdata(master);
@@ -1196,20 +1197,10 @@ static struct platform_driver ep93xx_spi_driver = {
1196 .name = "ep93xx-spi", 1197 .name = "ep93xx-spi",
1197 .owner = THIS_MODULE, 1198 .owner = THIS_MODULE,
1198 }, 1199 },
1199 .remove = __exit_p(ep93xx_spi_remove), 1200 .probe = ep93xx_spi_probe,
1201 .remove = __devexit_p(ep93xx_spi_remove),
1200}; 1202};
1201 1203module_platform_driver(ep93xx_spi_driver);
1202static int __init ep93xx_spi_init(void)
1203{
1204 return platform_driver_probe(&ep93xx_spi_driver, ep93xx_spi_probe);
1205}
1206module_init(ep93xx_spi_init);
1207
1208static void __exit ep93xx_spi_exit(void)
1209{
1210 platform_driver_unregister(&ep93xx_spi_driver);
1211}
1212module_exit(ep93xx_spi_exit);
1213 1204
1214MODULE_DESCRIPTION("EP93xx SPI Controller driver"); 1205MODULE_DESCRIPTION("EP93xx SPI Controller driver");
1215MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>"); 1206MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 54e499d5f92c..d770f03705c3 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -744,18 +744,7 @@ static struct platform_driver fsl_espi_driver = {
744 .probe = of_fsl_espi_probe, 744 .probe = of_fsl_espi_probe,
745 .remove = __devexit_p(of_fsl_espi_remove), 745 .remove = __devexit_p(of_fsl_espi_remove),
746}; 746};
747 747module_platform_driver(fsl_espi_driver);
748static int __init fsl_espi_init(void)
749{
750 return platform_driver_register(&fsl_espi_driver);
751}
752module_init(fsl_espi_init);
753
754static void __exit fsl_espi_exit(void)
755{
756 platform_driver_unregister(&fsl_espi_driver);
757}
758module_exit(fsl_espi_exit);
759 748
760MODULE_AUTHOR("Mingkai Hu"); 749MODULE_AUTHOR("Mingkai Hu");
761MODULE_DESCRIPTION("Enhanced Freescale SPI Driver"); 750MODULE_DESCRIPTION("Enhanced Freescale SPI Driver");
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0e88ab745490..635ff08b377f 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -311,7 +311,7 @@ done:
311 return value; 311 return value;
312} 312}
313 313
314static int __init spi_gpio_probe(struct platform_device *pdev) 314static int __devinit spi_gpio_probe(struct platform_device *pdev)
315{ 315{
316 int status; 316 int status;
317 struct spi_master *master; 317 struct spi_master *master;
@@ -379,7 +379,7 @@ gpio_free:
379 return status; 379 return status;
380} 380}
381 381
382static int __exit spi_gpio_remove(struct platform_device *pdev) 382static int __devexit spi_gpio_remove(struct platform_device *pdev)
383{ 383{
384 struct spi_gpio *spi_gpio; 384 struct spi_gpio *spi_gpio;
385 struct spi_gpio_platform_data *pdata; 385 struct spi_gpio_platform_data *pdata;
@@ -408,21 +408,10 @@ MODULE_ALIAS("platform:" DRIVER_NAME);
408static struct platform_driver spi_gpio_driver = { 408static struct platform_driver spi_gpio_driver = {
409 .driver.name = DRIVER_NAME, 409 .driver.name = DRIVER_NAME,
410 .driver.owner = THIS_MODULE, 410 .driver.owner = THIS_MODULE,
411 .remove = __exit_p(spi_gpio_remove), 411 .probe = spi_gpio_probe,
412 .remove = __devexit_p(spi_gpio_remove),
412}; 413};
413 414module_platform_driver(spi_gpio_driver);
414static int __init spi_gpio_init(void)
415{
416 return platform_driver_probe(&spi_gpio_driver, spi_gpio_probe);
417}
418module_init(spi_gpio_init);
419
420static void __exit spi_gpio_exit(void)
421{
422 platform_driver_unregister(&spi_gpio_driver);
423}
424module_exit(spi_gpio_exit);
425
426 415
427MODULE_DESCRIPTION("SPI master driver using generic bitbanged GPIO "); 416MODULE_DESCRIPTION("SPI master driver using generic bitbanged GPIO ");
428MODULE_AUTHOR("David Brownell"); 417MODULE_AUTHOR("David Brownell");
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index fa594d604aca..c6e697f5e007 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -929,19 +929,7 @@ static struct platform_driver spi_imx_driver = {
929 .probe = spi_imx_probe, 929 .probe = spi_imx_probe,
930 .remove = __devexit_p(spi_imx_remove), 930 .remove = __devexit_p(spi_imx_remove),
931}; 931};
932 932module_platform_driver(spi_imx_driver);
933static int __init spi_imx_init(void)
934{
935 return platform_driver_register(&spi_imx_driver);
936}
937
938static void __exit spi_imx_exit(void)
939{
940 platform_driver_unregister(&spi_imx_driver);
941}
942
943module_init(spi_imx_init);
944module_exit(spi_imx_exit);
945 933
946MODULE_DESCRIPTION("SPI Master Controller driver"); 934MODULE_DESCRIPTION("SPI Master Controller driver");
947MODULE_AUTHOR("Sascha Hauer, Pengutronix"); 935MODULE_AUTHOR("Sascha Hauer, Pengutronix");
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 6a5b4238fb6b..4c63f772780a 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -559,18 +559,7 @@ static struct platform_driver mpc512x_psc_spi_of_driver = {
559 .of_match_table = mpc512x_psc_spi_of_match, 559 .of_match_table = mpc512x_psc_spi_of_match,
560 }, 560 },
561}; 561};
562 562module_platform_driver(mpc512x_psc_spi_of_driver);
563static int __init mpc512x_psc_spi_init(void)
564{
565 return platform_driver_register(&mpc512x_psc_spi_of_driver);
566}
567module_init(mpc512x_psc_spi_init);
568
569static void __exit mpc512x_psc_spi_exit(void)
570{
571 platform_driver_unregister(&mpc512x_psc_spi_of_driver);
572}
573module_exit(mpc512x_psc_spi_exit);
574 563
575MODULE_AUTHOR("John Rigby"); 564MODULE_AUTHOR("John Rigby");
576MODULE_DESCRIPTION("MPC512x PSC SPI Driver"); 565MODULE_DESCRIPTION("MPC512x PSC SPI Driver");
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c
index e30baf0852ac..66047156d90d 100644
--- a/drivers/spi/spi-mpc52xx-psc.c
+++ b/drivers/spi/spi-mpc52xx-psc.c
@@ -511,18 +511,7 @@ static struct platform_driver mpc52xx_psc_spi_of_driver = {
511 .of_match_table = mpc52xx_psc_spi_of_match, 511 .of_match_table = mpc52xx_psc_spi_of_match,
512 }, 512 },
513}; 513};
514 514module_platform_driver(mpc52xx_psc_spi_of_driver);
515static int __init mpc52xx_psc_spi_init(void)
516{
517 return platform_driver_register(&mpc52xx_psc_spi_of_driver);
518}
519module_init(mpc52xx_psc_spi_init);
520
521static void __exit mpc52xx_psc_spi_exit(void)
522{
523 platform_driver_unregister(&mpc52xx_psc_spi_of_driver);
524}
525module_exit(mpc52xx_psc_spi_exit);
526 515
527MODULE_AUTHOR("Dragos Carp"); 516MODULE_AUTHOR("Dragos Carp");
528MODULE_DESCRIPTION("MPC52xx PSC SPI Driver"); 517MODULE_DESCRIPTION("MPC52xx PSC SPI Driver");
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 015a974bed72..57633d963456 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -564,16 +564,4 @@ static struct platform_driver mpc52xx_spi_of_driver = {
564 .probe = mpc52xx_spi_probe, 564 .probe = mpc52xx_spi_probe,
565 .remove = __devexit_p(mpc52xx_spi_remove), 565 .remove = __devexit_p(mpc52xx_spi_remove),
566}; 566};
567 567module_platform_driver(mpc52xx_spi_of_driver);
568static int __init mpc52xx_spi_init(void)
569{
570 return platform_driver_register(&mpc52xx_spi_of_driver);
571}
572module_init(mpc52xx_spi_init);
573
574static void __exit mpc52xx_spi_exit(void)
575{
576 platform_driver_unregister(&mpc52xx_spi_of_driver);
577}
578module_exit(mpc52xx_spi_exit);
579
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c
index c0a6ce81f9c0..e763254741c2 100644
--- a/drivers/spi/spi-nuc900.c
+++ b/drivers/spi/spi-nuc900.c
@@ -484,19 +484,7 @@ static struct platform_driver nuc900_spi_driver = {
484 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
485 }, 485 },
486}; 486};
487 487module_platform_driver(nuc900_spi_driver);
488static int __init nuc900_spi_init(void)
489{
490 return platform_driver_register(&nuc900_spi_driver);
491}
492
493static void __exit nuc900_spi_exit(void)
494{
495 platform_driver_unregister(&nuc900_spi_driver);
496}
497
498module_init(nuc900_spi_init);
499module_exit(nuc900_spi_exit);
500 488
501MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 489MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
502MODULE_DESCRIPTION("nuc900 spi driver!"); 490MODULE_DESCRIPTION("nuc900 spi driver!");
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index f1bde66cea19..897274e8715c 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -406,18 +406,7 @@ static struct platform_driver tiny_spi_driver = {
406 .of_match_table = tiny_spi_match, 406 .of_match_table = tiny_spi_match,
407 }, 407 },
408}; 408};
409 409module_platform_driver(tiny_spi_driver);
410static int __init tiny_spi_init(void)
411{
412 return platform_driver_register(&tiny_spi_driver);
413}
414module_init(tiny_spi_init);
415
416static void __exit tiny_spi_exit(void)
417{
418 platform_driver_unregister(&tiny_spi_driver);
419}
420module_exit(tiny_spi_exit);
421 410
422MODULE_DESCRIPTION("OpenCores tiny SPI driver"); 411MODULE_DESCRIPTION("OpenCores tiny SPI driver");
423MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>"); 412MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index fde3a2d4f120..322be7aea8b4 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1116,15 +1116,16 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
1116 status = -ENODEV; 1116 status = -ENODEV;
1117 goto err1; 1117 goto err1;
1118 } 1118 }
1119
1120 r->start += pdata->regs_offset;
1121 r->end += pdata->regs_offset;
1122 mcspi->phys = r->start;
1119 if (!request_mem_region(r->start, resource_size(r), 1123 if (!request_mem_region(r->start, resource_size(r),
1120 dev_name(&pdev->dev))) { 1124 dev_name(&pdev->dev))) {
1121 status = -EBUSY; 1125 status = -EBUSY;
1122 goto err1; 1126 goto err1;
1123 } 1127 }
1124 1128
1125 r->start += pdata->regs_offset;
1126 r->end += pdata->regs_offset;
1127 mcspi->phys = r->start;
1128 mcspi->base = ioremap(r->start, resource_size(r)); 1129 mcspi->base = ioremap(r->start, resource_size(r));
1129 if (!mcspi->base) { 1130 if (!mcspi->base) {
1130 dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); 1131 dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 1ab2fa0d37fd..f103e470cb63 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -113,7 +113,6 @@
113#define SSP_CR0_MASK_CSS_ST (0x1FUL << 16) 113#define SSP_CR0_MASK_CSS_ST (0x1FUL << 16)
114#define SSP_CR0_MASK_FRF_ST (0x3UL << 21) 114#define SSP_CR0_MASK_FRF_ST (0x3UL << 21)
115 115
116
117/* 116/*
118 * SSP Control Register 0 - SSP_CR1 117 * SSP Control Register 0 - SSP_CR1
119 */ 118 */
@@ -283,7 +282,6 @@
283 282
284#define SPI_POLLING_TIMEOUT 1000 283#define SPI_POLLING_TIMEOUT 1000
285 284
286
287/* 285/*
288 * The type of reading going on on this chip 286 * The type of reading going on on this chip
289 */ 287 */
@@ -749,7 +747,6 @@ static void readwriter(struct pl022 *pl022)
749 */ 747 */
750} 748}
751 749
752
753/** 750/**
754 * next_transfer - Move to the Next transfer in the current spi message 751 * next_transfer - Move to the Next transfer in the current spi message
755 * @pl022: SSP driver private data structure 752 * @pl022: SSP driver private data structure
@@ -1016,14 +1013,14 @@ static int configure_dma(struct pl022 *pl022)
1016 dmaengine_slave_config(txchan, &tx_conf); 1013 dmaengine_slave_config(txchan, &tx_conf);
1017 1014
1018 /* Create sglists for the transfers */ 1015 /* Create sglists for the transfers */
1019 pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1; 1016 pages = DIV_ROUND_UP(pl022->cur_transfer->len, PAGE_SIZE);
1020 dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages); 1017 dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages);
1021 1018
1022 ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_KERNEL); 1019 ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC);
1023 if (ret) 1020 if (ret)
1024 goto err_alloc_rx_sg; 1021 goto err_alloc_rx_sg;
1025 1022
1026 ret = sg_alloc_table(&pl022->sgt_tx, pages, GFP_KERNEL); 1023 ret = sg_alloc_table(&pl022->sgt_tx, pages, GFP_ATOMIC);
1027 if (ret) 1024 if (ret)
1028 goto err_alloc_tx_sg; 1025 goto err_alloc_tx_sg;
1029 1026
@@ -1531,8 +1528,7 @@ static void pump_messages(struct work_struct *work)
1531 /* Initial message state */ 1528 /* Initial message state */
1532 pl022->cur_msg->state = STATE_START; 1529 pl022->cur_msg->state = STATE_START;
1533 pl022->cur_transfer = list_entry(pl022->cur_msg->transfers.next, 1530 pl022->cur_transfer = list_entry(pl022->cur_msg->transfers.next,
1534 struct spi_transfer, 1531 struct spi_transfer, transfer_list);
1535 transfer_list);
1536 1532
1537 /* Setup the SPI using the per chip configuration */ 1533 /* Setup the SPI using the per chip configuration */
1538 pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); 1534 pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
@@ -1551,7 +1547,6 @@ static void pump_messages(struct work_struct *work)
1551 do_interrupt_dma_transfer(pl022); 1547 do_interrupt_dma_transfer(pl022);
1552} 1548}
1553 1549
1554
1555static int __init init_queue(struct pl022 *pl022) 1550static int __init init_queue(struct pl022 *pl022)
1556{ 1551{
1557 INIT_LIST_HEAD(&pl022->queue); 1552 INIT_LIST_HEAD(&pl022->queue);
@@ -1560,8 +1555,8 @@ static int __init init_queue(struct pl022 *pl022)
1560 pl022->running = false; 1555 pl022->running = false;
1561 pl022->busy = false; 1556 pl022->busy = false;
1562 1557
1563 tasklet_init(&pl022->pump_transfers, 1558 tasklet_init(&pl022->pump_transfers, pump_transfers,
1564 pump_transfers, (unsigned long)pl022); 1559 (unsigned long)pl022);
1565 1560
1566 INIT_WORK(&pl022->pump_messages, pump_messages); 1561 INIT_WORK(&pl022->pump_messages, pump_messages);
1567 pl022->workqueue = create_singlethread_workqueue( 1562 pl022->workqueue = create_singlethread_workqueue(
@@ -1572,7 +1567,6 @@ static int __init init_queue(struct pl022 *pl022)
1572 return 0; 1567 return 0;
1573} 1568}
1574 1569
1575
1576static int start_queue(struct pl022 *pl022) 1570static int start_queue(struct pl022 *pl022)
1577{ 1571{
1578 unsigned long flags; 1572 unsigned long flags;
@@ -1595,7 +1589,6 @@ static int start_queue(struct pl022 *pl022)
1595 return 0; 1589 return 0;
1596} 1590}
1597 1591
1598
1599static int stop_queue(struct pl022 *pl022) 1592static int stop_queue(struct pl022 *pl022)
1600{ 1593{
1601 unsigned long flags; 1594 unsigned long flags;
@@ -1791,71 +1784,70 @@ static int pl022_transfer(struct spi_device *spi, struct spi_message *msg)
1791 return 0; 1784 return 0;
1792} 1785}
1793 1786
1794static int calculate_effective_freq(struct pl022 *pl022, 1787static inline u32 spi_rate(u32 rate, u16 cpsdvsr, u16 scr)
1795 int freq, 1788{
1796 struct ssp_clock_params *clk_freq) 1789 return rate / (cpsdvsr * (1 + scr));
1790}
1791
1792static int calculate_effective_freq(struct pl022 *pl022, int freq, struct
1793 ssp_clock_params * clk_freq)
1797{ 1794{
1798 /* Lets calculate the frequency parameters */ 1795 /* Lets calculate the frequency parameters */
1799 u16 cpsdvsr = 2; 1796 u16 cpsdvsr = CPSDVR_MIN, scr = SCR_MIN;
1800 u16 scr = 0; 1797 u32 rate, max_tclk, min_tclk, best_freq = 0, best_cpsdvsr = 0,
1801 bool freq_found = false; 1798 best_scr = 0, tmp, found = 0;
1802 u32 rate;
1803 u32 max_tclk;
1804 u32 min_tclk;
1805 1799
1806 rate = clk_get_rate(pl022->clk); 1800 rate = clk_get_rate(pl022->clk);
1807 /* cpsdvscr = 2 & scr 0 */ 1801 /* cpsdvscr = 2 & scr 0 */
1808 max_tclk = (rate / (CPSDVR_MIN * (1 + SCR_MIN))); 1802 max_tclk = spi_rate(rate, CPSDVR_MIN, SCR_MIN);
1809 /* cpsdvsr = 254 & scr = 255 */ 1803 /* cpsdvsr = 254 & scr = 255 */
1810 min_tclk = (rate / (CPSDVR_MAX * (1 + SCR_MAX))); 1804 min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX);
1811 1805
1812 if ((freq <= max_tclk) && (freq >= min_tclk)) { 1806 if (!((freq <= max_tclk) && (freq >= min_tclk))) {
1813 while (cpsdvsr <= CPSDVR_MAX && !freq_found) {
1814 while (scr <= SCR_MAX && !freq_found) {
1815 if ((rate /
1816 (cpsdvsr * (1 + scr))) > freq)
1817 scr += 1;
1818 else {
1819 /*
1820 * This bool is made true when
1821 * effective frequency >=
1822 * target frequency is found
1823 */
1824 freq_found = true;
1825 if ((rate /
1826 (cpsdvsr * (1 + scr))) != freq) {
1827 if (scr == SCR_MIN) {
1828 cpsdvsr -= 2;
1829 scr = SCR_MAX;
1830 } else
1831 scr -= 1;
1832 }
1833 }
1834 }
1835 if (!freq_found) {
1836 cpsdvsr += 2;
1837 scr = SCR_MIN;
1838 }
1839 }
1840 if (cpsdvsr != 0) {
1841 dev_dbg(&pl022->adev->dev,
1842 "SSP Effective Frequency is %u\n",
1843 (rate / (cpsdvsr * (1 + scr))));
1844 clk_freq->cpsdvsr = (u8) (cpsdvsr & 0xFF);
1845 clk_freq->scr = (u8) (scr & 0xFF);
1846 dev_dbg(&pl022->adev->dev,
1847 "SSP cpsdvsr = %d, scr = %d\n",
1848 clk_freq->cpsdvsr, clk_freq->scr);
1849 }
1850 } else {
1851 dev_err(&pl022->adev->dev, 1807 dev_err(&pl022->adev->dev,
1852 "controller data is incorrect: out of range frequency"); 1808 "controller data is incorrect: out of range frequency");
1853 return -EINVAL; 1809 return -EINVAL;
1854 } 1810 }
1811
1812 /*
1813 * best_freq will give closest possible available rate (<= requested
1814 * freq) for all values of scr & cpsdvsr.
1815 */
1816 while ((cpsdvsr <= CPSDVR_MAX) && !found) {
1817 while (scr <= SCR_MAX) {
1818 tmp = spi_rate(rate, cpsdvsr, scr);
1819
1820 if (tmp > freq)
1821 scr++;
1822 /*
1823 * If found exact value, update and break.
1824 * If found more closer value, update and continue.
1825 */
1826 else if ((tmp == freq) || (tmp > best_freq)) {
1827 best_freq = tmp;
1828 best_cpsdvsr = cpsdvsr;
1829 best_scr = scr;
1830
1831 if (tmp == freq)
1832 break;
1833 }
1834 scr++;
1835 }
1836 cpsdvsr += 2;
1837 scr = SCR_MIN;
1838 }
1839
1840 clk_freq->cpsdvsr = (u8) (best_cpsdvsr & 0xFF);
1841 clk_freq->scr = (u8) (best_scr & 0xFF);
1842 dev_dbg(&pl022->adev->dev,
1843 "SSP Target Frequency is: %u, Effective Frequency is %u\n",
1844 freq, best_freq);
1845 dev_dbg(&pl022->adev->dev, "SSP cpsdvsr = %d, scr = %d\n",
1846 clk_freq->cpsdvsr, clk_freq->scr);
1847
1855 return 0; 1848 return 0;
1856} 1849}
1857 1850
1858
1859/* 1851/*
1860 * A piece of default chip info unless the platform 1852 * A piece of default chip info unless the platform
1861 * supplies it. 1853 * supplies it.
@@ -1873,7 +1865,6 @@ static const struct pl022_config_chip pl022_default_chip_info = {
1873 .cs_control = null_cs_control, 1865 .cs_control = null_cs_control,
1874}; 1866};
1875 1867
1876
1877/** 1868/**
1878 * pl022_setup - setup function registered to SPI master framework 1869 * pl022_setup - setup function registered to SPI master framework
1879 * @spi: spi device which is requesting setup 1870 * @spi: spi device which is requesting setup
@@ -1950,7 +1941,6 @@ static int pl022_setup(struct spi_device *spi)
1950 goto err_config_params; 1941 goto err_config_params;
1951 } 1942 }
1952 1943
1953
1954 status = verify_controller_parameters(pl022, chip_info); 1944 status = verify_controller_parameters(pl022, chip_info);
1955 if (status) { 1945 if (status) {
1956 dev_err(&spi->dev, "controller data is incorrect"); 1946 dev_err(&spi->dev, "controller data is incorrect");
@@ -2090,7 +2080,8 @@ static int pl022_setup(struct spi_device *spi)
2090 } 2080 }
2091 SSP_WRITE_BITS(chip->cr1, SSP_DISABLED, SSP_CR1_MASK_SSE, 1); 2081 SSP_WRITE_BITS(chip->cr1, SSP_DISABLED, SSP_CR1_MASK_SSE, 1);
2092 SSP_WRITE_BITS(chip->cr1, chip_info->hierarchy, SSP_CR1_MASK_MS, 2); 2082 SSP_WRITE_BITS(chip->cr1, chip_info->hierarchy, SSP_CR1_MASK_MS, 2);
2093 SSP_WRITE_BITS(chip->cr1, chip_info->slave_tx_disable, SSP_CR1_MASK_SOD, 3); 2083 SSP_WRITE_BITS(chip->cr1, chip_info->slave_tx_disable, SSP_CR1_MASK_SOD,
2084 3);
2094 2085
2095 /* Save controller_state */ 2086 /* Save controller_state */
2096 spi_set_ctldata(spi, chip); 2087 spi_set_ctldata(spi, chip);
@@ -2116,7 +2107,6 @@ static void pl022_cleanup(struct spi_device *spi)
2116 kfree(chip); 2107 kfree(chip);
2117} 2108}
2118 2109
2119
2120static int __devinit 2110static int __devinit
2121pl022_probe(struct amba_device *adev, const struct amba_id *id) 2111pl022_probe(struct amba_device *adev, const struct amba_id *id)
2122{ 2112{
@@ -2242,7 +2232,9 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
2242 err_start_queue: 2232 err_start_queue:
2243 err_init_queue: 2233 err_init_queue:
2244 destroy_queue(pl022); 2234 destroy_queue(pl022);
2245 pl022_dma_remove(pl022); 2235 if (platform_info->enable_dma)
2236 pl022_dma_remove(pl022);
2237
2246 free_irq(adev->irq[0], pl022); 2238 free_irq(adev->irq[0], pl022);
2247 err_no_irq: 2239 err_no_irq:
2248 clk_unprepare(pl022->clk); 2240 clk_unprepare(pl022->clk);
@@ -2277,7 +2269,9 @@ pl022_remove(struct amba_device *adev)
2277 if (destroy_queue(pl022) != 0) 2269 if (destroy_queue(pl022) != 0)
2278 dev_err(&adev->dev, "queue remove failed\n"); 2270 dev_err(&adev->dev, "queue remove failed\n");
2279 load_ssp_default_config(pl022); 2271 load_ssp_default_config(pl022);
2280 pl022_dma_remove(pl022); 2272 if (pl022->master_info->enable_dma)
2273 pl022_dma_remove(pl022);
2274
2281 free_irq(adev->irq[0], pl022); 2275 free_irq(adev->irq[0], pl022);
2282 clk_disable(pl022->clk); 2276 clk_disable(pl022->clk);
2283 clk_unprepare(pl022->clk); 2277 clk_unprepare(pl022->clk);
@@ -2364,7 +2358,6 @@ static struct vendor_data vendor_arm = {
2364 .loopback = true, 2358 .loopback = true,
2365}; 2359};
2366 2360
2367
2368static struct vendor_data vendor_st = { 2361static struct vendor_data vendor_st = {
2369 .fifodepth = 32, 2362 .fifodepth = 32,
2370 .max_bpw = 32, 2363 .max_bpw = 32,
@@ -2419,9 +2412,9 @@ static struct amba_id pl022_ids[] = {
2419 * and 32 locations deep TX/RX FIFO but no extended 2412 * and 32 locations deep TX/RX FIFO but no extended
2420 * CR0/CR1 register 2413 * CR0/CR1 register
2421 */ 2414 */
2422 .id = 0x00080023, 2415 .id = 0x00080023,
2423 .mask = 0xffffffff, 2416 .mask = 0xffffffff,
2424 .data = &vendor_st_pl023, 2417 .data = &vendor_st_pl023,
2425 }, 2418 },
2426 { 2419 {
2427 .id = 0x10080023, 2420 .id = 0x10080023,
@@ -2441,19 +2434,16 @@ static struct amba_driver pl022_driver = {
2441 .remove = __devexit_p(pl022_remove), 2434 .remove = __devexit_p(pl022_remove),
2442}; 2435};
2443 2436
2444
2445static int __init pl022_init(void) 2437static int __init pl022_init(void)
2446{ 2438{
2447 return amba_driver_register(&pl022_driver); 2439 return amba_driver_register(&pl022_driver);
2448} 2440}
2449
2450subsys_initcall(pl022_init); 2441subsys_initcall(pl022_init);
2451 2442
2452static void __exit pl022_exit(void) 2443static void __exit pl022_exit(void)
2453{ 2444{
2454 amba_driver_unregister(&pl022_driver); 2445 amba_driver_unregister(&pl022_driver);
2455} 2446}
2456
2457module_exit(pl022_exit); 2447module_exit(pl022_exit);
2458 2448
2459MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); 2449MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index b267fd901e54..98ec53285fc7 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -514,7 +514,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op)
514 /* Request IRQ */ 514 /* Request IRQ */
515 hw->irqnum = irq_of_parse_and_map(np, 0); 515 hw->irqnum = irq_of_parse_and_map(np, 0);
516 ret = request_irq(hw->irqnum, spi_ppc4xx_int, 516 ret = request_irq(hw->irqnum, spi_ppc4xx_int,
517 IRQF_DISABLED, "spi_ppc4xx_of", (void *)hw); 517 0, "spi_ppc4xx_of", (void *)hw);
518 if (ret) { 518 if (ret) {
519 dev_err(dev, "unable to allocate interrupt\n"); 519 dev_err(dev, "unable to allocate interrupt\n");
520 goto free_gpios; 520 goto free_gpios;
@@ -594,18 +594,7 @@ static struct platform_driver spi_ppc4xx_of_driver = {
594 .of_match_table = spi_ppc4xx_of_match, 594 .of_match_table = spi_ppc4xx_of_match,
595 }, 595 },
596}; 596};
597 597module_platform_driver(spi_ppc4xx_of_driver);
598static int __init spi_ppc4xx_init(void)
599{
600 return platform_driver_register(&spi_ppc4xx_of_driver);
601}
602module_init(spi_ppc4xx_init);
603
604static void __exit spi_ppc4xx_exit(void)
605{
606 platform_driver_unregister(&spi_ppc4xx_of_driver);
607}
608module_exit(spi_ppc4xx_exit);
609 598
610MODULE_AUTHOR("Gary Jennejohn & Stefan Roese"); 599MODULE_AUTHOR("Gary Jennejohn & Stefan Roese");
611MODULE_DESCRIPTION("Simple PPC4xx SPI Driver"); 600MODULE_DESCRIPTION("Simple PPC4xx SPI Driver");
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index 1996ac57ef91..b857a3e7af94 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -505,7 +505,7 @@ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
505 } 505 }
506} 506}
507 507
508static int __init s3c24xx_spi_probe(struct platform_device *pdev) 508static int __devinit s3c24xx_spi_probe(struct platform_device *pdev)
509{ 509{
510 struct s3c2410_spi_info *pdata; 510 struct s3c2410_spi_info *pdata;
511 struct s3c24xx_spi *hw; 511 struct s3c24xx_spi *hw;
@@ -661,7 +661,7 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
661 return err; 661 return err;
662} 662}
663 663
664static int __exit s3c24xx_spi_remove(struct platform_device *dev) 664static int __devexit s3c24xx_spi_remove(struct platform_device *dev)
665{ 665{
666 struct s3c24xx_spi *hw = platform_get_drvdata(dev); 666 struct s3c24xx_spi *hw = platform_get_drvdata(dev);
667 667
@@ -719,26 +719,15 @@ static const struct dev_pm_ops s3c24xx_spi_pmops = {
719 719
720MODULE_ALIAS("platform:s3c2410-spi"); 720MODULE_ALIAS("platform:s3c2410-spi");
721static struct platform_driver s3c24xx_spi_driver = { 721static struct platform_driver s3c24xx_spi_driver = {
722 .remove = __exit_p(s3c24xx_spi_remove), 722 .probe = s3c24xx_spi_probe,
723 .remove = __devexit_p(s3c24xx_spi_remove),
723 .driver = { 724 .driver = {
724 .name = "s3c2410-spi", 725 .name = "s3c2410-spi",
725 .owner = THIS_MODULE, 726 .owner = THIS_MODULE,
726 .pm = S3C24XX_SPI_PMOPS, 727 .pm = S3C24XX_SPI_PMOPS,
727 }, 728 },
728}; 729};
729 730module_platform_driver(s3c24xx_spi_driver);
730static int __init s3c24xx_spi_init(void)
731{
732 return platform_driver_probe(&s3c24xx_spi_driver, s3c24xx_spi_probe);
733}
734
735static void __exit s3c24xx_spi_exit(void)
736{
737 platform_driver_unregister(&s3c24xx_spi_driver);
738}
739
740module_init(s3c24xx_spi_init);
741module_exit(s3c24xx_spi_exit);
742 731
743MODULE_DESCRIPTION("S3C24XX SPI Driver"); 732MODULE_DESCRIPTION("S3C24XX SPI Driver");
744MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 733MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index e00d94b22250..0f4834ae28cd 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -635,7 +635,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
635 goto err2; 635 goto err2;
636 } 636 }
637 637
638 ret = request_irq(i, sh_msiof_spi_irq, IRQF_DISABLED, 638 ret = request_irq(i, sh_msiof_spi_irq, 0,
639 dev_name(&pdev->dev), p); 639 dev_name(&pdev->dev), p);
640 if (ret) { 640 if (ret) {
641 dev_err(&pdev->dev, "unable to request irq\n"); 641 dev_err(&pdev->dev, "unable to request irq\n");
@@ -730,18 +730,7 @@ static struct platform_driver sh_msiof_spi_drv = {
730 .pm = &sh_msiof_spi_dev_pm_ops, 730 .pm = &sh_msiof_spi_dev_pm_ops,
731 }, 731 },
732}; 732};
733 733module_platform_driver(sh_msiof_spi_drv);
734static int __init sh_msiof_spi_init(void)
735{
736 return platform_driver_register(&sh_msiof_spi_drv);
737}
738module_init(sh_msiof_spi_init);
739
740static void __exit sh_msiof_spi_exit(void)
741{
742 platform_driver_unregister(&sh_msiof_spi_drv);
743}
744module_exit(sh_msiof_spi_exit);
745 734
746MODULE_DESCRIPTION("SuperH MSIOF SPI Master Interface Driver"); 735MODULE_DESCRIPTION("SuperH MSIOF SPI Master Interface Driver");
747MODULE_AUTHOR("Magnus Damm"); 736MODULE_AUTHOR("Magnus Damm");
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c
index e7779c09f6ef..8844bc342782 100644
--- a/drivers/spi/spi-sh-sci.c
+++ b/drivers/spi/spi-sh-sci.c
@@ -186,18 +186,7 @@ static struct platform_driver sh_sci_spi_drv = {
186 .owner = THIS_MODULE, 186 .owner = THIS_MODULE,
187 }, 187 },
188}; 188};
189 189module_platform_driver(sh_sci_spi_drv);
190static int __init sh_sci_spi_init(void)
191{
192 return platform_driver_register(&sh_sci_spi_drv);
193}
194module_init(sh_sci_spi_init);
195
196static void __exit sh_sci_spi_exit(void)
197{
198 platform_driver_unregister(&sh_sci_spi_drv);
199}
200module_exit(sh_sci_spi_exit);
201 190
202MODULE_DESCRIPTION("SH SCI SPI Driver"); 191MODULE_DESCRIPTION("SH SCI SPI Driver");
203MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); 192MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
index 9eedd71ad898..70c8af9f7ccc 100644
--- a/drivers/spi/spi-sh.c
+++ b/drivers/spi/spi-sh.c
@@ -484,7 +484,7 @@ static int __devinit spi_sh_probe(struct platform_device *pdev)
484 goto error2; 484 goto error2;
485 } 485 }
486 486
487 ret = request_irq(irq, spi_sh_irq, IRQF_DISABLED, "spi_sh", ss); 487 ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss);
488 if (ret < 0) { 488 if (ret < 0) {
489 dev_err(&pdev->dev, "request_irq error\n"); 489 dev_err(&pdev->dev, "request_irq error\n");
490 goto error3; 490 goto error3;
@@ -524,18 +524,7 @@ static struct platform_driver spi_sh_driver = {
524 .owner = THIS_MODULE, 524 .owner = THIS_MODULE,
525 }, 525 },
526}; 526};
527 527module_platform_driver(spi_sh_driver);
528static int __init spi_sh_init(void)
529{
530 return platform_driver_register(&spi_sh_driver);
531}
532module_init(spi_sh_init);
533
534static void __exit spi_sh_exit(void)
535{
536 platform_driver_unregister(&spi_sh_driver);
537}
538module_exit(spi_sh_exit);
539 528
540MODULE_DESCRIPTION("SH SPI bus driver"); 529MODULE_DESCRIPTION("SH SPI bus driver");
541MODULE_LICENSE("GPL"); 530MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-stmp.c b/drivers/spi/spi-stmp.c
index fadff76eb7e0..58e385285323 100644
--- a/drivers/spi/spi-stmp.c
+++ b/drivers/spi/spi-stmp.c
@@ -659,19 +659,8 @@ static struct platform_driver stmp_spi_driver = {
659 .suspend = stmp_spi_suspend, 659 .suspend = stmp_spi_suspend,
660 .resume = stmp_spi_resume, 660 .resume = stmp_spi_resume,
661}; 661};
662module_platform_driver(stmp_spi_driver);
662 663
663static int __init stmp_spi_init(void)
664{
665 return platform_driver_register(&stmp_spi_driver);
666}
667
668static void __exit stmp_spi_exit(void)
669{
670 platform_driver_unregister(&stmp_spi_driver);
671}
672
673module_init(stmp_spi_init);
674module_exit(stmp_spi_exit);
675module_param(pio, int, S_IRUGO); 664module_param(pio, int, S_IRUGO);
676module_param(clock, int, S_IRUGO); 665module_param(clock, int, S_IRUGO);
677MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com>"); 666MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com>");
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index a5a6302dc8e0..ae6d78a3e912 100644
--- a/drivers/spi/spi-tegra.c
+++ b/drivers/spi/spi-tegra.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
@@ -464,7 +465,7 @@ static int spi_tegra_transfer(struct spi_device *spi, struct spi_message *m)
464 return 0; 465 return 0;
465} 466}
466 467
467static int __init spi_tegra_probe(struct platform_device *pdev) 468static int __devinit spi_tegra_probe(struct platform_device *pdev)
468{ 469{
469 struct spi_master *master; 470 struct spi_master *master;
470 struct spi_tegra_data *tspi; 471 struct spi_tegra_data *tspi;
@@ -612,19 +613,9 @@ static struct platform_driver spi_tegra_driver = {
612 .owner = THIS_MODULE, 613 .owner = THIS_MODULE,
613 .of_match_table = spi_tegra_of_match_table, 614 .of_match_table = spi_tegra_of_match_table,
614 }, 615 },
616 .probe = spi_tegra_probe,
615 .remove = __devexit_p(spi_tegra_remove), 617 .remove = __devexit_p(spi_tegra_remove),
616}; 618};
617 619module_platform_driver(spi_tegra_driver);
618static int __init spi_tegra_init(void)
619{
620 return platform_driver_probe(&spi_tegra_driver, spi_tegra_probe);
621}
622module_init(spi_tegra_init);
623
624static void __exit spi_tegra_exit(void)
625{
626 platform_driver_unregister(&spi_tegra_driver);
627}
628module_exit(spi_tegra_exit);
629 620
630MODULE_LICENSE("GPL"); 621MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-ti-ssp.c b/drivers/spi/spi-ti-ssp.c
index ee22795c7973..7963c60063d6 100644
--- a/drivers/spi/spi-ti-ssp.c
+++ b/drivers/spi/spi-ti-ssp.c
@@ -383,18 +383,7 @@ static struct platform_driver ti_ssp_spi_driver = {
383 .owner = THIS_MODULE, 383 .owner = THIS_MODULE,
384 }, 384 },
385}; 385};
386 386module_platform_driver(ti_ssp_spi_driver);
387static int __init ti_ssp_spi_init(void)
388{
389 return platform_driver_register(&ti_ssp_spi_driver);
390}
391module_init(ti_ssp_spi_init);
392
393static void __exit ti_ssp_spi_exit(void)
394{
395 platform_driver_unregister(&ti_ssp_spi_driver);
396}
397module_exit(ti_ssp_spi_exit);
398 387
399MODULE_DESCRIPTION("SSP SPI Master"); 388MODULE_DESCRIPTION("SSP SPI Master");
400MODULE_AUTHOR("Cyril Chemparathy"); 389MODULE_AUTHOR("Cyril Chemparathy");
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 4d2c75df886c..4c5a663b9fa8 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -538,18 +538,7 @@ static struct platform_driver xilinx_spi_driver = {
538 .of_match_table = xilinx_spi_of_match, 538 .of_match_table = xilinx_spi_of_match,
539 }, 539 },
540}; 540};
541 541module_platform_driver(xilinx_spi_driver);
542static int __init xilinx_spi_pltfm_init(void)
543{
544 return platform_driver_register(&xilinx_spi_driver);
545}
546module_init(xilinx_spi_pltfm_init);
547
548static void __exit xilinx_spi_pltfm_exit(void)
549{
550 platform_driver_unregister(&xilinx_spi_driver);
551}
552module_exit(xilinx_spi_pltfm_exit);
553 542
554MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 543MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>");
555MODULE_DESCRIPTION("Xilinx SPI driver"); 544MODULE_DESCRIPTION("Xilinx SPI driver");