PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / spi / spi-pxa2xx-pci.c
blob3f006d3ed2a8bad5f749e5433aa1572ea23df15b
1 /*
2 * CE4100's SPI device is more or less the same one as found on PXA
4 */
5 #include <linux/pci.h>
6 #include <linux/platform_device.h>
7 #include <linux/of_device.h>
8 #include <linux/module.h>
9 #include <linux/spi/pxa2xx_spi.h>
11 static int ce4100_spi_probe(struct pci_dev *dev,
12 const struct pci_device_id *ent)
14 struct platform_device_info pi;
15 int ret;
16 struct platform_device *pdev;
17 struct pxa2xx_spi_master spi_pdata;
18 struct ssp_device *ssp;
20 ret = pcim_enable_device(dev);
21 if (ret)
22 return ret;
24 ret = pcim_iomap_regions(dev, 1 << 0, "PXA2xx SPI");
25 if (ret)
26 return ret;
28 memset(&spi_pdata, 0, sizeof(spi_pdata));
29 spi_pdata.num_chipselect = dev->devfn;
31 ssp = &spi_pdata.ssp;
32 ssp->phys_base = pci_resource_start(dev, 0);
33 ssp->mmio_base = pcim_iomap_table(dev)[0];
34 if (!ssp->mmio_base) {
35 dev_err(&dev->dev, "failed to ioremap() registers\n");
36 return -EIO;
38 ssp->irq = dev->irq;
39 ssp->port_id = dev->devfn;
40 ssp->type = PXA25x_SSP;
42 memset(&pi, 0, sizeof(pi));
43 pi.parent = &dev->dev;
44 pi.name = "pxa2xx-spi";
45 pi.id = ssp->port_id;
46 pi.data = &spi_pdata;
47 pi.size_data = sizeof(spi_pdata);
49 pdev = platform_device_register_full(&pi);
50 if (IS_ERR(pdev))
51 return PTR_ERR(pdev);
53 pci_set_drvdata(dev, pdev);
55 return 0;
58 static void ce4100_spi_remove(struct pci_dev *dev)
60 struct platform_device *pdev = pci_get_drvdata(dev);
62 platform_device_unregister(pdev);
65 static const struct pci_device_id ce4100_spi_devices[] = {
66 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) },
67 { },
69 MODULE_DEVICE_TABLE(pci, ce4100_spi_devices);
71 static struct pci_driver ce4100_spi_driver = {
72 .name = "ce4100_spi",
73 .id_table = ce4100_spi_devices,
74 .probe = ce4100_spi_probe,
75 .remove = ce4100_spi_remove,
78 module_pci_driver(ce4100_spi_driver);
80 MODULE_DESCRIPTION("CE4100 PCI-SPI glue code for PXA's driver");
81 MODULE_LICENSE("GPL v2");
82 MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");