aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-25 08:37:05 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-25 08:37:05 -0400
commit8e5d0661b3948f3c5a143f32d192710375822af2 (patch)
treeca18920d3f7219f7ffb7ca2fa372b82558938006 /drivers/spi
parent39a6ac11df6579df0361922f05c43f0fac8daa37 (diff)
parent5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff)
Merge tag 'v3.6-rc6' into spi-drivers
Linux 3.6-rc6 Conflicts: drivers/spi/spi-omap2-mcspi.c
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-bcm63xx.c35
-rw-r--r--drivers/spi/spi-coldfire-qspi.c5
-rw-r--r--drivers/spi/spi-omap2-mcspi.c6
-rw-r--r--drivers/spi/spi-pl022.c1
-rw-r--r--drivers/spi/spi-s3c64xx.c12
5 files changed, 39 insertions, 20 deletions
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 6e25ef1bce91..a9f4049c6769 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -47,6 +47,8 @@ struct bcm63xx_spi {
47 /* Platform data */ 47 /* Platform data */
48 u32 speed_hz; 48 u32 speed_hz;
49 unsigned fifo_size; 49 unsigned fifo_size;
50 unsigned int msg_type_shift;
51 unsigned int msg_ctl_width;
50 52
51 /* Data buffers */ 53 /* Data buffers */
52 const unsigned char *tx_ptr; 54 const unsigned char *tx_ptr;
@@ -221,13 +223,20 @@ static unsigned int bcm63xx_txrx_bufs(struct spi_device *spi,
221 msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT); 223 msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT);
222 224
223 if (t->rx_buf && t->tx_buf) 225 if (t->rx_buf && t->tx_buf)
224 msg_ctl |= (SPI_FD_RW << SPI_MSG_TYPE_SHIFT); 226 msg_ctl |= (SPI_FD_RW << bs->msg_type_shift);
225 else if (t->rx_buf) 227 else if (t->rx_buf)
226 msg_ctl |= (SPI_HD_R << SPI_MSG_TYPE_SHIFT); 228 msg_ctl |= (SPI_HD_R << bs->msg_type_shift);
227 else if (t->tx_buf) 229 else if (t->tx_buf)
228 msg_ctl |= (SPI_HD_W << SPI_MSG_TYPE_SHIFT); 230 msg_ctl |= (SPI_HD_W << bs->msg_type_shift);
229 231
230 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL); 232 switch (bs->msg_ctl_width) {
233 case 8:
234 bcm_spi_writeb(bs, msg_ctl, SPI_MSG_CTL);
235 break;
236 case 16:
237 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL);
238 break;
239 }
231 240
232 /* Issue the transfer */ 241 /* Issue the transfer */
233 cmd = SPI_CMD_START_IMMEDIATE; 242 cmd = SPI_CMD_START_IMMEDIATE;
@@ -406,9 +415,21 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev)
406 master->transfer_one_message = bcm63xx_spi_transfer_one; 415 master->transfer_one_message = bcm63xx_spi_transfer_one;
407 master->mode_bits = MODEBITS; 416 master->mode_bits = MODEBITS;
408 bs->speed_hz = pdata->speed_hz; 417 bs->speed_hz = pdata->speed_hz;
418 bs->msg_type_shift = pdata->msg_type_shift;
419 bs->msg_ctl_width = pdata->msg_ctl_width;
409 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); 420 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
410 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); 421 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA));
411 422
423 switch (bs->msg_ctl_width) {
424 case 8:
425 case 16:
426 break;
427 default:
428 dev_err(dev, "unsupported MSG_CTL width: %d\n",
429 bs->msg_ctl_width);
430 goto out_clk_disable;
431 }
432
412 /* Initialize hardware */ 433 /* Initialize hardware */
413 clk_enable(bs->clk); 434 clk_enable(bs->clk);
414 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); 435 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);
@@ -438,7 +459,7 @@ out:
438 459
439static int __devexit bcm63xx_spi_remove(struct platform_device *pdev) 460static int __devexit bcm63xx_spi_remove(struct platform_device *pdev)
440{ 461{
441 struct spi_master *master = platform_get_drvdata(pdev); 462 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
442 struct bcm63xx_spi *bs = spi_master_get_devdata(master); 463 struct bcm63xx_spi *bs = spi_master_get_devdata(master);
443 464
444 spi_unregister_master(master); 465 spi_unregister_master(master);
@@ -452,6 +473,8 @@ static int __devexit bcm63xx_spi_remove(struct platform_device *pdev)
452 473
453 platform_set_drvdata(pdev, 0); 474 platform_set_drvdata(pdev, 0);
454 475
476 spi_master_put(master);
477
455 return 0; 478 return 0;
456} 479}
457 480
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index b2d4b9e4e010..764bfee75920 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -533,7 +533,6 @@ static int __devexit mcfqspi_remove(struct platform_device *pdev)
533 iounmap(mcfqspi->iobase); 533 iounmap(mcfqspi->iobase);
534 release_mem_region(res->start, resource_size(res)); 534 release_mem_region(res->start, resource_size(res));
535 spi_unregister_master(master); 535 spi_unregister_master(master);
536 spi_master_put(master);
537 536
538 return 0; 537 return 0;
539} 538}
@@ -541,7 +540,7 @@ static int __devexit mcfqspi_remove(struct platform_device *pdev)
541#ifdef CONFIG_PM_SLEEP 540#ifdef CONFIG_PM_SLEEP
542static int mcfqspi_suspend(struct device *dev) 541static int mcfqspi_suspend(struct device *dev)
543{ 542{
544 struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); 543 struct spi_master *master = dev_get_drvdata(dev);
545 struct mcfqspi *mcfqspi = spi_master_get_devdata(master); 544 struct mcfqspi *mcfqspi = spi_master_get_devdata(master);
546 545
547 spi_master_suspend(master); 546 spi_master_suspend(master);
@@ -553,7 +552,7 @@ static int mcfqspi_suspend(struct device *dev)
553 552
554static int mcfqspi_resume(struct device *dev) 553static int mcfqspi_resume(struct device *dev)
555{ 554{
556 struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); 555 struct spi_master *master = dev_get_drvdata(dev);
557 struct mcfqspi *mcfqspi = spi_master_get_devdata(master); 556 struct mcfqspi *mcfqspi = spi_master_get_devdata(master);
558 557
559 spi_master_resume(master); 558 spi_master_resume(master);
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 9926f2784bba..06684d995d3b 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1260,18 +1260,16 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
1260 1260
1261 status = spi_register_master(master); 1261 status = spi_register_master(master);
1262 if (status < 0) 1262 if (status < 0)
1263 goto err_spi_register; 1263 goto disable_pm;
1264 1264
1265 return status; 1265 return status;
1266 1266
1267err_spi_register:
1268 spi_master_put(master);
1269disable_pm: 1267disable_pm:
1270 pm_runtime_disable(&pdev->dev); 1268 pm_runtime_disable(&pdev->dev);
1271dma_chnl_free: 1269dma_chnl_free:
1272 kfree(mcspi->dma_channels); 1270 kfree(mcspi->dma_channels);
1273free_master: 1271free_master:
1274 kfree(master); 1272 spi_master_put(master);
1275 return status; 1273 return status;
1276} 1274}
1277 1275
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 3f2f36c79ab8..f8568b43660d 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2188,7 +2188,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
2188 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", 2188 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
2189 adev->res.start, pl022->virtbase); 2189 adev->res.start, pl022->virtbase);
2190 2190
2191 pm_runtime_enable(dev);
2192 pm_runtime_resume(dev); 2191 pm_runtime_resume(dev);
2193 2192
2194 pl022->clk = clk_get(&adev->dev, NULL); 2193 pl022->clk = clk_get(&adev->dev, NULL);
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index c6ad4e1c3dc0..a2062b231a6b 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1480,40 +1480,40 @@ static const struct dev_pm_ops s3c64xx_spi_pm = {
1480 s3c64xx_spi_runtime_resume, NULL) 1480 s3c64xx_spi_runtime_resume, NULL)
1481}; 1481};
1482 1482
1483struct s3c64xx_spi_port_config s3c2443_spi_port_config = { 1483static struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
1484 .fifo_lvl_mask = { 0x7f }, 1484 .fifo_lvl_mask = { 0x7f },
1485 .rx_lvl_offset = 13, 1485 .rx_lvl_offset = 13,
1486 .tx_st_done = 21, 1486 .tx_st_done = 21,
1487 .high_speed = true, 1487 .high_speed = true,
1488}; 1488};
1489 1489
1490struct s3c64xx_spi_port_config s3c6410_spi_port_config = { 1490static struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
1491 .fifo_lvl_mask = { 0x7f, 0x7F }, 1491 .fifo_lvl_mask = { 0x7f, 0x7F },
1492 .rx_lvl_offset = 13, 1492 .rx_lvl_offset = 13,
1493 .tx_st_done = 21, 1493 .tx_st_done = 21,
1494}; 1494};
1495 1495
1496struct s3c64xx_spi_port_config s5p64x0_spi_port_config = { 1496static struct s3c64xx_spi_port_config s5p64x0_spi_port_config = {
1497 .fifo_lvl_mask = { 0x1ff, 0x7F }, 1497 .fifo_lvl_mask = { 0x1ff, 0x7F },
1498 .rx_lvl_offset = 15, 1498 .rx_lvl_offset = 15,
1499 .tx_st_done = 25, 1499 .tx_st_done = 25,
1500}; 1500};
1501 1501
1502struct s3c64xx_spi_port_config s5pc100_spi_port_config = { 1502static struct s3c64xx_spi_port_config s5pc100_spi_port_config = {
1503 .fifo_lvl_mask = { 0x7f, 0x7F }, 1503 .fifo_lvl_mask = { 0x7f, 0x7F },
1504 .rx_lvl_offset = 13, 1504 .rx_lvl_offset = 13,
1505 .tx_st_done = 21, 1505 .tx_st_done = 21,
1506 .high_speed = true, 1506 .high_speed = true,
1507}; 1507};
1508 1508
1509struct s3c64xx_spi_port_config s5pv210_spi_port_config = { 1509static struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
1510 .fifo_lvl_mask = { 0x1ff, 0x7F }, 1510 .fifo_lvl_mask = { 0x1ff, 0x7F },
1511 .rx_lvl_offset = 15, 1511 .rx_lvl_offset = 15,
1512 .tx_st_done = 25, 1512 .tx_st_done = 25,
1513 .high_speed = true, 1513 .high_speed = true,
1514}; 1514};
1515 1515
1516struct s3c64xx_spi_port_config exynos4_spi_port_config = { 1516static struct s3c64xx_spi_port_config exynos4_spi_port_config = {
1517 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, 1517 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F },
1518 .rx_lvl_offset = 15, 1518 .rx_lvl_offset = 15,
1519 .tx_st_done = 25, 1519 .tx_st_done = 25,