Version:  2.0.40 2.2.26 2.4.37 2.6.39 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15

Linux/drivers/spi/spi-pxa2xx-pci.c

  1 /*
  2  * CE4100's SPI device is more or less the same one as found on PXA
  3  *
  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>
 10 
 11 static int ce4100_spi_probe(struct pci_dev *dev,
 12                 const struct pci_device_id *ent)
 13 {
 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;
 19 
 20         ret = pcim_enable_device(dev);
 21         if (ret)
 22                 return ret;
 23 
 24         ret = pcim_iomap_regions(dev, 1 << 0, "PXA2xx SPI");
 25         if (ret)
 26                 return ret;
 27 
 28         memset(&spi_pdata, 0, sizeof(spi_pdata));
 29         spi_pdata.num_chipselect = dev->devfn;
 30 
 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;
 37         }
 38         ssp->irq = dev->irq;
 39         ssp->port_id = dev->devfn;
 40         ssp->type = PXA25x_SSP;
 41 
 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);
 48 
 49         pdev = platform_device_register_full(&pi);
 50         if (IS_ERR(pdev))
 51                 return PTR_ERR(pdev);
 52 
 53         pci_set_drvdata(dev, pdev);
 54 
 55         return 0;
 56 }
 57 
 58 static void ce4100_spi_remove(struct pci_dev *dev)
 59 {
 60         struct platform_device *pdev = pci_get_drvdata(dev);
 61 
 62         platform_device_unregister(pdev);
 63 }
 64 
 65 static const struct pci_device_id ce4100_spi_devices[] = {
 66         { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) },
 67         { },
 68 };
 69 MODULE_DEVICE_TABLE(pci, ce4100_spi_devices);
 70 
 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,
 76 };
 77 
 78 module_pci_driver(ce4100_spi_driver);
 79 
 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>");
 83 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us