aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-05-25 02:38:26 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-05-25 02:38:26 -0400
commitb1e50ebcf24668e57f058deb48b0704b5391ed0f (patch)
tree17e1b69b249d0738317b732186340c9dd053f1a1 /drivers/spi
parent0c2a2ae32793e3500a15a449612485f5d17dd431 (diff)
parent7e125f7b9cbfce4101191b8076d606c517a73066 (diff)
Merge remote branch 'origin' into secretlab/next-spi
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/Kconfig6
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c15
-rw-r--r--drivers/spi/mpc52xx_spi.c22
-rw-r--r--drivers/spi/pxa2xx_spi.c25
-rw-r--r--drivers/spi/spi_mpc8xxx.c17
-rw-r--r--drivers/spi/spi_ppc4xx.c2
-rw-r--r--drivers/spi/xilinx_spi_of.c2
7 files changed, 46 insertions, 43 deletions
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index aacc0ed25ba..91c2f4f3af1 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -197,10 +197,10 @@ config SPI_OMAP_UWIRE
197 This hooks up to the MicroWire controller on OMAP1 chips. 197 This hooks up to the MicroWire controller on OMAP1 chips.
198 198
199config SPI_OMAP24XX 199config SPI_OMAP24XX
200 tristate "McSPI driver for OMAP24xx/OMAP34xx" 200 tristate "McSPI driver for OMAP"
201 depends on ARCH_OMAP2 || ARCH_OMAP3 201 depends on ARCH_OMAP2PLUS
202 help 202 help
203 SPI master controller for OMAP24xx/OMAP34xx Multichannel SPI 203 SPI master controller for OMAP24XX and later Multichannel SPI
204 (McSPI) modules. 204 (McSPI) modules.
205 205
206config SPI_OMAP_100K 206config SPI_OMAP_100K
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 77d4cc88ede..7104cb739da 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -472,18 +472,18 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
472 s16 id = -1; 472 s16 id = -1;
473 int rc; 473 int rc;
474 474
475 regaddr_p = of_get_address(op->node, 0, &size64, NULL); 475 regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL);
476 if (!regaddr_p) { 476 if (!regaddr_p) {
477 dev_err(&op->dev, "Invalid PSC address\n"); 477 dev_err(&op->dev, "Invalid PSC address\n");
478 return -EINVAL; 478 return -EINVAL;
479 } 479 }
480 regaddr64 = of_translate_address(op->node, regaddr_p); 480 regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
481 481
482 /* get PSC id (1..6, used by port_config) */ 482 /* get PSC id (1..6, used by port_config) */
483 if (op->dev.platform_data == NULL) { 483 if (op->dev.platform_data == NULL) {
484 const u32 *psc_nump; 484 const u32 *psc_nump;
485 485
486 psc_nump = of_get_property(op->node, "cell-index", NULL); 486 psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL);
487 if (!psc_nump || *psc_nump > 5) { 487 if (!psc_nump || *psc_nump > 5) {
488 dev_err(&op->dev, "Invalid cell-index property\n"); 488 dev_err(&op->dev, "Invalid cell-index property\n");
489 return -EINVAL; 489 return -EINVAL;
@@ -492,9 +492,10 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
492 } 492 }
493 493
494 rc = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, 494 rc = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
495 irq_of_parse_and_map(op->node, 0), id); 495 irq_of_parse_and_map(op->dev.of_node, 0), id);
496 if (rc == 0) 496 if (rc == 0)
497 of_register_spi_devices(dev_get_drvdata(&op->dev), op->node); 497 of_register_spi_devices(dev_get_drvdata(&op->dev),
498 op->dev.of_node);
498 499
499 return rc; 500 return rc;
500} 501}
@@ -513,14 +514,12 @@ static const struct of_device_id mpc52xx_psc_spi_of_match[] = {
513MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); 514MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match);
514 515
515static struct of_platform_driver mpc52xx_psc_spi_of_driver = { 516static struct of_platform_driver mpc52xx_psc_spi_of_driver = {
516 .owner = THIS_MODULE,
517 .name = "mpc52xx-psc-spi",
518 .match_table = mpc52xx_psc_spi_of_match,
519 .probe = mpc52xx_psc_spi_of_probe, 517 .probe = mpc52xx_psc_spi_of_probe,
520 .remove = __exit_p(mpc52xx_psc_spi_of_remove), 518 .remove = __exit_p(mpc52xx_psc_spi_of_remove),
521 .driver = { 519 .driver = {
522 .name = "mpc52xx-psc-spi", 520 .name = "mpc52xx-psc-spi",
523 .owner = THIS_MODULE, 521 .owner = THIS_MODULE,
522 .of_match_table = mpc52xx_psc_spi_of_match,
524 }, 523 },
525}; 524};
526 525
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
index cd68f1ce5cc..b1a76bff775 100644
--- a/drivers/spi/mpc52xx_spi.c
+++ b/drivers/spi/mpc52xx_spi.c
@@ -403,7 +403,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
403 403
404 /* MMIO registers */ 404 /* MMIO registers */
405 dev_dbg(&op->dev, "probing mpc5200 SPI device\n"); 405 dev_dbg(&op->dev, "probing mpc5200 SPI device\n");
406 regs = of_iomap(op->node, 0); 406 regs = of_iomap(op->dev.of_node, 0);
407 if (!regs) 407 if (!regs)
408 return -ENODEV; 408 return -ENODEV;
409 409
@@ -445,11 +445,11 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
445 ms = spi_master_get_devdata(master); 445 ms = spi_master_get_devdata(master);
446 ms->master = master; 446 ms->master = master;
447 ms->regs = regs; 447 ms->regs = regs;
448 ms->irq0 = irq_of_parse_and_map(op->node, 0); 448 ms->irq0 = irq_of_parse_and_map(op->dev.of_node, 0);
449 ms->irq1 = irq_of_parse_and_map(op->node, 1); 449 ms->irq1 = irq_of_parse_and_map(op->dev.of_node, 1);
450 ms->state = mpc52xx_spi_fsmstate_idle; 450 ms->state = mpc52xx_spi_fsmstate_idle;
451 ms->ipb_freq = mpc5xxx_get_bus_frequency(op->node); 451 ms->ipb_freq = mpc5xxx_get_bus_frequency(op->dev.of_node);
452 ms->gpio_cs_count = of_gpio_count(op->node); 452 ms->gpio_cs_count = of_gpio_count(op->dev.of_node);
453 if (ms->gpio_cs_count > 0) { 453 if (ms->gpio_cs_count > 0) {
454 master->num_chipselect = ms->gpio_cs_count; 454 master->num_chipselect = ms->gpio_cs_count;
455 ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int), 455 ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int),
@@ -460,7 +460,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
460 } 460 }
461 461
462 for (i = 0; i < ms->gpio_cs_count; i++) { 462 for (i = 0; i < ms->gpio_cs_count; i++) {
463 gpio_cs = of_get_gpio(op->node, i); 463 gpio_cs = of_get_gpio(op->dev.of_node, i);
464 if (gpio_cs < 0) { 464 if (gpio_cs < 0) {
465 dev_err(&op->dev, 465 dev_err(&op->dev,
466 "could not parse the gpio field " 466 "could not parse the gpio field "
@@ -512,7 +512,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
512 if (rc) 512 if (rc)
513 goto err_register; 513 goto err_register;
514 514
515 of_register_spi_devices(master, op->node); 515 of_register_spi_devices(master, op->dev.of_node);
516 dev_info(&ms->master->dev, "registered MPC5200 SPI bus\n"); 516 dev_info(&ms->master->dev, "registered MPC5200 SPI bus\n");
517 517
518 return rc; 518 return rc;
@@ -558,9 +558,11 @@ static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
558MODULE_DEVICE_TABLE(of, mpc52xx_spi_match); 558MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);
559 559
560static struct of_platform_driver mpc52xx_spi_of_driver = { 560static struct of_platform_driver mpc52xx_spi_of_driver = {
561 .owner = THIS_MODULE, 561 .driver = {
562 .name = "mpc52xx-spi", 562 .name = "mpc52xx-spi",
563 .match_table = mpc52xx_spi_match, 563 .owner = THIS_MODULE,
564 .of_match_table = mpc52xx_spi_match,
565 },
564 .probe = mpc52xx_spi_probe, 566 .probe = mpc52xx_spi_probe,
565 .remove = __exit_p(mpc52xx_spi_remove), 567 .remove = __exit_p(mpc52xx_spi_remove),
566}; 568};
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 36828358a4d..e76b1afafe0 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
43MODULE_AUTHOR("Stephen Street"); 42MODULE_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
1606out_error_master_alloc: 1605out_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_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index 6e7aabe8db1..ffa111a7e9d 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -678,7 +678,7 @@ static int mpc8xxx_spi_setup(struct spi_device *spi)
678 } 678 }
679 mpc8xxx_spi = spi_master_get_devdata(spi->master); 679 mpc8xxx_spi = spi_master_get_devdata(spi->master);
680 680
681 hw_mode = cs->hw_mode; /* Save orginal settings */ 681 hw_mode = cs->hw_mode; /* Save original settings */
682 cs->hw_mode = mpc8xxx_spi_read_reg(&mpc8xxx_spi->base->mode); 682 cs->hw_mode = mpc8xxx_spi_read_reg(&mpc8xxx_spi->base->mode);
683 /* mask out bits we are going to set */ 683 /* mask out bits we are going to set */
684 cs->hw_mode &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH 684 cs->hw_mode &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
@@ -835,7 +835,7 @@ static void mpc8xxx_spi_free_dummy_rx(void)
835static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) 835static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
836{ 836{
837 struct device *dev = mspi->dev; 837 struct device *dev = mspi->dev;
838 struct device_node *np = dev_archdata_get_node(&dev->archdata); 838 struct device_node *np = dev->of_node;
839 const u32 *iprop; 839 const u32 *iprop;
840 int size; 840 int size;
841 unsigned long spi_base_ofs; 841 unsigned long spi_base_ofs;
@@ -889,7 +889,7 @@ static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
889static int mpc8xxx_spi_cpm_init(struct mpc8xxx_spi *mspi) 889static int mpc8xxx_spi_cpm_init(struct mpc8xxx_spi *mspi)
890{ 890{
891 struct device *dev = mspi->dev; 891 struct device *dev = mspi->dev;
892 struct device_node *np = dev_archdata_get_node(&dev->archdata); 892 struct device_node *np = dev->of_node;
893 const u32 *iprop; 893 const u32 *iprop;
894 int size; 894 int size;
895 unsigned long pram_ofs; 895 unsigned long pram_ofs;
@@ -1161,7 +1161,7 @@ static void mpc8xxx_spi_cs_control(struct spi_device *spi, bool on)
1161 1161
1162static int of_mpc8xxx_spi_get_chipselects(struct device *dev) 1162static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
1163{ 1163{
1164 struct device_node *np = dev_archdata_get_node(&dev->archdata); 1164 struct device_node *np = dev->of_node;
1165 struct fsl_spi_platform_data *pdata = dev->platform_data; 1165 struct fsl_spi_platform_data *pdata = dev->platform_data;
1166 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); 1166 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
1167 unsigned int ngpios; 1167 unsigned int ngpios;
@@ -1262,7 +1262,7 @@ static int __devinit of_mpc8xxx_spi_probe(struct of_device *ofdev,
1262 const struct of_device_id *ofid) 1262 const struct of_device_id *ofid)
1263{ 1263{
1264 struct device *dev = &ofdev->dev; 1264 struct device *dev = &ofdev->dev;
1265 struct device_node *np = ofdev->node; 1265 struct device_node *np = ofdev->dev.of_node;
1266 struct mpc8xxx_spi_probe_info *pinfo; 1266 struct mpc8xxx_spi_probe_info *pinfo;
1267 struct fsl_spi_platform_data *pdata; 1267 struct fsl_spi_platform_data *pdata;
1268 struct spi_master *master; 1268 struct spi_master *master;
@@ -1350,8 +1350,11 @@ static const struct of_device_id of_mpc8xxx_spi_match[] = {
1350MODULE_DEVICE_TABLE(of, of_mpc8xxx_spi_match); 1350MODULE_DEVICE_TABLE(of, of_mpc8xxx_spi_match);
1351 1351
1352static struct of_platform_driver of_mpc8xxx_spi_driver = { 1352static struct of_platform_driver of_mpc8xxx_spi_driver = {
1353 .name = "mpc8xxx_spi", 1353 .driver = {
1354 .match_table = of_mpc8xxx_spi_match, 1354 .name = "mpc8xxx_spi",
1355 .owner = THIS_MODULE,
1356 .of_match_table = of_mpc8xxx_spi_match,
1357 },
1355 .probe = of_mpc8xxx_spi_probe, 1358 .probe = of_mpc8xxx_spi_probe,
1356 .remove = __devexit_p(of_mpc8xxx_spi_remove), 1359 .remove = __devexit_p(of_mpc8xxx_spi_remove),
1357}; 1360};
diff --git a/drivers/spi/spi_ppc4xx.c b/drivers/spi/spi_ppc4xx.c
index 7cb5ff37f6e..19c0b3b34fc 100644
--- a/drivers/spi/spi_ppc4xx.c
+++ b/drivers/spi/spi_ppc4xx.c
@@ -587,12 +587,12 @@ static const struct of_device_id spi_ppc4xx_of_match[] = {
587MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match); 587MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match);
588 588
589static struct of_platform_driver spi_ppc4xx_of_driver = { 589static struct of_platform_driver spi_ppc4xx_of_driver = {
590 .match_table = spi_ppc4xx_of_match,
591 .probe = spi_ppc4xx_of_probe, 590 .probe = spi_ppc4xx_of_probe,
592 .remove = __exit_p(spi_ppc4xx_of_remove), 591 .remove = __exit_p(spi_ppc4xx_of_remove),
593 .driver = { 592 .driver = {
594 .name = DRIVER_NAME, 593 .name = DRIVER_NAME,
595 .owner = THIS_MODULE, 594 .owner = THIS_MODULE,
595 .of_match_table = spi_ppc4xx_of_match,
596 }, 596 },
597}; 597};
598 598
diff --git a/drivers/spi/xilinx_spi_of.c b/drivers/spi/xilinx_spi_of.c
index 748d33a76d2..55c58012a02 100644
--- a/drivers/spi/xilinx_spi_of.c
+++ b/drivers/spi/xilinx_spi_of.c
@@ -109,12 +109,12 @@ static const struct of_device_id xilinx_spi_of_match[] = {
109MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); 109MODULE_DEVICE_TABLE(of, xilinx_spi_of_match);
110 110
111static struct of_platform_driver xilinx_spi_of_driver = { 111static struct of_platform_driver xilinx_spi_of_driver = {
112 .match_table = xilinx_spi_of_match,
113 .probe = xilinx_spi_of_probe, 112 .probe = xilinx_spi_of_probe,
114 .remove = __exit_p(xilinx_spi_of_remove), 113 .remove = __exit_p(xilinx_spi_of_remove),
115 .driver = { 114 .driver = {
116 .name = "xilinx-xps-spi", 115 .name = "xilinx-xps-spi",
117 .owner = THIS_MODULE, 116 .owner = THIS_MODULE,
117 .of_match_table = xilinx_spi_of_match,
118 }, 118 },
119}; 119};
120 120