ARM: OMAP4: Clock fixes
v2 cover ARM: OMAP4: Clock fixes
Fixes included, fixing up timer clock aliases for v3.8 and working around ABE DPLL issue seen with latest u-boot bootloader (v2012.10).
Testing includes:
- Boot testing on OMAP4460 Panda and verifying that all dmtimers are working.
V2 changes:
- Updated series to latest ARM-SoC for-next branch that includes common clock updates for OMAP4.
- Added new function table for non-M4X DPLLs which is now required after enhancing support for OMAP4 DPLLs for 4X multiplier.
Jon Hunter (4):
ARM: OMAP4: Update timer clock aliases
ARM: OMAP4: Add function table for non-M4X dplls
ARM: OMAP4: Enhance support for DPLLs with 4X multiplier
ARM: OMAP4460: Workaround ABE DPLL failing to turn-on
arch/arm/mach-omap2/cclock44xx_data.c | 49 ++++++++++++++++++++----- arch/arm/mach-omap2/clock.h | 10 ++++++ arch/arm/mach-omap2/dpll3xxx.c | 46 ++++++++++++++++-------- arch/arm/mach-omap2/dpll44xx.c | 64 ++++++++++++++++++++++++++++----- 4 files changed, 138 insertions(+), 31 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/4 ARM: OMAP4: Update timer clock aliases
Commit "ARM: dts: OMAP4: Update timer addresses" updated the device-tree names of the OMAP4 timers 5-7 because the default address for the timers was changed from the L3 address to the MPU private address. When booting with device-tree, this introduces a regression when attempting to set the parent clock of timers 5-7 to the sys_clk_div_ck. Therefore, update the clock aliases for timer 5-7 to reflect the updated device-tree name for the timers.
--- arch/arm/mach-omap2/cclock44xx_data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/cclock44xx_data.c +4 -4
@@ -1935,10 +1935,10 @@ static struct omap_clk omap44xx_clks[] = {CLK ("4803e000.timer" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ),CLK ("48086000.timer" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ),CLK ("48088000.timer" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("49038000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), -CLK ("4903a000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), -CLK ("4903c000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), -CLK ("4903e000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("40138000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("4013a000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("4013c000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("4013e000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), };
Signature · 1 line
1.7.9.5
PATCH v2 2/4 ARM: OMAP4: Add function table for non-M4X dplls
In reply to Jon HunterCurrently all OMAP4 non-core DPLLs use the same function table for configuring DPLLs. For these DPLLs, the function omap4_dpll_regm4xen_recalc() is used to recalculate the DPLL rate and the function omap4_dpll_regm4xen_round_rate() is used to calculate the closest rate to that requested. However, these omap4_dpll_regm4xen_xxx() functions are only applicable to the ABE DPLL and not the other non-core DPLLs. Therefore, add a new function table for non-core DPLLs that do not include the 4X-multiplier (M4X).
Please note that using these omap4_dpll_regm4x_xxx() function works for the non-M4X DPLLs today because we only check to see if the 4X multiplier is enabled when calculating the rate. However, it is planned that the dpll functions will be enhanced to enable the 4X multiplier as necessary (in order to achieve the requested rate) and so calling these functions for non-M4X dplls will no longer work.
--- arch/arm/mach-omap2/cclock44xx_data.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/cclock44xx_data.c +13 -4
@@ -365,6 +365,15 @@ static struct dpll_data dpll_iva_dd = {static struct clk dpll_iva_ck; +static const struct clk_ops dpll_ck_ops = { + .enable = &omap3_noncore_dpll_enable, + .disable = &omap3_noncore_dpll_disable, + .recalc_rate = &omap3_dpll_recalc, + .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, + .get_parent = &omap2_init_dpll_parent, +}; +static struct clk_hw_omap dpll_iva_ck_hw = { .hw = { .clk = &dpll_iva_ck,
@@ -373,7 +382,7 @@ static struct clk_hw_omap dpll_iva_ck_hw = { .ops = &clkhwops_omap3_dpll, }; -DEFINE_STRUCT_CLK (dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops); +DEFINE_STRUCT_CLK (dpll_iva_ck, dpll_core_ck_parents, dpll_ck_ops);static const char *dpll_iva_x2_ck_parents[] = {"dpll_iva_ck" ,
@@ -426,7 +435,7 @@ static struct clk_hw_omap dpll_mpu_ck_hw = { .ops = &clkhwops_omap3_dpll, }; -DEFINE_STRUCT_CLK (dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops); +DEFINE_STRUCT_CLK (dpll_mpu_ck, dpll_core_ck_parents, dpll_ck_ops);DEFINE_CLK_FIXED_FACTOR (mpu_periphclk,"dpll_mpu_ck" , &dpll_mpu_ck,0x0 ,1 ,2 );
@@ -475,7 +484,7 @@ static struct clk_hw_omap dpll_per_ck_hw = { .ops = &clkhwops_omap3_dpll, }; -DEFINE_STRUCT_CLK (dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops); +DEFINE_STRUCT_CLK (dpll_per_ck, dpll_core_ck_parents, dpll_ck_ops); DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0, OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
@@ -569,7 +578,7 @@ static struct clk_hw_omap dpll_usb_ck_hw = { .ops = &clkhwops_omap3_dpll, }; -DEFINE_STRUCT_CLK (dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops); +DEFINE_STRUCT_CLK (dpll_usb_ck, dpll_core_ck_parents, dpll_ck_ops);static const char *dpll_usb_clkdcoldo_ck_parents[] = {"dpll_usb_ck" ,
Signature · 1 line
1.7.9.5
PATCH v2 3/4 ARM: OMAP4: Enhance support for DPLLs with 4X multiplier
In reply to Jon HunterOn OMAP4 devices, the ABE DPLL has an internal 4X multiplier that can be enabled or disabled in addition to the standard configurable multiplier (M) for OMAP DPLLs. When configuring the ABE DPLL the 4X multiplier is accounted for by checking to see whether it is enabled or not. However, when calculating a new rate we only check to see if the rate can be achieved with the current setting for the 4X multiplier. Enhance the round_rate() function for such DPLLs to see if the rate can be achieved with the 4X multiplier if it cannot be achieved without the 4X multiplier.
This change is necessary, because when using the 32kHz clock as the source clock for the ABE DPLL, the default DPLL frequency for the ABE DPLL cannot be achieved without enabling the 4X multiplier.
When using the 32kHz clock as the source clock for the ABE DPLL and attempting to lock the DPLL to 98.304MHz (default frequency), it was found that the DPLL would fail to lock if the low-power mode for the DPLL was not enabled. From reviewing boot-loader settings that configure the ABE DPLL it was found that the low-power mode is enabled when using the 32kHz clock source, however, the documentation for OMAP does not state that this is a requirement. Therefore, introduce a new function for OMAP4 devices to see if low-power mode can be enabled when calculating a new rate to ensure the DPLL will lock.
New variables for the last calculated 4X multiplier and low-power setting have been added to the dpll data structure as well as variables defining the bit mask for enabling these features via the DPLL's control_reg. It is possible that we could eliminate these bit masks from the dpll data structure as these bit masks are not unique to OMAP4, if it is preferred.
The function omap3_noncore_program_dpll() has been updated to avoid passing the calculated values for the multiplier (M) and divider (N) as these are stored in the clk structure.
--- arch/arm/mach-omap2/cclock44xx_data.c | 2 ++ arch/arm/mach-omap2/clock.h | 10 ++++++ arch/arm/mach-omap2/dpll3xxx.c | 46 ++++++++++++++++-------- arch/arm/mach-omap2/dpll44xx.c | 64 ++++++++++++++++++++++++++++----- 4 files changed, 99 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/cclock44xx_data.c +2 -0
@@ -124,6 +124,8 @@ static struct dpll_data dpll_abe_dd = { .enable_mask = OMAP4430_DPLL_EN_MASK, .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, + .m4xen_mask = OMAP4430_DPLL_REGM4XEN_MASK, + .lpmode_mask = OMAP4430_DPLL_LPMODE_EN_MASK, .max_multiplier = 2047, .max_divider = 128, .min_divider = 1,
arch/arm/mach-omap2/clock.h +10 -0
@@ -195,6 +195,10 @@ struct clksel {* @enable_mask: mask of the DPLL mode bitfield in @control_reg * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() +* @last_rounded_m4xen: cache of the last M4X result of +* omap4_dpll_regm4xen_round_rate() +* @last_rounded_lpmode: cache of the last lpmode result of +* omap4_dpll_lpmode_recalc() * @max_multiplier: maximum valid non-bypass multiplier value (actual) * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() * @min_divider: minimum valid non-bypass divider value (actual)
@@ -205,6 +209,8 @@ struct clksel {* @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg +* @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg +* @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
@@ -233,6 +239,8 @@ struct dpll_data {u32 enable_mask;unsigned long last_rounded_rate;u16 last_rounded_m; +u8 last_rounded_m4xen; +u8 last_rounded_lpmode;u16 max_multiplier;u8 last_rounded_n;u8 min_divider;
@@ -245,6 +253,8 @@ struct dpll_data {u32 idlest_mask;u32 dco_mask;u32 sddiv_mask; +u32 lpmode_mask; +u32 m4xen_mask;u8 auto_recal_bit;u8 recal_en_bit;u8 recal_st_bit;
arch/arm/mach-omap2/dpll3xxx.c +32 -14
79 lines not on this page · raw message
arch/arm/mach-omap2/dpll44xx.c +55 -9
92 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 4/4 ARM: OMAP4460: Workaround ABE DPLL failing to turn-on
In reply to Jon HunterWith the latest mainline u-boot bootloader (v2012.10), timers (5-8) in the ABE power domain are failing to turn-on. The timers never come out of the disabled state when setting the module-mode field to enable.
The problem was exposed when u-boot was updated to NOT configure and lock the ABE DPLL on start-up. If the ABE DPLL is configured and locked by u-boot the problem does not occur. However, if the ABE DPLL is in the idle low-power bypass state and we attempt to enable a timer in the ABE power domain, it remains stuck in the disabled state. It appears to be a problem the timer interface clock as this comes from the ABE DPLL.
If we place the ABE DPLL in the MN-bypass state and not the idle low-power state, then this problem is not seen.
This problem only appears to occur on OMAP4460 and not OMAP4430.
Workaround this problem by locking the ABE DPLL for OMAP4460 in the kernel on boot. By locking the ABE DPLL, when clocks from the ABE DPLL are not being requested the DPLL will transition into a low-power stop mode.
--- arch/arm/mach-omap2/cclock44xx_data.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm/mach-omap2/cclock44xx_data.c +22 -0
@@ -40,6 +40,14 @@#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1 +/* +* OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section +* "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK +* must be set to 196.608 MHz" and hence, the DPLL locked frequency is +* half of this value. +*/ +#define OMAP4_DPLL_ABE_DEFFREQ 98304000 +/* Root clocks */ DEFINE_CLK_FIXED_RATE (extalt_clkin_ck,CLK_IS_ROOT ,59000000 ,0x0 );
@@ -1966,6 +1974,7 @@ int __init omap4xxx_clk_init(void) {u32 cpu_clkflg;struct omap_clk *c; +int rc;if (cpu_is_omap443x ()) { cpu_mask =RATE_IN_4430 ;
@@ -1994,5 +2003,18 @@ int __init omap4xxx_clk_init(void)omap2_clk_enable_init_clocks (enable_init_clks,ARRAY_SIZE (enable_init_clks)); +/* +* On OMAP4460 the ABE DPLL fails to turn on if in idle low-power +* state when turning the ABE clock domain. Workaround this by +* locking the ABE DPLL on boot. +*/ +if (cpu_is_omap446x ()) { + rc =clk_set_parent (&abe_dpll_refclk_mux_ck, &sys_32k_ck); +if (!rc) + rc =clk_set_rate (&dpll_abe_ck,OMAP4_DPLL_ABE_DEFFREQ ); +if (rc) +pr_err ("%s: failed to configure ABE DPLL!\n" , __func__); + } +return 0 ; }
Signature · 1 line
1.7.9.5
Paul Walmsley
maintainerv2 cover ARM: OMAP4: Clock fixes
In reply to Jon HunterQuoted 7 lines · Jon Hunter
Fixes included, fixing up timer clock aliases for v3.8 and working around ABE DPLL issue seen with latest u-boot bootloader (v2012.10).
Testing includes:
- Boot testing on OMAP4460 Panda and verifying that all dmtimers are working.
Quoted 5 lines
V2 changes:
- Updated series to latest ARM-SoC for-next branch that includes common clock updates for OMAP4.
- Added new function table for non-M4X DPLLs which is now required after enhancing support for OMAP4 DPLLs for 4X multiplier.
Thanks, queued for 3.8-rc.
- Paul