Skip to content

Commit

Permalink
Merge branch 'spi/next' of git://git.secretlab.ca/git/linux-2.6
Browse files Browse the repository at this point in the history
* '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
  • Loading branch information
Linus Torvalds committed Oct 29, 2011
2 parents 41684f6 + 940ab88 commit 18c0635
Show file tree
Hide file tree
Showing 33 changed files with 231 additions and 494 deletions.
13 changes: 1 addition & 12 deletions drivers/spi/spi-altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,7 @@ static struct platform_driver altera_spi_driver = {
.of_match_table = altera_spi_match,
},
};

static int __init altera_spi_init(void)
{
return platform_driver_register(&altera_spi_driver);
}
module_init(altera_spi_init);

static void __exit altera_spi_exit(void)
{
platform_driver_unregister(&altera_spi_driver);
}
module_exit(altera_spi_exit);
module_platform_driver(altera_spi_driver);

MODULE_DESCRIPTION("Altera SPI driver");
MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
Expand Down
13 changes: 1 addition & 12 deletions drivers/spi/spi-ath79.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,7 @@ static struct platform_driver ath79_spi_driver = {
.owner = THIS_MODULE,
},
};

static __init int ath79_spi_init(void)
{
return platform_driver_register(&ath79_spi_driver);
}
module_init(ath79_spi_init);

static __exit void ath79_spi_exit(void)
{
platform_driver_unregister(&ath79_spi_driver);
}
module_exit(ath79_spi_exit);
module_platform_driver(ath79_spi_driver);

MODULE_DESCRIPTION("SPI controller driver for Atheros AR71XX/AR724X/AR913X");
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
Expand Down
13 changes: 1 addition & 12 deletions drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,18 +1074,7 @@ static struct platform_driver atmel_spi_driver = {
.resume = atmel_spi_resume,
.remove = __exit_p(atmel_spi_remove),
};

static int __init atmel_spi_init(void)
{
return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
}
module_init(atmel_spi_init);

static void __exit atmel_spi_exit(void)
{
platform_driver_unregister(&atmel_spi_driver);
}
module_exit(atmel_spi_exit);
module_platform_driver(atmel_spi_driver);

MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
Expand Down
13 changes: 1 addition & 12 deletions drivers/spi/spi-bfin-sport.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,15 +938,4 @@ static struct platform_driver bfin_sport_spi_driver = {
.suspend = bfin_sport_spi_suspend,
.resume = bfin_sport_spi_resume,
};

static int __init bfin_sport_spi_init(void)
{
return platform_driver_register(&bfin_sport_spi_driver);
}
module_init(bfin_sport_spi_init);

static void __exit bfin_sport_spi_exit(void)
{
platform_driver_unregister(&bfin_sport_spi_driver);
}
module_exit(bfin_sport_spi_exit);
module_platform_driver(bfin_sport_spi_driver);
2 changes: 1 addition & 1 deletion drivers/spi/spi-bfin5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int bfin_spi_setup(struct spi_device *spi)

if (chip->pio_interrupt && !drv_data->irq_requested) {
ret = request_irq(drv_data->spi_irq, bfin_spi_pio_irq_handler,
IRQF_DISABLED, "BFIN_SPI", drv_data);
0, "BFIN_SPI", drv_data);
if (ret) {
dev_err(&spi->dev, "Unable to register spi IRQ\n");
goto error;
Expand Down
16 changes: 3 additions & 13 deletions drivers/spi/spi-coldfire-qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev)
goto fail2;
}

