Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 301d8384 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'spi/topic/oom', 'spi/topic/pxa2xx',...

Merge remote-tracking branches 'spi/topic/oom', 'spi/topic/pxa2xx', 'spi/topic/rspi' and 'spi/topic/sirf' into spi-next
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -1111,10 +1111,8 @@ static int pl022_dma_probe(struct pl022 *pl022)
	}

	pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
	if (!pl022->dummypage) {
		dev_dbg(&pl022->adev->dev, "no DMA dummypage!\n");
	if (!pl022->dummypage)
		goto err_no_dummypage;
	}

	dev_info(&pl022->adev->dev, "setup for DMA on RX %s, TX %s\n",
		 dma_chan_name(pl022->dma_rx_channel),
@@ -1809,11 +1807,8 @@ static int pl022_setup(struct spi_device *spi)

	if (chip == NULL) {
		chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
		if (!chip) {
			dev_err(&spi->dev,
				"cannot allocate controller state\n");
		if (!chip)
			return -ENOMEM;
		}
		dev_dbg(&spi->dev,
			"allocated memory for controller's runtime state\n");
	}
@@ -2050,10 +2045,8 @@ pl022_platform_data_dt_get(struct device *dev)
	}

	pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL);
	if (!pd) {
		dev_err(dev, "cannot allocate platform data memory\n");
	if (!pd)
		return NULL;
	}

	pd->bus_id = -1;
	pd->enable_dma = 1;
+61 −15
Original line number Diff line number Diff line
@@ -8,7 +8,43 @@
#include <linux/module.h>
#include <linux/spi/pxa2xx_spi.h>

static int ce4100_spi_probe(struct pci_dev *dev,
enum {
	PORT_CE4100,
	PORT_BYT,
};

struct pxa_spi_info {
	enum pxa_ssp_type type;
	int port_id;
	int num_chipselect;
	int tx_slave_id;
	int tx_chan_id;
	int rx_slave_id;
	int rx_chan_id;
};

static struct pxa_spi_info spi_info_configs[] = {
	[PORT_CE4100] = {
		.type = PXA25x_SSP,
		.port_id =  -1,
		.num_chipselect = -1,
		.tx_slave_id = -1,
		.tx_chan_id = -1,
		.rx_slave_id = -1,
		.rx_chan_id = -1,
	},
	[PORT_BYT] = {
		.type = LPSS_SSP,
		.port_id = 0,
		.num_chipselect = 1,
		.tx_slave_id = 0,
		.tx_chan_id = 0,
		.rx_slave_id = 1,
		.rx_chan_id = 1,
	},
};

static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
		const struct pci_device_id *ent)
{
	struct platform_device_info pi;
@@ -16,6 +52,7 @@ static int ce4100_spi_probe(struct pci_dev *dev,
	struct platform_device *pdev;
	struct pxa2xx_spi_master spi_pdata;
	struct ssp_device *ssp;
	struct pxa_spi_info *c;

	ret = pcim_enable_device(dev);
	if (ret)
@@ -25,8 +62,16 @@ static int ce4100_spi_probe(struct pci_dev *dev,
	if (ret)
		return ret;

	c = &spi_info_configs[ent->driver_data];

	memset(&spi_pdata, 0, sizeof(spi_pdata));
	spi_pdata.num_chipselect = dev->devfn;
	spi_pdata.num_chipselect = (c->num_chipselect > 0) ?
					c->num_chipselect : dev->devfn;
	spi_pdata.tx_slave_id = c->tx_slave_id;
	spi_pdata.tx_chan_id = c->tx_chan_id;
	spi_pdata.rx_slave_id = c->rx_slave_id;
	spi_pdata.rx_chan_id = c->rx_chan_id;
	spi_pdata.enable_dma = c->rx_slave_id >= 0 && c->tx_slave_id >= 0;

	ssp = &spi_pdata.ssp;
	ssp->phys_base = pci_resource_start(dev, 0);
@@ -36,8 +81,8 @@ static int ce4100_spi_probe(struct pci_dev *dev,
		return -EIO;
	}
	ssp->irq = dev->irq;
	ssp->port_id = dev->devfn;
	ssp->type = PXA25x_SSP;
	ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn;
	ssp->type = c->type;

	memset(&pi, 0, sizeof(pi));
	pi.parent = &dev->dev;
@@ -55,28 +100,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 const struct pci_device_id ce4100_spi_devices[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) },
static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
	{ PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 },
	{ PCI_VDEVICE(INTEL, 0x0f0e), PORT_BYT },
	{ },
};
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("CE4100/LPSS PCI-SPI glue code for PXA's driver");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");
+7 −13
Original line number Diff line number Diff line
@@ -886,11 +886,8 @@ static int setup(struct spi_device *spi)
	chip = spi_get_ctldata(spi);
	if (!chip) {
		chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
		if (!chip) {
			dev_err(&spi->dev,
				"failed setup: can't allocate chip data\n");
		if (!chip)
			return -ENOMEM;
		}

		if (drv_data->ssp_type == CE4100_SSP) {
			if (spi->chip_select > 4) {
@@ -1037,11 +1034,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
		return NULL;

	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
	if (!pdata) {
		dev_err(&pdev->dev,
			"failed to allocate memory for platform data\n");
	if (!pdata)
		return NULL;
	}

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res)
@@ -1202,6 +1196,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
	tasklet_init(&drv_data->pump_transfers, pump_transfers,
		     (unsigned long)drv_data);

	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);

	/* Register with the SPI framework */
	platform_set_drvdata(pdev, drv_data);
	status = devm_spi_register_master(&pdev->dev, master);
@@ -1210,11 +1209,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
		goto out_error_clock_enabled;
	}

	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);

	return status;

out_error_clock_enabled:
+217 −384

File changed.

Preview size limit exceeded, changes collapsed.

+4 −10
Original line number Diff line number Diff line
@@ -183,11 +183,11 @@ static int s3c24xx_spi_setup(struct spi_device *spi)

	/* allocate settings on the first call */
	if (!cs) {
		cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL);
		if (!cs) {
			dev_err(&spi->dev, "no memory for controller state\n");
		cs = devm_kzalloc(&spi->dev,
				  sizeof(struct s3c24xx_spi_devstate),
				  GFP_KERNEL);
		if (!cs)
			return -ENOMEM;
		}

		cs->spcon = SPCON_DEFAULT;
		cs->hz = -1;
@@ -209,11 +209,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
	return 0;
}

static void s3c24xx_spi_cleanup(struct spi_device *spi)
{
	kfree(spi->controller_state);
}

static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
{
	return hw->tx ? hw->tx[count] : 0;
@@ -543,7 +538,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
	hw->bitbang.txrx_bufs      = s3c24xx_spi_txrx;

	hw->master->setup  = s3c24xx_spi_setup;
	hw->master->cleanup = s3c24xx_spi_cleanup;

	dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);

Loading