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>
11 static int ce4100_spi_probe(struct pci_dev
*dev
,
12 const struct pci_device_id
*ent
)
14 struct platform_device_info pi
;
16 struct platform_device
*pdev
;
17 struct pxa2xx_spi_master spi_pdata
;
18 struct ssp_device
*ssp
;
20 ret
= pcim_enable_device(dev
);
24 ret
= pcim_iomap_regions(dev
, 1 << 0, "PXA2xx SPI");
28 memset(&spi_pdata
, 0, sizeof(spi_pdata
));
29 spi_pdata
.num_chipselect
= dev
->devfn
;
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");
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";
47 pi
.size_data
= sizeof(spi_pdata
);
49 pdev
= platform_device_register_full(&pi
);
53 pci_set_drvdata(dev
, pdev
);
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 DEFINE_PCI_DEVICE_TABLE(ce4100_spi_devices
) = {
66 { PCI_DEVICE(PCI_VENDOR_ID_INTEL
, 0x2e6a) },
69 MODULE_DEVICE_TABLE(pci
, ce4100_spi_devices
);
71 static struct pci_driver ce4100_spi_driver
= {
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>");