From fc1c145e73eb5b4aa25208f58fc3a411984aba3d Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Thu, 2 Aug 2007 12:10:17 -0600 Subject: [PATCH] omap2 clock: return -EINVAL if no clock enable code; fix dpll_ck enable If the clock framework can't figure out how to enable a clock, return -EINVAL to indicate that the clock cannot be enabled. Previously the code returned 0, which indicated success. Also fix the "clock.c: Enable for dpll_ck without enable code" boot warning by marking dpll_ck as ALWAYS_ENABLED. This is not technically true, since the DPLL can be bypassed; but since we currently have no software infrastructure to control it directly, ALWAYS_ENABLED is a sufficient fiction for dpll_ck. Signed-off-by: Paul Walmsley Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/clock.c | 11 +++++++++-- arch/arm/mach-omap2/clock.h | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index ede0dd5e945..c3038875907 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -218,7 +218,7 @@ static int _omap2_clk_enable(struct clk * clk) if (unlikely(clk->enable_reg == 0)) { printk(KERN_ERR "clock.c: Enable for %s without enable code\n", clk->name); - return 0; + return -EINVAL; } if (clk->enable_reg == OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN)) { @@ -259,8 +259,15 @@ static void _omap2_clk_disable(struct clk *clk) return; } - if (clk->enable_reg == 0) + if (clk->enable_reg == 0) { + /* + * 'Independent' here refers to a clock which is not + * controlled by its parent. + */ + printk(KERN_ERR "clock: clk_disable called on independent " + "clock %s which has no enable_reg\n", clk->name); return; + } if (clk->enable_reg == OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN)) { omap2_clk_fixed_disable(clk); diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 4df1d64cfa9..76ac124733f 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -630,7 +630,8 @@ static struct clk dpll_ck = { .name = "dpll_ck", .parent = &sys_ck, /* Can be func_32k also */ .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | - RATE_PROPAGATES | RATE_CKCTL | CM_PLL_SEL1, + RATE_PROPAGATES | RATE_CKCTL | CM_PLL_SEL1 | + ALWAYS_ENABLED, .recalc = &omap2_clksel_recalc, }; -- 2.41.1