status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, IRQF_DISABLED,
status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, 0,
pdev->name, mcfqspi);
if (status) {
dev_dbg(&pdev->dev, "request_irq failed\n");
Expand Down Expand Up @@ -621,20 +621,10 @@ static struct platform_driver mcfqspi_driver = {
.driver.name = DRIVER_NAME,
.driver.owner = THIS_MODULE,
.driver.pm = MCFQSPI_DEV_PM_OPS,
.probe = mcfqspi_probe,
.remove = __devexit_p(mcfqspi_remove),
};

static int __init mcfqspi_init(void)
{
return platform_driver_probe(&mcfqspi_driver, mcfqspi_probe);
}
module_init(mcfqspi_init);

static void __exit mcfqspi_exit(void)
{
platform_driver_unregister(&mcfqspi_driver);
}
module_exit(mcfqspi_exit);
module_platform_driver(mcfqspi_driver);

MODULE_AUTHOR("Steven King <sfking@fdwdc.com>");
MODULE_DESCRIPTION("Coldfire QSPI Controller Driver");
Expand Down
20 changes: 5 additions & 15 deletions drivers/spi/spi-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static int davinci_spi_request_dma(struct davinci_spi *dspi)
* It will invoke spi_bitbang_start to create work queue so that client driver
* can register transfer method to work queue.
*/
static int davinci_spi_probe(struct platform_device *pdev)
static int __devinit davinci_spi_probe(struct platform_device *pdev)
{
struct spi_master *master;
struct davinci_spi *dspi;
Expand Down Expand Up @@ -984,7 +984,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
* It will also call spi_bitbang_stop to destroy the work queue which was
* created by spi_bitbang_start.
*/
static int __exit davinci_spi_remove(struct platform_device *pdev)
static int __devexit davinci_spi_remove(struct platform_device *pdev)
{
struct davinci_spi *dspi;
struct spi_master *master;
Expand All @@ -1011,20 +1011,10 @@ static struct platform_driver davinci_spi_driver = {
.name = "spi_davinci",
.owner = THIS_MODULE,
},
.remove = __exit_p(davinci_spi_remove),
.probe = davinci_spi_probe,
.remove = __devexit_p(davinci_spi_remove),
};

static int __init davinci_spi_init(void)
{
return platform_driver_probe(&davinci_spi_driver, davinci_spi_probe);
}
module_init(davinci_spi_init);

static void __exit davinci_spi_exit(void)
{
platform_driver_unregister(&davinci_spi_driver);
}
module_exit(davinci_spi_exit);
module_platform_driver(davinci_spi_driver);

MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver");
MODULE_LICENSE("GPL");
9 changes: 5 additions & 4 deletions drivers/spi/spi-dw-mid.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
/* 1. setup DMA related registers */
if (cs_change) {
spi_enable_chip(dws, 0);
dw_writew(dws, dmardlr, 0xf);
dw_writew(dws, dmatdlr, 0x10);
dw_writew(dws, DW_SPI_DMARDLR, 0xf);
dw_writew(dws, DW_SPI_DMATDLR, 0x10);
if (dws->tx_dma)
dma_ctrl |= 0x2;
if (dws->rx_dma)
dma_ctrl |= 0x1;
dw_writew(dws, dmacr, dma_ctrl);
dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
spi_enable_chip(dws, 1);
}

Expand Down Expand Up @@ -200,7 +200,8 @@ static struct dw_spi_dma_ops mid_dma_ops = {

int dw_spi_mid_init(struct dw_spi *dws)
{
u32 *clk_reg, clk_cdiv;
void __iomem *clk_reg;
u32 clk_cdiv;

clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16);
if (!clk_reg)
Expand Down
14 changes: 2 additions & 12 deletions drivers/spi/spi-dw-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,14 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
}

static struct platform_driver dw_spi_mmio_driver = {
.probe = dw_spi_mmio_probe,
.remove = __devexit_p(dw_spi_mmio_remove),
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
};

static int __init dw_spi_mmio_init(void)
{
return platform_driver_probe(&dw_spi_mmio_driver, dw_spi_mmio_probe);
}
module_init(dw_spi_mmio_init);

static void __exit dw_spi_mmio_exit(void)
{
platform_driver_unregister(&dw_spi_mmio_driver);
}
module_exit(dw_spi_mmio_exit);
module_platform_driver(dw_spi_mmio_driver);

MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>");
MODULE_DESCRIPTION("Memory-mapped I/O interface driver for DW SPI Core");
Expand Down
62 changes: 31 additions & 31 deletions drivers/spi/spi-dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,35 +88,35 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"=================================\n");
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"CTRL0: \t\t0x%08x\n", dw_readl(dws, ctrl0));
"CTRL0: \t\t0x%08x\n", dw_readl(dws, DW_SPI_CTRL0));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"CTRL1: \t\t0x%08x\n", dw_readl(dws, ctrl1));
"CTRL1: \t\t0x%08x\n", dw_readl(dws, DW_SPI_CTRL1));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"SSIENR: \t0x%08x\n", dw_readl(dws, ssienr));
"SSIENR: \t0x%08x\n", dw_readl(dws, DW_SPI_SSIENR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"SER: \t\t0x%08x\n", dw_readl(dws, ser));
"SER: \t\t0x%08x\n", dw_readl(dws, DW_SPI_SER));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"BAUDR: \t\t0x%08x\n", dw_readl(dws, baudr));
"BAUDR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_BAUDR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"TXFTLR: \t0x%08x\n", dw_readl(dws, txfltr));
"TXFTLR: \t0x%08x\n", dw_readl(dws, DW_SPI_TXFLTR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"RXFTLR: \t0x%08x\n", dw_readl(dws, rxfltr));
"RXFTLR: \t0x%08x\n", dw_readl(dws, DW_SPI_RXFLTR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"TXFLR: \t\t0x%08x\n", dw_readl(dws, txflr));
"TXFLR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_TXFLR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"RXFLR: \t\t0x%08x\n", dw_readl(dws, rxflr));
"RXFLR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_RXFLR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"SR: \t\t0x%08x\n", dw_readl(dws, sr));
"SR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_SR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"IMR: \t\t0x%08x\n", dw_readl(dws, imr));
"IMR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_IMR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"ISR: \t\t0x%08x\n", dw_readl(dws, isr));
"ISR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_ISR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"DMACR: \t\t0x%08x\n", dw_readl(dws, dmacr));
"DMACR: \t\t0x%08x\n", dw_readl(dws, DW_SPI_DMACR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"DMATDLR: \t0x%08x\n", dw_readl(dws, dmatdlr));
"DMATDLR: \t0x%08x\n", dw_readl(dws, DW_SPI_DMATDLR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"DMARDLR: \t0x%08x\n", dw_readl(dws, dmardlr));
"DMARDLR: \t0x%08x\n", dw_readl(dws, DW_SPI_DMARDLR));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"=================================\n");

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

tx_left = (dws->tx_end - dws->tx) / dws->n_bytes;
tx_room = dws->fifo_len - dw_readw(dws, txflr);
tx_room = dws->fifo_len - dw_readw(dws, DW_SPI_TXFLR);

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

return min(rx_left, (u32)dw_readw(dws, rxflr));
return min(rx_left, (u32)dw_readw(dws, DW_SPI_RXFLR));
}

static void dw_writer(struct dw_spi *dws)
Expand All @@ -203,7 +203,7 @@ static void dw_writer(struct dw_spi *dws)
else
txw = *(u16 *)(dws->tx);
}
dw_writew(dws, dr, txw);
dw_writew(dws, DW_SPI_DR, txw);
dws->tx += dws->n_bytes;
}
}
Expand All @@ -214,7 +214,7 @@ static void dw_reader(struct dw_spi *dws)
u16 rxw;

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

static irqreturn_t interrupt_transfer(struct dw_spi *dws)
{
u16 irq_status = dw_readw(dws, isr);
u16 irq_status = dw_readw(dws, DW_SPI_ISR);

/* Error handling */
if (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) {
dw_readw(dws, txoicr);
dw_readw(dws, rxoicr);
dw_readw(dws, rxuicr);
dw_readw(dws, DW_SPI_TXOICR);
dw_readw(dws, DW_SPI_RXOICR);
dw_readw(dws, DW_SPI_RXUICR);
int_error_stop(dws, "interrupt_transfer: fifo overrun/underrun");
return IRQ_HANDLED;
}
Expand All @@ -352,7 +352,7 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
static irqreturn_t dw_spi_irq(int irq, void *dev_id)
{
struct dw_spi *dws = dev_id;
u16 irq_status = dw_readw(dws, isr) & 0x3f;
u16 irq_status = dw_readw(dws, DW_SPI_ISR) & 0x3f;

if (!irq_status)
return IRQ_NONE;
Expand Down Expand Up @@ -520,11 +520,11 @@ static void pump_transfers(unsigned long data)
* 2. clk_div is changed
* 3. control value changes
*/
if (dw_readw(dws, ctrl0) != cr0 || cs_change || clk_div || imask) {
if (dw_readw(dws, DW_SPI_CTRL0) != cr0 || cs_change || clk_div || imask) {
spi_enable_chip(dws, 0);

if (dw_readw(dws, ctrl0) != cr0)
dw_writew(dws, ctrl0, cr0);
if (dw_readw(dws, DW_SPI_CTRL0) != cr0)
dw_writew(dws, DW_SPI_CTRL0, cr0);

spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
spi_chip_sel(dws, spi->chip_select);
Expand All @@ -534,7 +534,7 @@ static void pump_transfers(unsigned long data)
if (imask)
spi_umask_intr(dws, imask);
if (txint_level)
dw_writew(dws, txfltr, txint_level);
dw_writew(dws, DW_SPI_TXFLTR, txint_level);

spi_enable_chip(dws, 1);
if (cs_change)
Expand Down Expand Up @@ -790,13 +790,13 @@ static void spi_hw_init(struct dw_spi *dws)
if (!dws->fifo_len) {
u32 fifo;
for (fifo = 2; fifo <= 257; fifo++) {
dw_writew(dws, txfltr, fifo);
if (fifo != dw_readw(dws, txfltr))
dw_writew(dws, DW_SPI_TXFLTR, fifo);
if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
break;
}

dws->fifo_len = (fifo == 257) ? 0 : fifo;
dw_writew(dws, txfltr, 0);
dw_writew(dws, DW_SPI_TXFLTR, 0);
}
}

Expand Down
Loading

0 comments on commit 18c0635

Please sign in to comment.