diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/omap2_mcspi.c | 5 | ||||
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 25 | ||||
-rw-r--r-- | drivers/spi/spi.c | 8 |
3 files changed, 20 insertions, 18 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index d8356af118a8..e0de0d0eedea 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
@@ -204,6 +204,7 @@ static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val) | |||
204 | 204 | ||
205 | cs->chconf0 = val; | 205 | cs->chconf0 = val; |
206 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); | 206 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); |
207 | mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0); | ||
207 | } | 208 | } |
208 | 209 | ||
209 | static void omap2_mcspi_set_dma_req(const struct spi_device *spi, | 210 | static void omap2_mcspi_set_dma_req(const struct spi_device *spi, |
@@ -532,7 +533,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
532 | goto out; | 533 | goto out; |
533 | } | 534 | } |
534 | #ifdef VERBOSE | 535 | #ifdef VERBOSE |
535 | dev_dbg(&spi->dev, "write-%d %04x\n", | 536 | dev_dbg(&spi->dev, "write-%d %08x\n", |
536 | word_len, *tx); | 537 | word_len, *tx); |
537 | #endif | 538 | #endif |
538 | __raw_writel(*tx++, tx_reg); | 539 | __raw_writel(*tx++, tx_reg); |
@@ -550,7 +551,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
550 | mcspi_write_chconf0(spi, l); | 551 | mcspi_write_chconf0(spi, l); |
551 | *rx++ = __raw_readl(rx_reg); | 552 | *rx++ = __raw_readl(rx_reg); |
552 | #ifdef VERBOSE | 553 | #ifdef VERBOSE |
553 | dev_dbg(&spi->dev, "read-%d %04x\n", | 554 | dev_dbg(&spi->dev, "read-%d %08x\n", |
554 | word_len, *(rx - 1)); | 555 | word_len, *(rx - 1)); |
555 | #endif | 556 | #endif |
556 | } | 557 | } |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 36828358a4d8..e76b1afafe07 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -36,8 +36,7 @@ | |||
36 | #include <asm/delay.h> | 36 | #include <asm/delay.h> |
37 | 37 | ||
38 | #include <mach/dma.h> | 38 | #include <mach/dma.h> |
39 | #include <mach/regs-ssp.h> | 39 | #include <plat/ssp.h> |
40 | #include <mach/ssp.h> | ||
41 | #include <mach/pxa2xx_spi.h> | 40 | #include <mach/pxa2xx_spi.h> |
42 | 41 | ||
43 | MODULE_AUTHOR("Stephen Street"); | 42 | MODULE_AUTHOR("Stephen Street"); |
@@ -1318,14 +1317,14 @@ static int setup(struct spi_device *spi) | |||
1318 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | 1317 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ |
1319 | if (drv_data->ssp_type != PXA25x_SSP) | 1318 | if (drv_data->ssp_type != PXA25x_SSP) |
1320 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", | 1319 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", |
1321 | clk_get_rate(ssp->clk) | 1320 | clk_get_rate(ssp->clk) |
1322 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | 1321 | / (1 + ((chip->cr0 & SSCR0_SCR(0xfff)) >> 8)), |
1323 | chip->enable_dma ? "DMA" : "PIO"); | 1322 | chip->enable_dma ? "DMA" : "PIO"); |
1324 | else | 1323 | else |
1325 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", | 1324 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", |
1326 | clk_get_rate(ssp->clk) / 2 | 1325 | clk_get_rate(ssp->clk) / 2 |
1327 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | 1326 | / (1 + ((chip->cr0 & SSCR0_SCR(0x0ff)) >> 8)), |
1328 | chip->enable_dma ? "DMA" : "PIO"); | 1327 | chip->enable_dma ? "DMA" : "PIO"); |
1329 | 1328 | ||
1330 | if (spi->bits_per_word <= 8) { | 1329 | if (spi->bits_per_word <= 8) { |
1331 | chip->n_bytes = 1; | 1330 | chip->n_bytes = 1; |
@@ -1466,7 +1465,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | |||
1466 | 1465 | ||
1467 | platform_info = dev->platform_data; | 1466 | platform_info = dev->platform_data; |
1468 | 1467 | ||
1469 | ssp = ssp_request(pdev->id, pdev->name); | 1468 | ssp = pxa_ssp_request(pdev->id, pdev->name); |
1470 | if (ssp == NULL) { | 1469 | if (ssp == NULL) { |
1471 | dev_err(&pdev->dev, "failed to request SSP%d\n", pdev->id); | 1470 | dev_err(&pdev->dev, "failed to request SSP%d\n", pdev->id); |
1472 | return -ENODEV; | 1471 | return -ENODEV; |
@@ -1476,7 +1475,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | |||
1476 | master = spi_alloc_master(dev, sizeof(struct driver_data) + 16); | 1475 | master = spi_alloc_master(dev, sizeof(struct driver_data) + 16); |
1477 | if (!master) { | 1476 | if (!master) { |
1478 | dev_err(&pdev->dev, "cannot alloc spi_master\n"); | 1477 | dev_err(&pdev->dev, "cannot alloc spi_master\n"); |
1479 | ssp_free(ssp); | 1478 | pxa_ssp_free(ssp); |
1480 | return -ENOMEM; | 1479 | return -ENOMEM; |
1481 | } | 1480 | } |
1482 | drv_data = spi_master_get_devdata(master); | 1481 | drv_data = spi_master_get_devdata(master); |
@@ -1558,7 +1557,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | |||
1558 | write_SSCR1(SSCR1_RxTresh(RX_THRESH_DFLT) | | 1557 | write_SSCR1(SSCR1_RxTresh(RX_THRESH_DFLT) | |
1559 | SSCR1_TxTresh(TX_THRESH_DFLT), | 1558 | SSCR1_TxTresh(TX_THRESH_DFLT), |
1560 | drv_data->ioaddr); | 1559 | drv_data->ioaddr); |
1561 | write_SSCR0(SSCR0_SerClkDiv(2) | 1560 | write_SSCR0(SSCR0_SCR(2) |
1562 | | SSCR0_Motorola | 1561 | | SSCR0_Motorola |
1563 | | SSCR0_DataSize(8), | 1562 | | SSCR0_DataSize(8), |
1564 | drv_data->ioaddr); | 1563 | drv_data->ioaddr); |
@@ -1605,7 +1604,7 @@ out_error_irq_alloc: | |||
1605 | 1604 | ||
1606 | out_error_master_alloc: | 1605 | out_error_master_alloc: |
1607 | spi_master_put(master); | 1606 | spi_master_put(master); |
1608 | ssp_free(ssp); | 1607 | pxa_ssp_free(ssp); |
1609 | return status; | 1608 | return status; |
1610 | } | 1609 | } |
1611 | 1610 | ||
@@ -1649,7 +1648,7 @@ static int pxa2xx_spi_remove(struct platform_device *pdev) | |||
1649 | free_irq(ssp->irq, drv_data); | 1648 | free_irq(ssp->irq, drv_data); |
1650 | 1649 | ||
1651 | /* Release SSP */ | 1650 | /* Release SSP */ |
1652 | ssp_free(ssp); | 1651 | pxa_ssp_free(ssp); |
1653 | 1652 | ||
1654 | /* Disconnect from the SPI framework */ | 1653 | /* Disconnect from the SPI framework */ |
1655 | spi_unregister_master(drv_data->master); | 1654 | spi_unregister_master(drv_data->master); |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9ffb0fdbd6fe..b3a1f9259b62 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -41,7 +41,7 @@ static void spidev_release(struct device *dev) | |||
41 | spi->master->cleanup(spi); | 41 | spi->master->cleanup(spi); |
42 | 42 | ||
43 | spi_master_put(spi->master); | 43 | spi_master_put(spi->master); |
44 | kfree(dev); | 44 | kfree(spi); |
45 | } | 45 | } |
46 | 46 | ||
47 | static ssize_t | 47 | static ssize_t |
@@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi) | |||
257 | { | 257 | { |
258 | static DEFINE_MUTEX(spi_add_lock); | 258 | static DEFINE_MUTEX(spi_add_lock); |
259 | struct device *dev = spi->master->dev.parent; | 259 | struct device *dev = spi->master->dev.parent; |
260 | struct device *d; | ||
260 | int status; | 261 | int status; |
261 | 262 | ||
262 | /* Chipselects are numbered 0..max; validate. */ | 263 | /* Chipselects are numbered 0..max; validate. */ |
@@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi) | |||
278 | */ | 279 | */ |
279 | mutex_lock(&spi_add_lock); | 280 | mutex_lock(&spi_add_lock); |
280 | 281 | ||
281 | if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) | 282 | d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)); |
282 | != NULL) { | 283 | if (d != NULL) { |
283 | dev_err(dev, "chipselect %d already in use\n", | 284 | dev_err(dev, "chipselect %d already in use\n", |
284 | spi->chip_select); | 285 | spi->chip_select); |
286 | put_device(d); | ||
285 | status = -EBUSY; | 287 | status = -EBUSY; |
286 | goto done; | 288 | goto done; |
287 | } | 289 | } |