2016-03-14 22:56:29

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 0/5] davinci_mmc fixes

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


2016-03-14 22:56:36

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 5/5] arm: davinci: remove mmc dma resources

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 <[email protected]>
---

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

2016-03-14 22:56:32

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

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 <[email protected]>
---

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

2016-03-14 22:56:30

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 1/5] mmc: davinci: remove matching string

The string "MMCSDCLK" is not actually used for clock lookup, so can be removed.

Signed-off-by: David Lechner <[email protected]>
---

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

2016-03-14 22:57:17

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 3/5] mmc: davinci: prepare clock

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 <[email protected]>
---

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

2016-03-14 22:57:39

by David Lechner

[permalink] [raw]
Subject: [PATCH v2 2/5] mmc: davinci: fix unwinding in probe

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 <[email protected]>
---

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

2016-03-15 08:11:03

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

+ 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 <[email protected]>

Looks good to me.

Acked-by: Sekhar Nori <[email protected]>

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)
>

2016-03-15 08:14:27

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] davinci_mmc fixes

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

2016-03-15 08:25:17

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] arm: davinci: remove mmc dma resources

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 <[email protected]>

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 <[email protected]>

BTW, we prefer a captialized "ARM:" in subject prefix. Whoever is
applying can probably fix it though.

Thanks,
Sekhar

2016-03-15 08:56:02

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

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 <[email protected]>
> ---
>
> 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


Attachments:
0001-mmc-davinci_mmc-Use-dma_request_chan-to-requesting-D.patch (3.34 kB)

2016-03-15 08:57:32

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

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 <[email protected]>
>> ---
>>
>> 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

2016-03-15 09:12:15

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] mmc: davinci: fix unwinding in probe

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 <[email protected]>
> ---
>
> 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

2016-03-15 09:14:07

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 1/5] mmc: davinci: remove matching string

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 <[email protected]>

In general, you can carry forward acks received in the last version of
the patch if the patch is unchanged.

Acked-by: Sekhar Nori <[email protected]>

Thanks,
Sekhar

2016-03-15 09:14:57

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 3/5] mmc: davinci: prepare clock

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 <[email protected]>

Acked-by: Sekhar Nori <[email protected]>

Regards,
Sekhar

2016-03-15 17:14:53

by David Lechner

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

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?

2016-03-16 08:48:01

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] mmc: davinci: don't use dma platform resources

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