[linux-yocto] [PATCH 04/22] valleyisland-io: spi/pxa2xx-pci: convert to generic pci glue layer
boon.leong.ong at intel.com
boon.leong.ong at intel.com
Wed Jan 29 10:41:29 PST 2014
From: Ong Boon Leong <boon.leong.ong at intel.com>
Rename the functions from ce4100_xxx to pxa2xx_spi_pci_xxx
to clarify that this is a generic PCI glue layer.
Signed-off-by: Ong Boon Leong <boon.leong.ong at intel.com>
---
...2xx-pci-convert-to-generic-pci-glue-layer.patch | 127 ++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 meta/cfg/kernel-cache/features/valleyisland-io/0002-spi-pxa2xx-pci-convert-to-generic-pci-glue-layer.patch
diff --git a/meta/cfg/kernel-cache/features/valleyisland-io/0002-spi-pxa2xx-pci-convert-to-generic-pci-glue-layer.patch b/meta/cfg/kernel-cache/features/valleyisland-io/0002-spi-pxa2xx-pci-convert-to-generic-pci-glue-layer.patch
new file mode 100644
index 0000000..d7ff329
--- /dev/null
+++ b/meta/cfg/kernel-cache/features/valleyisland-io/0002-spi-pxa2xx-pci-convert-to-generic-pci-glue-layer.patch
@@ -0,0 +1,127 @@
+From f881b2c9b27b9a06424f49eedd919a7c2b1f9bb4 Mon Sep 17 00:00:00 2001
+From: Chew, Chiau Ee <chiau.ee.chew at intel.com>
+Date: Thu, 23 Jan 2014 05:18:56 +0800
+Subject: [PATCH 02/19] spi/pxa2xx-pci: convert to generic pci glue layer
+
+Rename the functions from ce4100_xxx to pxa2xx_spi_pci_xxx
+to clarify that this is a generic PCI glue layer.
+
+This commit is created in reference to Mika Westerberg's previous
+work.
+
+Signed-off-by: Chew, Chiau Ee <chiau.ee.chew at intel.com>
+---
+ drivers/spi/spi-pxa2xx-pci.c | 60 +++++++++++++++++++++++++++++++----------
+ 1 files changed, 45 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
+index 48abae5..ea42179 100644
+--- a/drivers/spi/spi-pxa2xx-pci.c
++++ b/drivers/spi/spi-pxa2xx-pci.c
+@@ -7,10 +7,30 @@
+ #include <linux/of_device.h>
+ #include <linux/module.h>
+ #include <linux/spi/pxa2xx_spi.h>
++#include <linux/clk.h>
+
+-static int ce4100_spi_probe(struct pci_dev *dev,
++enum {
++ PORT_CE4100,
++};
++
++struct pxa2xx_spi_pci_config {
++ enum pxa_ssp_type type;
++ int num_cs;
++ int bus_num;
++};
++
++static struct pxa2xx_spi_pci_config spi_pci_configs[] = {
++ [PORT_CE4100] = {
++ .type = PXA25x_SSP,
++ .num_cs = -1,
++ .bus_num = -1,
++ },
++};
++
++static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
+ const struct pci_device_id *ent)
+ {
++ struct pxa2xx_spi_pci_config *c;
+ struct platform_device_info pi;
+ int ret;
+ struct platform_device *pdev;
+@@ -25,8 +45,11 @@ static int ce4100_spi_probe(struct pci_dev *dev,
+ if (ret)
+ return ret;
+
++
++ c = &spi_pci_configs[ent->driver_data];
++
+ memset(&spi_pdata, 0, sizeof(spi_pdata));
+- spi_pdata.num_chipselect = dev->devfn;
++ spi_pdata.num_chipselect = (c->num_cs >= 0) ? c->num_cs : dev->devfn;
+
+ ssp = &spi_pdata.ssp;
+ ssp->phys_base = pci_resource_start(dev, 0);
+@@ -35,9 +58,15 @@ static int ce4100_spi_probe(struct pci_dev *dev,
+ dev_err(&dev->dev, "failed to ioremap() registers\n");
+ return -EIO;
+ }
++ ssp->clk = devm_clk_get(&dev->dev, NULL);
++ if (IS_ERR(ssp->clk)) {
++ dev_err(&dev->dev, "failed to get clock\n");
++ return PTR_ERR(ssp->clk);
++ }
++
+ ssp->irq = dev->irq;
+- ssp->port_id = dev->devfn;
+- ssp->type = PXA25x_SSP;
++ ssp->port_id = (c->bus_num >= 0) ? c->bus_num : dev->devfn;
++ ssp->type = c->type;
+
+ memset(&pi, 0, sizeof(pi));
+ pi.parent = &dev->dev;
+@@ -55,28 +84,29 @@ static int ce4100_spi_probe(struct pci_dev *dev,
+ return 0;
+ }
+
+-static void ce4100_spi_remove(struct pci_dev *dev)
++static void pxa2xx_spi_pci_remove(struct pci_dev *dev)
+ {
+ struct platform_device *pdev = pci_get_drvdata(dev);
+
+ platform_device_unregister(pdev);
+ }
+
+-static DEFINE_PCI_DEVICE_TABLE(ce4100_spi_devices) = {
+- { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) },
++static DEFINE_PCI_DEVICE_TABLE(pxa2xx_spi_pci_devices) = {
++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a),
++ .driver_data = PORT_CE4100 },
+ { },
+ };
+-MODULE_DEVICE_TABLE(pci, ce4100_spi_devices);
++MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices);
+
+-static struct pci_driver ce4100_spi_driver = {
+- .name = "ce4100_spi",
+- .id_table = ce4100_spi_devices,
+- .probe = ce4100_spi_probe,
+- .remove = ce4100_spi_remove,
++static struct pci_driver pxa2xx_spi_pci_driver = {
++ .name = "pxa2xx-spi-pci",
++ .id_table = pxa2xx_spi_pci_devices,
++ .probe = pxa2xx_spi_pci_probe,
++ .remove = pxa2xx_spi_pci_remove,
+ };
+
+-module_pci_driver(ce4100_spi_driver);
++module_pci_driver(pxa2xx_spi_pci_driver);
+
+-MODULE_DESCRIPTION("CE4100 PCI-SPI glue code for PXA's driver");
++MODULE_DESCRIPTION("PCI-SPI glue code for PXA's driver");
+ MODULE_LICENSE("GPL v2");
+ MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy at linutronix.de>");
+--
+1.7.4.4
+
--
1.7.10.4
More information about the linux-yocto
mailing list