aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-25 08:41:02 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-25 08:41:02 -0400
commitac48f6cb5f268daff06b636444819e5ffb462611 (patch)
tree56bcc8b2de42738764ac65056067a17cb97609f4 /drivers/spi
parente64d07a2dae569fc3c938adac777562a1d6f151e (diff)
parent5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff)
Merge tag 'v3.6-rc6' into spi-mxs
Linux 3.6-rc6 Conflicts (overlap between moving code that accesses registers around and factoring the register access out into a SSP layer): drivers/mmc/host/mxs-mmc.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 bc4778175e34..b2fb141da375 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1228,18 +1228,16 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
1228 1228
1229 status = spi_register_master(master); 1229 status = spi_register_master(master);
1230 if (status < 0) 1230 if (status < 0)
1231 goto err_spi_register; 1231 goto disable_pm;
1232 1232
1233 return status; 1233 return status;
1234 1234
1235err_spi_register:
1236 spi_master_put(master);
1237disable_pm: 1235disable_pm:
1238 pm_runtime_disable(&pdev->dev); 1236 pm_runtime_disable(&pdev->dev);
1239dma_chnl_free: 1237dma_chnl_free:
1240 kfree(mcspi->dma_channels); 1238 kfree(mcspi->dma_channels);
1241free_master: 1239free_master:
1242 kfree(master); 1240 spi_master_put(master);
1243 platform_set_drvdata(pdev, NULL); 1241 platform_set_drvdata(pdev, NULL);
1244 return status; 1242 return status;
1245} 1243}
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index aab518ec2bbc..6abbe23c39b4 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2053,7 +2053,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
2053 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", 2053 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
2054 adev->res.start, pl022->virtbase); 2054 adev->res.start, pl022->virtbase);
2055 2055
2056 pm_runtime_enable(dev);
2057 pm_runtime_resume(dev); 2056 pm_runtime_resume(dev);
2058 2057
2059 pl022->clk = clk_get(&adev->dev, NULL); 2058 pl022->clk = clk_get(&adev->dev, NULL);
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index cfa2c35dfeed..d1c8441f638c 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1479,40 +1479,40 @@ static const struct dev_pm_ops s3c64xx_spi_pm = {
1479 s3c64xx_spi_runtime_resume, NULL) 1479 s3c64xx_spi_runtime_resume, NULL)
1480}; 1480};
1481 1481
1482struct s3c64xx_spi_port_config s3c2443_spi_port_config = { 1482static struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
1483 .fifo_lvl_mask = { 0x7f }, 1483 .fifo_lvl_mask = { 0x7f },
1484 .rx_lvl_offset = 13, 1484 .rx_lvl_offset = 13,
1485 .tx_st_done = 21, 1485 .tx_st_done = 21,
1486 .high_speed = true, 1486 .high_speed = true,
1487}; 1487};
1488 1488
1489struct s3c64xx_spi_port_config s3c6410_spi_port_config = { 1489static struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
1490 .fifo_lvl_mask = { 0x7f, 0x7F }, 1490 .fifo_lvl_mask = { 0x7f, 0x7F },
1491 .rx_lvl_offset = 13, 1491 .rx_lvl_offset = 13,
1492 .tx_st_done = 21, 1492 .tx_st_done = 21,
1493}; 1493};
1494 1494
1495struct s3c64xx_spi_port_config s5p64x0_spi_port_config = { 1495static struct s3c64xx_spi_port_config s5p64x0_spi_port_config = {
1496 .fifo_lvl_mask = { 0x1ff, 0x7F }, 1496 .fifo_lvl_mask = { 0x1ff, 0x7F },
1497 .rx_lvl_offset = 15, 1497 .rx_lvl_offset = 15,
1498 .tx_st_done = 25, 1498 .tx_st_done = 25,
1499}; 1499};
1500 1500
1501struct s3c64xx_spi_port_config s5pc100_spi_port_config = { 1501static struct s3c64xx_spi_port_config s5pc100_spi_port_config = {
1502 .fifo_lvl_mask = { 0x7f, 0x7F }, 1502 .fifo_lvl_mask = { 0x7f, 0x7F },
1503 .rx_lvl_offset = 13, 1503 .rx_lvl_offset = 13,
1504 .tx_st_done = 21, 1504 .tx_st_done = 21,
1505 .high_speed = true, 1505 .high_speed = true,
1506}; 1506};
1507 1507
1508struct s3c64xx_spi_port_config s5pv210_spi_port_config = { 1508static struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
1509 .fifo_lvl_mask = { 0x1ff, 0x7F }, 1509 .fifo_lvl_mask = { 0x1ff, 0x7F },
1510 .rx_lvl_offset = 15, 1510 .rx_lvl_offset = 15,
1511 .tx_st_done = 25, 1511 .tx_st_done = 25,
1512 .high_speed = true, 1512 .high_speed = true,
1513}; 1513};
1514 1514
1515struct s3c64xx_spi_port_config exynos4_spi_port_config = { 1515static struct s3c64xx_spi_port_config exynos4_spi_port_config = {
1516 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, 1516 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F },
1517 .rx_lvl_offset = 15, 1517 .rx_lvl_offset = 15,
1518 .tx_st_done = 25, 1518 .tx_st_done = 25,