* [PATCH 0/4] davinci_mmc device tree fixes
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, nsekhar, David Lechner, linux-arm-kernel
I'm working on getting a davinci device working with device tree. I came across
some issues in the davinci_mmc driver.
David Lechner (4):
mmc: davinci: remove matching string
mmc: davinci: fix unwinding in probe
mmc: davinci: prepare clock
mmc: davinci: suppress waring when using DT
drivers/mmc/host/davinci_mmc.c | 86 ++++++++++++++++++++----------------------
1 file changed, 41 insertions(+), 45 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 0/4] davinci_mmc device tree fixes
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: linux-arm-kernel
I'm working on getting a davinci device working with device tree. I came across
some issues in the davinci_mmc driver.
David Lechner (4):
mmc: davinci: remove matching string
mmc: davinci: fix unwinding in probe
mmc: davinci: prepare clock
mmc: davinci: suppress waring when using DT
drivers/mmc/host/davinci_mmc.c | 86 ++++++++++++++++++++----------------------
1 file changed, 41 insertions(+), 45 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 1/4] mmc: davinci: remove matching string
2016-03-09 23:50 ` David Lechner
@ 2016-03-09 23:50 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, nsekhar, David Lechner, linux-arm-kernel
The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index ea2a2eb..469aa8c 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1280,7 +1280,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
goto out;
ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, "MMCSDCLK");
+ host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 1/4] mmc: davinci: remove matching string
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: linux-arm-kernel
The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index ea2a2eb..469aa8c 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1280,7 +1280,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
goto out;
ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, "MMCSDCLK");
+ host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 2/4] mmc: davinci: fix unwinding in probe
2016-03-09 23:50 ` David Lechner
@ 2016-03-09 23:50 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, nsekhar, David Lechner, linux-arm-kernel
Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
not handled and not all paths unwound correctly.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 62 +++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 34 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 469aa8c..f571549 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1232,7 +1232,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
struct mmc_davinci_host *host = NULL;
struct mmc_host *mmc = NULL;
struct resource *r, *mem = NULL;
- int ret = 0, irq = 0;
+ int ret, irq;
size_t mem_size;
const struct platform_device_id *id_entry;
@@ -1242,22 +1242,21 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return -ENOENT;
}
- ret = -ENODEV;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq == NO_IRQ)
- goto out;
+ return -ENODEV;
- ret = -EBUSY;
mem_size = resource_size(r);
mem = request_mem_region(r->start, mem_size, pdev->name);
if (!mem)
- goto out;
+ return -EBUSY;
- ret = -ENOMEM;
mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
- if (!mmc)
- goto out;
+ if (!mmc) {
+ ret = -ENOMEM;
+ goto mmc_alloc_host_fail;
+ }
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
@@ -1277,15 +1276,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
if (!host->base)
- goto out;
+ goto ioremap_fail;
- ret = -ENXIO;
host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
- goto out;
+ goto clk_get_fail;
}
- clk_enable(host->clk);
+ ret = clk_enable(host->clk);
+ if (ret)
+ goto clk_enable_fail;
+
host->mmc_input_clk = clk_get_rate(host->clk);
init_mmcsd_host(host);
@@ -1355,11 +1356,11 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = mmc_add_host(mmc);
if (ret < 0)
- goto out;
+ goto mmc_add_host_fail;
ret = request_irq(irq, mmc_davinci_irq, 0, mmc_hostname(mmc), host);
if (ret)
- goto out;
+ goto request_irq_fail;
if (host->sdio_irq >= 0) {
ret = request_irq(host->sdio_irq, mmc_davinci_sdio_irq, 0,
@@ -1376,28 +1377,21 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return 0;
-out:
+request_irq_fail:
+ mmc_remove_host(mmc);
+mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
- if (host) {
- davinci_release_dma_channels(host);
-
- if (host->clk) {
- clk_disable(host->clk);
- clk_put(host->clk);
- }
-
- if (host->base)
- iounmap(host->base);
- }
-
- if (mmc)
- mmc_free_host(mmc);
-
- if (mem)
- release_resource(mem);
-
- dev_dbg(&pdev->dev, "probe err %d\n", ret);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+clk_enable_fail:
+ clk_put(host->clk);
+clk_get_fail:
+ iounmap(host->base);
+ioremap_fail:
+ mmc_free_host(mmc);
+mmc_alloc_host_fail:
+ release_resource(mem);
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 2/4] mmc: davinci: fix unwinding in probe
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: linux-arm-kernel
Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
not handled and not all paths unwound correctly.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 62 +++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 34 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 469aa8c..f571549 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1232,7 +1232,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
struct mmc_davinci_host *host = NULL;
struct mmc_host *mmc = NULL;
struct resource *r, *mem = NULL;
- int ret = 0, irq = 0;
+ int ret, irq;
size_t mem_size;
const struct platform_device_id *id_entry;
@@ -1242,22 +1242,21 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return -ENOENT;
}
- ret = -ENODEV;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq == NO_IRQ)
- goto out;
+ return -ENODEV;
- ret = -EBUSY;
mem_size = resource_size(r);
mem = request_mem_region(r->start, mem_size, pdev->name);
if (!mem)
- goto out;
+ return -EBUSY;
- ret = -ENOMEM;
mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
- if (!mmc)
- goto out;
+ if (!mmc) {
+ ret = -ENOMEM;
+ goto mmc_alloc_host_fail;
+ }
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
@@ -1277,15 +1276,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
if (!host->base)
- goto out;
+ goto ioremap_fail;
- ret = -ENXIO;
host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
- goto out;
+ goto clk_get_fail;
}
- clk_enable(host->clk);
+ ret = clk_enable(host->clk);
+ if (ret)
+ goto clk_enable_fail;
+
host->mmc_input_clk = clk_get_rate(host->clk);
init_mmcsd_host(host);
@@ -1355,11 +1356,11 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = mmc_add_host(mmc);
if (ret < 0)
- goto out;
+ goto mmc_add_host_fail;
ret = request_irq(irq, mmc_davinci_irq, 0, mmc_hostname(mmc), host);
if (ret)
- goto out;
+ goto request_irq_fail;
if (host->sdio_irq >= 0) {
ret = request_irq(host->sdio_irq, mmc_davinci_sdio_irq, 0,
@@ -1376,28 +1377,21 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return 0;
-out:
+request_irq_fail:
+ mmc_remove_host(mmc);
+mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
- if (host) {
- davinci_release_dma_channels(host);
-
- if (host->clk) {
- clk_disable(host->clk);
- clk_put(host->clk);
- }
-
- if (host->base)
- iounmap(host->base);
- }
-
- if (mmc)
- mmc_free_host(mmc);
-
- if (mem)
- release_resource(mem);
-
- dev_dbg(&pdev->dev, "probe err %d\n", ret);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+clk_enable_fail:
+ clk_put(host->clk);
+clk_get_fail:
+ iounmap(host->base);
+ioremap_fail:
+ mmc_free_host(mmc);
+mmc_alloc_host_fail:
+ release_resource(mem);
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
2016-03-09 23:50 ` David Lechner
@ 2016-03-09 23:50 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, nsekhar, David Lechner, linux-arm-kernel
When trying to use this driver with the common clock framework, enabling
the clock fails because it was not prepared. This fixes the problem by
calling clk_prepare and clk_enable in a single function.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index f571549..b160feb 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1283,9 +1283,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = PTR_ERR(host->clk);
goto clk_get_fail;
}
- ret = clk_enable(host->clk);
+ ret = clk_prepare_enable(host->clk);
if (ret)
- goto clk_enable_fail;
+ goto clk_prepare_enable_fail;
host->mmc_input_clk = clk_get_rate(host->clk);
@@ -1384,7 +1384,7 @@ mmc_add_host_fail:
cpu_freq_fail:
davinci_release_dma_channels(host);
clk_disable(host->clk);
-clk_enable_fail:
+clk_prepare_enable_fail:
clk_put(host->clk);
clk_get_fail:
iounmap(host->base);
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: linux-arm-kernel
When trying to use this driver with the common clock framework, enabling
the clock fails because it was not prepared. This fixes the problem by
calling clk_prepare and clk_enable in a single function.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index f571549..b160feb 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1283,9 +1283,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = PTR_ERR(host->clk);
goto clk_get_fail;
}
- ret = clk_enable(host->clk);
+ ret = clk_prepare_enable(host->clk);
if (ret)
- goto clk_enable_fail;
+ goto clk_prepare_enable_fail;
host->mmc_input_clk = clk_get_rate(host->clk);
@@ -1384,7 +1384,7 @@ mmc_add_host_fail:
cpu_freq_fail:
davinci_release_dma_channels(host);
clk_disable(host->clk);
-clk_enable_fail:
+clk_prepare_enable_fail:
clk_put(host->clk);
clk_get_fail:
iounmap(host->base);
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 4/4] mmc: davinci: suppress waring when using DT
2016-03-09 23:50 ` David Lechner
@ 2016-03-09 23:50 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, nsekhar, David Lechner, linux-arm-kernel
When using device tree dms resources are not obtained via IORESOURCE_DMA.
As a result, we would get warning even though DMA was working.
This fixes the problem by checking for dev.of_node and skipping trying to
get the dma platform resource if we are using device tree.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index b160feb..475704d 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1261,17 +1261,19 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
+ if (!pdev->dev.of_node) {
+ r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!r)
+ dev_warn(&pdev->dev, "RX DMA resource not specified\n");
+ else
+ host->rxdma = r->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
+ r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!r)
+ dev_warn(&pdev->dev, "TX DMA resource not specified\n");
+ else
+ host->txdma = r->start;
+ }
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 4/4] mmc: davinci: suppress waring when using DT
@ 2016-03-09 23:50 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-09 23:50 UTC (permalink / raw)
To: linux-arm-kernel
When using device tree dms resources are not obtained via IORESOURCE_DMA.
As a result, we would get warning even though DMA was working.
This fixes the problem by checking for dev.of_node and skipping trying to
get the dma platform resource if we are using device tree.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/mmc/host/davinci_mmc.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index b160feb..475704d 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1261,17 +1261,19 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
+ if (!pdev->dev.of_node) {
+ r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!r)
+ dev_warn(&pdev->dev, "RX DMA resource not specified\n");
+ else
+ host->rxdma = r->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
+ r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!r)
+ dev_warn(&pdev->dev, "TX DMA resource not specified\n");
+ else
+ host->txdma = r->start;
+ }
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] mmc: davinci: fix unwinding in probe
2016-03-09 23:50 ` David Lechner
@ 2016-03-14 11:52 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 11:52 UTC (permalink / raw)
To: David Lechner, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
Hi David,
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Since you are touching this, can you also shift to using devm_*()
variants where possible (like devm_ioremap()). That will simplify the
error handling quite a bit.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 2/4] mmc: davinci: fix unwinding in probe
@ 2016-03-14 11:52 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 11:52 UTC (permalink / raw)
To: linux-arm-kernel
Hi David,
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Since you are touching this, can you also shift to using devm_*()
variants where possible (like devm_ioremap()). That will simplify the
error handling quite a bit.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 3/4] mmc: davinci: prepare clock
2016-03-09 23:50 ` David Lechner
@ 2016-03-14 11:54 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 11:54 UTC (permalink / raw)
To: David Lechner, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> When trying to use this driver with the common clock framework, enabling
> the clock fails because it was not prepared. This fixes the problem by
> calling clk_prepare and clk_enable in a single function.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Patch looks good. But I wonder how you hit this issue since we dont use
common clock framework on mach-davinci and this driver is not used
anywhere else AFAIK.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
@ 2016-03-14 11:54 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 11:54 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> When trying to use this driver with the common clock framework, enabling
> the clock fails because it was not prepared. This fixes the problem by
> calling clk_prepare and clk_enable in a single function.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Patch looks good. But I wonder how you hit this issue since we dont use
common clock framework on mach-davinci and this driver is not used
anywhere else AFAIK.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 4/4] mmc: davinci: suppress waring when using DT
2016-03-09 23:50 ` David Lechner
@ 2016-03-14 13:41 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 13:41 UTC (permalink / raw)
To: David Lechner, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> When using device tree dms resources are not obtained via IORESOURCE_DMA.
> As a result, we would get warning even though DMA was working.
>
> This fixes the problem by checking for dev.of_node and skipping trying to
> get the dma platform resource if we are using device tree.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Actually, with Peter's series adding dma_slave_map[] for all
mach-davinci platforms, this code should not be needed at all. Can you
try that dropping the platform_get_resource() calls for DMA works with
linux-next?
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 4/4] mmc: davinci: suppress waring when using DT
@ 2016-03-14 13:41 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 13:41 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> When using device tree dms resources are not obtained via IORESOURCE_DMA.
> As a result, we would get warning even though DMA was working.
>
> This fixes the problem by checking for dev.of_node and skipping trying to
> get the dma platform resource if we are using device tree.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Actually, with Peter's series adding dma_slave_map[] for all
mach-davinci platforms, this code should not be needed at all. Can you
try that dropping the platform_get_resource() calls for DMA works with
linux-next?
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 1/4] mmc: davinci: remove matching string
2016-03-09 23:50 ` David Lechner
@ 2016-03-14 13:41 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 13:41 UTC (permalink / raw)
To: David Lechner, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 1/4] mmc: davinci: remove matching string
@ 2016-03-14 13:41 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-14 13:41 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
> The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 3/4] mmc: davinci: prepare clock
2016-03-14 11:54 ` Sekhar Nori
@ 2016-03-14 17:09 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 17:09 UTC (permalink / raw)
To: Sekhar Nori, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On 03/14/2016 06:54 AM, Sekhar Nori wrote:
> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>> When trying to use this driver with the common clock framework, enabling
>> the clock fails because it was not prepared. This fixes the problem by
>> calling clk_prepare and clk_enable in a single function.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
> Patch looks good. But I wonder how you hit this issue since we dont use
> common clock framework on mach-davinci and this driver is not used
> anywhere else AFAIK.
>
> Regards,
> Sekhar
>
Because I am working towards getting the common clock framework working
on mach-davinci - at least with da8xx/device tree. :-)
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
@ 2016-03-14 17:09 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 17:09 UTC (permalink / raw)
To: linux-arm-kernel
On 03/14/2016 06:54 AM, Sekhar Nori wrote:
> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>> When trying to use this driver with the common clock framework, enabling
>> the clock fails because it was not prepared. This fixes the problem by
>> calling clk_prepare and clk_enable in a single function.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
> Patch looks good. But I wonder how you hit this issue since we dont use
> common clock framework on mach-davinci and this driver is not used
> anywhere else AFAIK.
>
> Regards,
> Sekhar
>
Because I am working towards getting the common clock framework working
on mach-davinci - at least with da8xx/device tree. :-)
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 3/4] mmc: davinci: prepare clock
2016-03-14 17:09 ` David Lechner
@ 2016-03-14 17:13 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 17:13 UTC (permalink / raw)
To: Sekhar Nori, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On 03/14/2016 12:09 PM, David Lechner wrote:
> On 03/14/2016 06:54 AM, Sekhar Nori wrote:
>> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>>> When trying to use this driver with the common clock framework, enabling
>>> the clock fails because it was not prepared. This fixes the problem by
>>> calling clk_prepare and clk_enable in a single function.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>> Patch looks good. But I wonder how you hit this issue since we dont use
>> common clock framework on mach-davinci and this driver is not used
>> anywhere else AFAIK.
>>
>> Regards,
>> Sekhar
>>
> Because I am working towards getting the common clock framework working
> on mach-davinci - at least with da8xx/device tree. :-)
I should also mention that I did test using the existing mach-davinci
clocks as well.
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
@ 2016-03-14 17:13 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 17:13 UTC (permalink / raw)
To: linux-arm-kernel
On 03/14/2016 12:09 PM, David Lechner wrote:
> On 03/14/2016 06:54 AM, Sekhar Nori wrote:
>> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>>> When trying to use this driver with the common clock framework, enabling
>>> the clock fails because it was not prepared. This fixes the problem by
>>> calling clk_prepare and clk_enable in a single function.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>> Patch looks good. But I wonder how you hit this issue since we dont use
>> common clock framework on mach-davinci and this driver is not used
>> anywhere else AFAIK.
>>
>> Regards,
>> Sekhar
>>
> Because I am working towards getting the common clock framework working
> on mach-davinci - at least with da8xx/device tree. :-)
I should also mention that I did test using the existing mach-davinci
clocks as well.
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 0/5] davinci_mmc fixes
2016-03-14 13:41 ` Sekhar Nori
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
I've updated the patche set based on feedback. This is tested on linux-next with
LEGO MINDSTORMS EV3 (da850), both with and without device tree enabled.
David Lechner (5):
mmc: davinci: remove matching string
mmc: davinci: fix unwinding in probe
mmc: davinci: prepare clock
mmc: davinci: don't use dma platform resources
arm: davinci: remove mmc dma resources
arch/arm/mach-davinci/devices-da8xx.c | 20 ------
arch/arm/mach-davinci/devices.c | 16 -----
drivers/mmc/host/davinci_mmc.c | 112 +++++++++++-----------------------
3 files changed, 37 insertions(+), 111 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 0/5] davinci_mmc fixes
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
I've updated the patche set based on feedback. This is tested on linux-next with
LEGO MINDSTORMS EV3 (da850), both with and without device tree enabled.
David Lechner (5):
mmc: davinci: remove matching string
mmc: davinci: fix unwinding in probe
mmc: davinci: prepare clock
mmc: davinci: don't use dma platform resources
arm: davinci: remove mmc dma resources
arch/arm/mach-davinci/devices-da8xx.c | 20 ------
arch/arm/mach-davinci/devices.c | 16 -----
drivers/mmc/host/davinci_mmc.c | 112 +++++++++++-----------------------
3 files changed, 37 insertions(+), 111 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 1/5] mmc: davinci: remove matching string
2016-03-14 22:54 ` David Lechner
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: none
drivers/mmc/host/davinci_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 693144e..a294d261 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1271,7 +1271,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
goto out;
ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, "MMCSDCLK");
+ host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 1/5] mmc: davinci: remove matching string
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: none
drivers/mmc/host/davinci_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 693144e..a294d261 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1271,7 +1271,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
goto out;
ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, "MMCSDCLK");
+ host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 2/5] mmc: davinci: fix unwinding in probe
2016-03-14 22:54 ` David Lechner
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
not handled and not all paths unwound correctly. Also using devm_ where
possible to simplify things.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: use devm_ where possible
drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
1 file changed, 35 insertions(+), 58 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index a294d261..6dd9562 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
struct mmc_davinci_host *host = NULL;
struct mmc_host *mmc = NULL;
struct resource *r, *mem = NULL;
- int ret = 0, irq = 0;
+ int ret, irq;
size_t mem_size;
const struct platform_device_id *id_entry;
@@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return -ENOENT;
}
- ret = -ENODEV;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq == NO_IRQ)
- goto out;
+ return -ENODEV;
- ret = -EBUSY;
mem_size = resource_size(r);
- mem = request_mem_region(r->start, mem_size, pdev->name);
+ mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
+ pdev->name);
if (!mem)
- goto out;
+ return -EBUSY;
- ret = -ENOMEM;
mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
if (!mmc)
- goto out;
+ ret = -ENOMEM;
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
@@ -1266,17 +1264,19 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->txdma = r->start;
host->mem_res = mem;
- host->base = ioremap(mem->start, mem_size);
+ host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
if (!host->base)
- goto out;
+ goto ioremap_fail;
- ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, NULL);
+ host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
- goto out;
+ goto clk_get_fail;
}
- clk_enable(host->clk);
+ ret = clk_enable(host->clk);
+ if (ret)
+ goto clk_enable_fail;
+
host->mmc_input_clk = clk_get_rate(host->clk);
init_mmcsd_host(host);
@@ -1346,15 +1346,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = mmc_add_host(mmc);
if (ret < 0)
- goto out;
+ goto mmc_add_host_fail;
- ret = request_irq(irq, mmc_davinci_irq, 0, mmc_hostname(mmc), host);
+ ret = devm_request_irq(&pdev->dev, irq, mmc_davinci_irq, 0,
+ mmc_hostname(mmc), host);
if (ret)
- goto out;
+ goto request_irq_fail;
if (host->sdio_irq >= 0) {
- ret = request_irq(host->sdio_irq, mmc_davinci_sdio_irq, 0,
- mmc_hostname(mmc), host);
+ ret = devm_request_irq(&pdev->dev, host->sdio_irq,
+ mmc_davinci_sdio_irq, 0,
+ mmc_hostname(mmc), host);
if (!ret)
mmc->caps |= MMC_CAP_SDIO_IRQ;
}
@@ -1367,28 +1369,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return 0;
-out:
+request_irq_fail:
+ mmc_remove_host(mmc);
+mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
- if (host) {
- davinci_release_dma_channels(host);
-
- if (host->clk) {
- clk_disable(host->clk);
- clk_put(host->clk);
- }
-
- if (host->base)
- iounmap(host->base);
- }
-
- if (mmc)
- mmc_free_host(mmc);
-
- if (mem)
- release_resource(mem);
-
- dev_dbg(&pdev->dev, "probe err %d\n", ret);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+clk_enable_fail:
+clk_get_fail:
+ioremap_fail:
+ mmc_free_host(mmc);
return ret;
}
@@ -1397,25 +1388,11 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
{
struct mmc_davinci_host *host = platform_get_drvdata(pdev);
- if (host) {
- mmc_davinci_cpufreq_deregister(host);
-
- mmc_remove_host(host->mmc);
- free_irq(host->mmc_irq, host);
- if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
- free_irq(host->sdio_irq, host);
-
- davinci_release_dma_channels(host);
-
- clk_disable(host->clk);
- clk_put(host->clk);
-
- iounmap(host->base);
-
- release_resource(host->mem_res);
-
- mmc_free_host(host->mmc);
- }
+ mmc_remove_host(host->mmc);
+ mmc_davinci_cpufreq_deregister(host);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+ mmc_free_host(host->mmc);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 2/5] mmc: davinci: fix unwinding in probe
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
not handled and not all paths unwound correctly. Also using devm_ where
possible to simplify things.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: use devm_ where possible
drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
1 file changed, 35 insertions(+), 58 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index a294d261..6dd9562 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
struct mmc_davinci_host *host = NULL;
struct mmc_host *mmc = NULL;
struct resource *r, *mem = NULL;
- int ret = 0, irq = 0;
+ int ret, irq;
size_t mem_size;
const struct platform_device_id *id_entry;
@@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return -ENOENT;
}
- ret = -ENODEV;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq == NO_IRQ)
- goto out;
+ return -ENODEV;
- ret = -EBUSY;
mem_size = resource_size(r);
- mem = request_mem_region(r->start, mem_size, pdev->name);
+ mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
+ pdev->name);
if (!mem)
- goto out;
+ return -EBUSY;
- ret = -ENOMEM;
mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
if (!mmc)
- goto out;
+ ret = -ENOMEM;
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
@@ -1266,17 +1264,19 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->txdma = r->start;
host->mem_res = mem;
- host->base = ioremap(mem->start, mem_size);
+ host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
if (!host->base)
- goto out;
+ goto ioremap_fail;
- ret = -ENXIO;
- host->clk = clk_get(&pdev->dev, NULL);
+ host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
- goto out;
+ goto clk_get_fail;
}
- clk_enable(host->clk);
+ ret = clk_enable(host->clk);
+ if (ret)
+ goto clk_enable_fail;
+
host->mmc_input_clk = clk_get_rate(host->clk);
init_mmcsd_host(host);
@@ -1346,15 +1346,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = mmc_add_host(mmc);
if (ret < 0)
- goto out;
+ goto mmc_add_host_fail;
- ret = request_irq(irq, mmc_davinci_irq, 0, mmc_hostname(mmc), host);
+ ret = devm_request_irq(&pdev->dev, irq, mmc_davinci_irq, 0,
+ mmc_hostname(mmc), host);
if (ret)
- goto out;
+ goto request_irq_fail;
if (host->sdio_irq >= 0) {
- ret = request_irq(host->sdio_irq, mmc_davinci_sdio_irq, 0,
- mmc_hostname(mmc), host);
+ ret = devm_request_irq(&pdev->dev, host->sdio_irq,
+ mmc_davinci_sdio_irq, 0,
+ mmc_hostname(mmc), host);
if (!ret)
mmc->caps |= MMC_CAP_SDIO_IRQ;
}
@@ -1367,28 +1369,17 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
return 0;
-out:
+request_irq_fail:
+ mmc_remove_host(mmc);
+mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
- if (host) {
- davinci_release_dma_channels(host);
-
- if (host->clk) {
- clk_disable(host->clk);
- clk_put(host->clk);
- }
-
- if (host->base)
- iounmap(host->base);
- }
-
- if (mmc)
- mmc_free_host(mmc);
-
- if (mem)
- release_resource(mem);
-
- dev_dbg(&pdev->dev, "probe err %d\n", ret);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+clk_enable_fail:
+clk_get_fail:
+ioremap_fail:
+ mmc_free_host(mmc);
return ret;
}
@@ -1397,25 +1388,11 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
{
struct mmc_davinci_host *host = platform_get_drvdata(pdev);
- if (host) {
- mmc_davinci_cpufreq_deregister(host);
-
- mmc_remove_host(host->mmc);
- free_irq(host->mmc_irq, host);
- if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
- free_irq(host->sdio_irq, host);
-
- davinci_release_dma_channels(host);
-
- clk_disable(host->clk);
- clk_put(host->clk);
-
- iounmap(host->base);
-
- release_resource(host->mem_res);
-
- mmc_free_host(host->mmc);
- }
+ mmc_remove_host(host->mmc);
+ mmc_davinci_cpufreq_deregister(host);
+ davinci_release_dma_channels(host);
+ clk_disable(host->clk);
+ mmc_free_host(host->mmc);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 3/5] mmc: davinci: prepare clock
2016-03-14 22:54 ` David Lechner
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
When trying to use this driver with the common clock framework, enabling
the clock fails because it was not prepared. This fixes the problem by
calling clk_prepare and clk_enable in a single function. Ditto for
clk_disable_unprepare.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: use clk_disable_unprepare where applicable.
drivers/mmc/host/davinci_mmc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 6dd9562..8d10a92 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1273,9 +1273,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = PTR_ERR(host->clk);
goto clk_get_fail;
}
- ret = clk_enable(host->clk);
+ ret = clk_prepare_enable(host->clk);
if (ret)
- goto clk_enable_fail;
+ goto clk_prepare_enable_fail;
host->mmc_input_clk = clk_get_rate(host->clk);
@@ -1375,8 +1375,8 @@ mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
davinci_release_dma_channels(host);
- clk_disable(host->clk);
-clk_enable_fail:
+ clk_disable_unprepare(host->clk);
+clk_prepare_enable_fail:
clk_get_fail:
ioremap_fail:
mmc_free_host(mmc);
@@ -1391,7 +1391,7 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
mmc_remove_host(host->mmc);
mmc_davinci_cpufreq_deregister(host);
davinci_release_dma_channels(host);
- clk_disable(host->clk);
+ clk_disable_unprepare(host->clk);
mmc_free_host(host->mmc);
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 3/5] mmc: davinci: prepare clock
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
When trying to use this driver with the common clock framework, enabling
the clock fails because it was not prepared. This fixes the problem by
calling clk_prepare and clk_enable in a single function. Ditto for
clk_disable_unprepare.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: use clk_disable_unprepare where applicable.
drivers/mmc/host/davinci_mmc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 6dd9562..8d10a92 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1273,9 +1273,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
ret = PTR_ERR(host->clk);
goto clk_get_fail;
}
- ret = clk_enable(host->clk);
+ ret = clk_prepare_enable(host->clk);
if (ret)
- goto clk_enable_fail;
+ goto clk_prepare_enable_fail;
host->mmc_input_clk = clk_get_rate(host->clk);
@@ -1375,8 +1375,8 @@ mmc_add_host_fail:
mmc_davinci_cpufreq_deregister(host);
cpu_freq_fail:
davinci_release_dma_channels(host);
- clk_disable(host->clk);
-clk_enable_fail:
+ clk_disable_unprepare(host->clk);
+clk_prepare_enable_fail:
clk_get_fail:
ioremap_fail:
mmc_free_host(mmc);
@@ -1391,7 +1391,7 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
mmc_remove_host(host->mmc);
mmc_davinci_cpufreq_deregister(host);
davinci_release_dma_channels(host);
- clk_disable(host->clk);
+ clk_disable_unprepare(host->clk);
mmc_free_host(host->mmc);
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-14 22:54 ` David Lechner
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
The davinci arch now has dma_slave_map tables for dma resources, so it is
no longer necessary to pass dma resources through the platform device.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: Remove platform_get_resource completly instead of just ignoring it.
drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 8d10a92..dc96401 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -202,7 +202,6 @@ struct mmc_davinci_host {
u32 buffer_bytes_left;
u32 bytes_left;
- u32 rxdma, txdma;
struct dma_chan *dma_tx;
struct dma_chan *dma_rx;
bool use_dma;
@@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
dma_cap_set(DMA_SLAVE, mask);
host->dma_tx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->txdma, mmc_dev(host->mmc), "tx");
+ dma_request_slave_channel(mmc_dev(host->mmc), "tx");
if (!host->dma_tx) {
dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
return -ENODEV;
}
host->dma_rx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->rxdma, mmc_dev(host->mmc), "rx");
+ dma_request_slave_channel(mmc_dev(host->mmc), "rx");
if (!host->dma_rx) {
dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
r = -ENODEV;
@@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
-
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
-
host->mem_res = mem;
host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
if (!host->base)
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
The davinci arch now has dma_slave_map tables for dma resources, so it is
no longer necessary to pass dma resources through the platform device.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: Remove platform_get_resource completly instead of just ignoring it.
drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 8d10a92..dc96401 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -202,7 +202,6 @@ struct mmc_davinci_host {
u32 buffer_bytes_left;
u32 bytes_left;
- u32 rxdma, txdma;
struct dma_chan *dma_tx;
struct dma_chan *dma_rx;
bool use_dma;
@@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
dma_cap_set(DMA_SLAVE, mask);
host->dma_tx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->txdma, mmc_dev(host->mmc), "tx");
+ dma_request_slave_channel(mmc_dev(host->mmc), "tx");
if (!host->dma_tx) {
dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
return -ENODEV;
}
host->dma_rx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->rxdma, mmc_dev(host->mmc), "rx");
+ dma_request_slave_channel(mmc_dev(host->mmc), "rx");
if (!host->dma_rx) {
dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
r = -ENODEV;
@@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
-
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
-
host->mem_res = mem;
host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
if (!host->base)
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 5/5] arm: davinci: remove mmc dma resources
2016-03-14 22:54 ` David Lechner
@ 2016-03-14 22:54 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: nsekhar
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
David Lechner
The davinci_mmc driver no longer uses platform resources for getting dma
channels. Instead lookup is now done using dma_slave_map.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: This is a new patch in v2.
arch/arm/mach-davinci/devices-da8xx.c | 20 --------------------
arch/arm/mach-davinci/devices.c | 16 ----------------
2 files changed, 36 deletions(-)
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 725e693..add3771 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -751,16 +751,6 @@ static struct resource da8xx_mmcsd0_resources[] = {
.end = IRQ_DA8XX_MMCSDINT0,
.flags = IORESOURCE_IRQ,
},
- { /* DMA RX */
- .start = DA8XX_DMA_MMCSD0_RX,
- .end = DA8XX_DMA_MMCSD0_RX,
- .flags = IORESOURCE_DMA,
- },
- { /* DMA TX */
- .start = DA8XX_DMA_MMCSD0_TX,
- .end = DA8XX_DMA_MMCSD0_TX,
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device da8xx_mmcsd0_device = {
@@ -788,16 +778,6 @@ static struct resource da850_mmcsd1_resources[] = {
.end = IRQ_DA850_MMCSDINT0_1,
.flags = IORESOURCE_IRQ,
},
- { /* DMA RX */
- .start = DA850_DMA_MMCSD1_RX,
- .end = DA850_DMA_MMCSD1_RX,
- .flags = IORESOURCE_DMA,
- },
- { /* DMA TX */
- .start = DA850_DMA_MMCSD1_TX,
- .end = DA850_DMA_MMCSD1_TX,
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device da850_mmcsd1_device = {
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 6257aa4..67d26c5 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -144,14 +144,6 @@ static struct resource mmcsd0_resources[] = {
.start = IRQ_SDIOINT,
.flags = IORESOURCE_IRQ,
},
- /* DMA channels: RX, then TX */
- {
- .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT),
- .flags = IORESOURCE_DMA,
- }, {
- .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT),
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device davinci_mmcsd0_device = {
@@ -181,14 +173,6 @@ static struct resource mmcsd1_resources[] = {
.start = IRQ_DM355_SDIOINT1,
.flags = IORESOURCE_IRQ,
},
- /* DMA channels: RX, then TX */
- {
- .start = EDMA_CTLR_CHAN(0, 30), /* rx */
- .flags = IORESOURCE_DMA,
- }, {
- .start = EDMA_CTLR_CHAN(0, 31), /* tx */
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device davinci_mmcsd1_device = {
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 5/5] arm: davinci: remove mmc dma resources
@ 2016-03-14 22:54 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-14 22:54 UTC (permalink / raw)
To: linux-arm-kernel
The davinci_mmc driver no longer uses platform resources for getting dma
channels. Instead lookup is now done using dma_slave_map.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes: This is a new patch in v2.
arch/arm/mach-davinci/devices-da8xx.c | 20 --------------------
arch/arm/mach-davinci/devices.c | 16 ----------------
2 files changed, 36 deletions(-)
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 725e693..add3771 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -751,16 +751,6 @@ static struct resource da8xx_mmcsd0_resources[] = {
.end = IRQ_DA8XX_MMCSDINT0,
.flags = IORESOURCE_IRQ,
},
- { /* DMA RX */
- .start = DA8XX_DMA_MMCSD0_RX,
- .end = DA8XX_DMA_MMCSD0_RX,
- .flags = IORESOURCE_DMA,
- },
- { /* DMA TX */
- .start = DA8XX_DMA_MMCSD0_TX,
- .end = DA8XX_DMA_MMCSD0_TX,
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device da8xx_mmcsd0_device = {
@@ -788,16 +778,6 @@ static struct resource da850_mmcsd1_resources[] = {
.end = IRQ_DA850_MMCSDINT0_1,
.flags = IORESOURCE_IRQ,
},
- { /* DMA RX */
- .start = DA850_DMA_MMCSD1_RX,
- .end = DA850_DMA_MMCSD1_RX,
- .flags = IORESOURCE_DMA,
- },
- { /* DMA TX */
- .start = DA850_DMA_MMCSD1_TX,
- .end = DA850_DMA_MMCSD1_TX,
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device da850_mmcsd1_device = {
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 6257aa4..67d26c5 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -144,14 +144,6 @@ static struct resource mmcsd0_resources[] = {
.start = IRQ_SDIOINT,
.flags = IORESOURCE_IRQ,
},
- /* DMA channels: RX, then TX */
- {
- .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT),
- .flags = IORESOURCE_DMA,
- }, {
- .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT),
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device davinci_mmcsd0_device = {
@@ -181,14 +173,6 @@ static struct resource mmcsd1_resources[] = {
.start = IRQ_DM355_SDIOINT1,
.flags = IORESOURCE_IRQ,
},
- /* DMA channels: RX, then TX */
- {
- .start = EDMA_CTLR_CHAN(0, 30), /* rx */
- .flags = IORESOURCE_DMA,
- }, {
- .start = EDMA_CTLR_CHAN(0, 31), /* tx */
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device davinci_mmcsd1_device = {
--
1.9.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 3/4] mmc: davinci: prepare clock
2016-03-14 17:09 ` David Lechner
@ 2016-03-15 5:16 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 5:16 UTC (permalink / raw)
To: David Lechner, ulf.hansson, k.kozlowski.k, linux-mmc
Cc: khilman, linux-arm-kernel
On Monday 14 March 2016 10:39 PM, David Lechner wrote:
> On 03/14/2016 06:54 AM, Sekhar Nori wrote:
>> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>>> When trying to use this driver with the common clock framework, enabling
>>> the clock fails because it was not prepared. This fixes the problem by
>>> calling clk_prepare and clk_enable in a single function.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>> Patch looks good. But I wonder how you hit this issue since we dont use
>> common clock framework on mach-davinci and this driver is not used
>> anywhere else AFAIK.
>>
>> Regards,
>> Sekhar
>>
> Because I am working towards getting the common clock framework working
> on mach-davinci - at least with da8xx/device tree. :-)
Alright, glad to know someone is pursuing this.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 3/4] mmc: davinci: prepare clock
@ 2016-03-15 5:16 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 5:16 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 14 March 2016 10:39 PM, David Lechner wrote:
> On 03/14/2016 06:54 AM, Sekhar Nori wrote:
>> On Thursday 10 March 2016 05:20 AM, David Lechner wrote:
>>> When trying to use this driver with the common clock framework, enabling
>>> the clock fails because it was not prepared. This fixes the problem by
>>> calling clk_prepare and clk_enable in a single function.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>> Patch looks good. But I wonder how you hit this issue since we dont use
>> common clock framework on mach-davinci and this driver is not used
>> anywhere else AFAIK.
>>
>> Regards,
>> Sekhar
>>
> Because I am working towards getting the common clock framework working
> on mach-davinci - at least with da8xx/device tree. :-)
Alright, glad to know someone is pursuing this.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 8:09 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:09 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
Peter Ujfalusi
+ Peter
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Looks good to me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:09 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:09 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc,
Peter Ujfalusi
+ Peter
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Looks good to me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:09 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:09 UTC (permalink / raw)
To: linux-arm-kernel
+ Peter
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Looks good to me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 0/5] davinci_mmc fixes
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 8:13 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:13 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
Hi David,
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> I've updated the patche set based on feedback. This is tested on linux-next with
> LEGO MINDSTORMS EV3 (da850), both with and without device tree enabled.
When posting an updated series, please post as a fresh thread. Not as
reply to the original posting. With the later, there are more chances of
series being lost.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 0/5] davinci_mmc fixes
@ 2016-03-15 8:13 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:13 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
Hi David,
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> I've updated the patche set based on feedback. This is tested on linux-next with
> LEGO MINDSTORMS EV3 (da850), both with and without device tree enabled.
When posting an updated series, please post as a fresh thread. Not as
reply to the original posting. With the later, there are more chances of
series being lost.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 0/5] davinci_mmc fixes
@ 2016-03-15 8:13 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:13 UTC (permalink / raw)
To: linux-arm-kernel
Hi David,
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> I've updated the patche set based on feedback. This is tested on linux-next with
> LEGO MINDSTORMS EV3 (da850), both with and without device tree enabled.
When posting an updated series, please post as a fresh thread. Not as
reply to the original posting. With the later, there are more chances of
series being lost.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 5/5] arm: davinci: remove mmc dma resources
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 8:23 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:23 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci_mmc driver no longer uses platform resources for getting dma
> channels. Instead lookup is now done using dma_slave_map.
>
> Signed-off-by: David Lechner <david@lechnology.com>
I guess this will now be targeted for v4.7. I can apply the patch if I
get an immutable branch from Ulf post v4.6-rc1 or if Ulf decides to
apply this, fine with me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
BTW, we prefer a captialized "ARM:" in subject prefix. Whoever is
applying can probably fix it though.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 5/5] arm: davinci: remove mmc dma resources
@ 2016-03-15 8:23 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:23 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci_mmc driver no longer uses platform resources for getting dma
> channels. Instead lookup is now done using dma_slave_map.
>
> Signed-off-by: David Lechner <david@lechnology.com>
I guess this will now be targeted for v4.7. I can apply the patch if I
get an immutable branch from Ulf post v4.6-rc1 or if Ulf decides to
apply this, fine with me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
BTW, we prefer a captialized "ARM:" in subject prefix. Whoever is
applying can probably fix it though.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 5/5] arm: davinci: remove mmc dma resources
@ 2016-03-15 8:23 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 8:23 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The davinci_mmc driver no longer uses platform resources for getting dma
> channels. Instead lookup is now done using dma_slave_map.
>
> Signed-off-by: David Lechner <david@lechnology.com>
I guess this will now be targeted for v4.7. I can apply the patch if I
get an immutable branch from Ulf post v4.6-rc1 or if Ulf decides to
apply this, fine with me.
Acked-by: Sekhar Nori <nsekhar@ti.com>
BTW, we prefer a captialized "ARM:" in subject prefix. Whoever is
applying can probably fix it though.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 8:54 ` Peter Ujfalusi
-1 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:54 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]
On 03/15/16 00:54, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
you would need to use dma_request_chan() to be able to rely on the legacy
channel mapping.
I have staged commits for converting all daVinci and OMAP drivers, I'll attach
the patch I have for davinci-mmc for reference.
When we convert to use the dma_request_chan() we can handle deferred probing
also...
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
--
Péter
[-- Attachment #2: 0001-mmc-davinci_mmc-Use-dma_request_chan-to-requesting-D.patch --]
[-- Type: text/x-patch, Size: 3424 bytes --]
>From c349c76720ffa6e203eff3865de2da8e4c0b415c Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Mon, 21 Dec 2015 12:47:07 +0200
Subject: [PATCH] mmc: davinci_mmc: Use dma_request_chan() to requesting DMA
channel
With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mmc/host/davinci_mmc.c | 52 ++++++++++++------------------------------
1 file changed, 14 insertions(+), 38 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 693144e7427b..9edc37d207d2 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -32,12 +32,10 @@
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
-#include <linux/edma.h>
#include <linux/mmc/mmc.h>
#include <linux/of.h>
#include <linux/of_device.h>
-#include <linux/platform_data/edma.h>
#include <linux/platform_data/mmc-davinci.h>
/*
@@ -513,35 +511,20 @@ davinci_release_dma_channels(struct mmc_davinci_host *host)
static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
{
- int r;
- dma_cap_mask_t mask;
-
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
-
- host->dma_tx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->txdma, mmc_dev(host->mmc), "tx");
- if (!host->dma_tx) {
+ host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
+ if (IS_ERR(host->dma_tx)) {
dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
- return -ENODEV;
+ return PTR_ERR(host->dma_tx);
}
- host->dma_rx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->rxdma, mmc_dev(host->mmc), "rx");
- if (!host->dma_rx) {
+ host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx");
+ if (IS_ERR(host->dma_rx)) {
dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
- r = -ENODEV;
- goto free_master_write;
+ dma_release_channel(host->dma_tx);
+ return PTR_ERR(host->dma_rx);
}
return 0;
-
-free_master_write:
- dma_release_channel(host->dma_tx);
-
- return r;
}
/*----------------------------------------------------------------------*/
@@ -1253,18 +1236,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
-
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
-
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
if (!host->base)
@@ -1291,8 +1262,13 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->mmc_irq = irq;
host->sdio_irq = platform_get_irq(pdev, 1);
- if (host->use_dma && davinci_acquire_dma_channels(host) != 0)
- host->use_dma = 0;
+ if (host->use_dma) {
+ ret = davinci_acquire_dma_channels(host);
+ if (ret == -EPROBE_DEFER)
+ goto out;
+ else if (ret)
+ host->use_dma = 0;
+ }
/* REVISIT: someday, support IRQ-driven card detection. */
mmc->caps |= MMC_CAP_NEEDS_POLL;
--
2.7.3
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:54 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:54 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]
On 03/15/16 00:54, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
you would need to use dma_request_chan() to be able to rely on the legacy
channel mapping.
I have staged commits for converting all daVinci and OMAP drivers, I'll attach
the patch I have for davinci-mmc for reference.
When we convert to use the dma_request_chan() we can handle deferred probing
also...
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
--
Péter
[-- Attachment #2: 0001-mmc-davinci_mmc-Use-dma_request_chan-to-requesting-D.patch --]
[-- Type: text/x-patch, Size: 3424 bytes --]
>From c349c76720ffa6e203eff3865de2da8e4c0b415c Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Mon, 21 Dec 2015 12:47:07 +0200
Subject: [PATCH] mmc: davinci_mmc: Use dma_request_chan() to requesting DMA
channel
With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mmc/host/davinci_mmc.c | 52 ++++++++++++------------------------------
1 file changed, 14 insertions(+), 38 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 693144e7427b..9edc37d207d2 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -32,12 +32,10 @@
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
-#include <linux/edma.h>
#include <linux/mmc/mmc.h>
#include <linux/of.h>
#include <linux/of_device.h>
-#include <linux/platform_data/edma.h>
#include <linux/platform_data/mmc-davinci.h>
/*
@@ -513,35 +511,20 @@ davinci_release_dma_channels(struct mmc_davinci_host *host)
static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
{
- int r;
- dma_cap_mask_t mask;
-
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
-
- host->dma_tx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->txdma, mmc_dev(host->mmc), "tx");
- if (!host->dma_tx) {
+ host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
+ if (IS_ERR(host->dma_tx)) {
dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
- return -ENODEV;
+ return PTR_ERR(host->dma_tx);
}
- host->dma_rx =
- dma_request_slave_channel_compat(mask, edma_filter_fn,
- &host->rxdma, mmc_dev(host->mmc), "rx");
- if (!host->dma_rx) {
+ host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx");
+ if (IS_ERR(host->dma_rx)) {
dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
- r = -ENODEV;
- goto free_master_write;
+ dma_release_channel(host->dma_tx);
+ return PTR_ERR(host->dma_rx);
}
return 0;
-
-free_master_write:
- dma_release_channel(host->dma_tx);
-
- return r;
}
/*----------------------------------------------------------------------*/
@@ -1253,18 +1236,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host = mmc_priv(mmc);
host->mmc = mmc; /* Important */
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- dev_warn(&pdev->dev, "RX DMA resource not specified\n");
- else
- host->rxdma = r->start;
-
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- dev_warn(&pdev->dev, "TX DMA resource not specified\n");
- else
- host->txdma = r->start;
-
host->mem_res = mem;
host->base = ioremap(mem->start, mem_size);
if (!host->base)
@@ -1291,8 +1262,13 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
host->mmc_irq = irq;
host->sdio_irq = platform_get_irq(pdev, 1);
- if (host->use_dma && davinci_acquire_dma_channels(host) != 0)
- host->use_dma = 0;
+ if (host->use_dma) {
+ ret = davinci_acquire_dma_channels(host);
+ if (ret == -EPROBE_DEFER)
+ goto out;
+ else if (ret)
+ host->use_dma = 0;
+ }
/* REVISIT: someday, support IRQ-driven card detection. */
mmc->caps |= MMC_CAP_NEEDS_POLL;
--
2.7.3
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:54 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:54 UTC (permalink / raw)
To: linux-arm-kernel
On 03/15/16 00:54, David Lechner wrote:
> The davinci arch now has dma_slave_map tables for dma resources, so it is
> no longer necessary to pass dma resources through the platform device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>
>
> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8d10a92..dc96401 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
> u32 buffer_bytes_left;
> u32 bytes_left;
>
> - u32 rxdma, txdma;
> struct dma_chan *dma_tx;
> struct dma_chan *dma_rx;
> bool use_dma;
> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
> dma_cap_set(DMA_SLAVE, mask);
>
> host->dma_tx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->txdma, mmc_dev(host->mmc), "tx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
you would need to use dma_request_chan() to be able to rely on the legacy
channel mapping.
I have staged commits for converting all daVinci and OMAP drivers, I'll attach
the patch I have for davinci-mmc for reference.
When we convert to use the dma_request_chan() we can handle deferred probing
also...
> if (!host->dma_tx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
> return -ENODEV;
> }
>
> host->dma_rx =
> - dma_request_slave_channel_compat(mask, edma_filter_fn,
> - &host->rxdma, mmc_dev(host->mmc), "rx");
> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
> if (!host->dma_rx) {
> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
> r = -ENODEV;
> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> host = mmc_priv(mmc);
> host->mmc = mmc; /* Important */
>
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!r)
> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
> - else
> - host->rxdma = r->start;
> -
> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> - if (!r)
> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
> - else
> - host->txdma = r->start;
> -
> host->mem_res = mem;
> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
> if (!host->base)
>
--
P?ter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mmc-davinci_mmc-Use-dma_request_chan-to-requesting-D.patch
Type: text/x-patch
Size: 3424 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160315/91afbacb/attachment-0001.bin>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-15 8:54 ` Peter Ujfalusi
(?)
@ 2016-03-15 8:56 ` Peter Ujfalusi
-1 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:56 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
On 03/15/16 10:54, Peter Ujfalusi wrote:
> On 03/15/16 00:54, David Lechner wrote:
>> The davinci arch now has dma_slave_map tables for dma resources, so it is
>> no longer necessary to pass dma resources through the platform device.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>
>> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>>
>>
>> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
>> 1 file changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
>> index 8d10a92..dc96401 100644
>> --- a/drivers/mmc/host/davinci_mmc.c
>> +++ b/drivers/mmc/host/davinci_mmc.c
>> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
>> u32 buffer_bytes_left;
>> u32 bytes_left;
>>
>> - u32 rxdma, txdma;
>> struct dma_chan *dma_tx;
>> struct dma_chan *dma_rx;
>> bool use_dma;
>> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
>> dma_cap_set(DMA_SLAVE, mask);
>>
>> host->dma_tx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->txdma, mmc_dev(host->mmc), "tx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>
> you would need to use dma_request_chan() to be able to rely on the legacy
> channel mapping.
In other words: w/o dma_request_chan() legacy boot will not work as you will
not get the DMA channel.
> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
> the patch I have for davinci-mmc for reference.
> When we convert to use the dma_request_chan() we can handle deferred probing
> also...
>
>
>
>> if (!host->dma_tx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
>> return -ENODEV;
>> }
>>
>> host->dma_rx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->rxdma, mmc_dev(host->mmc), "rx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
>> if (!host->dma_rx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
>> r = -ENODEV;
>> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
>> host = mmc_priv(mmc);
>> host->mmc = mmc; /* Important */
>>
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>> - if (!r)
>> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
>> - else
>> - host->rxdma = r->start;
>> -
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
>> - if (!r)
>> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
>> - else
>> - host->txdma = r->start;
>> -
>> host->mem_res = mem;
>> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
>> if (!host->base)
>>
>
>
--
Péter
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:56 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:56 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
On 03/15/16 10:54, Peter Ujfalusi wrote:
> On 03/15/16 00:54, David Lechner wrote:
>> The davinci arch now has dma_slave_map tables for dma resources, so it is
>> no longer necessary to pass dma resources through the platform device.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>
>> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>>
>>
>> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
>> 1 file changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
>> index 8d10a92..dc96401 100644
>> --- a/drivers/mmc/host/davinci_mmc.c
>> +++ b/drivers/mmc/host/davinci_mmc.c
>> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
>> u32 buffer_bytes_left;
>> u32 bytes_left;
>>
>> - u32 rxdma, txdma;
>> struct dma_chan *dma_tx;
>> struct dma_chan *dma_rx;
>> bool use_dma;
>> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
>> dma_cap_set(DMA_SLAVE, mask);
>>
>> host->dma_tx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->txdma, mmc_dev(host->mmc), "tx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>
> you would need to use dma_request_chan() to be able to rely on the legacy
> channel mapping.
In other words: w/o dma_request_chan() legacy boot will not work as you will
not get the DMA channel.
> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
> the patch I have for davinci-mmc for reference.
> When we convert to use the dma_request_chan() we can handle deferred probing
> also...
>
>
>
>> if (!host->dma_tx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
>> return -ENODEV;
>> }
>>
>> host->dma_rx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->rxdma, mmc_dev(host->mmc), "rx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
>> if (!host->dma_rx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
>> r = -ENODEV;
>> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
>> host = mmc_priv(mmc);
>> host->mmc = mmc; /* Important */
>>
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>> - if (!r)
>> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
>> - else
>> - host->rxdma = r->start;
>> -
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
>> - if (!r)
>> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
>> - else
>> - host->txdma = r->start;
>> -
>> host->mem_res = mem;
>> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
>> if (!host->base)
>>
>
>
--
Péter
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 8:56 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-15 8:56 UTC (permalink / raw)
To: linux-arm-kernel
On 03/15/16 10:54, Peter Ujfalusi wrote:
> On 03/15/16 00:54, David Lechner wrote:
>> The davinci arch now has dma_slave_map tables for dma resources, so it is
>> no longer necessary to pass dma resources through the platform device.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>
>> v2 changes: Remove platform_get_resource completly instead of just ignoring it.
>>
>>
>> drivers/mmc/host/davinci_mmc.c | 19 ++-----------------
>> 1 file changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
>> index 8d10a92..dc96401 100644
>> --- a/drivers/mmc/host/davinci_mmc.c
>> +++ b/drivers/mmc/host/davinci_mmc.c
>> @@ -202,7 +202,6 @@ struct mmc_davinci_host {
>> u32 buffer_bytes_left;
>> u32 bytes_left;
>>
>> - u32 rxdma, txdma;
>> struct dma_chan *dma_tx;
>> struct dma_chan *dma_rx;
>> bool use_dma;
>> @@ -520,16 +519,14 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
>> dma_cap_set(DMA_SLAVE, mask);
>>
>> host->dma_tx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->txdma, mmc_dev(host->mmc), "tx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>
> you would need to use dma_request_chan() to be able to rely on the legacy
> channel mapping.
In other words: w/o dma_request_chan() legacy boot will not work as you will
not get the DMA channel.
> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
> the patch I have for davinci-mmc for reference.
> When we convert to use the dma_request_chan() we can handle deferred probing
> also...
>
>
>
>> if (!host->dma_tx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n");
>> return -ENODEV;
>> }
>>
>> host->dma_rx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->rxdma, mmc_dev(host->mmc), "rx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "rx");
>> if (!host->dma_rx) {
>> dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n");
>> r = -ENODEV;
>> @@ -1251,18 +1248,6 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
>> host = mmc_priv(mmc);
>> host->mmc = mmc; /* Important */
>>
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>> - if (!r)
>> - dev_warn(&pdev->dev, "RX DMA resource not specified\n");
>> - else
>> - host->rxdma = r->start;
>> -
>> - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
>> - if (!r)
>> - dev_warn(&pdev->dev, "TX DMA resource not specified\n");
>> - else
>> - host->txdma = r->start;
>> -
>> host->mem_res = mem;
>> host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
>> if (!host->base)
>>
>
>
--
P?ter
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 2/5] mmc: davinci: fix unwinding in probe
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 9:10 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:10 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly. Also using devm_ where
> possible to simplify things.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: use devm_ where possible
>
> drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
> 1 file changed, 35 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index a294d261..6dd9562 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> struct mmc_davinci_host *host = NULL;
> struct mmc_host *mmc = NULL;
> struct resource *r, *mem = NULL;
> - int ret = 0, irq = 0;
> + int ret, irq;
> size_t mem_size;
> const struct platform_device_id *id_entry;
>
> @@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> return -ENOENT;
> }
>
> - ret = -ENODEV;
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> irq = platform_get_irq(pdev, 0);
> if (!r || irq == NO_IRQ)
> - goto out;
> + return -ENODEV;
>
> - ret = -EBUSY;
> mem_size = resource_size(r);
> - mem = request_mem_region(r->start, mem_size, pdev->name);
> + mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
> + pdev->name);
> if (!mem)
> - goto out;
> + return -EBUSY;
>
> - ret = -ENOMEM;
> mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
> if (!mmc)
> - goto out;
> + ret = -ENOMEM;
This should be 'return -ENOMEM' you dont want to proceed further if this
fails.
Other than that, looks fine to me.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 2/5] mmc: davinci: fix unwinding in probe
@ 2016-03-15 9:10 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:10 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly. Also using devm_ where
> possible to simplify things.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: use devm_ where possible
>
> drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
> 1 file changed, 35 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index a294d261..6dd9562 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> struct mmc_davinci_host *host = NULL;
> struct mmc_host *mmc = NULL;
> struct resource *r, *mem = NULL;
> - int ret = 0, irq = 0;
> + int ret, irq;
> size_t mem_size;
> const struct platform_device_id *id_entry;
>
> @@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> return -ENOENT;
> }
>
> - ret = -ENODEV;
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> irq = platform_get_irq(pdev, 0);
> if (!r || irq == NO_IRQ)
> - goto out;
> + return -ENODEV;
>
> - ret = -EBUSY;
> mem_size = resource_size(r);
> - mem = request_mem_region(r->start, mem_size, pdev->name);
> + mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
> + pdev->name);
> if (!mem)
> - goto out;
> + return -EBUSY;
>
> - ret = -ENOMEM;
> mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
> if (!mmc)
> - goto out;
> + ret = -ENOMEM;
This should be 'return -ENOMEM' you dont want to proceed further if this
fails.
Other than that, looks fine to me.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 2/5] mmc: davinci: fix unwinding in probe
@ 2016-03-15 9:10 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:10 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly. Also using devm_ where
> possible to simplify things.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>
> v2 changes: use devm_ where possible
>
> drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
> 1 file changed, 35 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index a294d261..6dd9562 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> struct mmc_davinci_host *host = NULL;
> struct mmc_host *mmc = NULL;
> struct resource *r, *mem = NULL;
> - int ret = 0, irq = 0;
> + int ret, irq;
> size_t mem_size;
> const struct platform_device_id *id_entry;
>
> @@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> return -ENOENT;
> }
>
> - ret = -ENODEV;
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> irq = platform_get_irq(pdev, 0);
> if (!r || irq == NO_IRQ)
> - goto out;
> + return -ENODEV;
>
> - ret = -EBUSY;
> mem_size = resource_size(r);
> - mem = request_mem_region(r->start, mem_size, pdev->name);
> + mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
> + pdev->name);
> if (!mem)
> - goto out;
> + return -EBUSY;
>
> - ret = -ENOMEM;
> mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
> if (!mmc)
> - goto out;
> + ret = -ENOMEM;
This should be 'return -ENOMEM' you dont want to proceed further if this
fails.
Other than that, looks fine to me.
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 1/5] mmc: davinci: remove matching string
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 9:12 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:12 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
>
> Signed-off-by: David Lechner <david@lechnology.com>
In general, you can carry forward acks received in the last version of
the patch if the patch is unchanged.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 1/5] mmc: davinci: remove matching string
@ 2016-03-15 9:12 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:12 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
>
> Signed-off-by: David Lechner <david@lechnology.com>
In general, you can carry forward acks received in the last version of
the patch if the patch is unchanged.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 1/5] mmc: davinci: remove matching string
@ 2016-03-15 9:12 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:12 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.
>
> Signed-off-by: David Lechner <david@lechnology.com>
In general, you can carry forward acks received in the last version of
the patch if the patch is unchanged.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 3/5] mmc: davinci: prepare clock
2016-03-14 22:54 ` David Lechner
(?)
@ 2016-03-15 9:13 ` Sekhar Nori
-1 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:13 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> When trying to use this driver with the common clock framework, enabling
> the clock fails because it was not prepared. This fixes the problem by
> calling clk_prepare and clk_enable in a single function. Ditto for
> clk_disable_unprepare.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 3/5] mmc: davinci: prepare clock
@ 2016-03-15 9:13 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:13 UTC (permalink / raw)
To: David Lechner
Cc: khilman, ulf.hansson, linux-arm-kernel, linux-kernel, linux-mmc
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> When trying to use this driver with the common clock framework, enabling
> the clock fails because it was not prepared. This fixes the problem by
> calling clk_prepare and clk_enable in a single function. Ditto for
> clk_disable_unprepare.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 3/5] mmc: davinci: prepare clock
@ 2016-03-15 9:13 ` Sekhar Nori
0 siblings, 0 replies; 65+ messages in thread
From: Sekhar Nori @ 2016-03-15 9:13 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> When trying to use this driver with the common clock framework, enabling
> the clock fails because it was not prepared. This fixes the problem by
> calling clk_prepare and clk_enable in a single function. Ditto for
> clk_disable_unprepare.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Regards,
Sekhar
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-15 8:54 ` Peter Ujfalusi
@ 2016-03-15 17:14 ` David Lechner
-1 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-15 17:14 UTC (permalink / raw)
To: Peter Ujfalusi, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
On 03/15/2016 03:54 AM, Peter Ujfalusi wrote:
> On 03/15/16 00:54, David Lechner wrote:
>>
>> host->dma_tx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->txdma, mmc_dev(host->mmc), "tx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>
> you would need to use dma_request_chan() to be able to rely on the legacy
> channel mapping.
> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
> the patch I have for davinci-mmc for reference.
> When we convert to use the dma_request_chan() we can handle deferred probing
> also...
>
OK. So I should redo this patch on top of the patch you attached?
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-15 17:14 ` David Lechner
0 siblings, 0 replies; 65+ messages in thread
From: David Lechner @ 2016-03-15 17:14 UTC (permalink / raw)
To: linux-arm-kernel
On 03/15/2016 03:54 AM, Peter Ujfalusi wrote:
> On 03/15/16 00:54, David Lechner wrote:
>>
>> host->dma_tx =
>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>> - &host->txdma, mmc_dev(host->mmc), "tx");
>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>
> you would need to use dma_request_chan() to be able to rely on the legacy
> channel mapping.
> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
> the patch I have for davinci-mmc for reference.
> When we convert to use the dma_request_chan() we can handle deferred probing
> also...
>
OK. So I should redo this patch on top of the patch you attached?
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
2016-03-15 17:14 ` David Lechner
(?)
@ 2016-03-16 8:46 ` Peter Ujfalusi
-1 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-16 8:46 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
On 03/15/16 19:14, David Lechner wrote:
> On 03/15/2016 03:54 AM, Peter Ujfalusi wrote:
>> On 03/15/16 00:54, David Lechner wrote:
>>>
>>> host->dma_tx =
>>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>>> - &host->txdma, mmc_dev(host->mmc), "tx");
>>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>>
>> you would need to use dma_request_chan() to be able to rely on the legacy
>> channel mapping.
>> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
>> the patch I have for davinci-mmc for reference.
>> When we convert to use the dma_request_chan() we can handle deferred probing
>> also...
>>
>
> OK. So I should redo this patch on top of the patch you attached?
Or replace your patch with mine in your series. In my patch I forgot to remove
the 'u32 rxdma, txdma;' from struct mmc_davinci_host...
--
Péter
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-16 8:46 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-16 8:46 UTC (permalink / raw)
To: David Lechner, nsekhar
Cc: ulf.hansson, khilman, linux-mmc, linux-kernel, linux-arm-kernel
On 03/15/16 19:14, David Lechner wrote:
> On 03/15/2016 03:54 AM, Peter Ujfalusi wrote:
>> On 03/15/16 00:54, David Lechner wrote:
>>>
>>> host->dma_tx =
>>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>>> - &host->txdma, mmc_dev(host->mmc), "tx");
>>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>>
>> you would need to use dma_request_chan() to be able to rely on the legacy
>> channel mapping.
>> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
>> the patch I have for davinci-mmc for reference.
>> When we convert to use the dma_request_chan() we can handle deferred probing
>> also...
>>
>
> OK. So I should redo this patch on top of the patch you attached?
Or replace your patch with mine in your series. In my patch I forgot to remove
the 'u32 rxdma, txdma;' from struct mmc_davinci_host...
--
Péter
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 4/5] mmc: davinci: don't use dma platform resources
@ 2016-03-16 8:46 ` Peter Ujfalusi
0 siblings, 0 replies; 65+ messages in thread
From: Peter Ujfalusi @ 2016-03-16 8:46 UTC (permalink / raw)
To: linux-arm-kernel
On 03/15/16 19:14, David Lechner wrote:
> On 03/15/2016 03:54 AM, Peter Ujfalusi wrote:
>> On 03/15/16 00:54, David Lechner wrote:
>>>
>>> host->dma_tx =
>>> - dma_request_slave_channel_compat(mask, edma_filter_fn,
>>> - &host->txdma, mmc_dev(host->mmc), "tx");
>>> + dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>>
>> you would need to use dma_request_chan() to be able to rely on the legacy
>> channel mapping.
>> I have staged commits for converting all daVinci and OMAP drivers, I'll attach
>> the patch I have for davinci-mmc for reference.
>> When we convert to use the dma_request_chan() we can handle deferred probing
>> also...
>>
>
> OK. So I should redo this patch on top of the patch you attached?
Or replace your patch with mine in your series. In my patch I forgot to remove
the 'u32 rxdma, txdma;' from struct mmc_davinci_host...
--
P?ter
^ permalink raw reply [flat|nested] 65+ messages in thread
end of thread, other threads:[~2016-03-16 8:48 UTC | newest]
Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 23:50 [PATCH 0/4] davinci_mmc device tree fixes David Lechner
2016-03-09 23:50 ` David Lechner
2016-03-09 23:50 ` [PATCH 1/4] mmc: davinci: remove matching string David Lechner
2016-03-09 23:50 ` David Lechner
2016-03-14 13:41 ` Sekhar Nori
2016-03-14 13:41 ` Sekhar Nori
2016-03-09 23:50 ` [PATCH 2/4] mmc: davinci: fix unwinding in probe David Lechner
2016-03-09 23:50 ` David Lechner
2016-03-14 11:52 ` Sekhar Nori
2016-03-14 11:52 ` Sekhar Nori
2016-03-09 23:50 ` [PATCH 3/4] mmc: davinci: prepare clock David Lechner
2016-03-09 23:50 ` David Lechner
2016-03-14 11:54 ` Sekhar Nori
2016-03-14 11:54 ` Sekhar Nori
2016-03-14 17:09 ` David Lechner
2016-03-14 17:09 ` David Lechner
2016-03-14 17:13 ` David Lechner
2016-03-14 17:13 ` David Lechner
2016-03-15 5:16 ` Sekhar Nori
2016-03-15 5:16 ` Sekhar Nori
2016-03-09 23:50 ` [PATCH 4/4] mmc: davinci: suppress waring when using DT David Lechner
2016-03-09 23:50 ` David Lechner
2016-03-14 13:41 ` Sekhar Nori
2016-03-14 13:41 ` Sekhar Nori
2016-03-14 22:54 ` [PATCH v2 0/5] davinci_mmc fixes David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-14 22:54 ` [PATCH v2 1/5] mmc: davinci: remove matching string David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-15 9:12 ` Sekhar Nori
2016-03-15 9:12 ` Sekhar Nori
2016-03-15 9:12 ` Sekhar Nori
2016-03-14 22:54 ` [PATCH v2 2/5] mmc: davinci: fix unwinding in probe David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-15 9:10 ` Sekhar Nori
2016-03-15 9:10 ` Sekhar Nori
2016-03-15 9:10 ` Sekhar Nori
2016-03-14 22:54 ` [PATCH v2 3/5] mmc: davinci: prepare clock David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-15 9:13 ` Sekhar Nori
2016-03-15 9:13 ` Sekhar Nori
2016-03-15 9:13 ` Sekhar Nori
2016-03-14 22:54 ` [PATCH v2 4/5] mmc: davinci: don't use dma platform resources David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-15 8:09 ` Sekhar Nori
2016-03-15 8:09 ` Sekhar Nori
2016-03-15 8:09 ` Sekhar Nori
2016-03-15 8:54 ` Peter Ujfalusi
2016-03-15 8:54 ` Peter Ujfalusi
2016-03-15 8:54 ` Peter Ujfalusi
2016-03-15 8:56 ` Peter Ujfalusi
2016-03-15 8:56 ` Peter Ujfalusi
2016-03-15 8:56 ` Peter Ujfalusi
2016-03-15 17:14 ` David Lechner
2016-03-15 17:14 ` David Lechner
2016-03-16 8:46 ` Peter Ujfalusi
2016-03-16 8:46 ` Peter Ujfalusi
2016-03-16 8:46 ` Peter Ujfalusi
2016-03-14 22:54 ` [PATCH v2 5/5] arm: davinci: remove mmc dma resources David Lechner
2016-03-14 22:54 ` David Lechner
2016-03-15 8:23 ` Sekhar Nori
2016-03-15 8:23 ` Sekhar Nori
2016-03-15 8:23 ` Sekhar Nori
2016-03-15 8:13 ` [PATCH v2 0/5] davinci_mmc fixes Sekhar Nori
2016-03-15 8:13 ` Sekhar Nori
2016-03-15 8:13 ` Sekhar Nori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.