2 * CE4100's SPI device is more or less the same one as found on PXA
6 #include <linux/platform_device.h>
7 #include <linux/of_device.h>
8 #include <linux/module.h>
9 #include <linux/spi/pxa2xx_spi.h>
17 enum pxa_ssp_type type;
26 static struct pxa_spi_info spi_info_configs[] = {
47 static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
48 const struct pci_device_id *ent)
50 struct platform_device_info pi;
52 struct platform_device *pdev;
53 struct pxa2xx_spi_master spi_pdata;
54 struct ssp_device *ssp;
55 struct pxa_spi_info *c;
57 ret = pcim_enable_device(dev);
61 ret = pcim_iomap_regions(dev, 1 << 0, "PXA2xx SPI");
65 c = &spi_info_configs[ent->driver_data];
67 memset(&spi_pdata, 0, sizeof(spi_pdata));
68 spi_pdata.num_chipselect = (c->num_chipselect > 0) ?
69 c->num_chipselect : dev->devfn;
70 spi_pdata.tx_slave_id = c->tx_slave_id;
71 spi_pdata.tx_chan_id = c->tx_chan_id;
72 spi_pdata.rx_slave_id = c->rx_slave_id;
73 spi_pdata.rx_chan_id = c->rx_chan_id;
74 spi_pdata.enable_dma = c->rx_slave_id >= 0 && c->tx_slave_id >= 0;
77 ssp->phys_base = pci_resource_start(dev, 0);
78 ssp->mmio_base = pcim_iomap_table(dev)[0];
79 if (!ssp->mmio_base) {
80 dev_err(&dev->dev, "failed to ioremap() registers\n");
84 ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn;
87 memset(&pi, 0, sizeof(pi));
88 pi.parent = &dev->dev;
89 pi.name = "pxa2xx-spi";
92 pi.size_data = sizeof(spi_pdata);
94 pdev = platform_device_register_full(&pi);
98 pci_set_drvdata(dev, pdev);
103 static void pxa2xx_spi_pci_remove(struct pci_dev *dev)
105 struct platform_device *pdev = pci_get_drvdata(dev);
107 platform_device_unregister(pdev);
110 static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
111 { PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 },
112 { PCI_VDEVICE(INTEL, 0x0f0e), PORT_BYT },
115 MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices);
117 static struct pci_driver pxa2xx_spi_pci_driver = {
118 .name = "pxa2xx_spi_pci",
119 .id_table = pxa2xx_spi_pci_devices,
120 .probe = pxa2xx_spi_pci_probe,
121 .remove = pxa2xx_spi_pci_remove,
124 module_pci_driver(pxa2xx_spi_pci_driver);
126 MODULE_DESCRIPTION("CE4100/LPSS PCI-SPI glue code for PXA's driver");
127 MODULE_LICENSE("GPL v2");
128 MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");