Add clk_prepare/clk_unprepare for mxs clock api
Subsystems (15)
cover Add clk_prepare/clk_unprepare for mxs clock api
The mutex locking problem on mxs platform has been reported on mailing list for a few time. The cause is that a mutex is being held in mxs clock api clk_enable/clk_disable which are being called by some mxs clock client drivers like amba-pl011 and mxs-saif in atomic context.
This series takes Russell's suggestion to:
* Convert all mxs clock client drivers to clk_prepare/clk_unprepare. (I hope the series has covered all the drivers, but appreciate any reminding on any missing ones.)
* Add clk_prepare/clk_unprepare for mxs clock api to contain the non-atomic portion of existing clk_enable/clk_disable implemention. (As the whole existing clk_enable/clk_disable are non-atomic, clk_prepare/clk_unprepare become a renaming of the existing clk_enable/clk_disable, and the new clk_enable/clk_disable become a pair of dummy functions.)
Thus, we can ensure that no mutex will be held for atomic context, and the problem people keep reporting gets fixed with one step move toward common clk framework while not ncessarily waiting for it.
If driver maintainers have no objection, after the review process, I would like to send the series through arm-soc tree to ease the merge process.
Those two patches from Richard Zhao are included here for completeness, and they have been picked up by Sascha on imx tree. But since imx and mxs will both go through arm-soc, it should easy to sort out how we should merge them.
Regards,
Shawn
Richard Zhao (2):
clk: add helper functions clk_prepare_enable and clk_disable_unprepare
net: fec: add clk_prepare/clk_unprepare
Shawn Guo (10):
arm/mxs: convert platform code to clk_prepare/clk_unprepare
dma: mxs-dma: convert to clk_prepare/clk_unprepare
mmc: mxs-mmc: convert to clk_prepare/clk_unprepare
mtd: gpmi-lib: convert to clk_prepare/clk_unprepare
net: flexcan: convert to clk_prepare/clk_unprepare
serial: mxs-auart: convert to clk_prepare/clk_unprepare
video: mxsfb: convert to clk_prepare/clk_unprepare
ASoC: mxs-saif: convert to clk_prepare/clk_unprepare
clk: add config option HAVE_CLK_PREPARE into Kconfig arm/mxs: select HAVE_CLK_PREPARE for clock
arch/arm/Kconfig | 1 + arch/arm/mach-mxs/clock-mx23.c | 10 +++++----- arch/arm/mach-mxs/clock-mx28.c | 10 +++++----- arch/arm/mach-mxs/clock.c | 33 +++++++++++++++++++++++---------- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- arch/arm/mach-mxs/system.c | 2 +- arch/arm/mach-mxs/timer.c | 2 +- drivers/clk/Kconfig | 3 +++ drivers/dma/mxs-dma.c | 8 ++++---- drivers/mmc/host/mxs-mmc.c | 10 +++++----- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 12 ++++++------ drivers/net/can/flexcan.c | 10 +++++----- drivers/net/ethernet/freescale/fec.c | 10 +++++----- drivers/tty/serial/mxs-auart.c | 8 ++++---- drivers/video/mxsfb.c | 8 ++++---- include/linux/clk.h | 22 ++++++++++++++++++++++ sound/soc/mxs/mxs-saif.c | 4 ++-- 17 files changed, 97 insertions(+), 58 deletions(-)
PATCH 1/12 clk: add helper functions clk_prepare_enable and clk_disable_unprepare
From: Richard Zhao <[email protected]>
It's for migrating to generic clk framework API.
The helper functions help cases clk_enable/clk_disable is used in non-atomic context.
For example, Call clk_enable in probe and clk_disable in remove.
--- include/linux/clk.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
include/linux/clk.h +22 -0
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk) }#endif +/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ +static inline int clk_prepare_enable (struct clk *clk) +{ +int ret; + + ret =clk_prepare (clk); +if (ret) +return ret; + ret =clk_enable (clk); +if (ret) +clk_unprepare (clk); + +return ret; +} + +/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */ +static inline void clk_disable_unprepare (struct clk *clk) +{ +clk_disable (clk); +clk_unprepare (clk); +} +/** * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. * This is only valid once the clock source has been enabled.
Signature · 1 line
1.7.4.1
PATCH 1/12 clk: add helper functions clk_prepare_enable and clk_disable_unprepare
Quoted 48 lines
From: Richard Zhao <[email protected]>
It's for migrating to generic clk framework API.
The helper functions help cases clk_enable/clk_disable is used in non-atomic context.
For example, Callclk_enablein probe andclk_disablein remove.Signed-off-by Richard Zhao <[email protected]>Signed-off-by Sascha Hauer <[email protected]>Signed-off-by Shawn Guo <[email protected]>Cc Russell King <[email protected]>--- include/linux/clk.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)include/linux/clk.h +20
-0@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk) }#endif +/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ +static inline int clk_prepare_enable(struct clk *clk) +{ +int ret; + + ret =clk_prepare (clk); +if (ret) +return ret; + ret =clk_enable (clk); +if (ret) +clk_unprepare (clk); + +return ret; +} + +/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */ +static inline void clk_disable_unprepare(struct clk *clk) +{ +clk_disable (clk); +clk_unprepare (clk); +} +/** * clk_get_rate - obtain the current clock rate (in Hz) for a clock
Quoted 1 line
source. * This is only valid once the clock source has been
enabled.
Just be sure clk_prepare() is always available (which I suspect is checked in the implementation, so ok). Other than that,
PATCH 1/12 clk: add helper functions clk_prepare_enable and clk_disable_unprepare
Quoted 51 lines · Marek Vasut
Quoted 48 lines
From: Richard Zhao <[email protected]>
It's for migrating to generic clk framework API.
The helper functions help cases clk_enable/clk_disable is used in non-atomic context.
For example, Callclk_enablein probe andclk_disablein remove.Signed-off-by Richard Zhao <[email protected]>Signed-off-by Sascha Hauer <[email protected]>Signed-off-by Shawn Guo <[email protected]>Cc Russell King <[email protected]>--- include/linux/clk.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)include/linux/clk.h +20
-0@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk) }#endif +/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ +static inline int clk_prepare_enable(struct clk *clk) +{ +int ret; + + ret =clk_prepare (clk); +if (ret) +return ret; + ret =clk_enable (clk); +if (ret) +clk_unprepare (clk); + +return ret; +} + +/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */ +static inline void clk_disable_unprepare(struct clk *clk) +{ +clk_disable (clk); +clk_unprepare (clk); +} +/** * clk_get_rate - obtain the current clock rate (in Hz) for a clock Quoted 1 line
source. * This is only valid once the clock source has been
enabled.
Quoted 3 lines
Just be sure
clk_prepare()is always available (which I suspect is checked in the implementation, so ok). Other than that,
If HAVE_CLK_PREPARE is selected for given clock api implementation, that implementation needs to provide clk_prepare(). Otherwise, there is a dummy one provided by include/linux/clk.h.
Signature · 2 lines
Regards, Shawn
PATCH 2/12 arm/mxs: convert platform code to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxs platform code to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- arch/arm/mach-mxs/clock-mx23.c | 10 +++++----- arch/arm/mach-mxs/clock-mx28.c | 10 +++++----- arch/arm/mach-mxs/clock.c | 2 +- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- arch/arm/mach-mxs/system.c | 2 +- arch/arm/mach-mxs/timer.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-mxs/clock-mx23.c +5 -5
@@ -545,11 +545,11 @@ int __init mx23_clocks_init(void)*/ clk_set_parent (&ssp_clk, &ref_io_clk); -clk_enable (&cpu_clk); -clk_enable (&hbus_clk); -clk_enable (&xbus_clk); -clk_enable (&emi_clk); -clk_enable (&uart_clk); +clk_prepare_enable (&cpu_clk); +clk_prepare_enable (&hbus_clk); +clk_prepare_enable (&xbus_clk); +clk_prepare_enable (&emi_clk); +clk_prepare_enable (&uart_clk);clkdev_add_table (lookups,ARRAY_SIZE (lookups));
arch/arm/mach-mxs/clock-mx28.c +5 -5
@@ -775,11 +775,11 @@ int __init mx28_clocks_init(void)clk_set_parent (&ssp0_clk, &ref_io0_clk);clk_set_parent (&ssp1_clk, &ref_io0_clk); -clk_enable (&cpu_clk); -clk_enable (&hbus_clk); -clk_enable (&xbus_clk); -clk_enable (&emi_clk); -clk_enable (&uart_clk); +clk_prepare_enable (&cpu_clk); +clk_prepare_enable (&hbus_clk); +clk_prepare_enable (&xbus_clk); +clk_prepare_enable (&emi_clk); +clk_prepare_enable (&uart_clk);clk_set_parent (&lcdif_clk, &ref_pix_clk);clk_set_parent (&saif0_clk, &pll0_clk);
arch/arm/mach-mxs/clock.c +1 -1
@@ -166,7 +166,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)return ret;if (clk->usecount) -clk_enable (parent); +clk_prepare_enable (parent);mutex_lock (&clocks_mutex); ret = clk->set_parent (clk, parent);
arch/arm/mach-mxs/mach-mx28evk.c +1 -1
@@ -228,7 +228,7 @@ static void __init mx28evk_fec_reset(void)/* Enable fec phy clock */ clk =clk_get_sys ("pll2" ,NULL );if (!IS_ERR (clk)) -clk_enable (clk); +clk_prepare_enable (clk);/* Power up fec phy */ ret =gpio_request (MX28EVK_FEC_PHY_POWER ,"fec-phy-power" );
arch/arm/mach-mxs/system.c +1 -1
@@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void) clk =clk_get_sys ("rtc" ,NULL );if (!IS_ERR (clk)) -clk_enable (clk); +clk_prepare_enable (clk);return 0 ; }
arch/arm/mach-mxs/timer.c +1 -1
@@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)void __init mxs_timer_init (struct clk *timer_clk,int irq) { -clk_enable (timer_clk); +clk_prepare_enable (timer_clk);/* * Initialize timers to a known state
Signature · 1 line
1.7.4.1
PATCH 2/12 arm/mxs: convert platform code to clk_prepare/clk_unprepare
Quoted 87 lines
The patch converts mxs platform code to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Richard Zhao <[email protected]>Signed-off-by Shawn Guo <[email protected]>--- arch/arm/mach-mxs/clock-mx23.c | 10 +++++----- arch/arm/mach-mxs/clock-mx28.c | 10 +++++----- arch/arm/mach-mxs/clock.c | 2 +- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- arch/arm/mach-mxs/system.c | 2 +- arch/arm/mach-mxs/timer.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-mxs/clock-mx23.cindex 0163b6d..e12e112 100644arch/arm/mach-mxs/clock-mx23.c +5
-5@@ -545,11 +545,11 @@ int __init mx23_clocks_init(void)*/ clk_set_parent (&ssp_clk, &ref_io_clk); -clk_enable (&cpu_clk); -clk_enable (&hbus_clk); -clk_enable (&xbus_clk); -clk_enable (&emi_clk); -clk_enable (&uart_clk); +clk_prepare_enable (&cpu_clk); +clk_prepare_enable (&hbus_clk); +clk_prepare_enable (&xbus_clk); +clk_prepare_enable (&emi_clk); +clk_prepare_enable (&uart_clk);clkdev_add_table (lookups,ARRAY_SIZE (lookups));(quoted diff) +0
-0
b/arch/arm/mach-mxs/clock-mx28.cindex da6e4aa..f85f1f5 100644arch/arm/mach-mxs/clock-mx28.c +5
-5@@ -775,11 +775,11 @@ int __init mx28_clocks_init(void)clk_set_parent (&ssp0_clk, &ref_io0_clk);clk_set_parent (&ssp1_clk, &ref_io0_clk); -clk_enable (&cpu_clk); -clk_enable (&hbus_clk); -clk_enable (&xbus_clk); -clk_enable (&emi_clk); -clk_enable (&uart_clk); +clk_prepare_enable (&cpu_clk); +clk_prepare_enable (&hbus_clk); +clk_prepare_enable (&xbus_clk); +clk_prepare_enable (&emi_clk); +clk_prepare_enable (&uart_clk);clk_set_parent (&lcdif_clk, &ref_pix_clk);clk_set_parent (&saif0_clk, &pll0_clk);arch/arm/mach-mxs/clock.c +1
-1@@ -166,7 +166,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)return ret;if (clk->usecount) -clk_enable (parent); +clk_prepare_enable (parent);mutex_lock (&clocks_mutex); ret = clk->set_parent (clk, parent);(quoted diff) +0
-0
b/arch/arm/mach-mxs/mach-mx28evk.cindex 064ec5a..6b9e83e 100644arch/arm/mach-mxs/mach-mx28evk.c +1
-1@@ -228,7 +228,7 @@ static void __init mx28evk_fec_reset(void)/* Enable fec phy clock */ clk =clk_get_sys ("pll2" ,NULL );if (!IS_ERR (clk)) -clk_enable (clk); +clk_prepare_enable (clk);/* Power up fec phy */ ret =gpio_request (MX28EVK_FEC_PHY_POWER ,"fec-phy-power" );arch/arm/mach-mxs/system.c +0
-0
arch/arm/mach-mxs/system.c static int __init mxs_arch_reset_init(void) · line 70
Quoted 6 lines
arch/arm/mach-mxs/system.c +1
-1@@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void) clk =clk_get_sys ("rtc" ,NULL );if (!IS_ERR (clk)) -clk_enable (clk); +clk_prepare_enable (clk);
I still wonder how to handle the DUART -- amba-pl011 -- maybe we should toggle the clock here too ?
M
Quoted 16 lines
arch/arm/mach-mxs/system.c +0
-0return 0 ; }arch/arm/mach-mxs/timer.c +1
-1@@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)void __init mxs_timer_init (struct clk *timer_clk,int irq) { -clk_enable (timer_clk); +clk_prepare_enable (timer_clk);/* * Initialize timers to a known state
PATCH 2/12 arm/mxs: convert platform code to clk_prepare/clk_unprepare
Quoted 2 lines · Marek Vasut
I still wonder how to handle the DUART -- amba-pl011 -- maybe we should toggle the clock here too ?
amba-pl011, along with all the other Primecells and a few other devices, have already been converted to use clk_prepare() in the appropriate places. See the bunch of commits from 7ff6bcf048e6a9849ea0b44269fa4c1c72869db2 to (and including) 40d3e0f4942ec12c4521fe1b2a2b774164cd2c80.
PATCH 2/12 arm/mxs: convert platform code to clk_prepare/clk_unprepare
Quoted 9 lines · Marek Vasut
Quoted 2 lines
I still wonder how to handle the DUART -- amba-pl011 -- maybe we should toggle the clock here too ?
amba-pl011, along with all the other Primecells and a few other devices, have already been converted to use
clk_prepare()in the appropriate places. See the bunch of commits from7ff6bcf048e6a9849ea0b44269fa4c1c72869db2to (and including)40d3e0f4942ec12c4521fe1b2a2b774164cd2c80.
Thanks!
M
PATCH 3/12 net: fec: add clk_prepare/clk_unprepare
In reply to Shawn GuoFrom: Richard Zhao <[email protected]>
It's for migrating to generic clk framework API.
--- drivers/net/ethernet/freescale/fec.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/fec.c +5 -5
@@ -1591,7 +1591,7 @@ fec_probe(struct platform_device *pdev) ret =PTR_ERR (fep->clk); goto failed_clk; } -clk_enable (fep->clk); +clk_prepare_enable (fep->clk); ret =fec_enet_init (ndev);if (ret)
@@ -1614,7 +1614,7 @@ failed_register:fec_enet_mii_remove (fep); failed_mii_init: failed_init: -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);clk_put (fep->clk); failed_clk:for (i =0 ; i <FEC_IRQ_NUM ; i++) {
@@ -1641,7 +1641,7 @@ fec_drv_remove(struct platform_device *pdev)fec_stop (ndev);fec_enet_mii_remove (fep); -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);clk_put (fep->clk);iounmap (fep->hwp);unregister_netdev (ndev);
@@ -1667,7 +1667,7 @@ fec_suspend(struct device *dev)fec_stop (ndev);netif_device_detach (ndev); } -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);return 0 ; }
@@ -1678,7 +1678,7 @@ fec_resume(struct device *dev)struct net_device *ndev =dev_get_drvdata (dev);struct fec_enet_private *fep =netdev_priv (ndev); -clk_enable (fep->clk); +clk_prepare_enable (fep->clk);if (netif_running (ndev)) {fec_restart (ndev, fep->full_duplex);netif_device_attach (ndev);
Signature · 1 line
1.7.4.1
PATCH 3/12 net: fec: add clk_prepare/clk_unprepare
Quoted 53 lines
From: Richard Zhao <[email protected]>
It's for migrating to generic clk framework API.
Signed-off-by Richard Zhao <[email protected]>Signed-off-by Sascha Hauer <[email protected]>Signed-off-by Shawn Guo <[email protected]>Cc David S. Miller <[email protected]>--- drivers/net/ethernet/freescale/fec.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/net/ethernet/freescale/fec.cindex c136230..112af9b 100644drivers/net/ethernet/freescale/fec.c +4
-4@@ -1591,7 +1591,7 @@ fec_probe(struct platform_device *pdev) ret =PTR_ERR (fep->clk); goto failed_clk; } -clk_enable (fep->clk); +clk_prepare_enable (fep->clk); ret =fec_enet_init (ndev);if (ret)@@ -1614,7 +1614,7 @@ failed_register:fec_enet_mii_remove (fep); failed_mii_init: failed_init: -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);clk_put (fep->clk); failed_clk:for (i =0 ; i <FEC_IRQ_NUM ; i++) {@@ -1641,7 +1641,7 @@ fec_drv_remove(struct platform_device *pdev)fec_stop (ndev);fec_enet_mii_remove (fep); -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);clk_put (fep->clk);iounmap (fep->hwp);unregister_netdev (ndev);@@ -1667,7 +1667,7 @@ fec_suspend(struct device *dev)fec_stop (ndev);netif_device_detach (ndev); } -clk_disable (fep->clk); +clk_disable_unprepare (fep->clk);return 0 ; }
drivers/net/ethernet/freescale/fec.c fec_resume(struct device *dev) · line 1684
Quoted 8 lines
drivers/net/ethernet/freescale/fec.c +1
-1@@ -1678,7 +1678,7 @@ fec_resume(struct device *dev)struct net_device *ndev =dev_get_drvdata (dev);struct fec_enet_private *fep =netdev_priv (ndev); -clk_enable (fep->clk); +clk_prepare_enable (fep->clk);if (netif_running (ndev)) {fec_restart (ndev, fep->full_duplex);netif_device_attach (ndev);
Looks ok
PATCH 4/12 dma: mxs-dma: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxs-dma driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/dma/mxs-dma.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/dma/mxs-dma.c +4 -4
@@ -334,7 +334,7 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) goto err_irq; } - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_clk;
@@ -372,7 +372,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan)dma_free_coherent (mxs_dma->dma_device.dev,PAGE_SIZE , mxs_chan->ccw, mxs_chan->ccw_phys); -clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk); } static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
@@ -578,7 +578,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) {int ret; - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_out;
@@ -604,7 +604,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)writel (MXS_DMA_CHANNELS_MASK <<MXS_DMA_CHANNELS , mxs_dma->base +HW_APBHX_CTRL1 +MXS_SET_ADDR ); -clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk);return 0 ;
Signature · 1 line
1.7.4.1
PATCH 4/12 dma: mxs-dma: convert to clk_prepare/clk_unprepare
Quoted 41 lines
The patch converts mxs-dma driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Vinod Koul <[email protected]>--- drivers/dma/mxs-dma.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/dma/mxs-dma.c +3
-3@@ -334,7 +334,7 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) goto err_irq; } - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_clk;@@ -372,7 +372,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan) dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE, mxs_chan->ccw, mxs_chan->ccw_phys); -clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk); } static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(@@ -578,7 +578,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) {int ret; - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_out;
drivers/dma/mxs-dma.c static int __init mxs_dma_init(struct mxs_dma_engine · line 609
Quoted 7 lines
drivers/dma/mxs-dma.c +1
-1@@ -604,7 +604,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS, mxs_dma->base +HW_APBHX_CTRL1 +MXS_SET_ADDR ); -clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk);return 0 ;
PATCH 4/12 dma: mxs-dma: convert to clk_prepare/clk_unprepare
Quoted 44 lines · Marek Vasut
Quoted 44 lines
The patch converts mxs-dma driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Vinod Koul <[email protected]>--- drivers/dma/mxs-dma.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/dma/mxs-dma.c +3
-3@@ -334,7 +334,7 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) goto err_irq; } - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_clk;@@ -372,7 +372,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan) dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE, mxs_chan->ccw, mxs_chan->ccw_phys); -clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk); } static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(@@ -578,7 +578,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) {int ret; - ret =clk_enable (mxs_dma->clk); + ret =clk_prepare_enable (mxs_dma->clk);if (ret) goto err_out;@@ -604,7 +604,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS, mxs_dma->base +HW_APBHX_CTRL1 +MXS_SET_ADDR );
Quoted 6 lines
drivers/dma/mxs-dma.c static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) · line 609
Quoted 4 lines
drivers/dma/mxs-dma.c +1
-1-clk_disable (mxs_dma->clk); +clk_disable_unprepare (mxs_dma->clk);return 0 ;Acked-by Marek Vasut <[email protected]>
Signature · 1 line
~Vinod
PATCH 5/12 mmc: mxs-mmc: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxs-mmc driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/mmc/host/mxs-mmc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/mmc/host/mxs-mmc.c +5 -5
@@ -713,7 +713,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) ret =PTR_ERR (host->clk); goto out_iounmap; } -clk_enable (host->clk); +clk_prepare_enable (host->clk);mxs_mmc_reset (host);
@@ -772,7 +772,7 @@ out_free_dma:if (host->dmach)dma_release_channel (host->dmach); out_clk_put: -clk_disable (host->clk); +clk_disable_unprepare (host->clk);clk_put (host->clk); out_iounmap:iounmap (host->base);
@@ -798,7 +798,7 @@ static int mxs_mmc_remove(struct platform_device *pdev)if (host->dmach)dma_release_channel (host->dmach); -clk_disable (host->clk); +clk_disable_unprepare (host->clk);clk_put (host->clk);iounmap (host->base);
@@ -819,7 +819,7 @@ static int mxs_mmc_suspend(struct device *dev) ret =mmc_suspend_host (mmc); -clk_disable (host->clk); +clk_disable_unprepare (host->clk);return ret; }
@@ -830,7 +830,7 @@ static int mxs_mmc_resume(struct device *dev)struct mxs_mmc_host *host =mmc_priv (mmc);int ret =0 ; -clk_enable (host->clk); +clk_prepare_enable (host->clk); ret =mmc_resume_host (mmc);
Signature · 1 line
1.7.4.1
PATCH 5/12 mmc: mxs-mmc: convert to clk_prepare/clk_unprepare
Quoted 50 lines
The patch converts mxs-mmc driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Chris Ball <[email protected]>--- drivers/mmc/host/mxs-mmc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/mmc/host/mxs-mmc.c +4
-4@@ -713,7 +713,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) ret =PTR_ERR (host->clk); goto out_iounmap; } -clk_enable (host->clk); +clk_prepare_enable (host->clk);mxs_mmc_reset (host);@@ -772,7 +772,7 @@ out_free_dma:if (host->dmach)dma_release_channel (host->dmach); out_clk_put: -clk_disable (host->clk); +clk_disable_unprepare (host->clk);clk_put (host->clk); out_iounmap:iounmap (host->base);@@ -798,7 +798,7 @@ static int mxs_mmc_remove(struct platform_device *pdev)if (host->dmach)dma_release_channel (host->dmach); -clk_disable (host->clk); +clk_disable_unprepare (host->clk);clk_put (host->clk);iounmap (host->base);@@ -819,7 +819,7 @@ static int mxs_mmc_suspend(struct device *dev) ret =mmc_suspend_host (mmc); -clk_disable (host->clk); +clk_disable_unprepare (host->clk);return ret; }
drivers/mmc/host/mxs-mmc.c static int mxs_mmc_resume(struct device *dev) · line 835
Quoted 7 lines
drivers/mmc/host/mxs-mmc.c +1
-1@@ -830,7 +830,7 @@ static int mxs_mmc_resume(struct device *dev)struct mxs_mmc_host *host =mmc_priv (mmc);int ret =0 ; -clk_enable (host->clk); +clk_prepare_enable (host->clk); ret =mmc_resume_host (mmc);
PATCH 6/12 mtd: gpmi-lib: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts gpmi nand driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +6 -6
@@ -126,7 +126,7 @@ int gpmi_init(struct gpmi_nand_data *this)struct resources *r = &this->resources;int ret; - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) goto err_out; ret =gpmi_reset_block (r->gpmi_regs, false);
@@ -146,7 +146,7 @@ int gpmi_init(struct gpmi_nand_data *this)/* Select BCH ECC. */ writel (BM_GPMI_CTRL1_BCH_MODE , r->gpmi_regs +HW_GPMI_CTRL1_SET ); -clk_disable (r->clock); +clk_disable_unprepare (r->clock);return 0 ; err_out:return ret;
@@ -202,7 +202,7 @@ int bch_set_geometry(struct gpmi_nand_data *this) ecc_strength = bch_geo->ecc_strength >>1 ; page_size = bch_geo->page_size; - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) goto err_out;
@@ -229,7 +229,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)writel (BM_BCH_CTRL_COMPLETE_IRQ_EN , r->bch_regs +HW_BCH_CTRL_SET ); -clk_disable (r->clock); +clk_disable_unprepare (r->clock);return 0 ; err_out:return ret;
@@ -704,7 +704,7 @@ void gpmi_begin(struct gpmi_nand_data *this)int ret;/* Enable the clock. */ - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) {pr_err ("We failed in enable the clk\n" ); goto err_out;
@@ -773,7 +773,7 @@ err_out:void gpmi_end (struct gpmi_nand_data *this) {struct resources *r = &this->resources; -clk_disable (r->clock); +clk_disable_unprepare (r->clock); }/* Clears a BCH interrupt. */
Signature · 1 line
1.7.4.1
PATCH 6/12 mtd: gpmi-lib: convert to clk_prepare/clk_unprepare
Quoted 60 lines
The patch converts gpmi nand driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Huang Shijie <[email protected]>Cc Artem Bityutskiy <[email protected]>--- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/mtd/nand/gpmi-nand/gpmi-lib.cindex de4db76..2a56fc6 100644drivers/mtd/nand/gpmi-nand/gpmi-lib.c +5
-5@@ -126,7 +126,7 @@ int gpmi_init(struct gpmi_nand_data *this)struct resources *r = &this->resources;int ret; - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) goto err_out; ret =gpmi_reset_block (r->gpmi_regs, false);@@ -146,7 +146,7 @@ int gpmi_init(struct gpmi_nand_data *this)/* Select BCH ECC. */ writel (BM_GPMI_CTRL1_BCH_MODE , r->gpmi_regs +HW_GPMI_CTRL1_SET ); -clk_disable (r->clock); +clk_disable_unprepare (r->clock);return 0 ; err_out:return ret;@@ -202,7 +202,7 @@ int bch_set_geometry(struct gpmi_nand_data *this) ecc_strength = bch_geo->ecc_strength >>1 ; page_size = bch_geo->page_size; - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) goto err_out;@@ -229,7 +229,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)writel (BM_BCH_CTRL_COMPLETE_IRQ_EN , r->bch_regs +HW_BCH_CTRL_SET ); -clk_disable (r->clock); +clk_disable_unprepare (r->clock);return 0 ; err_out:return ret;@@ -704,7 +704,7 @@ void gpmi_begin(struct gpmi_nand_data *this)int ret;/* Enable the clock. */ - ret =clk_enable (r->clock); + ret =clk_prepare_enable (r->clock);if (ret) {pr_err ("We failed in enable the clk\n" ); goto err_out;
drivers/mtd/nand/gpmi-nand/gpmi-lib.c err_out: · line 779
Quoted 8 lines
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +1
-1@@ -773,7 +773,7 @@ err_out:void gpmi_end (struct gpmi_nand_data *this) {struct resources *r = &this->resources; -clk_disable (r->clock); +clk_disable_unprepare (r->clock); }/* Clears a BCH interrupt. */
Yes, this is still all very easy conversion :)
PATCH 7/12 net: flexcan: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts flexcan driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/net/can/flexcan.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/can/flexcan.c +5 -5
@@ -802,7 +802,7 @@ static int flexcan_open(struct net_device *dev)struct flexcan_priv *priv =netdev_priv (dev);int err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk); err =open_candev (dev);if (err)
@@ -824,7 +824,7 @@ static int flexcan_open(struct net_device *dev) out_close:close_candev (dev); out: -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }
@@ -838,7 +838,7 @@ static int flexcan_close(struct net_device *dev)flexcan_chip_stop (dev);free_irq (dev->irq, dev); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);close_candev (dev);
@@ -877,7 +877,7 @@ static int __devinit register_flexcandev(struct net_device *dev)struct flexcan_regs __iomem *regs = priv->base;u32 reg, err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk);/* select "bus clock", chip must be disabled */ flexcan_chip_disable (priv);
@@ -911,7 +911,7 @@ static int __devinit register_flexcandev(struct net_device *dev) out:/* disable core and turn off clocks */ flexcan_chip_disable (priv); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }
Signature · 1 line
1.7.4.1
PATCH 7/12 net: flexcan: convert to clk_prepare/clk_unprepare
Quoted 52 lines
The patch converts flexcan driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Marc Kleine-Budde <[email protected]>Cc David S. Miller <[email protected]>--- drivers/net/can/flexcan.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/net/can/flexcan.c +4
-4@@ -802,7 +802,7 @@ static int flexcan_open(struct net_device *dev)struct flexcan_priv *priv =netdev_priv (dev);int err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk); err =open_candev (dev);if (err)@@ -824,7 +824,7 @@ static int flexcan_open(struct net_device *dev) out_close:close_candev (dev); out: -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }@@ -838,7 +838,7 @@ static int flexcan_close(struct net_device *dev)flexcan_chip_stop (dev);free_irq (dev->irq, dev); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);close_candev (dev);@@ -877,7 +877,7 @@ static int __devinit register_flexcandev(struct net_device *dev) struct flexcan_regs __iomem *regs = priv->base;u32 reg, err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk);/* select "bus clock", chip must be disabled */ flexcan_chip_disable (priv);@@ -911,7 +911,7 @@ static int __devinit register_flexcandev(struct
net_device*dev) out:
drivers/net/can/flexcan.c static int __devinit register_flexcandev(struct net_device *dev) · line 917
Quoted 7 lines
drivers/net/can/flexcan.c +1
-1/* disable core and turn off clocks */ flexcan_chip_disable (priv); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }
Are you sure close()/open() ops are not called from atomic?
M
PATCH 7/12 net: flexcan: convert to clk_prepare/clk_unprepare
Quoted 57 lines · Marek Vasut
Quoted 57 lines
The patch converts flexcan driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Marc Kleine-Budde <[email protected]>Cc David S. Miller <[email protected]>--- drivers/net/can/flexcan.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/net/can/flexcan.c +4
-4@@ -802,7 +802,7 @@ static int flexcan_open(struct net_device *dev)struct flexcan_priv *priv =netdev_priv (dev);int err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk); err =open_candev (dev);if (err)@@ -824,7 +824,7 @@ static int flexcan_open(struct net_device *dev) out_close:close_candev (dev); out: -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }@@ -838,7 +838,7 @@ static int flexcan_close(struct net_device *dev)flexcan_chip_stop (dev);free_irq (dev->irq, dev); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);close_candev (dev);@@ -877,7 +877,7 @@ static int __devinit register_flexcandev(struct net_device *dev) struct flexcan_regs __iomem *regs = priv->base;u32 reg, err; -clk_enable (priv->clk); +clk_prepare_enable (priv->clk);/* select "bus clock", chip must be disabled */ flexcan_chip_disable (priv);@@ -911,7 +911,7 @@ static int __devinit register_flexcandev(struct
net_device*dev) out:drivers/net/can/flexcan.c +1
-1/* disable core and turn off clocks */ flexcan_chip_disable (priv); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);
Quoted 5 lines
Quoted 2 lines
return err;
}Are you sure close()/open() ops are not called from atomic?
That's my understanding. But I Cc-ed Marc and David for help :)
Signature · 2 lines
Regards, Shawn
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/mxs-auart.c +4 -4
@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );
@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)
@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);
@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret; }
Signature · 1 line
1.7.4.1
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Quoted 42 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>--- drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +3
-3@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);
drivers/tty/serial/mxs-auart.c auart_console_setup(struct console *co, char *options) · line 649
Quoted 8 lines
drivers/tty/serial/mxs-auart.c +1
-1@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret; }
DTTO here, are you sure all of them are not called from atomic ctx?
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Hello,
Quoted 45 lines · Marek Vasut
Quoted 45 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>--- drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +3
-3@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow);
Quoted 7 lines
drivers/tty/serial/mxs-auart.c auart_console_setup(struct console *co, char *options) · line 649
Quoted 5 lines
drivers/tty/serial/mxs-auart.c +1
-1-clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret; }DTTO here, are you sure all of them are not called from atomic ctx?
the startup callback is called with irqs off. AFAIK clk_prepare should be called in request_port and console_setup.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Quoted 48 lines · Uwe Kleine-K?nig
Hello,
Quoted 45 lines · Marek Vasut
Quoted 45 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>--- drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +3
-3@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow);
Quoted 8 lines
Quoted 7 lines
drivers/tty/serial/mxs-auart.c auart_console_setup(struct console *co, char *options) · line 649
Quoted 5 lines
drivers/tty/serial/mxs-auart.c +1
-1-clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret; }DTTO here, are you sure all of them are not called from atomic ctx?
the startup callback is called with irqs off.
It shouldn't be, as it has to do things like request_irq() which can sleep. The documentation in Documentation/serial/driver is now out of date, and can't be relied upon.
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Quoted 49 lines · Uwe Kleine-K?nig
Quoted 48 lines
Hello,
Quoted 45 lines · Marek Vasut
Quoted 45 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>---
drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +1
-1@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +1
-1writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);}
static unsigned int
mxs_auart_tx_empty(struct uart_port *u)drivers/tty/serial/mxs-auart.c +0
-0@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/tty/serial/mxs-auart.c
Quoted 8 lines
drivers/tty/serial/mxs-auart.c +1
-1return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +0
-0if (options) uart_parse_options(options, &baud, &parity, &bits,
&flow);
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
drivers/tty/serial/mxs-auart.c +1
-1@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret;Quoted 1 line
}
DTTO here, are you sure all of them are not called from atomic ctx?
Quoted 5 lines
Quoted 1 line
the startup callback is called with irqs off.
It shouldn't be, as it has to do things like
request_irq()which can sleep. The documentation inDocumentation/serial/driveris now out of date, and can't be relied upon.
auart_rx/tx_empty() shouldn't be called from atomic context? It doesn't really look that way. The name is probably misleading though.
M
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Quoted 73 lines · Marek Vasut
Quoted 49 lines · Uwe Kleine-K?nig
Quoted 48 lines
Hello,
Quoted 45 lines · Marek Vasut
Quoted 45 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>---
drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +1
-1@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +1
-1writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);}
static unsigned int
mxs_auart_tx_empty(struct uart_port *u)drivers/tty/serial/mxs-auart.c +0
-0@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/tty/serial/mxs-auart.c
Quoted 8 lines
drivers/tty/serial/mxs-auart.c +1
-1return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +0
-0if (options) uart_parse_options(options, &baud, &parity, &bits,&flow);
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
drivers/tty/serial/mxs-auart.c +1
-1@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret;Quoted 1 line
}
DTTO here, are you sure all of them are not called from atomic ctx?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
the startup callback is called with irqs off.
It shouldn't be, as it has to do things like
request_irq()which can sleep. The documentation inDocumentation/serial/driveris now out of date, and can't be relied upon.auart_rx/tx_empty() shouldn't be called from atomic context? It doesn't really look that way. The name is probably misleading though.
I can't find an auart_rx nor auart_rx_empty() function.
The tx_empty function should only be called while the port is started-up, and in any case is only called from process context. (Functions calling this also call put_user(), msleep() or other functions which can cause schedule events.)
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
Quoted 87 lines · Marek Vasut
Quoted 77 lines
Quoted 52 lines · Uwe Kleine-K?nig
Quoted 51 lines
Hello,
Quoted 48 lines · Marek Vasut
Quoted 48 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>---
drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +1
-1@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +1
-1writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u) writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase + AUART_INTR_CLR); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/tty/serial/mxs-auart.c
Quoted 8 lines
drivers/tty/serial/mxs-auart.c +1
-1return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);drivers/tty/serial/mxs-auart.c +0
-0if (options) uart_parse_options(options, &baud, &parity, &bits,&flow);
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 11 lines
drivers/tty/serial/mxs-auart.c +1
-1@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow); -clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret;}
DTTO here, are you sure all of them are not called from atomic ctx?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
the startup callback is called with irqs off.
It shouldn't be, as it has to do things like
request_irq()which can sleep. The documentation inDocumentation/serial/driveris now out of date, and can't be relied upon.auart_rx/tx_empty() shouldn't be called from atomic context? It doesn't really look that way. The name is probably misleading though.
Quoted 6 lines
I can't find an
auart_rxnorauart_rx_empty()function.The
tx_emptyfunction should only be called while the port is started-up, and in any case is only called from process context. (Functions calling this also callput_user(),msleep()or other functions which can cause schedule events.)
Well then this is cleared up :)
M
PATCH 8/12 serial: mxs-auart: convert to clk_prepare/clk_unprepare
In reply to Marek VasutQuoted 45 lines · Marek Vasut
Quoted 45 lines
The patch converts mxs-auart driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>--- drivers/tty/serial/mxs-auart.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/mxs-auart.cindex 7e02c9c..c33500a 100644drivers/tty/serial/mxs-auart.c +3
-3@@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u) {struct mxs_auart_port *s =to_auart_port (u); -clk_enable (s->clk); +clk_prepare_enable (s->clk);writel (AUART_CTRL0_CLKGATE , u->membase +AUART_CTRL0_CLR );@@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)writel (AUART_INTR_RXIEN |AUART_INTR_RTIEN |AUART_INTR_CTSMIEN , u->membase +AUART_INTR_CLR ); -clk_disable (s->clk); +clk_disable_unprepare (s->clk); }static unsigned int mxs_auart_tx_empty (struct uart_port *u)@@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)if (!s)return -ENODEV ; -clk_enable (s->clk); +clk_prepare_enable (s->clk);if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);@@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options) ret =uart_set_options (&s->port, co, baud, parity, bits, flow);
Quoted 8 lines
drivers/tty/serial/mxs-auart.c auart_console_setup(struct console *co, char *options) · line 649
Quoted 5 lines
drivers/tty/serial/mxs-auart.c +1
-1-clk_disable (s->clk); +clk_disable_unprepare (s->clk);return ret; }DTTO here, are you sure all of them are not called from atomic ctx?
Yes. My understanding is that only the clk_enable/clk_disable in auart_console_write() will be called in atomic context.
Signature · 2 lines
Regards, Shawn
PATCH 9/12 video: mxsfb: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxsfb driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- drivers/video/mxsfb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/mxsfb.c +4 -4
@@ -328,7 +328,7 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)dev_dbg (&host->pdev->dev,"%s\n" , __func__); -clk_enable (host->clk); +clk_prepare_enable (host->clk);clk_set_rate (host->clk,PICOS2KHZ (fb_info->var.pixclock) *1000U );/* if it was disabled, re-enable the mode again */
@@ -368,7 +368,7 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)writel (VDCTRL4_SYNC_SIGNALS_ON , host->base +LCDC_VDCTRL4 +REG_CLR ); -clk_disable (host->clk); +clk_disable_unprepare (host->clk); host->enabled =0 ; }
@@ -668,7 +668,7 @@ static int __devinit mxsfb_restore_mode(struct mxsfb_info *host) line_count = fb_info->fix.smem_len / fb_info->fix.line_length; fb_info->fix.ypanstep =1 ; -clk_enable (host->clk); +clk_prepare_enable (host->clk); host->enabled =1 ;return 0 ;
@@ -841,7 +841,7 @@ static int __devinit mxsfb_probe(struct platform_device *pdev) error_register:if (host->enabled) -clk_disable (host->clk); +clk_disable_unprepare (host->clk);fb_destroy_modelist (&fb_info->modelist); error_init_fb:kfree (fb_info->pseudo_palette);
Signature · 1 line
1.7.4.1
PATCH 9/12 video: mxsfb: convert to clk_prepare/clk_unprepare
Quoted 53 lines
The patch converts mxsfb driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Florian Tobias Schandinat <[email protected]>--- drivers/video/mxsfb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/video/mxsfb.c +1
-1@@ -328,7 +328,7 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)dev_dbg (&host->pdev->dev,"%s\n" , __func__); -clk_enable (host->clk); +clk_prepare_enable (host->clk);clk_set_rate (host->clk,PICOS2KHZ (fb_info->var.pixclock) *1000U );drivers/video/mxsfb.c +1
-1/* if it was disabled, re-enable the mode again */ @@ -368,7 +368,7 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)writel (VDCTRL4_SYNC_SIGNALS_ON , host->base +LCDC_VDCTRL4 +REG_CLR ); -clk_disable (host->clk); +clk_disable_unprepare (host->clk); host->enabled =0 ;}
drivers/video/mxsfb.c +0
-0@@ -668,7 +668,7 @@ static int __devinit mxsfb_restore_mode(struct
mxsfb_info*host)line_count=fb_info->fix.smem_len/fb_info->fix.line_length;drivers/video/mxsfb.c +2
-2fb_info->fix.ypanstep =1 ; -clk_enable (host->clk); +clk_prepare_enable (host->clk); host->enabled =1 ;return 0 ;@@ -841,7 +841,7 @@ static int __devinit mxsfb_probe(struct platform_device *pdev) error_register:if (host->enabled) -clk_disable (host->clk); +clk_disable_unprepare (host->clk);fb_destroy_modelist (&fb_info->modelist); error_init_fb:
Quoted 1 line
kfree(fb_info->pseudo_palette);
PATCH 9/12 video: mxsfb: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoQuoted 6 lines · Shawn Guo
The patch converts mxsfb driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Florian Tobias Schandinat <[email protected]>
Quoted 44 lines
--- drivers/video/mxsfb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/video/mxsfb.c +4
-4@@ -328,7 +328,7 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)dev_dbg (&host->pdev->dev,"%s\n" , __func__); -clk_enable (host->clk); +clk_prepare_enable (host->clk);clk_set_rate (host->clk,PICOS2KHZ (fb_info->var.pixclock) *1000U );/* if it was disabled, re-enable the mode again */ @@ -368,7 +368,7 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)writel (VDCTRL4_SYNC_SIGNALS_ON , host->base +LCDC_VDCTRL4 +REG_CLR ); -clk_disable (host->clk); +clk_disable_unprepare (host->clk); host->enabled =0 ; }@@ -668,7 +668,7 @@ static int __devinit mxsfb_restore_mode(struct mxsfb_info *host) line_count = fb_info->fix.smem_len / fb_info->fix.line_length; fb_info->fix.ypanstep =1 ; -clk_enable (host->clk); +clk_prepare_enable (host->clk); host->enabled =1 ;return 0 ;@@ -841,7 +841,7 @@ static int __devinit mxsfb_probe(struct platform_device *pdev) error_register:if (host->enabled) -clk_disable (host->clk); +clk_disable_unprepare (host->clk);fb_destroy_modelist (&fb_info->modelist); error_init_fb:kfree (fb_info->pseudo_palette);
PATCH 10/12 ASoC: mxs-saif: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoThe patch converts mxs-saif driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
--- sound/soc/mxs/mxs-saif.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/mxs/mxs-saif.c +2 -2
@@ -210,7 +210,7 @@ int mxs_saif_put_mclk(unsigned int saif_id)return -EBUSY ; } -clk_disable (saif->clk); +clk_disable_unprepare (saif->clk);/* disable MCLK output */ __raw_writel(BM_SAIF_CTRL_CLKGATE,
@@ -264,7 +264,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk,if (ret)return ret; - ret =clk_enable (saif->clk); + ret =clk_prepare_enable (saif->clk);if (ret)return ret;
Signature · 1 line
1.7.4.1
PATCH 10/12 ASoC: mxs-saif: convert to clk_prepare/clk_unprepare
Quoted 2 lines · Shawn Guo
The patch converts mxs-saif driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
PATCH 10/12 ASoC: mxs-saif: convert to clk_prepare/clk_unprepare
In reply to Shawn GuoQuoted 25 lines
The patch converts mxs-saif driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare.
Signed-off-by Shawn Guo <[email protected]>Cc Dong Aisheng <[email protected]>Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>--- sound/soc/mxs/mxs-saif.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)sound/soc/mxs/mxs-saif.c +1
-1@@ -210,7 +210,7 @@ int mxs_saif_put_mclk(unsigned int saif_id)return -EBUSY ; } -clk_disable (saif->clk); +clk_disable_unprepare (saif->clk);/* disable MCLK output */ __raw_writel(BM_SAIF_CTRL_CLKGATE,
sound/soc/mxs/mxs-saif.c int mxs_saif_get_mclk(unsigned int saif_id, unsigned · line 269
Quoted 7 lines
sound/soc/mxs/mxs-saif.c +1
-1@@ -264,7 +264,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk, if (ret) return ret; - ret =clk_enable (saif->clk); + ret =clk_prepare_enable (saif->clk);if (ret)return ret;
PATCH 11/12 clk: add config option HAVE_CLK_PREPARE into Kconfig
In reply to Shawn GuoThe commit 40d3e0f (clk: provide prepare/unprepare functions) provides the config option HAVE_CLK_PREPARE for platforms that have prepare/unprepare implementation to select. This patch adds the option into drivers/clk/Kconfig, so that it can be actually selected.
--- drivers/clk/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/clk/Kconfig +3 -0
@@ -3,5 +3,8 @@ config CLKDEV_LOOKUP bool select HAVE_CLK +config HAVE_CLK_PREPARE + bool + config HAVE_MACH_CLKDEV bool
Signature · 1 line
1.7.4.1
PATCH 12/12 arm/mxs: select HAVE_CLK_PREPARE for clock
In reply to Shawn GuoThis patch adds clk_prepare/clk_unprepare for mxs clock api by renaming the existing non-atomic clk_enable/clk_disable to clk_prepare/clk_unprepare and adding a pair of dummy clk_enable/clk_disable. Then with selecting HAVE_CLK_PREPARE for mxs clock, we can fix the mutex locking warning that has been reported for a few times.
--- arch/arm/Kconfig | 1 + arch/arm/mach-mxs/clock.c | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-)
arch/arm/Kconfig +1 -0
@@ -442,6 +442,7 @@ config ARCH_MXS select ARCH_REQUIRE_GPIOLIB select CLKDEV_LOOKUP select CLKSRC_MMIO + select HAVE_CLK_PREPARE help Support for Freescale MXS-based family of processors
arch/arm/mach-mxs/clock.c +22 -9
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)return 0 ; } -/* This function increments the reference count on the clock and enables the -* clock if not already enabled. The parent clock tree is recursively enabled +/* +* The clk_enable/clk_disable could be called by drivers in atomic context, +* so they should not really hold mutex. Instead, clk_prepare/clk_unprepare +* can hold a mutex, as the pair will only be called in non-atomic context. +* Before migrating to common clk framework, we can have __clk_enable and +* __clk_disable called in clk_prepare/clk_unprepare with mutex held and +* leave clk_enable/clk_disable as the dummy functions. */ -int clk_enable (struct clk *clk) +int clk_prepare (struct clk *clk) {int ret =0 ;
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)return ret; } -EXPORT_SYMBOL (clk_enable); +EXPORT_SYMBOL (clk_prepare); -/* This function decrements the reference count on the clock and disables -* the clock when reference count is 0. The parent clock tree is -* recursively disabled -*/ -void clk_disable (struct clk *clk) +void clk_unprepare (struct clk *clk) {if (clk ==NULL ||IS_ERR (clk))return ;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)__clk_disable (clk);mutex_unlock (&clocks_mutex); } +EXPORT_SYMBOL (clk_unprepare); + +int clk_enable (struct clk *clk) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_enable); + +void clk_disable (struct clk *clk) +{ +/* nothing to do */ +}EXPORT_SYMBOL (clk_disable);/* Retrieve the *current* clock rate. If the clock itself
Signature · 1 line
1.7.4.1
cover Add clk_prepare/clk_unprepare for mxs clock api
In reply to Shawn GuoQuoted 10 lines
The mutex locking problem on mxs platform has been reported on mailing list for a few time. The cause is that a mutex is being held in mxs clock api clk_enable/clk_disable which are being called by some mxs clock client drivers like amba-pl011 and mxs-saif in atomic context.
This series takes Russell's suggestion to:
* Convert all mxs clock client drivers to clk_prepare/clk_unprepare. (I hope the series has covered all the drivers, but appreciate any reminding on any missing ones.)
serial/amba-pl011.c isn't converted, that's where I originally observed the issue.
Quoted 59 lines
* Add clk_prepare/clk_unprepare for mxs clock api to contain the non-atomic portion of existing clk_enable/clk_disable implemention. (As the whole existing clk_enable/clk_disable are non-atomic, clk_prepare/clk_unprepare become a renaming of the existing clk_enable/clk_disable, and the new clk_enable/clk_disable become a pair of dummy functions.)
Thus, we can ensure that no mutex will be held for atomic context, and the problem people keep reporting gets fixed with one step move toward common clk framework while not ncessarily waiting for it.
If driver maintainers have no objection, after the review process, I would like to send the series through arm-soc tree to ease the merge process.
Those two patches from Richard Zhao are included here for completeness, and they have been picked up by Sascha on imx tree. But since imx and mxs will both go through arm-soc, it should easy to sort out how we should merge them.
Regards,
ShawnRichard Zhao (2):
clk: add helper functionsclk_prepare_enableandclk_disable_unpreparenet: fec: add clk_prepare/clk_unprepareShawn Guo (10):
arm/mxs: convert platform code to clk_prepare/clk_unprepare
dma: mxs-dma: convert to clk_prepare/clk_unprepare
mmc: mxs-mmc: convert to clk_prepare/clk_unprepare
mtd: gpmi-lib: convert to clk_prepare/clk_unprepare
net: flexcan: convert to clk_prepare/clk_unprepare
serial: mxs-auart: convert to clk_prepare/clk_unprepare
video: mxsfb: convert to clk_prepare/clk_unprepare
ASoC: mxs-saif: convert to clk_prepare/clk_unprepare
clk: add config optionHAVE_CLK_PREPAREintoKconfigarm/mxs: selectHAVE_CLK_PREPAREfor clockarch/arm/Kconfig | 1 + arch/arm/mach-mxs/clock-mx23.c | 10 +++++----- arch/arm/mach-mxs/clock-mx28.c | 10 +++++----- arch/arm/mach-mxs/clock.c | 33 +++++++++++++++++++++++---------- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- arch/arm/mach-mxs/system.c | 2 +- arch/arm/mach-mxs/timer.c | 2 +- drivers/clk/Kconfig | 3 +++ drivers/dma/mxs-dma.c | 8 ++++---- drivers/mmc/host/mxs-mmc.c | 10 +++++----- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 12 ++++++------ drivers/net/can/flexcan.c | 10 +++++----- drivers/net/ethernet/freescale/fec.c | 10 +++++----- drivers/tty/serial/mxs-auart.c | 8 ++++---- drivers/video/mxsfb.c | 8 ++++---- include/linux/clk.h | 22 ++++++++++++++++++++++ sound/soc/mxs/mxs-saif.c | 4 ++-- 17 files changed, 97 insertions(+), 58 deletions(-)
cover Add clk_prepare/clk_unprepare for mxs clock api
Quoted 5 lines · Marek Vasut
Quoted 5 lines
The mutex locking problem on mxs platform has been reported on mailing list for a few time. The cause is that a mutex is being held in mxs clock api clk_enable/clk_disable which are being called by some mxs clock client drivers like amba-pl011 and mxs-saif in atomic context.
Quoted 8 lines
Quoted 5 lines
This series takes Russell's suggestion to:
* Convert all mxs clock client drivers to clk_prepare/clk_unprepare. (I hope the series has covered all the drivers, but appreciate any reminding on any missing ones.)
serial/amba-pl011.cisn't converted, that's where I originally observed the issue.
The amba-pl011 on mainline had already been converted by Russell. The reason we are still seeing the problem is that clk_prepare/clk_unprepare is dummy while clk_enable/clk_disable holds mutex on mxs clock api. And this series is trying to swap the their position to have the problem fixed.
You can try this series out to see if your problem goes away :)
Signature · 2 lines
Regards, Shawn
cover Add clk_prepare/clk_unprepare for mxs clock api
Quoted 15 lines · Marek Vasut
Quoted 5 lines
Quoted 5 lines
The mutex locking problem on mxs platform has been reported on mailing list for a few time. The cause is that a mutex is being held in mxs clock api clk_enable/clk_disable which are being called by some mxs clock client drivers like amba-pl011 and mxs-saif in atomic context.
Quoted 8 lines
Quoted 5 lines
This series takes Russell's suggestion to:
* Convert all mxs clock client drivers to clk_prepare/clk_unprepare.(I hope the series has covered all the drivers, but appreciate any reminding on any missing ones.)
serial/amba-pl011.cisn't converted, that's where I originally observed the issue.
Quoted 7 lines
The amba-pl011 on mainline had already been converted by Russell. The reason we are still seeing the problem is that clk_prepare/clk_unprepare is dummy while clk_enable/clk_disable holds mutex on mxs clock api. And this series is trying to swap the their position to have the problem fixed.
You can try this series out to see if your problem goes away :)
Shawn, what exact tree should I use for the test / what branch. I'm slightly confused here. So far, I used next/master since it contained all the stuff I needed (gpmi nand etc).
Thanks!
M
cover Add clk_prepare/clk_unprepare for mxs clock api
Quoted 4 lines · Marek Vasut
Shawn, what exact tree should I use for the test / what branch. I'm slightly confused here. So far, I used next/master since it contained all the stuff I needed (gpmi nand etc).
git://git.linaro.org/people/shawnguo/linux-2.6.git mxs/clk-prepare
It's based on v3.2-rc6, but I guess it can be merged to next/master without any major problem.
Signature · 2 lines
Regards, Shawn