Commit dc6df6e9 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Wolfram Sang

i2c: at91: remove legacy DMA support

Since at91sam9g45 is now DT-only, all DMA capable users of this driver
are using the DT case, and the legacy support can be removed.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 11321585
...@@ -75,7 +75,6 @@ struct at91_twi_pdata { ...@@ -75,7 +75,6 @@ struct at91_twi_pdata {
unsigned clk_max_div; unsigned clk_max_div;
unsigned clk_offset; unsigned clk_offset;
bool has_unre_flag; bool has_unre_flag;
bool has_dma_support;
struct at_dma_slave dma_slave; struct at_dma_slave dma_slave;
}; };
...@@ -556,35 +555,30 @@ static struct at91_twi_pdata at91rm9200_config = { ...@@ -556,35 +555,30 @@ static struct at91_twi_pdata at91rm9200_config = {
.clk_max_div = 5, .clk_max_div = 5,
.clk_offset = 3, .clk_offset = 3,
.has_unre_flag = true, .has_unre_flag = true,
.has_dma_support = false,
}; };
static struct at91_twi_pdata at91sam9261_config = { static struct at91_twi_pdata at91sam9261_config = {
.clk_max_div = 5, .clk_max_div = 5,
.clk_offset = 4, .clk_offset = 4,
.has_unre_flag = false, .has_unre_flag = false,
.has_dma_support = false,
}; };
static struct at91_twi_pdata at91sam9260_config = { static struct at91_twi_pdata at91sam9260_config = {
.clk_max_div = 7, .clk_max_div = 7,
.clk_offset = 4, .clk_offset = 4,
.has_unre_flag = false, .has_unre_flag = false,
.has_dma_support = false,
}; };
static struct at91_twi_pdata at91sam9g20_config = { static struct at91_twi_pdata at91sam9g20_config = {
.clk_max_div = 7, .clk_max_div = 7,
.clk_offset = 4, .clk_offset = 4,
.has_unre_flag = false, .has_unre_flag = false,
.has_dma_support = false,
}; };
static struct at91_twi_pdata at91sam9g10_config = { static struct at91_twi_pdata at91sam9g10_config = {
.clk_max_div = 7, .clk_max_div = 7,
.clk_offset = 4, .clk_offset = 4,
.has_unre_flag = false, .has_unre_flag = false,
.has_dma_support = false,
}; };
static const struct platform_device_id at91_twi_devtypes[] = { static const struct platform_device_id at91_twi_devtypes[] = {
...@@ -613,7 +607,6 @@ static struct at91_twi_pdata at91sam9x5_config = { ...@@ -613,7 +607,6 @@ static struct at91_twi_pdata at91sam9x5_config = {
.clk_max_div = 7, .clk_max_div = 7,
.clk_offset = 4, .clk_offset = 4,
.has_unre_flag = false, .has_unre_flag = false,
.has_dma_support = true,
}; };
static const struct of_device_id atmel_twi_dt_ids[] = { static const struct of_device_id atmel_twi_dt_ids[] = {
...@@ -642,30 +635,11 @@ static const struct of_device_id atmel_twi_dt_ids[] = { ...@@ -642,30 +635,11 @@ static const struct of_device_id atmel_twi_dt_ids[] = {
MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids); MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
#endif #endif
static bool filter(struct dma_chan *chan, void *pdata)
{
struct at91_twi_pdata *sl_pdata = pdata;
struct at_dma_slave *sl;
if (!sl_pdata)
return false;
sl = &sl_pdata->dma_slave;
if (sl && (sl->dma_dev == chan->device->dev)) {
chan->private = sl;
return true;
} else {
return false;
}
}
static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)
{ {
int ret = 0; int ret = 0;
struct at91_twi_pdata *pdata = dev->pdata;
struct dma_slave_config slave_config; struct dma_slave_config slave_config;
struct at91_twi_dma *dma = &dev->dma; struct at91_twi_dma *dma = &dev->dma;
dma_cap_mask_t mask;
memset(&slave_config, 0, sizeof(slave_config)); memset(&slave_config, 0, sizeof(slave_config));
slave_config.src_addr = (dma_addr_t)phy_addr + AT91_TWI_RHR; slave_config.src_addr = (dma_addr_t)phy_addr + AT91_TWI_RHR;
...@@ -676,19 +650,14 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) ...@@ -676,19 +650,14 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)
slave_config.dst_maxburst = 1; slave_config.dst_maxburst = 1;
slave_config.device_fc = false; slave_config.device_fc = false;
dma_cap_zero(mask); dma->chan_tx = dma_request_slave_channel(dev->dev, "tx");
dma_cap_set(DMA_SLAVE, mask);
dma->chan_tx = dma_request_slave_channel_compat(mask, filter, pdata,
dev->dev, "tx");
if (!dma->chan_tx) { if (!dma->chan_tx) {
dev_err(dev->dev, "can't get a DMA channel for tx\n"); dev_err(dev->dev, "can't get a DMA channel for tx\n");
ret = -EBUSY; ret = -EBUSY;
goto error; goto error;
} }
dma->chan_rx = dma_request_slave_channel_compat(mask, filter, pdata, dma->chan_rx = dma_request_slave_channel(dev->dev, "rx");
dev->dev, "rx");
if (!dma->chan_rx) { if (!dma->chan_rx) {
dev_err(dev->dev, "can't get a DMA channel for rx\n"); dev_err(dev->dev, "can't get a DMA channel for rx\n");
ret = -EBUSY; ret = -EBUSY;
...@@ -787,7 +756,7 @@ static int at91_twi_probe(struct platform_device *pdev) ...@@ -787,7 +756,7 @@ static int at91_twi_probe(struct platform_device *pdev)
} }
clk_prepare_enable(dev->clk); clk_prepare_enable(dev->clk);
if (dev->pdata->has_dma_support) { if (dev->dev->of_node) {
if (at91_twi_configure_dma(dev, phy_addr) == 0) if (at91_twi_configure_dma(dev, phy_addr) == 0)
dev->use_dma = true; dev->use_dma = true;
} }
......
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