ARM: at91: prepare the move to common clk framework
Subsystems (12)
cover ARM: at91: prepare the move to common clk framework
Hello,
This patch series was formerly part of the at91 common clk patch series. It prepares the move to common clk framework by replacing all the clk_enable and clk_disable calls by clk_prepare_unable and clk_disable_unprepare to avoid common clock framework warnings.
This patch series was taken out of the at91 common clk patch series beacuse it does not rely on any other patches and have a low impact on the drivers (can be merge faster).
Please tell me if I missed drivers using at91 PMC clks.
Best Regards,
Boris
Changes since v1:
- add clk_prepare_enable return check
- fix a deadlock in atmel-mci (missing spin_unlock)
- remove already applied patches (atmel-ssc and pwm-atmel-tcb)
Boris BREZILLON (8):
ARM: at91/tc/clocksource: replace clk_enable/disable with
clk_prepare_enable/disable_unprepare.
at_hdmac: prepare clk before calling enable
mmc: atmel-mci: prepare clk before calling enable
tty: atmel_serial: prepare clk before calling enable
usb: gadget: at91_udc: prepare clk before calling enable ehci-atmel.c: prepare clk before calling enable
USB: ohci-at91: prepare clk before calling enable at91/avr32/atmel_lcdfb: prepare clk before calling enable
drivers/clocksource/tcb_clksrc.c | 10 ++++----- drivers/dma/at_hdmac.c | 17 +++++++++------ drivers/mmc/host/atmel-mci.c | 29 ++++++++++++++++++-------- drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++--------- drivers/usb/gadget/at91_udc.c | 14 +++++++------ drivers/usb/host/ehci-atmel.c | 8 ++++---- drivers/usb/host/ohci-at91.c | 12 +++++------ drivers/video/atmel_lcdfb.c | 8 ++++---- 8 files changed, 89 insertions(+), 50 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/8 ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare.
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/clocksource/tcb_clksrc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/tcb_clksrc.c +5 -5
@@ -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); }
Signature · 1 line
1.7.9.5
Re: [PATCH 1/8] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare.
On 19/06/2013 13:13, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
Quoted 54 lines
--- drivers/clocksource/tcb_clksrc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/clocksource/tcb_clksrc.c +5
-5@@ -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); }
Signature · 1 line
Nicolas Ferre
PATCH 2/8 at_hdmac: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/dma/at_hdmac.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/dma/at_hdmac.c +11 -6
@@ -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 */
Signature · 1 line
1.7.9.5
Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
On 19/06/2013 13:14, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
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,
Quoted 68 lines
--- drivers/dma/at_hdmac.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/dma/at_hdmac.c +11
-6@@ -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 */
Signature · 1 line
Nicolas Ferre
Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
Quoted 10 lines · Nicolas Ferre
On 19/06/2013 13:14, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>Acked-by Nicolas Ferre <[email protected]>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
Re: [PATCH 2/8] at_hdmac: prepare clk before calling enable
On 21/06/2013 04:40, Vinod Koul :
Quoted 5 lines · Nicolas Ferre
Quoted 4 lines
On 19/06/2013 13:14, Boris BREZILLON :
Quoted 3 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Boris BREZILLON <[email protected]>Acked-by Nicolas Ferre <[email protected]>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,
Signature · 1 line
Nicolas Ferre
PATCH 2/8 at_hdmac: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/dma/at_hdmac.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/dma/at_hdmac.c +11 -6
@@ -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 */
Signature · 1 line
1.7.9.5
PATCH 3/8 mmc: atmel-mci: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/mmc/host/atmel-mci.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
drivers/mmc/host/atmel-mci.c +20 -9
@@ -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);
Signature · 1 line
1.7.9.5
PATCH 3/8 mmc: atmel-mci: prepare clk before calling enable
Hi Boris,
Thanks for your patch.
Quoted 4 lines · Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
One comment below
Quoted 79 lines
--- drivers/mmc/host/atmel-mci.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)drivers/mmc/host/atmel-mci.c +16
-7@@ -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;
drivers/mmc/host/atmel-mci.c err_init_slot: · line 2475
Quoted 4 lines
drivers/mmc/host/atmel-mci.c +1
-0@@ -2463,6 +2472,8 @@ err_init_slot:dma_release_channel (host->dma.chan);free_irq (irq, host); err_request_irq: +clk_unprepare (host->mck);
As discussed with you this part can be removed since a clk_disable_unprepare is done earlier.
Quoted 21 lines
drivers/mmc/host/atmel-mci.c +3
-2+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);Signature · 1 line
1.7.9.5
Re: [PATCH 3/8] mmc: atmel-mci: prepare clk before calling enable
In reply to Boris BREZILLONHi Boris,
Thanks for your patch.
Quoted 4 lines · Boris BREZILLON
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
One comment below
Quoted 79 lines
--- drivers/mmc/host/atmel-mci.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)drivers/mmc/host/atmel-mci.c +16
-7@@ -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;
drivers/mmc/host/atmel-mci.c err_init_slot: · line 2475
Quoted 4 lines
drivers/mmc/host/atmel-mci.c +1
-0@@ -2463,6 +2472,8 @@ err_init_slot:dma_release_channel (host->dma.chan);free_irq (irq, host); err_request_irq: +clk_unprepare (host->mck);
As discussed with you this part can be removed since a clk_disable_unprepare is done earlier.
Quoted 21 lines
drivers/mmc/host/atmel-mci.c +3
-2+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);Signature · 1 line
1.7.9.5
PATCH 4/8 tty: atmel_serial: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-)
drivers/tty/serial/atmel_serial.c +31 -10
@@ -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
Signature · 1 line
1.7.9.5
Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
On 19/06/2013 13:17, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
(one comment though)
Quoted 9 lines
--- drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-)drivers/tty/serial/atmel_serial.c +0
-0
drivers/tty/serial/atmel_serial.c static void atmel_serial_pm(struct uart_port *port, unsigned int state, · line 1103
Quoted 5 lines
drivers/tty/serial/atmel_serial.c +1
-1@@ -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?
Quoted 117 lines
drivers/tty/serial/atmel_serial.c +30
-9/* 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
Signature · 1 line
Nicolas Ferre
Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
Quoted 15 lines · Nicolas Ferre
On 19/06/2013 13:17, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>Acked-by Nicolas Ferre <[email protected]>(one comment though)
Quoted 5 lines
--- drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-)
Quoted 14 lines
drivers/tty/serial/atmel_serial.c static void atmel_serial_pm(struct uart_port · line 1104
Quoted 12 lines
drivers/tty/serial/atmel_serial.c +1
-1@@ -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.
Quoted 130 lines
Quoted 128 lines
drivers/tty/serial/atmel_serial.c +1
-1/* 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);drivers/tty/serial/atmel_serial.c +16
-3@@ -1458,9 +1458,10 @@ static void atmel_of_init_port(structatmel_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 */drivers/tty/serial/atmel_serial.c +1
-0@@ -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;drivers/tty/serial/atmel_serial.c +3
-1@@ -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);drivers/tty/serial/atmel_serial.c +7
-2@@ -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)) {drivers/tty/serial/atmel_serial.c +2
-2@@ -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
Re: [PATCH 4/8] tty: atmel_serial: prepare clk before calling enable
On 20/06/2013 10:06, boris brezillon :
Quoted 30 lines · Nicolas Ferre
Quoted 15 lines
On 19/06/2013 13:17, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>Acked-by Nicolas Ferre <[email protected]>(one comment though)
Quoted 5 lines
--- drivers/tty/serial/atmel_serial.c | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-)Quoted 14 lines
drivers/tty/serial/atmel_serial.c static void atmel_serial_pm(struct uart_port · line 1104
Quoted 12 lines
drivers/tty/serial/atmel_serial.c +1
-1@@ -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?
Quoted 8 lines
We could, but the pm function will not reflect the failure (void return). In addition, the
clk_prepare_enableshould 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,
Quoted 134 lines
Quoted 131 lines
Quoted 129 lines
drivers/tty/serial/atmel_serial.c +1
-1/* 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);drivers/tty/serial/atmel_serial.c +16
-3@@ -1458,9 +1458,10 @@ static void atmel_of_init_port(structatmel_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 */drivers/tty/serial/atmel_serial.c +1
-0@@ -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;drivers/tty/serial/atmel_serial.c +3
-1@@ -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);drivers/tty/serial/atmel_serial.c +7
-2@@ -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)) {drivers/tty/serial/atmel_serial.c +2
-2@@ -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
Signature · 1 line
Nicolas Ferre
PATCH 5/8 usb: gadget: at91_udc: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/usb/gadget/at91_udc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/usb/gadget/at91_udc.c +8 -6
@@ -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 );
Signature · 1 line
1.7.9.5
PATCH 6/8 ehci-atmel.c: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/usb/host/ehci-atmel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-atmel.c +4 -4
@@ -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 ; }
Signature · 1 line
1.7.9.5
PATCH 7/8 USB: ohci-at91: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/usb/host/ohci-at91.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/host/ohci-at91.c +6 -6
@@ -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 ; }
Signature · 1 line
1.7.9.5
PATCH 8/8 at91/avr32/atmel_lcdfb: prepare clk before calling enable
In reply to Boris BREZILLONReplace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
--- drivers/video/atmel_lcdfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/atmel_lcdfb.c +4 -4
@@ -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); }
Signature · 1 line
1.7.9.5
Re: [PATCH 8/8] at91/avr32/atmel_lcdfb: prepare clk before calling enable
On 19/06/2013 13:22, Boris BREZILLON :
Quoted 4 lines
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings.
Signed-off-by Boris BREZILLON <[email protected]>
Quoted 28 lines
--- drivers/video/atmel_lcdfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/video/atmel_lcdfb.c +4
-4@@ -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); }
Signature · 1 line
Nicolas Ferre