i2c: at91: remove legacy DMA support
Subsystems (2)
PATCH 1/2 i2c: at91: remove legacy DMA support
From: Arnd Bergmann <[email protected]>
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.
---
Hi,
I have split the legacy dma support removing and probe deferring. I have also fixed the compilation issue.
drivers/i2c/busses/i2c-at91.c | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-)
drivers/i2c/busses/i2c-at91.c +3 -34
@@ -72,7 +72,6 @@ struct at91_twi_pdata {unsigned clk_max_div;unsigned clk_offset;bool has_unre_flag; -bool has_dma_support;struct at_dma_slave dma_slave; };
@@ -541,35 +540,30 @@ static struct at91_twi_pdata at91rm9200_config = { .clk_max_div = 5, .clk_offset = 3, .has_unre_flag = true, - .has_dma_support = false, };static struct at91_twi_pdata at91sam9261_config = { .clk_max_div =5 , .clk_offset =4 , .has_unre_flag = false, - .has_dma_support = false, };static struct at91_twi_pdata at91sam9260_config = { .clk_max_div =7 , .clk_offset =4 , .has_unre_flag = false, - .has_dma_support = false, };static struct at91_twi_pdata at91sam9g20_config = { .clk_max_div =7 , .clk_offset =4 , .has_unre_flag = false, - .has_dma_support = false, };static struct at91_twi_pdata at91sam9g10_config = { .clk_max_div =7 , .clk_offset =4 , .has_unre_flag = false, - .has_dma_support = false, };static const struct platform_device_id at91_twi_devtypes[] = {
@@ -598,7 +592,6 @@ static struct at91_twi_pdata at91sam9x5_config = { .clk_max_div = 7, .clk_offset = 4, .has_unre_flag = false, - .has_dma_support = true, };static const struct of_device_id atmel_twi_dt_ids[] = {
@@ -627,30 +620,11 @@ static const struct of_device_id atmel_twi_dt_ids[] = {MODULE_DEVICE_TABLE (of, atmel_twi_dt_ids);#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) {int ret =0 ; -struct at91_twi_pdata *pdata = dev->pdata;struct dma_slave_config slave_config;struct at91_twi_dma *dma = &dev->dma; -dma_cap_mask_t mask;memset (&slave_config,0 ,sizeof (slave_config)); slave_config.src_addr = (dma_addr_t )phy_addr +AT91_TWI_RHR ;
@@ -661,19 +635,14 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) slave_config.dst_maxburst =1 ; slave_config.device_fc = false; -dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - dma->chan_tx =dma_request_slave_channel_compat (mask, filter, pdata, - dev->dev,"tx" ); + dma->chan_tx =dma_request_slave_channel (dev->dev,"tx" );if (!dma->chan_tx) {dev_err (dev->dev,"can't get a DMA channel for tx\n" ); ret = -EBUSY ; goto error; } - dma->chan_rx =dma_request_slave_channel_compat (mask, filter, pdata, - dev->dev,"rx" ); + dma->chan_rx =dma_request_slave_channel (dev->dev,"rx" );if (!dma->chan_rx) {dev_err (dev->dev,"can't get a DMA channel for rx\n" ); ret = -EBUSY ;
@@ -772,7 +741,7 @@ static int at91_twi_probe(struct platform_device *pdev) }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 ) dev->use_dma = true; }
Signature · 1 line
2.0.3
PATCH 2/2 i2c: at91: enable probe deferring on dma channel request
If dma controller is not probed, defer i2c probe.
---
Arnd,
It's a combination of the first patch I sent and yours. As you said that my patch "looks wrong but actually it's ok" I didn't dare to add your signed-off-by.
drivers/i2c/busses/i2c-at91.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/i2c/busses/i2c-at91.c +14 -11
@@ -635,17 +635,17 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) slave_config.dst_maxburst =1 ; slave_config.device_fc = false; - dma->chan_tx =dma_request_slave_channel (dev->dev,"tx" ); -if (!dma->chan_tx) { -dev_err (dev->dev,"can't get a DMA channel for tx\n" ); - ret = -EBUSY ; + dma->chan_tx =dma_request_slave_channel_reason (dev->dev,"tx" ); +if (IS_ERR (dma->chan_tx)) { + ret =PTR_ERR (dma->chan_tx); + dma->chan_tx =NULL ; goto error; } - dma->chan_rx =dma_request_slave_channel (dev->dev,"rx" ); -if (!dma->chan_rx) { -dev_err (dev->dev,"can't get a DMA channel for rx\n" ); - ret = -EBUSY ; + dma->chan_rx =dma_request_slave_channel_reason (dev->dev,"rx" ); +if (IS_ERR (dma->chan_rx)) { + ret =PTR_ERR (dma->chan_rx); + dma->chan_rx =NULL ; goto error; }
@@ -666,6 +666,7 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)sg_init_table (&dma->sg,1 ); dma->buf_mapped = false; dma->xfer_in_progress = false; + dev->use_dma = true;dev_info (dev->dev,"using %s (tx) and %s (rx) for DMA transfers\n" ,dma_chan_name (dma->chan_tx),dma_chan_name (dma->chan_rx));
@@ -673,7 +674,8 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)return ret; error: -dev_info (dev->dev,"can't use DMA\n" ); +if (ret != -EPROBE_DEFER ) +dev_info (dev->dev,"can't use DMA, error %d\n" , ret);if (dma->chan_rx)dma_release_channel (dma->chan_rx);if (dma->chan_tx)
@@ -742,8 +744,9 @@ static int at91_twi_probe(struct platform_device *pdev)clk_prepare_enable (dev->clk);if (dev->dev->of_node) { -if (at91_twi_configure_dma (dev, phy_addr) ==0 ) - dev->use_dma = true; + rc =at91_twi_configure_dma (dev, phy_addr); +if (rc == -EPROBE_DEFER ) +return rc; } rc = of_property_read_u32(dev->dev->of_node, "clock-frequency",
Signature · 1 line
2.0.3
PATCH 2/2 i2c: at91: enable probe deferring on dma channel request
Quoted 4 lines · On Friday 21 November 2014 14:44:32 Ludovic Desroches wrote:
If dma controller is not probed, defer i2c probe.
Signed-off-by Ludovic Desroches <[email protected]>---
Quoted 6 lines
Arnd,
It's a combination of the first patch I sent and yours. As you said that my patch "looks wrong but actually it's ok" I didn't dare to add your signed-off-by.
I think a good way to deal with this is to explain in the patch description who wrote what part.
Arnd
Wolfram Sang
AppliedPATCH 2/2 i2c: at91: enable probe deferring on dma channel request
In reply to Ludovic DesrochesQuoted 3 lines · Ludovic Desroches
If dma controller is not probed, defer i2c probe.
Signed-off-by Ludovic Desroches <[email protected]>
Applied to for-next, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141121/d9727223/attachment.sig>
Wolfram Sang
AppliedPATCH 1/2 i2c: at91: remove legacy DMA support
In reply to Ludovic DesrochesQuoted 7 lines · Ludovic Desroches
From: Arnd Bergmann <[email protected]>
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 Arnd Bergmann <[email protected]>Signed-off-by Ludovic Desroches <[email protected]>
Applied to for-next, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141121/42ca942c/attachment.sig>