2012-05-25 23:15:19

by Fabio Estevam

[permalink] [raw]
Subject: [PATCH 04/15] dma: imx-sdma: Use clk_prepare_enable/clk_disable_unprepare

From: Fabio Estevam <[email protected]>

Prepare the clock before enabling it.

Cc: Vinod Koul <[email protected]>
Cc: <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
---
drivers/dma/imx-sdma.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fb4f499..b6174e6 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -868,8 +868,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
sdmac->peripheral_type = data->peripheral_type;
sdmac->event_id0 = data->dma_request;

- clk_enable(sdmac->sdma->clk_ipg);
- clk_enable(sdmac->sdma->clk_ahb);
+ clk_prepare_enable(sdmac->sdma->clk_ipg);
+ clk_prepare_enable(sdmac->sdma->clk_ahb);

ret = sdma_request_channel(sdmac);
if (ret)
@@ -906,8 +906,8 @@ static void sdma_free_chan_resources(struct dma_chan *chan)

dma_free_coherent(NULL, PAGE_SIZE, sdmac->bd, sdmac->bd_phys);

- clk_disable(sdma->clk_ipg);
- clk_disable(sdma->clk_ahb);
+ clk_disable_unprepare(sdma->clk_ipg);
+ clk_disable_unprepare(sdma->clk_ahb);
}

static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
@@ -1180,14 +1180,14 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
addr = (void *)header + header->script_addrs_start;
ram_code = (void *)header + header->ram_code_start;

- clk_enable(sdma->clk_ipg);
- clk_enable(sdma->clk_ahb);
+ clk_prepare_enable(sdma->clk_ipg);
+ clk_prepare_enable(sdma->clk_ahb);
/* download the RAM image for SDMA */
sdma_load_script(sdma, ram_code,
header->ram_code_size,
addr->ram_code_start_addr);
- clk_disable(sdma->clk_ipg);
- clk_disable(sdma->clk_ahb);
+ clk_disable_unprepare(sdma->clk_ipg);
+ clk_disable_unprepare(sdma->clk_ahb);

sdma_add_scripts(sdma, addr);

@@ -1229,8 +1229,8 @@ static int __init sdma_init(struct sdma_engine *sdma)
return -ENODEV;
}

- clk_enable(sdma->clk_ipg);
- clk_enable(sdma->clk_ahb);
+ clk_prepare_enable(sdma->clk_ipg);
+ clk_prepare_enable(sdma->clk_ahb);

/* Be sure SDMA has not started yet */
writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);
@@ -1283,14 +1283,14 @@ static int __init sdma_init(struct sdma_engine *sdma)
/* Initializes channel's priorities */
sdma_set_channel_priority(&sdma->channel[0], 7);

- clk_disable(sdma->clk_ipg);
- clk_disable(sdma->clk_ahb);
+ clk_disable_unprepare(sdma->clk_ipg);
+ clk_disable_unprepare(sdma->clk_ahb);

return 0;

err_dma_alloc:
- clk_disable(sdma->clk_ipg);
- clk_disable(sdma->clk_ahb);
+ clk_disable_unprepare(sdma->clk_ipg);
+ clk_disable_unprepare(sdma->clk_ahb);
dev_err(sdma->dev, "initialisation failed with %d\n", ret);
return ret;
}
--
1.7.1


2012-05-26 11:30:55

by Sascha Hauer

[permalink] [raw]
Subject: Re: [PATCH 04/15] dma: imx-sdma: Use clk_prepare_enable/clk_disable_unprepare

On Fri, May 25, 2012 at 08:14:45PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <[email protected]>
>
> Prepare the clock before enabling it.
>
> Cc: Vinod Koul <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Fabio Estevam <[email protected]>
> ---
> drivers/dma/imx-sdma.c | 28 ++++++++++++++--------------
> 1 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index fb4f499..b6174e6 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -868,8 +868,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
> sdmac->peripheral_type = data->peripheral_type;
> sdmac->event_id0 = data->dma_request;
>
> - clk_enable(sdmac->sdma->clk_ipg);
> - clk_enable(sdmac->sdma->clk_ahb);
> + clk_prepare_enable(sdmac->sdma->clk_ipg);
> + clk_prepare_enable(sdmac->sdma->clk_ahb);

No, the clock already is prepared, see the probe function.

Sascha

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2012-05-26 16:04:05

by Fabio Estevam

[permalink] [raw]
Subject: [PATCH v2 03/15] hw_random: mxc-rnga: Use clk_prepare_enable/clk_disable_unprepare

From: Fabio Estevam <[email protected]>

Prepare the clock before enabling it.

Cc: Herbert Xu <[email protected]>
Cc: <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
---
Changes since v1:
- Add missing clk_disable_unprepare(clk) in the remove path

drivers/char/hw_random/mxc-rnga.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
index 187c6be..430582c 100644
--- a/drivers/char/hw_random/mxc-rnga.c
+++ b/drivers/char/hw_random/mxc-rnga.c
@@ -154,7 +154,7 @@ static int __init mxc_rnga_probe(struct platform_device *pdev)
goto out;
}

- clk_enable(clk);
+ clk_prepare_enable(clk);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -196,7 +196,7 @@ err_ioremap:
release_mem_region(res->start, resource_size(res));

err_region:
- clk_disable(clk);
+ clk_disable_unprepare(clk);
clk_put(clk);

out:
@@ -215,7 +215,7 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev)

release_mem_region(res->start, resource_size(res));

- clk_disable(clk);
+ clk_disable_unprepare(clk);
clk_put(clk);

return 0;
--
1.7.1

2012-05-29 09:18:08

by Sascha Hauer

[permalink] [raw]
Subject: Re: [PATCH v2 03/15] hw_random: mxc-rnga: Use clk_prepare_enable/clk_disable_unprepare

On Sat, May 26, 2012 at 01:03:52PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <[email protected]>
>
> Prepare the clock before enabling it.
>
> Cc: Herbert Xu <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Fabio Estevam <[email protected]>

Acked-by: Sascha Hauer <[email protected]>

> ---
> Changes since v1:
> - Add missing clk_disable_unprepare(clk) in the remove path
>
> drivers/char/hw_random/mxc-rnga.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
> index 187c6be..430582c 100644
> --- a/drivers/char/hw_random/mxc-rnga.c
> +++ b/drivers/char/hw_random/mxc-rnga.c
> @@ -154,7 +154,7 @@ static int __init mxc_rnga_probe(struct platform_device *pdev)
> goto out;
> }
>
> - clk_enable(clk);
> + clk_prepare_enable(clk);
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> @@ -196,7 +196,7 @@ err_ioremap:
> release_mem_region(res->start, resource_size(res));
>
> err_region:
> - clk_disable(clk);
> + clk_disable_unprepare(clk);
> clk_put(clk);
>
> out:
> @@ -215,7 +215,7 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev)
>
> release_mem_region(res->start, resource_size(res));
>
> - clk_disable(clk);
> + clk_disable_unprepare(clk);
> clk_put(clk);
>
> return 0;
> --
> 1.7.1
>
>

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2012-06-06 03:41:19

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH v2 03/15] hw_random: mxc-rnga: Use clk_prepare_enable/clk_disable_unprepare

Herbert,

On Tue, May 29, 2012 at 6:17 AM, Sascha Hauer <[email protected]> wrote:
> On Sat, May 26, 2012 at 01:03:52PM -0300, Fabio Estevam wrote:
>> From: Fabio Estevam <[email protected]>
>>
>> Prepare the clock before enabling it.
>>
>> Cc: Herbert Xu <[email protected]>
>> Cc: <[email protected]>
>> Signed-off-by: Fabio Estevam <[email protected]>
>
> Acked-by: Sascha Hauer <[email protected]>

Can this be applied?

2012-06-06 05:24:55

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v2 03/15] hw_random: mxc-rnga: Use clk_prepare_enable/clk_disable_unprepare

On Wed, Jun 06, 2012 at 12:41:17AM -0300, Fabio Estevam wrote:
> Herbert,
>
> On Tue, May 29, 2012 at 6:17 AM, Sascha Hauer <[email protected]> wrote:
> > On Sat, May 26, 2012 at 01:03:52PM -0300, Fabio Estevam wrote:
> >> From: Fabio Estevam <[email protected]>
> >>
> >> Prepare the clock before enabling it.
> >>
> >> Cc: Herbert Xu <[email protected]>
> >> Cc: <[email protected]>
> >> Signed-off-by: Fabio Estevam <[email protected]>
> >
> > Acked-by: Sascha Hauer <[email protected]>
>
> Can this be applied?

Your patch is in my queue. I'm at LinuxCon Japan right now,
so I'll be applying them later this week.

Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt