aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-pxa2xx-dma.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2014-08-19 13:29:19 -0400
committerVinod Koul <vinod.koul@intel.com>2014-09-18 02:24:07 -0400
commitb729bf34535ed413667b397a2f59cfa81266facf (patch)
tree9e8020289c02e2894afabb6ef57fabaf20d77d56 /drivers/spi/spi-pxa2xx-dma.c
parenta0a53a43ef51374c144a5f19f3f90c43aed76857 (diff)
spi/pxa2xx: Don't use slave_id of dma_slave_config
That field has been deprecated in favour of getting the necessary information from ACPI/DT. However, we still need to deal systems that are PCI only (no ACPI to back up). In order to support such systems, we allow the DMA filter function and its corresponding parameter via pxa2xx_spi_master platform data. Then when the pxa2xx_spi_dma_setup() doesn't find the channel via ACPI, it falls back to use the given filter function. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/spi/spi-pxa2xx-dma.c')
-rw-r--r--drivers/spi/spi-pxa2xx-dma.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c
index c41ff148a2b4..62a9297e96ac 100644
--- a/drivers/spi/spi-pxa2xx-dma.c
+++ b/drivers/spi/spi-pxa2xx-dma.c
@@ -157,7 +157,6 @@ static struct dma_async_tx_descriptor *
157pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data, 157pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data,
158 enum dma_transfer_direction dir) 158 enum dma_transfer_direction dir)
159{ 159{
160 struct pxa2xx_spi_master *pdata = drv_data->master_info;
161 struct chip_data *chip = drv_data->cur_chip; 160 struct chip_data *chip = drv_data->cur_chip;
162 enum dma_slave_buswidth width; 161 enum dma_slave_buswidth width;
163 struct dma_slave_config cfg; 162 struct dma_slave_config cfg;
@@ -184,7 +183,6 @@ pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data,
184 cfg.dst_addr = drv_data->ssdr_physical; 183 cfg.dst_addr = drv_data->ssdr_physical;
185 cfg.dst_addr_width = width; 184 cfg.dst_addr_width = width;
186 cfg.dst_maxburst = chip->dma_burst_size; 185 cfg.dst_maxburst = chip->dma_burst_size;
187 cfg.slave_id = pdata->tx_slave_id;
188 186
189 sgt = &drv_data->tx_sgt; 187 sgt = &drv_data->tx_sgt;
190 nents = drv_data->tx_nents; 188 nents = drv_data->tx_nents;
@@ -193,7 +191,6 @@ pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data,
193 cfg.src_addr = drv_data->ssdr_physical; 191 cfg.src_addr = drv_data->ssdr_physical;
194 cfg.src_addr_width = width; 192 cfg.src_addr_width = width;
195 cfg.src_maxburst = chip->dma_burst_size; 193 cfg.src_maxburst = chip->dma_burst_size;
196 cfg.slave_id = pdata->rx_slave_id;
197 194
198 sgt = &drv_data->rx_sgt; 195 sgt = &drv_data->rx_sgt;
199 nents = drv_data->rx_nents; 196 nents = drv_data->rx_nents;
@@ -210,14 +207,6 @@ pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data,
210 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 207 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
211} 208}
212 209
213static bool pxa2xx_spi_dma_filter(struct dma_chan *chan, void *param)
214{
215 const struct pxa2xx_spi_master *pdata = param;
216
217 return chan->chan_id == pdata->tx_chan_id ||
218 chan->chan_id == pdata->rx_chan_id;
219}
220
221bool pxa2xx_spi_dma_is_possible(size_t len) 210bool pxa2xx_spi_dma_is_possible(size_t len)
222{ 211{
223 return len <= MAX_DMA_LEN; 212 return len <= MAX_DMA_LEN;
@@ -321,12 +310,12 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data)
321 return -ENOMEM; 310 return -ENOMEM;
322 311
323 drv_data->tx_chan = dma_request_slave_channel_compat(mask, 312 drv_data->tx_chan = dma_request_slave_channel_compat(mask,
324 pxa2xx_spi_dma_filter, pdata, dev, "tx"); 313 pdata->dma_filter, pdata->tx_param, dev, "tx");
325 if (!drv_data->tx_chan) 314 if (!drv_data->tx_chan)
326 return -ENODEV; 315 return -ENODEV;
327 316
328 drv_data->rx_chan = dma_request_slave_channel_compat(mask, 317 drv_data->rx_chan = dma_request_slave_channel_compat(mask,
329 pxa2xx_spi_dma_filter, pdata, dev, "rx"); 318 pdata->dma_filter, pdata->rx_param, dev, "rx");
330 if (!drv_data->rx_chan) { 319 if (!drv_data->rx_chan) {
331 dma_release_channel(drv_data->tx_chan); 320 dma_release_channel(drv_data->tx_chan);
332 drv_data->tx_chan = NULL; 321 drv_data->tx_chan = NULL;