Commit cc160697 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

spi: pxa2xx: Convert PCI driver to use spi-pxa2xx code directly

PCI driver has an additional device layer for enumeration.
Remove that layer and use spi-pxa2xx code directly.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240530151117.1130792-12-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3d8f037f
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/platform_device.h> #include <linux/pm.h>
#include <linux/property.h>
#include <linux/sprintf.h> #include <linux/sprintf.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -265,10 +264,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, ...@@ -265,10 +264,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
const struct pxa_spi_info *info; const struct pxa_spi_info *info;
struct platform_device_info pi;
int ret; int ret;
struct platform_device *pdev; struct pxa2xx_spi_controller *pdata;
struct pxa2xx_spi_controller spi_pdata;
struct ssp_device *ssp; struct ssp_device *ssp;
ret = pcim_enable_device(dev); ret = pcim_enable_device(dev);
...@@ -279,15 +276,17 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, ...@@ -279,15 +276,17 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
if (ret) if (ret)
return ret; return ret;
memset(&spi_pdata, 0, sizeof(spi_pdata)); pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
ssp = &spi_pdata.ssp; ssp = &pdata->ssp;
ssp->dev = &dev->dev; ssp->dev = &dev->dev;
ssp->phys_base = pci_resource_start(dev, 0); ssp->phys_base = pci_resource_start(dev, 0);
ssp->mmio_base = pcim_iomap_table(dev)[0]; ssp->mmio_base = pcim_iomap_table(dev)[0];
info = (struct pxa_spi_info *)ent->driver_data; info = (struct pxa_spi_info *)ent->driver_data;
ret = info->setup(dev, &spi_pdata); ret = info->setup(dev, pdata);
if (ret) if (ret)
return ret; return ret;
...@@ -298,28 +297,12 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, ...@@ -298,28 +297,12 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
return ret; return ret;
ssp->irq = pci_irq_vector(dev, 0); ssp->irq = pci_irq_vector(dev, 0);
memset(&pi, 0, sizeof(pi)); return pxa2xx_spi_probe(&dev->dev, ssp);
pi.fwnode = dev_fwnode(&dev->dev);
pi.parent = &dev->dev;
pi.name = "pxa2xx-spi";
pi.id = ssp->port_id;
pi.data = &spi_pdata;
pi.size_data = sizeof(spi_pdata);
pdev = platform_device_register_full(&pi);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
pci_set_drvdata(dev, pdev);
return 0;
} }
static void pxa2xx_spi_pci_remove(struct pci_dev *dev) static void pxa2xx_spi_pci_remove(struct pci_dev *dev)
{ {
struct platform_device *pdev = pci_get_drvdata(dev); pxa2xx_spi_remove(&dev->dev);
platform_device_unregister(pdev);
} }
static const struct pci_device_id pxa2xx_spi_pci_devices[] = { static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
...@@ -341,6 +324,9 @@ MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices); ...@@ -341,6 +324,9 @@ MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices);
static struct pci_driver pxa2xx_spi_pci_driver = { static struct pci_driver pxa2xx_spi_pci_driver = {
.name = "pxa2xx_spi_pci", .name = "pxa2xx_spi_pci",
.id_table = pxa2xx_spi_pci_devices, .id_table = pxa2xx_spi_pci_devices,
.driver = {
.pm = pm_ptr(&pxa2xx_spi_pm_ops),
},
.probe = pxa2xx_spi_pci_probe, .probe = pxa2xx_spi_pci_probe,
.remove = pxa2xx_spi_pci_remove, .remove = pxa2xx_spi_pci_remove,
}; };
...@@ -349,4 +335,5 @@ module_pci_driver(pxa2xx_spi_pci_driver); ...@@ -349,4 +335,5 @@ module_pci_driver(pxa2xx_spi_pci_driver);
MODULE_DESCRIPTION("CE4100/LPSS PCI-SPI glue code for PXA's driver"); MODULE_DESCRIPTION("CE4100/LPSS PCI-SPI glue code for PXA's driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_IMPORT_NS(SPI_PXA2xx);
MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>"); MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment