* [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare.
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
@ 2013-06-19 11:13 ` Boris BREZILLON
2013-06-20 7:33 ` Nicolas Ferre
2013-06-19 11:14 ` [PATCH 2/8] at_hdmac: prepare clk before calling enable Boris BREZILLON
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:13 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, John Stultz, Thomas Gleixner
Cc: linux-arm-kernel, linux-kernel, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/clocksource/tcb_clksrc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 8a61872..229c019 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
|| tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
__raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
__raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
- clk_disable(tcd->clk);
+ clk_disable_unprepare(tcd->clk);
}
switch (m) {
@@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
* of oneshot, we get lower overhead and improved accuracy.
*/
case CLOCK_EVT_MODE_PERIODIC:
- clk_enable(tcd->clk);
+ clk_prepare_enable(tcd->clk);
/* slow clock, count up to RC, then irq and restart */
__raw_writel(timer_clock
@@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
break;
case CLOCK_EVT_MODE_ONESHOT:
- clk_enable(tcd->clk);
+ clk_prepare_enable(tcd->clk);
/* slow clock, count up to RC, then irq and stop */
__raw_writel(timer_clock | ATMEL_TC_CPCSTOP
@@ -275,7 +275,7 @@ static int __init tcb_clksrc_init(void)
pdev = tc->pdev;
t0_clk = tc->clk[0];
- clk_enable(t0_clk);
+ clk_prepare_enable(t0_clk);
/* How fast will we be counting? Pick something over 5 MHz. */
rate = (u32) clk_get_rate(t0_clk);
@@ -313,7 +313,7 @@ static int __init tcb_clksrc_init(void)
/* tclib will give us three clocks no matter what the
* underlying platform supports.
*/
- clk_enable(tc->clk[1]);
+ clk_prepare_enable(tc->clk[1]);
/* setup both channel 0 & 1 */
tcb_setup_dual_chan(tc, best_divisor_idx);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare.
2013-06-19 11:13 ` [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare Boris BREZILLON
@ 2013-06-20 7:33 ` Nicolas Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-20 7:33 UTC (permalink / raw)
To: Boris BREZILLON
Cc: Ludovic Desroches, Jean-Christophe Plagniol-Villard, John Stultz,
Thomas Gleixner, linux-arm-kernel, linux-kernel
On 19/06/2013 13:13, Boris BREZILLON :
> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> avoid common clk framework warnings.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/clocksource/tcb_clksrc.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
> index 8a61872..229c019 100644
> --- a/drivers/clocksource/tcb_clksrc.c
> +++ b/drivers/clocksource/tcb_clksrc.c
> @@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
> __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
> __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
> - clk_disable(tcd->clk);
> + clk_disable_unprepare(tcd->clk);
> }
>
> switch (m) {
> @@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> * of oneshot, we get lower overhead and improved accuracy.
> */
> case CLOCK_EVT_MODE_PERIODIC:
> - clk_enable(tcd->clk);
> + clk_prepare_enable(tcd->clk);
>
> /* slow clock, count up to RC, then irq and restart */
> __raw_writel(timer_clock
> @@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> break;
>
> case CLOCK_EVT_MODE_ONESHOT:
> - clk_enable(tcd->clk);
> + clk_prepare_enable(tcd->clk);
>
> /* slow clock, count up to RC, then irq and stop */
> __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
> @@ -275,7 +275,7 @@ static int __init tcb_clksrc_init(void)
> pdev = tc->pdev;
>
> t0_clk = tc->clk[0];
> - clk_enable(t0_clk);
> + clk_prepare_enable(t0_clk);
>
> /* How fast will we be counting? Pick something over 5 MHz. */
> rate = (u32) clk_get_rate(t0_clk);
> @@ -313,7 +313,7 @@ static int __init tcb_clksrc_init(void)
> /* tclib will give us three clocks no matter what the
> * underlying platform supports.
> */
> - clk_enable(tc->clk[1]);
> + clk_prepare_enable(tc->clk[1]);
> /* setup both channel 0 & 1 */
> tcb_setup_dual_chan(tc, best_divisor_idx);
> }
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/8] at_hdmac: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
2013-06-19 11:13 ` [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare Boris BREZILLON
@ 2013-06-19 11:14 ` Boris BREZILLON
2013-06-20 7:43 ` Nicolas Ferre
2013-06-19 11:15 ` Boris BREZILLON
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:14 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Dan Williams, Vinod Koul
Cc: linux-arm-kernel, linux-kernel, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/dma/at_hdmac.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e923cda..19a484a 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1374,7 +1374,9 @@ static int __init at_dma_probe(struct platform_device *pdev)
err = PTR_ERR(atdma->clk);
goto err_clk;
}
- clk_enable(atdma->clk);
+ err = clk_prepare_enable(atdma->clk);
+ if (err)
+ goto err_clk_prepare;
/* force dma off, just in case */
at_dma_off(atdma);
@@ -1475,7 +1477,8 @@ err_pool_create:
platform_set_drvdata(pdev, NULL);
free_irq(platform_get_irq(pdev, 0), atdma);
err_irq:
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
+err_clk_prepare:
clk_put(atdma->clk);
err_clk:
iounmap(atdma->regs);
@@ -1512,7 +1515,7 @@ static int at_dma_remove(struct platform_device *pdev)
list_del(&chan->device_node);
}
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
clk_put(atdma->clk);
iounmap(atdma->regs);
@@ -1531,7 +1534,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
struct at_dma *atdma = platform_get_drvdata(pdev);
at_dma_off(platform_get_drvdata(pdev));
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
}
static int at_dma_prepare(struct device *dev)
@@ -1588,7 +1591,7 @@ static int at_dma_suspend_noirq(struct device *dev)
/* disable DMA controller */
at_dma_off(atdma);
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
return 0;
}
@@ -1618,7 +1621,9 @@ static int at_dma_resume_noirq(struct device *dev)
struct dma_chan *chan, *_chan;
/* bring back DMA controller */
- clk_enable(atdma->clk);
+ err = clk_prepare_enable(atdma->clk);
+ if (err)
+ return err;
dma_writel(atdma, EN, AT_DMA_ENABLE);
/* clear any pending interrupt */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
2013-06-19 11:14 ` [PATCH 2/8] at_hdmac: prepare clk before calling enable Boris BREZILLON
@ 2013-06-20 7:43 ` Nicolas Ferre
2013-06-21 2:40 ` Vinod Koul
0 siblings, 1 reply; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-20 7:43 UTC (permalink / raw)
To: Boris BREZILLON, Vinod Koul
Cc: Ludovic Desroches, Jean-Christophe Plagniol-Villard,
Dan Williams, linux-arm-kernel, linux-kernel
On 19/06/2013 13:14, Boris BREZILLON :
> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> avoid common clk framework warnings.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
BTW Vinod, it seems that we have several slave-dma patches pending: do
you want me to collect them and send you a pull-request for 3.11?
Best regards,
> ---
> drivers/dma/at_hdmac.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e923cda..19a484a 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1374,7 +1374,9 @@ static int __init at_dma_probe(struct platform_device *pdev)
> err = PTR_ERR(atdma->clk);
> goto err_clk;
> }
> - clk_enable(atdma->clk);
> + err = clk_prepare_enable(atdma->clk);
> + if (err)
> + goto err_clk_prepare;
>
> /* force dma off, just in case */
> at_dma_off(atdma);
> @@ -1475,7 +1477,8 @@ err_pool_create:
> platform_set_drvdata(pdev, NULL);
> free_irq(platform_get_irq(pdev, 0), atdma);
> err_irq:
> - clk_disable(atdma->clk);
> + clk_disable_unprepare(atdma->clk);
> +err_clk_prepare:
> clk_put(atdma->clk);
> err_clk:
> iounmap(atdma->regs);
> @@ -1512,7 +1515,7 @@ static int at_dma_remove(struct platform_device *pdev)
> list_del(&chan->device_node);
> }
>
> - clk_disable(atdma->clk);
> + clk_disable_unprepare(atdma->clk);
> clk_put(atdma->clk);
>
> iounmap(atdma->regs);
> @@ -1531,7 +1534,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
> struct at_dma *atdma = platform_get_drvdata(pdev);
>
> at_dma_off(platform_get_drvdata(pdev));
> - clk_disable(atdma->clk);
> + clk_disable_unprepare(atdma->clk);
> }
>
> static int at_dma_prepare(struct device *dev)
> @@ -1588,7 +1591,7 @@ static int at_dma_suspend_noirq(struct device *dev)
>
> /* disable DMA controller */
> at_dma_off(atdma);
> - clk_disable(atdma->clk);
> + clk_disable_unprepare(atdma->clk);
> return 0;
> }
>
> @@ -1618,7 +1621,9 @@ static int at_dma_resume_noirq(struct device *dev)
> struct dma_chan *chan, *_chan;
>
> /* bring back DMA controller */
> - clk_enable(atdma->clk);
> + err = clk_prepare_enable(atdma->clk);
> + if (err)
> + return err;
> dma_writel(atdma, EN, AT_DMA_ENABLE);
>
> /* clear any pending interrupt */
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
2013-06-20 7:43 ` Nicolas Ferre
@ 2013-06-21 2:40 ` Vinod Koul
2013-06-24 17:40 ` Nicolas Ferre
0 siblings, 1 reply; 18+ messages in thread
From: Vinod Koul @ 2013-06-21 2:40 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Boris BREZILLON, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Dan Williams, linux-arm-kernel,
linux-kernel
On Thu, Jun 20, 2013 at 09:43:52AM +0200, Nicolas Ferre wrote:
> On 19/06/2013 13:14, Boris BREZILLON :
> >Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> >avoid common clk framework warnings.
> >
> >Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> BTW Vinod, it seems that we have several slave-dma patches pending:
> do you want me to collect them and send you a pull-request for 3.11?
I think those are the DT binding one, right? Sorry have been quite busy and
travelling. I could use the help right now...
--
~Vinod
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
2013-06-21 2:40 ` Vinod Koul
@ 2013-06-24 17:40 ` Nicolas Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-24 17:40 UTC (permalink / raw)
To: Vinod Koul
Cc: Boris BREZILLON, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Dan Williams, linux-arm-kernel,
linux-kernel
On 21/06/2013 04:40, Vinod Koul :
> On Thu, Jun 20, 2013 at 09:43:52AM +0200, Nicolas Ferre wrote:
>> On 19/06/2013 13:14, Boris BREZILLON :
>>> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
>>> avoid common clk framework warnings.
>>>
>>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
>> BTW Vinod, it seems that we have several slave-dma patches pending:
>> do you want me to collect them and send you a pull-request for 3.11?
> I think those are the DT binding one, right? Sorry have been quite busy and
> travelling. I could use the help right now...
Vinod,
I have just sent the pull-request with all patches that you may take for
3.11 ([GIT PULL] dmaengine: at_hdmac: updates for 3.11). It is a signed
tag "at91-sdma" on our github space.
I hope that it will be easy for you to take it in your slave-dma git
tree. If you have any question, please let me know.
Best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/8] at_hdmac: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
2013-06-19 11:13 ` [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare Boris BREZILLON
2013-06-19 11:14 ` [PATCH 2/8] at_hdmac: prepare clk before calling enable Boris BREZILLON
@ 2013-06-19 11:15 ` Boris BREZILLON
2013-06-19 11:16 ` [PATCH 3/8] mmc: atmel-mci: " Boris BREZILLON
` (5 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:15 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Chris Ball
Cc: linux-arm-kernel, linux-kernel, linux-mmc, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/dma/at_hdmac.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e923cda..19a484a 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1374,7 +1374,9 @@ static int __init at_dma_probe(struct platform_device *pdev)
err = PTR_ERR(atdma->clk);
goto err_clk;
}
- clk_enable(atdma->clk);
+ err = clk_prepare_enable(atdma->clk);
+ if (err)
+ goto err_clk_prepare;
/* force dma off, just in case */
at_dma_off(atdma);
@@ -1475,7 +1477,8 @@ err_pool_create:
platform_set_drvdata(pdev, NULL);
free_irq(platform_get_irq(pdev, 0), atdma);
err_irq:
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
+err_clk_prepare:
clk_put(atdma->clk);
err_clk:
iounmap(atdma->regs);
@@ -1512,7 +1515,7 @@ static int at_dma_remove(struct platform_device *pdev)
list_del(&chan->device_node);
}
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
clk_put(atdma->clk);
iounmap(atdma->regs);
@@ -1531,7 +1534,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
struct at_dma *atdma = platform_get_drvdata(pdev);
at_dma_off(platform_get_drvdata(pdev));
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
}
static int at_dma_prepare(struct device *dev)
@@ -1588,7 +1591,7 @@ static int at_dma_suspend_noirq(struct device *dev)
/* disable DMA controller */
at_dma_off(atdma);
- clk_disable(atdma->clk);
+ clk_disable_unprepare(atdma->clk);
return 0;
}
@@ -1618,7 +1621,9 @@ static int at_dma_resume_noirq(struct device *dev)
struct dma_chan *chan, *_chan;
/* bring back DMA controller */
- clk_enable(atdma->clk);
+ err = clk_prepare_enable(atdma->clk);
+ if (err)
+ return err;
dma_writel(atdma, EN, AT_DMA_ENABLE);
/* clear any pending interrupt */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/8] mmc: atmel-mci: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (2 preceding siblings ...)
2013-06-19 11:15 ` Boris BREZILLON
@ 2013-06-19 11:16 ` Boris BREZILLON
2013-06-19 11:17 ` [PATCH 4/8] tty: atmel_serial: " Boris BREZILLON
` (4 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:16 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Chris Ball
Cc: linux-arm-kernel, linux-kernel, linux-mmc, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/mmc/host/atmel-mci.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index e75774f..e3058a5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -380,6 +380,8 @@ static int atmci_regs_show(struct seq_file *s, void *v)
{
struct atmel_mci *host = s->private;
u32 *buf;
+ int ret = 0;
+
buf = kmalloc(ATMCI_REGS_SIZE, GFP_KERNEL);
if (!buf)
@@ -391,9 +393,13 @@ static int atmci_regs_show(struct seq_file *s, void *v)
* consistent.
*/
spin_lock_bh(&host->lock);
- clk_enable(host->mck);
+ ret = clk_prepare_enable(host->mck);
+ if (ret) {
+ spin_unlock_bh(&host->lock);
+ goto out;
+ }
memcpy_fromio(buf, host->regs, ATMCI_REGS_SIZE);
- clk_disable(host->mck);
+ clk_disable_unprepare(host->mck);
spin_unlock_bh(&host->lock);
seq_printf(s, "MR:\t0x%08x%s%s ",
@@ -444,9 +450,10 @@ static int atmci_regs_show(struct seq_file *s, void *v)
val & ATMCI_CFG_LSYNC ? " LSYNC" : "");
}
+out:
kfree(buf);
- return 0;
+ return ret;
}
static int atmci_regs_open(struct inode *inode, struct file *file)
@@ -1281,7 +1288,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
spin_lock_bh(&host->lock);
if (!host->mode_reg) {
- clk_enable(host->mck);
+ clk_prepare_enable(host->mck);
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
if (host->caps.has_cfg_reg)
@@ -1361,7 +1368,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
if (host->mode_reg) {
atmci_readl(host, ATMCI_MR);
- clk_disable(host->mck);
+ clk_disable_unprepare(host->mck);
}
host->mode_reg = 0;
}
@@ -2379,10 +2386,12 @@ static int __init atmci_probe(struct platform_device *pdev)
if (!host->regs)
goto err_ioremap;
- clk_enable(host->mck);
+ ret = clk_prepare_enable(host->mck);
+ if (ret)
+ goto err_clk_prepare_enable;
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
host->bus_hz = clk_get_rate(host->mck);
- clk_disable(host->mck);
+ clk_disable_unprepare(host->mck);
host->mapbase = regs->start;
@@ -2463,6 +2472,8 @@ err_init_slot:
dma_release_channel(host->dma.chan);
free_irq(irq, host);
err_request_irq:
+ clk_unprepare(host->mck);
+err_clk_prepare_enable:
iounmap(host->regs);
err_ioremap:
clk_put(host->mck);
@@ -2487,11 +2498,11 @@ static int __exit atmci_remove(struct platform_device *pdev)
atmci_cleanup_slot(host->slot[i], i);
}
- clk_enable(host->mck);
+ clk_prepare_enable(host->mck);
atmci_writel(host, ATMCI_IDR, ~0UL);
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
atmci_readl(host, ATMCI_SR);
- clk_disable(host->mck);
+ clk_disable_unprepare(host->mck);
if (host->dma.chan)
dma_release_channel(host->dma.chan);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (3 preceding siblings ...)
2013-06-19 11:16 ` [PATCH 3/8] mmc: atmel-mci: " Boris BREZILLON
@ 2013-06-19 11:17 ` Boris BREZILLON
2013-06-20 7:48 ` Nicolas Ferre
2013-06-19 11:18 ` [PATCH 5/8] usb: gadget: at91_udc: " Boris BREZILLON
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:17 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Greg Kroah-Hartman, Jiri Slaby
Cc: linux-arm-kernel, linux-kernel, linux-serial, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 3467462..691265f 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1100,7 +1100,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
* Enable the peripheral clock for this serial port.
* This is called on uart_open() or a resume event.
*/
- clk_enable(atmel_port->clk);
+ clk_prepare_enable(atmel_port->clk);
/* re-enable interrupts if we disabled some on suspend */
UART_PUT_IER(port, atmel_port->backup_imr);
@@ -1114,7 +1114,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
* Disable the peripheral clock for this serial port.
* This is called on uart_close() or a suspend event.
*/
- clk_disable(atmel_port->clk);
+ clk_disable_unprepare(atmel_port->clk);
break;
default:
printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
@@ -1458,9 +1458,10 @@ static void atmel_of_init_port(struct atmel_uart_port *atmel_port,
/*
* Configure the port from the platform device resource info.
*/
-static void atmel_init_port(struct atmel_uart_port *atmel_port,
+static int atmel_init_port(struct atmel_uart_port *atmel_port,
struct platform_device *pdev)
{
+ int ret;
struct uart_port *port = &atmel_port->uart;
struct atmel_uart_data *pdata = pdev->dev.platform_data;
@@ -1496,9 +1497,19 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
/* for console, the clock could already be configured */
if (!atmel_port->clk) {
atmel_port->clk = clk_get(&pdev->dev, "usart");
- clk_enable(atmel_port->clk);
+ if (IS_ERR(atmel_port->clk)) {
+ ret = PTR_ERR(atmel_port->clk);
+ atmel_port->clk = NULL;
+ return ret;
+ }
+ ret = clk_prepare_enable(atmel_port->clk);
+ if (ret) {
+ clk_put(atmel_port->clk);
+ atmel_port->clk = NULL;
+ return ret;
+ }
port->uartclk = clk_get_rate(atmel_port->clk);
- clk_disable(atmel_port->clk);
+ clk_disable_unprepare(atmel_port->clk);
/* only enable clock when USART is in use */
}
@@ -1511,6 +1522,8 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
} else {
atmel_port->tx_done_mask = ATMEL_US_TXRDY;
}
+
+ return 0;
}
struct platform_device *atmel_default_console_device; /* the serial console device */
@@ -1601,6 +1614,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
static int __init atmel_console_setup(struct console *co, char *options)
{
+ int ret;
struct uart_port *port = &atmel_ports[co->index].uart;
int baud = 115200;
int bits = 8;
@@ -1612,7 +1626,9 @@ static int __init atmel_console_setup(struct console *co, char *options)
return -ENODEV;
}
- clk_enable(atmel_ports[co->index].clk);
+ ret = clk_prepare_enable(atmel_ports[co->index].clk);
+ if (ret)
+ return ret;
UART_PUT_IDR(port, -1);
UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
@@ -1645,6 +1661,7 @@ static struct console atmel_console = {
*/
static int __init atmel_console_init(void)
{
+ int ret;
if (atmel_default_console_device) {
struct atmel_uart_data *pdata =
atmel_default_console_device->dev.platform_data;
@@ -1655,7 +1672,9 @@ static int __init atmel_console_init(void)
port->uart.line = id;
add_preferred_console(ATMEL_DEVICENAME, id, NULL);
- atmel_init_port(port, atmel_default_console_device);
+ ret = atmel_init_port(port, atmel_default_console_device);
+ if (ret)
+ return ret;
register_console(&atmel_console);
}
@@ -1786,7 +1805,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
port->backup_imr = 0;
port->uart.line = ret;
- atmel_init_port(port, pdev);
+ ret = atmel_init_port(port, pdev);
+ if (ret)
+ goto err;
pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
if (IS_ERR(pinctrl)) {
@@ -1812,9 +1833,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
&& ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
/*
* The serial core enabled the clock for us, so undo
- * the clk_enable() in atmel_console_setup()
+ * the clk_prepare_enable() in atmel_console_setup()
*/
- clk_disable(port->clk);
+ clk_disable_unprepare(port->clk);
}
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
2013-06-19 11:17 ` [PATCH 4/8] tty: atmel_serial: " Boris BREZILLON
@ 2013-06-20 7:48 ` Nicolas Ferre
2013-06-20 8:06 ` boris brezillon
0 siblings, 1 reply; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-20 7:48 UTC (permalink / raw)
To: Boris BREZILLON
Cc: Ludovic Desroches, Jean-Christophe Plagniol-Villard,
Greg Kroah-Hartman, Jiri Slaby, linux-arm-kernel, linux-kernel,
linux-serial
On 19/06/2013 13:17, Boris BREZILLON :
> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> avoid common clk framework warnings.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
(one comment though)
> ---
> drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++---------
> 1 file changed, 31 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 3467462..691265f 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1100,7 +1100,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
> * Enable the peripheral clock for this serial port.
> * This is called on uart_open() or a resume event.
> */
> - clk_enable(atmel_port->clk);
> + clk_prepare_enable(atmel_port->clk);
Do we need to check return code here?
>
> /* re-enable interrupts if we disabled some on suspend */
> UART_PUT_IER(port, atmel_port->backup_imr);
> @@ -1114,7 +1114,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
> * Disable the peripheral clock for this serial port.
> * This is called on uart_close() or a suspend event.
> */
> - clk_disable(atmel_port->clk);
> + clk_disable_unprepare(atmel_port->clk);
> break;
> default:
> printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
> @@ -1458,9 +1458,10 @@ static void atmel_of_init_port(struct atmel_uart_port *atmel_port,
> /*
> * Configure the port from the platform device resource info.
> */
> -static void atmel_init_port(struct atmel_uart_port *atmel_port,
> +static int atmel_init_port(struct atmel_uart_port *atmel_port,
> struct platform_device *pdev)
> {
> + int ret;
> struct uart_port *port = &atmel_port->uart;
> struct atmel_uart_data *pdata = pdev->dev.platform_data;
>
> @@ -1496,9 +1497,19 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
> /* for console, the clock could already be configured */
> if (!atmel_port->clk) {
> atmel_port->clk = clk_get(&pdev->dev, "usart");
> - clk_enable(atmel_port->clk);
> + if (IS_ERR(atmel_port->clk)) {
> + ret = PTR_ERR(atmel_port->clk);
> + atmel_port->clk = NULL;
> + return ret;
> + }
> + ret = clk_prepare_enable(atmel_port->clk);
> + if (ret) {
> + clk_put(atmel_port->clk);
> + atmel_port->clk = NULL;
> + return ret;
> + }
> port->uartclk = clk_get_rate(atmel_port->clk);
> - clk_disable(atmel_port->clk);
> + clk_disable_unprepare(atmel_port->clk);
> /* only enable clock when USART is in use */
> }
>
> @@ -1511,6 +1522,8 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
> } else {
> atmel_port->tx_done_mask = ATMEL_US_TXRDY;
> }
> +
> + return 0;
> }
>
> struct platform_device *atmel_default_console_device; /* the serial console device */
> @@ -1601,6 +1614,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
>
> static int __init atmel_console_setup(struct console *co, char *options)
> {
> + int ret;
> struct uart_port *port = &atmel_ports[co->index].uart;
> int baud = 115200;
> int bits = 8;
> @@ -1612,7 +1626,9 @@ static int __init atmel_console_setup(struct console *co, char *options)
> return -ENODEV;
> }
>
> - clk_enable(atmel_ports[co->index].clk);
> + ret = clk_prepare_enable(atmel_ports[co->index].clk);
> + if (ret)
> + return ret;
>
> UART_PUT_IDR(port, -1);
> UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
> @@ -1645,6 +1661,7 @@ static struct console atmel_console = {
> */
> static int __init atmel_console_init(void)
> {
> + int ret;
> if (atmel_default_console_device) {
> struct atmel_uart_data *pdata =
> atmel_default_console_device->dev.platform_data;
> @@ -1655,7 +1672,9 @@ static int __init atmel_console_init(void)
> port->uart.line = id;
>
> add_preferred_console(ATMEL_DEVICENAME, id, NULL);
> - atmel_init_port(port, atmel_default_console_device);
> + ret = atmel_init_port(port, atmel_default_console_device);
> + if (ret)
> + return ret;
> register_console(&atmel_console);
> }
>
> @@ -1786,7 +1805,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
> port->backup_imr = 0;
> port->uart.line = ret;
>
> - atmel_init_port(port, pdev);
> + ret = atmel_init_port(port, pdev);
> + if (ret)
> + goto err;
>
> pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> if (IS_ERR(pinctrl)) {
> @@ -1812,9 +1833,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
> && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
> /*
> * The serial core enabled the clock for us, so undo
> - * the clk_enable() in atmel_console_setup()
> + * the clk_prepare_enable() in atmel_console_setup()
> */
> - clk_disable(port->clk);
> + clk_disable_unprepare(port->clk);
> }
> #endif
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
2013-06-20 7:48 ` Nicolas Ferre
@ 2013-06-20 8:06 ` boris brezillon
2013-06-20 10:20 ` Nicolas Ferre
0 siblings, 1 reply; 18+ messages in thread
From: boris brezillon @ 2013-06-20 8:06 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Ludovic Desroches, Jean-Christophe Plagniol-Villard,
Greg Kroah-Hartman, Jiri Slaby, linux-arm-kernel, linux-kernel,
linux-serial
On 20/06/2013 09:48, Nicolas Ferre wrote:
> On 19/06/2013 13:17, Boris BREZILLON :
>> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
>> avoid common clk framework warnings.
>>
>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> (one comment though)
>
>> ---
>> drivers/tty/serial/atmel_serial.c | 41
>> ++++++++++++++++++++++++++++---------
>> 1 file changed, 31 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c
>> b/drivers/tty/serial/atmel_serial.c
>> index 3467462..691265f 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -1100,7 +1100,7 @@ static void atmel_serial_pm(struct uart_port
>> *port, unsigned int state,
>> * Enable the peripheral clock for this serial port.
>> * This is called on uart_open() or a resume event.
>> */
>> - clk_enable(atmel_port->clk);
>> + clk_prepare_enable(atmel_port->clk);
>
> Do we need to check return code here?
We could, but the pm function will not reflect the failure (void return).
In addition, the clk_prepare_enable should not fail because it already
succeed in the probe
function (no memory allocation, simple bit masking in clk-peripheral
implem).
I can add it add this check (and avoid the interrrupt activation if it
fails) if you want.
>
>>
>> /* re-enable interrupts if we disabled some on suspend */
>> UART_PUT_IER(port, atmel_port->backup_imr);
>> @@ -1114,7 +1114,7 @@ static void atmel_serial_pm(struct uart_port
>> *port, unsigned int state,
>> * Disable the peripheral clock for this serial port.
>> * This is called on uart_close() or a suspend event.
>> */
>> - clk_disable(atmel_port->clk);
>> + clk_disable_unprepare(atmel_port->clk);
>> break;
>> default:
>> printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
>> @@ -1458,9 +1458,10 @@ static void atmel_of_init_port(struct
>> atmel_uart_port *atmel_port,
>> /*
>> * Configure the port from the platform device resource info.
>> */
>> -static void atmel_init_port(struct atmel_uart_port *atmel_port,
>> +static int atmel_init_port(struct atmel_uart_port *atmel_port,
>> struct platform_device *pdev)
>> {
>> + int ret;
>> struct uart_port *port = &atmel_port->uart;
>> struct atmel_uart_data *pdata = pdev->dev.platform_data;
>>
>> @@ -1496,9 +1497,19 @@ static void atmel_init_port(struct
>> atmel_uart_port *atmel_port,
>> /* for console, the clock could already be configured */
>> if (!atmel_port->clk) {
>> atmel_port->clk = clk_get(&pdev->dev, "usart");
>> - clk_enable(atmel_port->clk);
>> + if (IS_ERR(atmel_port->clk)) {
>> + ret = PTR_ERR(atmel_port->clk);
>> + atmel_port->clk = NULL;
>> + return ret;
>> + }
>> + ret = clk_prepare_enable(atmel_port->clk);
>> + if (ret) {
>> + clk_put(atmel_port->clk);
>> + atmel_port->clk = NULL;
>> + return ret;
>> + }
>> port->uartclk = clk_get_rate(atmel_port->clk);
>> - clk_disable(atmel_port->clk);
>> + clk_disable_unprepare(atmel_port->clk);
>> /* only enable clock when USART is in use */
>> }
>>
>> @@ -1511,6 +1522,8 @@ static void atmel_init_port(struct
>> atmel_uart_port *atmel_port,
>> } else {
>> atmel_port->tx_done_mask = ATMEL_US_TXRDY;
>> }
>> +
>> + return 0;
>> }
>>
>> struct platform_device *atmel_default_console_device; /* the
>> serial console device */
>> @@ -1601,6 +1614,7 @@ static void __init
>> atmel_console_get_options(struct uart_port *port, int *baud,
>>
>> static int __init atmel_console_setup(struct console *co, char
>> *options)
>> {
>> + int ret;
>> struct uart_port *port = &atmel_ports[co->index].uart;
>> int baud = 115200;
>> int bits = 8;
>> @@ -1612,7 +1626,9 @@ static int __init atmel_console_setup(struct
>> console *co, char *options)
>> return -ENODEV;
>> }
>>
>> - clk_enable(atmel_ports[co->index].clk);
>> + ret = clk_prepare_enable(atmel_ports[co->index].clk);
>> + if (ret)
>> + return ret;
>>
>> UART_PUT_IDR(port, -1);
>> UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
>> @@ -1645,6 +1661,7 @@ static struct console atmel_console = {
>> */
>> static int __init atmel_console_init(void)
>> {
>> + int ret;
>> if (atmel_default_console_device) {
>> struct atmel_uart_data *pdata =
>> atmel_default_console_device->dev.platform_data;
>> @@ -1655,7 +1672,9 @@ static int __init atmel_console_init(void)
>> port->uart.line = id;
>>
>> add_preferred_console(ATMEL_DEVICENAME, id, NULL);
>> - atmel_init_port(port, atmel_default_console_device);
>> + ret = atmel_init_port(port, atmel_default_console_device);
>> + if (ret)
>> + return ret;
>> register_console(&atmel_console);
>> }
>>
>> @@ -1786,7 +1805,9 @@ static int atmel_serial_probe(struct
>> platform_device *pdev)
>> port->backup_imr = 0;
>> port->uart.line = ret;
>>
>> - atmel_init_port(port, pdev);
>> + ret = atmel_init_port(port, pdev);
>> + if (ret)
>> + goto err;
>>
>> pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>> if (IS_ERR(pinctrl)) {
>> @@ -1812,9 +1833,9 @@ static int atmel_serial_probe(struct
>> platform_device *pdev)
>> && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
>> /*
>> * The serial core enabled the clock for us, so undo
>> - * the clk_enable() in atmel_console_setup()
>> + * the clk_prepare_enable() in atmel_console_setup()
>> */
>> - clk_disable(port->clk);
>> + clk_disable_unprepare(port->clk);
>> }
>> #endif
>>
>>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
2013-06-20 8:06 ` boris brezillon
@ 2013-06-20 10:20 ` Nicolas Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-20 10:20 UTC (permalink / raw)
To: boris brezillon
Cc: Ludovic Desroches, Jean-Christophe Plagniol-Villard,
Greg Kroah-Hartman, Jiri Slaby, linux-arm-kernel, linux-kernel,
linux-serial
On 20/06/2013 10:06, boris brezillon :
> On 20/06/2013 09:48, Nicolas Ferre wrote:
>> On 19/06/2013 13:17, Boris BREZILLON :
>>> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
>>> avoid common clk framework warnings.
>>>
>>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
>> (one comment though)
>>
>>> ---
>>> drivers/tty/serial/atmel_serial.c | 41
>>> ++++++++++++++++++++++++++++---------
>>> 1 file changed, 31 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/atmel_serial.c
>>> b/drivers/tty/serial/atmel_serial.c
>>> index 3467462..691265f 100644
>>> --- a/drivers/tty/serial/atmel_serial.c
>>> +++ b/drivers/tty/serial/atmel_serial.c
>>> @@ -1100,7 +1100,7 @@ static void atmel_serial_pm(struct uart_port
>>> *port, unsigned int state,
>>> * Enable the peripheral clock for this serial port.
>>> * This is called on uart_open() or a resume event.
>>> */
>>> - clk_enable(atmel_port->clk);
>>> + clk_prepare_enable(atmel_port->clk);
>>
>> Do we need to check return code here?
> We could, but the pm function will not reflect the failure (void return).
> In addition, the clk_prepare_enable should not fail because it already
> succeed in the probe
> function (no memory allocation, simple bit masking in clk-peripheral
> implem).
>
> I can add it add this check (and avoid the interrrupt activation if it
> fails) if you want.
No, it seems okay like that. Thanks for the precision.
Bye,
>
>>
>>>
>>> /* re-enable interrupts if we disabled some on suspend */
>>> UART_PUT_IER(port, atmel_port->backup_imr);
>>> @@ -1114,7 +1114,7 @@ static void atmel_serial_pm(struct uart_port
>>> *port, unsigned int state,
>>> * Disable the peripheral clock for this serial port.
>>> * This is called on uart_close() or a suspend event.
>>> */
>>> - clk_disable(atmel_port->clk);
>>> + clk_disable_unprepare(atmel_port->clk);
>>> break;
>>> default:
>>> printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
>>> @@ -1458,9 +1458,10 @@ static void atmel_of_init_port(struct
>>> atmel_uart_port *atmel_port,
>>> /*
>>> * Configure the port from the platform device resource info.
>>> */
>>> -static void atmel_init_port(struct atmel_uart_port *atmel_port,
>>> +static int atmel_init_port(struct atmel_uart_port *atmel_port,
>>> struct platform_device *pdev)
>>> {
>>> + int ret;
>>> struct uart_port *port = &atmel_port->uart;
>>> struct atmel_uart_data *pdata = pdev->dev.platform_data;
>>>
>>> @@ -1496,9 +1497,19 @@ static void atmel_init_port(struct
>>> atmel_uart_port *atmel_port,
>>> /* for console, the clock could already be configured */
>>> if (!atmel_port->clk) {
>>> atmel_port->clk = clk_get(&pdev->dev, "usart");
>>> - clk_enable(atmel_port->clk);
>>> + if (IS_ERR(atmel_port->clk)) {
>>> + ret = PTR_ERR(atmel_port->clk);
>>> + atmel_port->clk = NULL;
>>> + return ret;
>>> + }
>>> + ret = clk_prepare_enable(atmel_port->clk);
>>> + if (ret) {
>>> + clk_put(atmel_port->clk);
>>> + atmel_port->clk = NULL;
>>> + return ret;
>>> + }
>>> port->uartclk = clk_get_rate(atmel_port->clk);
>>> - clk_disable(atmel_port->clk);
>>> + clk_disable_unprepare(atmel_port->clk);
>>> /* only enable clock when USART is in use */
>>> }
>>>
>>> @@ -1511,6 +1522,8 @@ static void atmel_init_port(struct
>>> atmel_uart_port *atmel_port,
>>> } else {
>>> atmel_port->tx_done_mask = ATMEL_US_TXRDY;
>>> }
>>> +
>>> + return 0;
>>> }
>>>
>>> struct platform_device *atmel_default_console_device; /* the
>>> serial console device */
>>> @@ -1601,6 +1614,7 @@ static void __init
>>> atmel_console_get_options(struct uart_port *port, int *baud,
>>>
>>> static int __init atmel_console_setup(struct console *co, char
>>> *options)
>>> {
>>> + int ret;
>>> struct uart_port *port = &atmel_ports[co->index].uart;
>>> int baud = 115200;
>>> int bits = 8;
>>> @@ -1612,7 +1626,9 @@ static int __init atmel_console_setup(struct
>>> console *co, char *options)
>>> return -ENODEV;
>>> }
>>>
>>> - clk_enable(atmel_ports[co->index].clk);
>>> + ret = clk_prepare_enable(atmel_ports[co->index].clk);
>>> + if (ret)
>>> + return ret;
>>>
>>> UART_PUT_IDR(port, -1);
>>> UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
>>> @@ -1645,6 +1661,7 @@ static struct console atmel_console = {
>>> */
>>> static int __init atmel_console_init(void)
>>> {
>>> + int ret;
>>> if (atmel_default_console_device) {
>>> struct atmel_uart_data *pdata =
>>> atmel_default_console_device->dev.platform_data;
>>> @@ -1655,7 +1672,9 @@ static int __init atmel_console_init(void)
>>> port->uart.line = id;
>>>
>>> add_preferred_console(ATMEL_DEVICENAME, id, NULL);
>>> - atmel_init_port(port, atmel_default_console_device);
>>> + ret = atmel_init_port(port, atmel_default_console_device);
>>> + if (ret)
>>> + return ret;
>>> register_console(&atmel_console);
>>> }
>>>
>>> @@ -1786,7 +1805,9 @@ static int atmel_serial_probe(struct
>>> platform_device *pdev)
>>> port->backup_imr = 0;
>>> port->uart.line = ret;
>>>
>>> - atmel_init_port(port, pdev);
>>> + ret = atmel_init_port(port, pdev);
>>> + if (ret)
>>> + goto err;
>>>
>>> pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>>> if (IS_ERR(pinctrl)) {
>>> @@ -1812,9 +1833,9 @@ static int atmel_serial_probe(struct
>>> platform_device *pdev)
>>> && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
>>> /*
>>> * The serial core enabled the clock for us, so undo
>>> - * the clk_enable() in atmel_console_setup()
>>> + * the clk_prepare_enable() in atmel_console_setup()
>>> */
>>> - clk_disable(port->clk);
>>> + clk_disable_unprepare(port->clk);
>>> }
>>> #endif
>>>
>>>
>>
>>
>
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 5/8] usb: gadget: at91_udc: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (4 preceding siblings ...)
2013-06-19 11:17 ` [PATCH 4/8] tty: atmel_serial: " Boris BREZILLON
@ 2013-06-19 11:18 ` Boris BREZILLON
2013-06-19 11:20 ` [PATCH 6/8] ehci-atmel.c: " Boris BREZILLON
` (2 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:18 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Felipe Balbi,
Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/usb/gadget/at91_udc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 073b938..fce8e4e 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -870,8 +870,8 @@ static void clk_on(struct at91_udc *udc)
if (udc->clocked)
return;
udc->clocked = 1;
- clk_enable(udc->iclk);
- clk_enable(udc->fclk);
+ clk_prepare_enable(udc->iclk);
+ clk_prepare_enable(udc->fclk);
}
static void clk_off(struct at91_udc *udc)
@@ -880,8 +880,8 @@ static void clk_off(struct at91_udc *udc)
return;
udc->clocked = 0;
udc->gadget.speed = USB_SPEED_UNKNOWN;
- clk_disable(udc->fclk);
- clk_disable(udc->iclk);
+ clk_disable_unprepare(udc->fclk);
+ clk_disable_unprepare(udc->iclk);
}
/*
@@ -1782,12 +1782,14 @@ static int at91udc_probe(struct platform_device *pdev)
}
/* don't do anything until we have both gadget driver and VBUS */
- clk_enable(udc->iclk);
+ retval = clk_prepare_enable(udc->iclk);
+ if (retval)
+ goto fail1;
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
at91_udp_write(udc, AT91_UDP_IDR, 0xffffffff);
/* Clear all pending interrupts - UDP may be used by bootloader. */
at91_udp_write(udc, AT91_UDP_ICR, 0xffffffff);
- clk_disable(udc->iclk);
+ clk_disable_unprepare(udc->iclk);
/* request UDC and maybe VBUS irqs */
udc->udp_irq = platform_get_irq(pdev, 0);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/8] ehci-atmel.c: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (5 preceding siblings ...)
2013-06-19 11:18 ` [PATCH 5/8] usb: gadget: at91_udc: " Boris BREZILLON
@ 2013-06-19 11:20 ` Boris BREZILLON
2013-06-19 11:21 ` [PATCH 7/8] USB: ohci-at91: " Boris BREZILLON
2013-06-19 11:22 ` [PATCH 8/8] at91/avr32/atmel_lcdfb: " Boris BREZILLON
8 siblings, 0 replies; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:20 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/usb/host/ehci-atmel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 6642009..015ce6e 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -37,15 +37,15 @@ static int clocked;
static void atmel_start_clock(void)
{
- clk_enable(iclk);
- clk_enable(fclk);
+ clk_prepare_enable(iclk);
+ clk_prepare_enable(fclk);
clocked = 1;
}
static void atmel_stop_clock(void)
{
- clk_disable(fclk);
- clk_disable(iclk);
+ clk_disable_unprepare(fclk);
+ clk_disable_unprepare(iclk);
clocked = 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/8] USB: ohci-at91: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (6 preceding siblings ...)
2013-06-19 11:20 ` [PATCH 6/8] ehci-atmel.c: " Boris BREZILLON
@ 2013-06-19 11:21 ` Boris BREZILLON
2013-06-19 11:22 ` [PATCH 8/8] at91/avr32/atmel_lcdfb: " Boris BREZILLON
8 siblings, 0 replies; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:21 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/usb/host/ohci-at91.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a0cb44f..329d277 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -41,17 +41,17 @@ extern int usb_disabled(void);
static void at91_start_clock(void)
{
- clk_enable(hclk);
- clk_enable(iclk);
- clk_enable(fclk);
+ clk_prepare_enable(hclk);
+ clk_prepare_enable(iclk);
+ clk_prepare_enable(fclk);
clocked = 1;
}
static void at91_stop_clock(void)
{
- clk_disable(fclk);
- clk_disable(iclk);
- clk_disable(hclk);
+ clk_disable_unprepare(fclk);
+ clk_disable_unprepare(iclk);
+ clk_disable_unprepare(hclk);
clocked = 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/8] at91/avr32/atmel_lcdfb: prepare clk before calling enable
2013-06-19 11:11 [PATCH 0/8] ARM: at91: prepare the move to common clk framework Boris BREZILLON
` (7 preceding siblings ...)
2013-06-19 11:21 ` [PATCH 7/8] USB: ohci-at91: " Boris BREZILLON
@ 2013-06-19 11:22 ` Boris BREZILLON
2013-06-20 7:49 ` Nicolas Ferre
8 siblings, 1 reply; 18+ messages in thread
From: Boris BREZILLON @ 2013-06-19 11:22 UTC (permalink / raw)
To: Nicolas Ferre, Ludovic Desroches,
Jean-Christophe Plagniol-Villard, Florian Tobias Schandinat
Cc: linux-arm-kernel, linux-kernel, linux-fbdev, Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/video/atmel_lcdfb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 540909d..8525457 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -893,14 +893,14 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
{
- clk_enable(sinfo->bus_clk);
- clk_enable(sinfo->lcdc_clk);
+ clk_prepare_enable(sinfo->bus_clk);
+ clk_prepare_enable(sinfo->lcdc_clk);
}
static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
{
- clk_disable(sinfo->bus_clk);
- clk_disable(sinfo->lcdc_clk);
+ clk_disable_unprepare(sinfo->bus_clk);
+ clk_disable_unprepare(sinfo->lcdc_clk);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 8/8] at91/avr32/atmel_lcdfb: prepare clk before calling enable
2013-06-19 11:22 ` [PATCH 8/8] at91/avr32/atmel_lcdfb: " Boris BREZILLON
@ 2013-06-20 7:49 ` Nicolas Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Ferre @ 2013-06-20 7:49 UTC (permalink / raw)
To: Boris BREZILLON, Jean-Christophe Plagniol-Villard
Cc: Ludovic Desroches, Florian Tobias Schandinat, linux-arm-kernel,
linux-kernel, linux-fbdev
On 19/06/2013 13:22, Boris BREZILLON :
> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> avoid common clk framework warnings.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/video/atmel_lcdfb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index 540909d..8525457 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -893,14 +893,14 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
>
> static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
> {
> - clk_enable(sinfo->bus_clk);
> - clk_enable(sinfo->lcdc_clk);
> + clk_prepare_enable(sinfo->bus_clk);
> + clk_prepare_enable(sinfo->lcdc_clk);
> }
>
> static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
> {
> - clk_disable(sinfo->bus_clk);
> - clk_disable(sinfo->lcdc_clk);
> + clk_disable_unprepare(sinfo->bus_clk);
> + clk_disable_unprepare(sinfo->lcdc_clk);
> }
>
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread