Skip to content

Commit 18c0635

Browse files
committed
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
2 parents 41684f6 + 940ab88 commit 18c0635

33 files changed

Lines changed: 231 additions & 494 deletions

‎drivers/spi/spi-altera.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,7 @@ static struct platform_driver altera_spi_driver = {
320320
.of_match_table = altera_spi_match,
321321
},
322322
};
323-
324-
static int __init altera_spi_init(void)
325-
{
326-
return platform_driver_register(&altera_spi_driver);
327-
}
328-
module_init(altera_spi_init);
329-
330-
static void __exit altera_spi_exit(void)
331-
{
332-
platform_driver_unregister(&altera_spi_driver);
333-
}
334-
module_exit(altera_spi_exit);
323+
module_platform_driver(altera_spi_driver);
335324

336325
MODULE_DESCRIPTION("Altera SPI driver");
337326
MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");

‎drivers/spi/spi-ath79.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,7 @@ static struct platform_driver ath79_spi_driver = {
273273
.owner = THIS_MODULE,
274274
},
275275
};
276-
277-
static __init int ath79_spi_init(void)
278-
{
279-
return platform_driver_register(&ath79_spi_driver);
280-
}
281-
module_init(ath79_spi_init);
282-
283-
static __exit void ath79_spi_exit(void)
284-
{
285-
platform_driver_unregister(&ath79_spi_driver);
286-
}
287-
module_exit(ath79_spi_exit);
276+
module_platform_driver(ath79_spi_driver);
288277

289278
MODULE_DESCRIPTION("SPI controller driver for Atheros AR71XX/AR724X/AR913X");
290279
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");

‎drivers/spi/spi-atmel.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,18 +1074,7 @@ static struct platform_driver atmel_spi_driver = {
10741074
.resume = atmel_spi_resume,
10751075
.remove = __exit_p(atmel_spi_remove),
10761076
};
1077-
1078-
static int __init atmel_spi_init(void)
1079-
{
1080-
return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
1081-
}
1082-
module_init(atmel_spi_init);
1083-
1084-
static void __exit atmel_spi_exit(void)
1085-
{
1086-
platform_driver_unregister(&atmel_spi_driver);
1087-
}
1088-
module_exit(atmel_spi_exit);
1077+
module_platform_driver(atmel_spi_driver);
10891078

10901079
MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
10911080
MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");

‎drivers/spi/spi-bfin-sport.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -938,15 +938,4 @@ static struct platform_driver bfin_sport_spi_driver = {
938938
.suspend = bfin_sport_spi_suspend,
939939
.resume = bfin_sport_spi_resume,
940940
};
941-
942-
static int __init bfin_sport_spi_init(void)
943-
{
944-
return platform_driver_register(&bfin_sport_spi_driver);
945-
}
946-
module_init(bfin_sport_spi_init);
947-
948-
static void __exit bfin_sport_spi_exit(void)
949-
{
950-
platform_driver_unregister(&bfin_sport_spi_driver);
951-
}
952-
module_exit(bfin_sport_spi_exit);
941+
module_platform_driver(bfin_sport_spi_driver);

‎drivers/spi/spi-bfin5xx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ static int bfin_spi_setup(struct spi_device *spi)
10981098

10991099
if (chip->pio_interrupt && !drv_data->irq_requested) {
11001100
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);
11021102
if (ret) {
11031103
dev_err(&spi->dev, "Unable to register spi IRQ\n");
11041104
goto error;

‎drivers/spi/spi-coldfire-qspi.c‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev)
487487
goto fail2;
488488
}
489489

