* [PATCH 1/3] mmc: atmel-mci: remove useless DMA stuff for non-dt devices @ 2014-11-20 10:07 Ludovic Desroches 2014-11-20 10:07 ` [PATCH 2/3] mmc: atmel-mci: stop using specific initcall Ludovic Desroches 2014-11-20 10:07 ` [PATCH 3/3] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches 0 siblings, 2 replies; 8+ messages in thread From: Ludovic Desroches @ 2014-11-20 10:07 UTC (permalink / raw) To: linux-arm-kernel, linux-mmc Cc: chris, ulf.hansson, nicolas.ferre, Ludovic Desroches All devices with a DMA controller are DT compliant and legacy support has been removed. For those reasons, some DMA stuff is useless. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> --- drivers/mmc/host/atmel-mci.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index ba38f94..b9226b3 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2267,17 +2267,9 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot, static bool atmci_configure_dma(struct atmel_mci *host) { - struct mci_platform_data *pdata; - dma_cap_mask_t mask; - if (host == NULL) return false; - pdata = host->pdev->dev.platform_data; - - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx"); if (!host->dma.chan) { dev_warn(&host->pdev->dev, "no DMA channel available\n"); -- 2.0.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 10:07 [PATCH 1/3] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches @ 2014-11-20 10:07 ` Ludovic Desroches 2014-11-20 11:10 ` Arnd Bergmann 2014-11-20 10:07 ` [PATCH 3/3] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches 1 sibling, 1 reply; 8+ messages in thread From: Ludovic Desroches @ 2014-11-20 10:07 UTC (permalink / raw) To: linux-arm-kernel, linux-mmc Cc: chris, ulf.hansson, nicolas.ferre, Ludovic Desroches No more use late initcall to manage probing order. Use probe deferring if needed. Then use module_platform_driver and clean init/exit attributes. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> --- drivers/mmc/host/atmel-mci.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index b9226b3..9b85c4e 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2137,7 +2137,7 @@ static irqreturn_t atmci_detect_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static int __init atmci_init_slot(struct atmel_mci *host, +static int atmci_init_slot(struct atmel_mci *host, struct mci_slot_pdata *slot_data, unsigned int id, u32 sdc_reg, u32 sdio_irq) { @@ -2344,7 +2344,7 @@ static void __init atmci_get_cap(struct atmel_mci *host) } } -static int __init atmci_probe(struct platform_device *pdev) +static int atmci_probe(struct platform_device *pdev) { struct mci_platform_data *pdata; struct atmel_mci *host; @@ -2480,7 +2480,7 @@ err_init_slot: return ret; } -static int __exit atmci_remove(struct platform_device *pdev) +static int atmci_remove(struct platform_device *pdev) { struct atmel_mci *host = platform_get_drvdata(pdev); unsigned int i; @@ -2510,25 +2510,14 @@ static int __exit atmci_remove(struct platform_device *pdev) } static struct platform_driver atmci_driver = { - .remove = __exit_p(atmci_remove), + .probe = atmci_probe, + .remove = atmci_remove, .driver = { .name = "atmel_mci", .of_match_table = of_match_ptr(atmci_dt_ids), }, }; - -static int __init atmci_init(void) -{ - return platform_driver_probe(&atmci_driver, atmci_probe); -} - -static void __exit atmci_exit(void) -{ - platform_driver_unregister(&atmci_driver); -} - -late_initcall(atmci_init); /* try to load after dma driver when built-in */ -module_exit(atmci_exit); +module_platform_driver(atmci_driver); MODULE_DESCRIPTION("Atmel Multimedia Card Interface driver"); MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); -- 2.0.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 10:07 ` [PATCH 2/3] mmc: atmel-mci: stop using specific initcall Ludovic Desroches @ 2014-11-20 11:10 ` Arnd Bergmann 2014-11-20 14:01 ` Ludovic Desroches 0 siblings, 1 reply; 8+ messages in thread From: Arnd Bergmann @ 2014-11-20 11:10 UTC (permalink / raw) To: linux-arm-kernel Cc: Ludovic Desroches, linux-mmc, ulf.hansson, nicolas.ferre, chris On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote: > No more use late initcall to manage probing order. Use probe deferring > if needed. Then use module_platform_driver and clean init/exit > attributes. > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> > Do we need this backported into stable kernels? It seems that the __init/__exit annotations will break things if you ever tried to unbind the device or run into deferred probing on earlier kernels. Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 11:10 ` Arnd Bergmann @ 2014-11-20 14:01 ` Ludovic Desroches 2014-11-20 14:13 ` Arnd Bergmann 0 siblings, 1 reply; 8+ messages in thread From: Ludovic Desroches @ 2014-11-20 14:01 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, Ludovic Desroches, linux-mmc, ulf.hansson, nicolas.ferre, chris On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote: > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote: > > No more use late initcall to manage probing order. Use probe deferring > > if needed. Then use module_platform_driver and clean init/exit > > attributes. > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> > > > > Do we need this backported into stable kernels? It seems that > the __init/__exit annotations will break things if you ever > tried to unbind the device or run into deferred probing on > earlier kernels. Well, it is a bit complicated, if we backport it, then the mci driver could be probed before the dma controller. Requesting dma chan will fail and it will switch to pio mode. So it has to be backported with the probe deferring. The issue is that probe deferring patch is based on other patches removing non-dt support which become useless only ine 3.19. Ludovic ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 14:01 ` Ludovic Desroches @ 2014-11-20 14:13 ` Arnd Bergmann 2014-11-20 14:18 ` Ludovic Desroches 0 siblings, 1 reply; 8+ messages in thread From: Arnd Bergmann @ 2014-11-20 14:13 UTC (permalink / raw) To: Ludovic Desroches Cc: linux-arm-kernel, linux-mmc, ulf.hansson, nicolas.ferre, chris On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote: > On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote: > > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote: > > > No more use late initcall to manage probing order. Use probe deferring > > > if needed. Then use module_platform_driver and clean init/exit > > > attributes. > > > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> > > > > > > > Do we need this backported into stable kernels? It seems that > > the __init/__exit annotations will break things if you ever > > tried to unbind the device or run into deferred probing on > > earlier kernels. > > Well, it is a bit complicated, if we backport it, then the mci driver > could be probed before the dma controller. Requesting dma chan will fail > and it will switch to pio mode. > > So it has to be backported with the probe deferring. The issue is > that probe deferring patch is based on other patches removing non-dt > support which become useless only ine 3.19. > Should we just have the __init/__exit removal in backports then? Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 14:13 ` Arnd Bergmann @ 2014-11-20 14:18 ` Ludovic Desroches 2014-11-20 15:25 ` Arnd Bergmann 0 siblings, 1 reply; 8+ messages in thread From: Ludovic Desroches @ 2014-11-20 14:18 UTC (permalink / raw) To: Arnd Bergmann Cc: Ludovic Desroches, linux-arm-kernel, linux-mmc, ulf.hansson, nicolas.ferre, chris On Thu, Nov 20, 2014 at 03:13:30PM +0100, Arnd Bergmann wrote: > On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote: > > On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote: > > > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote: > > > > No more use late initcall to manage probing order. Use probe deferring > > > > if needed. Then use module_platform_driver and clean init/exit > > > > attributes. > > > > > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> > > > > > > > > > > Do we need this backported into stable kernels? It seems that > > > the __init/__exit annotations will break things if you ever > > > tried to unbind the device or run into deferred probing on > > > earlier kernels. > > > > Well, it is a bit complicated, if we backport it, then the mci driver > > could be probed before the dma controller. Requesting dma chan will fail > > and it will switch to pio mode. > > > > So it has to be backported with the probe deferring. The issue is > > that probe deferring patch is based on other patches removing non-dt > > support which become useless only ine 3.19. > > > > Should we just have the __init/__exit removal in backports then? Yes. Do you want me to split this patch in order to have ony one for __init/__exit removal and another one for late_initcall removal? Ludovic ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mmc: atmel-mci: stop using specific initcall 2014-11-20 14:18 ` Ludovic Desroches @ 2014-11-20 15:25 ` Arnd Bergmann 0 siblings, 0 replies; 8+ messages in thread From: Arnd Bergmann @ 2014-11-20 15:25 UTC (permalink / raw) To: Ludovic Desroches Cc: linux-arm-kernel, linux-mmc, ulf.hansson, nicolas.ferre, chris On Thursday 20 November 2014 15:18:55 Ludovic Desroches wrote: > On Thu, Nov 20, 2014 at 03:13:30PM +0100, Arnd Bergmann wrote: > > On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote: > > > On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote: > > > > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote: > > > > > No more use late initcall to manage probing order. Use probe deferring > > > > > if needed. Then use module_platform_driver and clean init/exit > > > > > attributes. > > > > > > > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> > > > > > > > > > > > > > Do we need this backported into stable kernels? It seems that > > > > the __init/__exit annotations will break things if you ever > > > > tried to unbind the device or run into deferred probing on > > > > earlier kernels. > > > > > > Well, it is a bit complicated, if we backport it, then the mci driver > > > could be probed before the dma controller. Requesting dma chan will fail > > > and it will switch to pio mode. > > > > > > So it has to be backported with the probe deferring. The issue is > > > that probe deferring patch is based on other patches removing non-dt > > > support which become useless only ine 3.19. > > > > > > > Should we just have the __init/__exit removal in backports then? > > Yes. Do you want me to split this patch in order to have ony one for > __init/__exit removal and another one for late_initcall removal? > > Yes, I think that would be best. Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] mmc: atmel-mci: use probe deferring if dma controller is not ready yet 2014-11-20 10:07 [PATCH 1/3] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches 2014-11-20 10:07 ` [PATCH 2/3] mmc: atmel-mci: stop using specific initcall Ludovic Desroches @ 2014-11-20 10:07 ` Ludovic Desroches 1 sibling, 0 replies; 8+ messages in thread From: Ludovic Desroches @ 2014-11-20 10:07 UTC (permalink / raw) To: linux-arm-kernel, linux-mmc Cc: chris, ulf.hansson, nicolas.ferre, Ludovic Desroches Return probe defer if requesting a dma channel without a dma controller probed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> --- drivers/mmc/host/atmel-mci.c | 46 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 9b85c4e..29bfd5e 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2265,29 +2265,29 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot, mmc_free_host(slot->mmc); } -static bool atmci_configure_dma(struct atmel_mci *host) +static int atmci_configure_dma(struct atmel_mci *host) { - if (host == NULL) - return false; + int ret = 0; - host->dma.chan = dma_request_slave_channel(&host->pdev->dev, "rxtx"); - if (!host->dma.chan) { - dev_warn(&host->pdev->dev, "no DMA channel available\n"); - return false; - } else { - dev_info(&host->pdev->dev, - "using %s for DMA transfers\n", - dma_chan_name(host->dma.chan)); - - host->dma_conf.src_addr = host->mapbase + ATMCI_RDR; - host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - host->dma_conf.src_maxburst = 1; - host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR; - host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - host->dma_conf.dst_maxburst = 1; - host->dma_conf.device_fc = false; - return true; + host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev, "rxtx"); + if (IS_ERR(host->dma.chan)) { + ret = PTR_ERR(host->dma.chan); + host->dma.chan = NULL; + return ret; } + + dev_info(&host->pdev->dev, "using %s for DMA transfers\n", + dma_chan_name(host->dma.chan)); + + host->dma_conf.src_addr = host->mapbase + ATMCI_RDR; + host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + host->dma_conf.src_maxburst = 1; + host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR; + host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + host->dma_conf.dst_maxburst = 1; + host->dma_conf.device_fc = false; + + return ret; } /* @@ -2403,7 +2403,10 @@ static int atmci_probe(struct platform_device *pdev) /* Get MCI capabilities and set operations according to it */ atmci_get_cap(host); - if (atmci_configure_dma(host)) { + ret = atmci_configure_dma(host); + if (ret == -EPROBE_DEFER) + goto err_dma_probe_defer; + if (ret == 0) { host->prepare_data = &atmci_prepare_data_dma; host->submit_data = &atmci_submit_data_dma; host->stop_transfer = &atmci_stop_transfer_dma; @@ -2476,6 +2479,7 @@ err_init_slot: del_timer_sync(&host->timer); if (host->dma.chan) dma_release_channel(host->dma.chan); +err_dma_probe_defer: free_irq(irq, host); return ret; } -- 2.0.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-11-20 15:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-20 10:07 [PATCH 1/3] mmc: atmel-mci: remove useless DMA stuff for non-dt devices Ludovic Desroches 2014-11-20 10:07 ` [PATCH 2/3] mmc: atmel-mci: stop using specific initcall Ludovic Desroches 2014-11-20 11:10 ` Arnd Bergmann 2014-11-20 14:01 ` Ludovic Desroches 2014-11-20 14:13 ` Arnd Bergmann 2014-11-20 14:18 ` Ludovic Desroches 2014-11-20 15:25 ` Arnd Bergmann 2014-11-20 10:07 ` [PATCH 3/3] mmc: atmel-mci: use probe deferring if dma controller is not ready yet Ludovic Desroches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox