diff options
author | Anson Huang <b20788@freescale.com> | 2012-06-13 20:20:01 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-07-20 13:38:41 +0800 |
commit | 12d90f76238421c7771326a25f8402ec0a6bc126 (patch) | |
tree | 8bde6c252807baafe1a301801527c41c946b8c3a /arch/arm/plat-mxc | |
parent | e2dfce71652b251a204bc98b4c6600fd6f90d467 (diff) |
ENGR00180919 [MX6]Update clock tree if BUS freq is changed
As DDR freq change is by modifying CCM register directly,
we need to update the clock tree as well, or the clock
tree will be broken. Also, we need to make sure the clock
rate counting is right.
Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'arch/arm/plat-mxc')
-rwxr-xr-x | arch/arm/plat-mxc/clock.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c index 43d33376b52d..a55b3fbfb94a 100755 --- a/arch/arm/plat-mxc/clock.c +++ b/arch/arm/plat-mxc/clock.c @@ -209,6 +209,37 @@ int clk_get_usecount(struct clk *clk) EXPORT_SYMBOL(clk_get_usecount); +/*! + * @brief Function to update the usage count for the requested clock. + * + * This function returns none. + * + * @param clk clk we want to update. + * @param flag Increase or decrease usecount. + * + * @return Returns none. + */ +void update_usecount(struct clk *clk, bool flag) +{ + if (!flag) { + if (clk_get_usecount(clk) > 1) { + mutex_lock(&clocks_mutex); + clk->usecount--; + mutex_unlock(&clocks_mutex); + } else + clk_disable(clk); + } else { + if (clk_get_usecount(clk) < 1) + clk_enable(clk); + else { + mutex_lock(&clocks_mutex); + clk->usecount++; + mutex_unlock(&clocks_mutex); + } + } +} +EXPORT_SYMBOL(update_usecount); + /* Retrieve the *current* clock rate. If the clock itself * does not provide a special calculation routine, ask * its parent and so on, until one is able to return |