490-
status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, IRQF_DISABLED,
490+
status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, 0,
491491
pdev->name, mcfqspi);
492492
if (status) {
493493
dev_dbg(&pdev->dev, "request_irq failed\n");
@@ -621,20 +621,10 @@ static struct platform_driver mcfqspi_driver = {
621621
.driver.name = DRIVER_NAME,
622622
.driver.owner = THIS_MODULE,
623623
.driver.pm = MCFQSPI_DEV_PM_OPS,
624+
.probe = mcfqspi_probe,
624625
.remove = __devexit_p(mcfqspi_remove),
625626
};
626-
627-
static int __init mcfqspi_init(void)
628-
{
629-
return platform_driver_probe(&mcfqspi_driver, mcfqspi_probe);
630-
}
631-
module_init(mcfqspi_init);
632-
633-
static void __exit mcfqspi_exit(void)
634-
{
635-
platform_driver_unregister(&mcfqspi_driver);
636-
}
637-
module_exit(mcfqspi_exit);
627+
module_platform_driver(mcfqspi_driver);
638628

639629
MODULE_AUTHOR("Steven King <sfking@fdwdc.com>");
640630
MODULE_DESCRIPTION("Coldfire QSPI Controller Driver");

‎drivers/spi/spi-davinci.c‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ static int davinci_spi_request_dma(struct davinci_spi *dspi)
799799
* It will invoke spi_bitbang_start to create work queue so that client driver
800800
* can register transfer method to work queue.
801801
*/
802-
static int davinci_spi_probe(struct platform_device *pdev)
802+
static int __devinit davinci_spi_probe(struct platform_device *pdev)
803803
{
804804
struct spi_master *master;
805805
struct davinci_spi *dspi;
@@ -984,7 +984,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
984984
* It will also call spi_bitbang_stop to destroy the work queue which was
985985
* created by spi_bitbang_start.
986986
*/
987-
static int __exit davinci_spi_remove(struct platform_device *pdev)
987+
static int __devexit davinci_spi_remove(struct platform_device *pdev)
988988
{
989989
struct davinci_spi *dspi;
990990
struct spi_master *master;
@@ -1011,20 +1011,10 @@ static struct platform_driver davinci_spi_driver = {
10111011
.name = "spi_davinci",
10121012
.owner = THIS_MODULE,
10131013
},
1014-
.remove = __exit_p(davinci_spi_remove),
1014+
.probe = davinci_spi_probe,
1015+
.remove = __devexit_p(davinci_spi_remove),
10151016
};
1016-
1017-
static int __init davinci_spi_init(void)
1018-
{
1019-
return platform_driver_probe(&davinci_spi_driver, davinci_spi_probe);
1020-
}
1021-
module_init(davinci_spi_init);
1022-
1023-
static void __exit davinci_spi_exit(void)
1024-
{
1025-
platform_driver_unregister(&davinci_spi_driver);
1026-
}
1027-
module_exit(davinci_spi_exit);
1017+
module_platform_driver(davinci_spi_driver);
10281018

10291019
MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver");
10301020
MODULE_LICENSE("GPL");

‎drivers/spi/spi-dw-mid.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
116116
/* 1. setup DMA related registers */
117117
if (cs_change) {
118118
spi_enable_chip(dws, 0);
119-
dw_writew(dws, dmardlr, 0xf);
120-
dw_writew(dws, dmatdlr, 0x10);
119+
dw_writew(dws, DW_SPI_DMARDLR, 0xf);
120+
dw_writew(dws, DW_SPI_DMATDLR, 0x10);
121121
if (dws->tx_dma)
122122
dma_ctrl |= 0x2;
123123
if (dws->rx_dma)
124124
dma_ctrl |= 0x1;
125-
dw_writew(dws, dmacr, dma_ctrl);
125+
dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
126126
spi_enable_chip(dws, 1);
127127
}
128128

@@ -200,7 +200,8 @@ static struct dw_spi_dma_ops mid_dma_ops = {
200200

201201
int dw_spi_mid_init(struct dw_spi *dws)
202202
{
203-
u32 *clk_reg, clk_cdiv;
203+
void __iomem *clk_reg;
204+
u32 clk_cdiv;
204205

205206
clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16);
206207
if (!clk_reg)

‎drivers/spi/spi-dw-mmio.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,14 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
127127
}
128128

129129
static struct platform_driver dw_spi_mmio_driver = {
130+
.probe = dw_spi_mmio_probe,
130131
.remove = __devexit_p(dw_spi_mmio_remove),
131132
.driver = {
132133
.name = DRIVER_NAME,
133134
.owner = THIS_MODULE,
134135
},
135136
};
136-
137-
static int __init dw_spi_mmio_init(void)
138-
{
139-
return platform_driver_probe(&dw_spi_mmio_driver, dw_spi_mmio_probe);
140-
}
141-
module_init(dw_spi_mmio_init);
142-
143-
static void __exit dw_spi_mmio_exit(void)
144-
{
145-
platform_driver_unregister(&dw_spi_mmio_driver);
146-
}
147-
module_exit(dw_spi_mmio_exit);
137+
module_platform_driver(dw_spi_mmio_driver);
148138

149139
MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>");
150140
MODULE_DESCRIPTION("Memory-mapped I/O interface driver for DW SPI Core");

‎drivers/spi/spi-dw.c‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,35 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
8888
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
8989
"=================================\n");
9090
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));
9292
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));
9494
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));
9696
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));
9898
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));
100100
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));
102102
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));
104104
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));
106106
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));
108108
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));
110110
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));
112112
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));
114114
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));
116116
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));
118118
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));
120120
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
121121
"=================================\n");
122122

@@ -166,7 +166,7 @@ static inline u32 tx_max(struct dw_spi *dws)
166166
u32 tx_left, tx_room, rxtx_gap;
167167

168168
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);
170170

171171
/*
172172
* Another concern is about the tx/rx mismatch, we
@@ -187,7 +187,7 @@ static inline u32 rx_max(struct dw_spi *dws)
187187
{
188188
u32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes;
189189

190-
return min(rx_left, (u32)dw_readw(dws, rxflr));
190+
return min(rx_left, (u32)dw_readw(dws, DW_SPI_RXFLR));
191191
}
192192

193193
static void dw_writer(struct dw_spi *dws)
@@ -203,7 +203,7 @@ static void dw_writer(struct dw_spi *dws)
203203
else
204204
txw = *(u16 *)(dws->tx);
205205
}
206-
dw_writew(dws, dr, txw);
206+
dw_writew(dws, DW_SPI_DR, txw);
207207
dws->tx += dws->n_bytes;
208208
}
209209
}
@@ -214,7 +214,7 @@ static void dw_reader(struct dw_spi *dws)
214214
u16 rxw;
215215

216216
while (max--) {
217-
rxw = dw_readw(dws, dr);
217+
rxw = dw_readw(dws, DW_SPI_DR);
218218
/* Care rx only if the transfer's original "rx" is not null */
219219
if (dws->rx_end - dws->len) {
220220
if (dws->n_bytes == 1)
@@ -322,13 +322,13 @@ EXPORT_SYMBOL_GPL(dw_spi_xfer_done);
322322

323323
static irqreturn_t interrupt_transfer(struct dw_spi *dws)
324324
{
325-
u16 irq_status = dw_readw(dws, isr);
325+
u16 irq_status = dw_readw(dws, DW_SPI_ISR);
326326

327327
/* Error handling */
328328
if (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) {
329-
dw_readw(dws, txoicr);
330-
dw_readw(dws, rxoicr);
331-
dw_readw(dws, rxuicr);
329+
dw_readw(dws, DW_SPI_TXOICR);
330+
dw_readw(dws, DW_SPI_RXOICR);
331+
dw_readw(dws, DW_SPI_RXUICR);
332332
int_error_stop(dws, "interrupt_transfer: fifo overrun/underrun");
333333
return IRQ_HANDLED;
334334
}
@@ -352,7 +352,7 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
352352
static irqreturn_t dw_spi_irq(int irq, void *dev_id)
353353
{
354354
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;
356356

357357
if (!irq_status)
358358
return IRQ_NONE;
@@ -520,11 +520,11 @@ static void pump_transfers(unsigned long data)
520520
* 2. clk_div is changed
521521
* 3. control value changes
522522
*/
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) {
524524
spi_enable_chip(dws, 0);
525525

526-
if (dw_readw(dws, ctrl0) != cr0)
527-
dw_writew(dws, ctrl0, cr0);
526+
if (dw_readw(dws, DW_SPI_CTRL0) != cr0)
527+
dw_writew(dws, DW_SPI_CTRL0, cr0);
528528

529529
spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
530530
spi_chip_sel(dws, spi->chip_select);
@@ -534,7 +534,7 @@ static void pump_transfers(unsigned long data)
534534
if (imask)
535535
spi_umask_intr(dws, imask);
536536
if (txint_level)
537-
dw_writew(dws, txfltr, txint_level);
537+
dw_writew(dws, DW_SPI_TXFLTR, txint_level);
538538

539539
spi_enable_chip(dws, 1);
540540
if (cs_change)
@@ -790,13 +790,13 @@ static void spi_hw_init(struct dw_spi *dws)
790790
if (!dws->fifo_len) {
791791
u32 fifo;
792792
for (fifo = 2; fifo <= 257; fifo++) {
793-
dw_writew(dws, txfltr, fifo);
794-
if (fifo != dw_readw(dws, txfltr))
793+
dw_writew(dws, DW_SPI_TXFLTR, fifo);
794+
if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
795795
break;
796796
}
797797

798798
dws->fifo_len = (fifo == 257) ? 0 : fifo;
799-
dw_writew(dws, txfltr, 0);
799+
dw_writew(dws, DW_SPI_TXFLTR, 0);
800800
}
801801
}
802802

0 commit comments

Comments
 (0)