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

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
...@@ -1111,10 +1111,8 @@ static int pl022_dma_probe(struct pl022 *pl022) ...@@ -1111,10 +1111,8 @@ static int pl022_dma_probe(struct pl022 *pl022)
} }
pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!pl022->dummypage) { if (!pl022->dummypage)
dev_dbg(&pl022->adev->dev, "no DMA dummypage!\n");
goto err_no_dummypage; goto err_no_dummypage;
}
dev_info(&pl022->adev->dev, "setup for DMA on RX %s, TX %s\n", dev_info(&pl022->adev->dev, "setup for DMA on RX %s, TX %s\n",
dma_chan_name(pl022->dma_rx_channel), dma_chan_name(pl022->dma_rx_channel),
...@@ -1809,11 +1807,8 @@ static int pl022_setup(struct spi_device *spi) ...@@ -1809,11 +1807,8 @@ static int pl022_setup(struct spi_device *spi)
if (chip == NULL) { if (chip == NULL) {
chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
if (!chip) { if (!chip)
dev_err(&spi->dev,
"cannot allocate controller state\n");
return -ENOMEM; return -ENOMEM;
}
dev_dbg(&spi->dev, dev_dbg(&spi->dev,
"allocated memory for controller's runtime state\n"); "allocated memory for controller's runtime state\n");
} }
...@@ -2050,10 +2045,8 @@ pl022_platform_data_dt_get(struct device *dev) ...@@ -2050,10 +2045,8 @@ pl022_platform_data_dt_get(struct device *dev)
} }
pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL); pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL);
if (!pd) { if (!pd)
dev_err(dev, "cannot allocate platform data memory\n");
return NULL; return NULL;
}
pd->bus_id = -1; pd->bus_id = -1;
pd->enable_dma = 1; pd->enable_dma = 1;
......
...@@ -8,7 +8,43 @@ ...@@ -8,7 +8,43 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/spi/pxa2xx_spi.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) const struct pci_device_id *ent)
{ {
struct platform_device_info pi; struct platform_device_info pi;
...@@ -16,6 +52,7 @@ static int ce4100_spi_probe(struct pci_dev *dev, ...@@ -16,6 +52,7 @@ static int ce4100_spi_probe(struct pci_dev *dev,
struct platform_device *pdev; struct platform_device *pdev;
struct pxa2xx_spi_master spi_pdata; struct pxa2xx_spi_master spi_pdata;
struct ssp_device *ssp; struct ssp_device *ssp;
struct pxa_spi_info *c;
ret = pcim_enable_device(dev); ret = pcim_enable_device(dev);
if (ret) if (ret)
...@@ -25,8 +62,16 @@ static int ce4100_spi_probe(struct pci_dev *dev, ...@@ -25,8 +62,16 @@ static int ce4100_spi_probe(struct pci_dev *dev,
if (ret) if (ret)
return ret; return ret;
c = &spi_info_configs[ent->driver_data];
memset(&spi_pdata, 0, sizeof(spi_pdata)); 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 = &spi_pdata.ssp;
ssp->phys_base = pci_resource_start(dev, 0); ssp->phys_base = pci_resource_start(dev, 0);
...@@ -36,8 +81,8 @@ static int ce4100_spi_probe(struct pci_dev *dev, ...@@ -36,8 +81,8 @@ static int ce4100_spi_probe(struct pci_dev *dev,
return -EIO; return -EIO;
} }
ssp->irq = dev->irq; ssp->irq = dev->irq;
ssp->port_id = dev->devfn; ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn;
ssp->type = PXA25x_SSP; ssp->type = c->type;
memset(&pi, 0, sizeof(pi)); memset(&pi, 0, sizeof(pi));
pi.parent = &dev->dev; pi.parent = &dev->dev;
...@@ -55,28 +100,29 @@ static int ce4100_spi_probe(struct pci_dev *dev, ...@@ -55,28 +100,29 @@ static int ce4100_spi_probe(struct pci_dev *dev,
return 0; 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); struct platform_device *pdev = pci_get_drvdata(dev);
platform_device_unregister(pdev); platform_device_unregister(pdev);
} }
static const struct pci_device_id ce4100_spi_devices[] = { static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, { 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 = { static struct pci_driver pxa2xx_spi_pci_driver = {
.name = "ce4100_spi", .name = "pxa2xx_spi_pci",
.id_table = ce4100_spi_devices, .id_table = pxa2xx_spi_pci_devices,
.probe = ce4100_spi_probe, .probe = pxa2xx_spi_pci_probe,
.remove = ce4100_spi_remove, .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_LICENSE("GPL v2");
MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>"); MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");
...@@ -886,11 +886,8 @@ static int setup(struct spi_device *spi) ...@@ -886,11 +886,8 @@ static int setup(struct spi_device *spi)
chip = spi_get_ctldata(spi); chip = spi_get_ctldata(spi);
if (!chip) { if (!chip) {
chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
if (!chip) { if (!chip)
dev_err(&spi->dev,
"failed setup: can't allocate chip data\n");
return -ENOMEM; return -ENOMEM;
}
if (drv_data->ssp_type == CE4100_SSP) { if (drv_data->ssp_type == CE4100_SSP) {
if (spi->chip_select > 4) { if (spi->chip_select > 4) {
...@@ -1037,11 +1034,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) ...@@ -1037,11 +1034,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
return NULL; return NULL;
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_err(&pdev->dev,
"failed to allocate memory for platform data\n");
return NULL; return NULL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) if (!res)
...@@ -1202,6 +1196,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) ...@@ -1202,6 +1196,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
tasklet_init(&drv_data->pump_transfers, pump_transfers, tasklet_init(&drv_data->pump_transfers, pump_transfers,
(unsigned long)drv_data); (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 */ /* Register with the SPI framework */
platform_set_drvdata(pdev, drv_data); platform_set_drvdata(pdev, drv_data);
status = devm_spi_register_master(&pdev->dev, master); status = devm_spi_register_master(&pdev->dev, master);
...@@ -1210,11 +1209,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) ...@@ -1210,11 +1209,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
goto out_error_clock_enabled; 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; return status;
out_error_clock_enabled: out_error_clock_enabled:
......
This diff is collapsed.
...@@ -183,11 +183,11 @@ static int s3c24xx_spi_setup(struct spi_device *spi) ...@@ -183,11 +183,11 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
/* allocate settings on the first call */ /* allocate settings on the first call */
if (!cs) { if (!cs) {
cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL); cs = devm_kzalloc(&spi->dev,
if (!cs) { sizeof(struct s3c24xx_spi_devstate),
dev_err(&spi->dev, "no memory for controller state\n"); GFP_KERNEL);
if (!cs)
return -ENOMEM; return -ENOMEM;
}
cs->spcon = SPCON_DEFAULT; cs->spcon = SPCON_DEFAULT;
cs->hz = -1; cs->hz = -1;
...@@ -209,11 +209,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi) ...@@ -209,11 +209,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
return 0; 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) static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
{ {
return hw->tx ? hw->tx[count] : 0; return hw->tx ? hw->tx[count] : 0;
...@@ -543,7 +538,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) ...@@ -543,7 +538,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
hw->master->setup = s3c24xx_spi_setup; hw->master->setup = s3c24xx_spi_setup;
hw->master->cleanup = s3c24xx_spi_cleanup;
dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
......
...@@ -773,7 +773,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( ...@@ -773,7 +773,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
cs = kzalloc(sizeof(*cs), GFP_KERNEL); cs = kzalloc(sizeof(*cs), GFP_KERNEL);
if (!cs) { if (!cs) {
dev_err(&spi->dev, "could not allocate memory for controller data\n");
of_node_put(data_np); of_node_put(data_np);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -987,10 +986,8 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) ...@@ -987,10 +986,8 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
u32 temp; u32 temp;
sci = devm_kzalloc(dev, sizeof(*sci), GFP_KERNEL); sci = devm_kzalloc(dev, sizeof(*sci), GFP_KERNEL);
if (!sci) { if (!sci)
dev_err(dev, "memory allocation for spi_info failed\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
if (of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) { if (of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) {
dev_warn(dev, "spi bus clock parent not specified, using clock at index 0 as parent\n"); dev_warn(dev, "spi bus clock parent not specified, using clock at index 0 as parent\n");
......
...@@ -642,10 +642,8 @@ static struct sh_msiof_spi_info *sh_msiof_spi_parse_dt(struct device *dev) ...@@ -642,10 +642,8 @@ static struct sh_msiof_spi_info *sh_msiof_spi_parse_dt(struct device *dev)
u32 num_cs = 1; u32 num_cs = 1;
info = devm_kzalloc(dev, sizeof(struct sh_msiof_spi_info), GFP_KERNEL); info = devm_kzalloc(dev, sizeof(struct sh_msiof_spi_info), GFP_KERNEL);
if (!info) { if (!info)
dev_err(dev, "failed to allocate setup data\n");
return NULL; return NULL;
}
/* Parse the MSIOF properties */ /* Parse the MSIOF properties */
of_property_read_u32(np, "num-cs", &num_cs); of_property_read_u32(np, "num-cs", &num_cs);
......
This diff is collapsed.
...@@ -253,10 +253,8 @@ static int tle62x0_probe(struct spi_device *spi) ...@@ -253,10 +253,8 @@ static int tle62x0_probe(struct spi_device *spi)
} }
st = kzalloc(sizeof(struct tle62x0_state), GFP_KERNEL); st = kzalloc(sizeof(struct tle62x0_state), GFP_KERNEL);
if (st == NULL) { if (st == NULL)
dev_err(&spi->dev, "no memory for device state\n");
return -ENOMEM; return -ENOMEM;
}
st->us = spi; st->us = spi;
st->nr_gpio = pdata->gpio_count; st->nr_gpio = pdata->gpio_count;
......
...@@ -1578,14 +1578,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1578,14 +1578,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct pch_pd_dev_save *pd_dev_save; struct pch_pd_dev_save *pd_dev_save;
pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL); pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL);
if (!pd_dev_save) { if (!pd_dev_save)
dev_err(&pdev->dev, "%s Can't allocate pd_dev_sav\n", __func__);
return -ENOMEM; return -ENOMEM;
}
board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL); board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL);
if (!board_dat) { if (!board_dat) {
dev_err(&pdev->dev, "%s Can't allocate board_dat\n", __func__);
retval = -ENOMEM; retval = -ENOMEM;
goto err_no_mem; goto err_no_mem;
} }
......
...@@ -25,8 +25,6 @@ struct rspi_plat_data { ...@@ -25,8 +25,6 @@ struct rspi_plat_data {
unsigned int dma_tx_id; unsigned int dma_tx_id;
unsigned int dma_rx_id; unsigned int dma_rx_id;
unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
u16 num_chipselect; u16 num_chipselect;
}; };
......
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