OMAP2/3/4 clock: split out code for clock types and clean up
Paul Walmsley
maintainercover OMAP2/3/4 clock: split out code for clock types and clean up
Hi,
This patch series splits clock2xxx.c and clock34xx.c by clock "type", e.g., DPLLs, APLLs, clksel clocks, etc. The point is to make the code easier to read and easier to debug (by restricting the scope of DEBUG defines). This also lays the groundwork for further generalization of the clock code.
The series also cleans up a few other minor aspects of the clock
code: the various struct omap2_clk_functions are combined; a warning identified by sparse is resolved; unnecessary includes have been trimmed; and some formerly-common code is now only compiled for the chips that need it.
There are a few minor functional changes, documented in some of the patch descriptions, but nothing significant.
Compile-tested with n8x0_defconfig, omap_2430sdp_defconfig, and omap3_beagle_defconfig. Boot-tested on Beagle and N800.
Applies on the "for_2.6.34" branch of git://git.pwsan.com/linux-2.6
- Paul
---
size:
text data bss dec hex filename
2329525 126400 64056 2519981 2673ad vmlinux.n8x0.orig
2329585 126400 64056 2520041 2673e9 vmlinux.n8x0.patched
3418395 179456 146848 3744699 3923bb vmlinux.2430sdp.orig
3418547 179456 146848 3744851 392453 vmlinux.2430sdp.patched
3624493 199200 102984 3926677 3bea95 vmlinux.beagle.orig
3624373 199200 102984 3926557 3bea1d vmlinux.beagle
Paul Walmsley (18):
OMAP3 clock: move OMAP3-specific DPLL functions to dpll3xxx.c OMAP2/3/4 clock: move DPLL clock functions into clkt_dpll.c OMAP2/3/4 clock: move clksel clock functions into clkt_clksel.c OMAP2 clock: move all static functions to the top of the file OMAP2/3/4 clock: combine all omap2_clk_functions
OMAP2xxx clock: move the DPLL+CORE composite clock code into clkt2xxx_dpllcore.c OMAP2xxx clock: move the DVFS virtual clock code into clkt2xxx_virt_prcm_set.c OMAP2xxx clock: move the APLL clock code into clkt2xxx_apll.c OMAP2xxx clock: move osc_clk code into clkt2xxx_osc.c
OMAP2xxx clock: move sys_clk code into clkt2xxx_sys.c
OMAP2 clock: don't compile OMAP2430-only functions on non-2430 builds OMAP3 clock: split out DPLL3 M2 divider functions into clkt3xxx_dpll3m2.c OMAP2/3 clock: clean up omap*_clk_arch_init()
OMAP2/3 clock: remove unnecessary includes and clean up header OMAP2/3/4 clock: omap2_clk_prepare_for_reboot() is OMAP2xxx-only OMAP3 DPLL: reorganize static functions
OMAP clock: resolve all remaining sparse warnings
OMAP2/3/4 clock: rename and clean the omap2_clk_init() functions
arch/arm/mach-omap2/Makefile | 18 -
arch/arm/mach-omap2/clkt2xxx_apll.c | 120 ++++
arch/arm/mach-omap2/clkt2xxx_dpllcore.c | 172 +++++
arch/arm/mach-omap2/clkt2xxx_osc.c | 62 ++
arch/arm/mach-omap2/clkt2xxx_sys.c | 50 ++
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 245 ++++++++
arch/arm/mach-omap2/clkt3xxx_dpll3m2.c | 120 ++++
arch/arm/mach-omap2/clkt_clksel.c | 413 +++++++++++++
arch/arm/mach-omap2/clkt_dpll.c | 386 ++++++++++++
arch/arm/mach-omap2/clock.c | 825 ++------------------------
arch/arm/mach-omap2/clock.h | 11
arch/arm/mach-omap2/clock2xxx.c | 548 +----------------
arch/arm/mach-omap2/clock2xxx.h | 7
arch/arm/mach-omap2/clock2xxx_data.c | 6
arch/arm/mach-omap2/clock34xx.c | 154 -----
arch/arm/mach-omap2/clock34xx.h | 1
arch/arm/mach-omap2/clock34xx_data.c | 19 -
arch/arm/mach-omap2/clock44xx.c | 14
arch/arm/mach-omap2/clock44xx.h | 2
arch/arm/mach-omap2/clock44xx_data.c | 4
arch/arm/mach-omap2/dpll3xxx.c | 113 ++--
arch/arm/mach-omap2/io.c | 15
arch/arm/mach-omap2/prcm.c | 8
arch/arm/plat-omap/clock.c | 2
arch/arm/plat-omap/include/plat/clock.h | 2
25 files changed, 1774 insertions(+), 1543 deletions(-)
create mode 100644 arch/arm/mach-omap2/clkt2xxx_apll.c
create mode 100644 arch/arm/mach-omap2/clkt2xxx_dpllcore.c
create mode 100644 arch/arm/mach-omap2/clkt2xxx_osc.c
create mode 100644 arch/arm/mach-omap2/clkt2xxx_sys.c
create mode 100644 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
create mode 100644 arch/arm/mach-omap2/clkt3xxx_dpll3m2.c
create mode 100644 arch/arm/mach-omap2/clkt_clksel.c
create mode 100644 arch/arm/mach-omap2/clkt_dpll.c
rename arch/arm/mach-omap2/{dpll.c => dpll3xxx.c} (98%)Paul Walmsley
maintainerPATCH 1/18 OMAP3 clock: move OMAP3-specific DPLL functions to dpll3xxx.c
Mark the OMAP3-specific DPLL functions as being OMAP3-specific by moving them from mach-omap2/dpll.c to mach-omap2/dpll3xxx.c.
---
arch/arm/mach-omap2/Makefile | 2 +-
arch/arm/mach-omap2/dpll3xxx.c | 0
2 files changed, 1 insertions(+), 1 deletions(-)
rename arch/arm/mach-omap2/{dpll.c => dpll3xxx.c} (100%)arch/arm/mach-omap2/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o omap-2-3-common = irq.o sdrc.o omap_hwmod.o -omap-3-4-common = dpll.o +omap-3-4-common = dpll3xxx.o prcm-common = prcm.o powerdomain.o clock-common = clock.o clock_common_data.o clockdomain.o
arch/arm/mach-omap2/dpll3xxx.c renamed from arch/arm/mach-omap2/dpll.c +0 -0
Paul Walmsley
maintainerPATCH 2/18 OMAP2/3/4 clock: move DPLL clock functions into clkt_dpll.c
In reply to Paul WalmsleyMove all DPLL-related clock functions from mach-omap2/clock.c to clkt_dpll.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clkt_dpll.c | 386 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock.c | 355 ------------------------------------ 3 files changed, 388 insertions(+), 356 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt_dpll.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -8,7 +8,8 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o omap-2-3-common = irq.o sdrc.o omap_hwmod.o omap-3-4-common = dpll3xxx.o prcm-common = prcm.o powerdomain.o -clock-common = clock.o clock_common_data.o clockdomain.o +clock-common = clock.o clock_common_data.o \ + clockdomain.o clkt_dpll.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \
arch/arm/mach-omap2/clkt_dpll.c new file +386 -0
386 lines not on this page · raw message
arch/arm/mach-omap2/clock.c +0 -355
392 lines not on this page · raw message
Paul Walmsley
maintainerPATCH 3/18 OMAP2/3/4 clock: move clksel clock functions into clkt_clksel.c
In reply to Paul WalmsleyMove all clksel-related clock functions from mach-omap2/clock.c to clkt_clksel.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clkt_clksel.c | 413 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock.c | 377 ---------------------------------- arch/arm/mach-omap2/clock.h | 2 4 files changed, 420 insertions(+), 375 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt_clksel.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -9,7 +9,8 @@ omap-2-3-common = irq.o sdrc.o omap_hwmod.o omap-3-4-common = dpll3xxx.o prcm-common = prcm.o powerdomain.o clock-common = clock.o clock_common_data.o \ - clockdomain.o clkt_dpll.o + clockdomain.o clkt_dpll.o \ + clkt_clksel.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \
arch/arm/mach-omap2/clkt_clksel.c new file +413 -0
413 lines not on this page · raw message
arch/arm/mach-omap2/clock.c +3 -374
415 lines not on this page · raw message
arch/arm/mach-omap2/clock.h +2 -0
@@ -80,6 +80,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val);u32 omap2_divisor_to_clksel (struct clk *clk,u32 div);long omap2_clksel_round_rate (struct clk *clk,unsigned long target_rate);int omap2_clksel_set_rate (struct clk *clk,unsigned long rate); +int omap2_clksel_set_parent (struct clk *clk,struct clk *new_parent);u32 omap2_get_dpll_rate (struct clk *clk);void omap2_init_dpll_parent (struct clk *clk);int omap2_wait_clock_ready (void __iomem *reg,u32 cval,const char *name);
@@ -90,6 +91,7 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, u8 *other_bit);void omap2_clk_dflt_find_idlest (struct clk *clk,void __iomem **idlest_reg,u8 *idlest_bit); +void omap2xxx_clk_commit (struct clk *clk);extern u8 cpu_mask;
Paul Walmsley
maintainerPATCH 4/18 OMAP2 clock: move all static functions to the top of the file
In reply to Paul WalmsleyMove static functions to the top of the file and ensure that their names are prefixed with an underscore to conform with the practice in the newer OMAP clock code files.
--- arch/arm/mach-omap2/clock.c | 88 ++++++++++++++++++++++--------------------- 1 files changed, 46 insertions(+), 42 deletions(-)
arch/arm/mach-omap2/clock.c +46 -42
@@ -42,6 +42,51 @@ u8 cpu_mask;* OMAP2/3/4 specific clock functions *-------------------------------------------------------------------------*/ +/* Private functions */ + +/** +* _omap2_module_wait_ready - wait for an OMAP module to leave IDLE +* @clk: struct clk * belonging to the module +* +* If the necessary clocks for the OMAP hardware IP block that +* corresponds to clock @clk are enabled, then wait for the module to +* indicate readiness (i.e., to leave IDLE). This code does not +* belong in the clock code and will be moved in the medium term to +* module-dependent code. No return value. +*/ +static void _omap2_module_wait_ready (struct clk *clk) +{ +void __iomem *companion_reg, *idlest_reg; +u8 other_bit, idlest_bit; + +/* Not all modules have multiple clocks that their IDLEST depends on */ +if (clk->ops->find_companion) { + clk->ops->find_companion (clk, &companion_reg, &other_bit); +if (!(__raw_readl (companion_reg) & (1 << other_bit))) +return ; + } + + clk->ops->find_idlest (clk, &idlest_reg, &idlest_bit); + +omap2_cm_wait_idlest (idlest_reg, (1 << idlest_bit), clk->name); +} + +/* Enables clock without considering parent dependencies or use count +* REVISIT: Maybe change this to use clk->enable like on omap1? +*/ +static int _omap2_clk_enable (struct clk *clk) +{ +return clk->ops->enable (clk); +} + +/* Disables clock without considering parent dependencies or use count */ +static void _omap2_clk_disable (struct clk *clk) +{ + clk->ops->disable (clk); +} + +/* Public functions */ +/** * omap2xxx_clk_commit - commit clock parent/rate changes in hardware * @clk: struct clk *
@@ -149,33 +194,6 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, *idlest_bit = clk->enable_bit; } -/** -* omap2_module_wait_ready - wait for an OMAP module to leave IDLE -* @clk: struct clk * belonging to the module -* -* If the necessary clocks for the OMAP hardware IP block that -* corresponds to clock @clk are enabled, then wait for the module to -* indicate readiness (i.e., to leave IDLE). This code does not -* belong in the clock code and will be moved in the medium term to -* module-dependent code. No return value. -*/ -static void omap2_module_wait_ready (struct clk *clk) -{ -void __iomem *companion_reg, *idlest_reg; -u8 other_bit, idlest_bit; - -/* Not all modules have multiple clocks that their IDLEST depends on */ -if (clk->ops->find_companion) { - clk->ops->find_companion (clk, &companion_reg, &other_bit); -if (!(__raw_readl (companion_reg) & (1 << other_bit))) -return ; - } - - clk->ops->find_idlest (clk, &idlest_reg, &idlest_bit); - -omap2_cm_wait_idlest (idlest_reg, (1 << idlest_bit), clk->name); -} -int omap2_dflt_clk_enable (struct clk *clk) {u32 v;
@@ -195,7 +213,7 @@ int omap2_dflt_clk_enable(struct clk *clk) v =__raw_readl (clk->enable_reg);/* OCP barrier */ if (clk->ops->find_idlest) -omap2_module_wait_ready (clk); +_omap2_module_wait_ready (clk);return 0 ; }
@@ -235,20 +253,6 @@ const struct clkops clkops_omap2_dflt = { .disable = omap2_dflt_clk_disable, }; -/* Enables clock without considering parent dependencies or use count -* REVISIT: Maybe change this to use clk->enable like on omap1? -*/ -static int _omap2_clk_enable (struct clk *clk) -{ -return clk->ops->enable (clk); -} - -/* Disables clock without considering parent dependencies or use count */ -static void _omap2_clk_disable (struct clk *clk) -{ - clk->ops->disable (clk); -} -void omap2_clk_disable (struct clk *clk) {if (clk->usecount >0 && !(--clk->usecount)) {
Paul Walmsley
maintainerPATCH 5/18 OMAP2/3/4 clock: combine all omap2_clk_functions
In reply to Paul WalmsleyThe struct clk_functions for OMAP2, 3, and 4 are all essentially the same, so combine them. This removes one multi-OMAP kernel impediment and saves memory on multi-OMAP builds.
The stubs for omap2_clk_{init,exit}_cpufreq() code will removed once the OPP layer code that's currently in Kevin's PM branch is merged.
--- arch/arm/mach-omap2/clock.c | 17 +++++++++++++++++ arch/arm/mach-omap2/clock.h | 7 +++++++ arch/arm/mach-omap2/clock2xxx.c | 23 ++++++++--------------- arch/arm/mach-omap2/clock34xx.c | 9 --------- arch/arm/mach-omap2/clock44xx.c | 9 --------- 5 files changed, 32 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/clock.c +17 -0
@@ -351,3 +351,20 @@ void omap2_clk_disable_unused(struct clk *clk)pwrdm_clkdm_state_switch (clk->clkdm); }#endif + +/* Common data */ + +struct clk_functions omap2_clk_functions = { + .clk_enable = omap2_clk_enable, + .clk_disable = omap2_clk_disable, + .clk_round_rate = omap2_clk_round_rate, + .clk_set_rate = omap2_clk_set_rate, + .clk_set_parent = omap2_clk_set_parent, + .clk_disable_unused = omap2_clk_disable_unused, +#ifdef CONFIG_CPU_FREQ +/* These will be removed when the OPP code is integrated */ + .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, + .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table, +#endif +}; +
arch/arm/mach-omap2/clock.h +7 -0
@@ -105,5 +105,12 @@ extern const struct clksel_rate gpt_32k_rates[];extern const struct clksel_rate gpt_sys_rates[];extern const struct clksel_rate gfx_l3_rates[]; +#if defined(CONFIG_ARCH_OMAP24XX ) && defined(CONFIG_CPU_FREQ ) +extern void omap2_clk_init_cpufreq_table (struct cpufreq_frequency_table **table); +extern void omap2_clk_exit_cpufreq_table (struct cpufreq_frequency_table **table); +#else +#define omap2_clk_init_cpufreq_table 0 +#define omap2_clk_exit_cpufreq_table 0 +#endif #endif
arch/arm/mach-omap2/clock2xxx.c +8 -15
@@ -453,13 +453,16 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)*/ static struct cpufreq_frequency_table *freq_table; -void omap2_clk_init_cpufreq_table (struct cpufreq_frequency_table **table) +void omap2xxx_clk_init_cpufreq_table (struct cpufreq_frequency_table **table) {const struct prcm_config *prcm;long sys_ck_rate;int i =0 ;int tbl_sz =0 ; +if (!cpu_is_omap2xxx ()) +return ; + sys_ck_rate =clk_get_rate (sclk);for (prcm = rate_table; prcm->mpu_speed; prcm++) {
@@ -516,26 +519,16 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) *table = &freq_table[0]; } -void omap2_clk_exit_cpufreq_table (struct cpufreq_frequency_table **table) +void omap2xxx_clk_exit_cpufreq_table (struct cpufreq_frequency_table **table) { +if (!cpu_is_omap2xxx ()) +return ; +kfree (freq_table); }#endif -struct clk_functions omap2_clk_functions = { - .clk_enable = omap2_clk_enable, - .clk_disable = omap2_clk_disable, - .clk_round_rate = omap2_clk_round_rate, - .clk_set_rate = omap2_clk_set_rate, - .clk_set_parent = omap2_clk_set_parent, - .clk_disable_unused = omap2_clk_disable_unused, -#ifdef CONFIG_CPU_FREQ - .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, - .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table, -#endif -}; -static u32 omap2_get_apll_clkin (void ) {u32 aplls, srate =0 ;
arch/arm/mach-omap2/clock34xx.c +0 -9
@@ -258,15 +258,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)*/ #if defined(CONFIG_ARCH_OMAP3 ) -struct clk_functions omap2_clk_functions = { - .clk_enable = omap2_clk_enable, - .clk_disable = omap2_clk_disable, - .clk_round_rate = omap2_clk_round_rate, - .clk_set_rate = omap2_clk_set_rate, - .clk_set_parent = omap2_clk_set_parent, - .clk_disable_unused = omap2_clk_disable_unused, -}; -/* * Set clocks for bypass mode for reboot to work. */
arch/arm/mach-omap2/clock44xx.c +0 -9
@@ -13,15 +13,6 @@#include <linux/errno.h> #include "clock.h" -struct clk_functions omap2_clk_functions = { - .clk_enable = omap2_clk_enable, - .clk_disable = omap2_clk_disable, - .clk_round_rate = omap2_clk_round_rate, - .clk_set_rate = omap2_clk_set_rate, - .clk_set_parent = omap2_clk_set_parent, - .clk_disable_unused = omap2_clk_disable_unused, -}; -const struct clkops clkops_noncore_dpll_ops = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable,
Paul Walmsley
maintainerPATCH 6/18 OMAP2xxx clock: move the DPLL+CORE composite clock code into clkt2xxx_dpllcore.c
In reply to Paul WalmsleyMove the DPLL+CORE composite clock functions from clock2xxx.c to clkt2xxx_dpllcore.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 4 + arch/arm/mach-omap2/clkt2xxx_dpllcore.c | 172 +++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock2xxx.c | 136 ------------------------- 3 files changed, 175 insertions(+), 137 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt2xxx_dpllcore.c
arch/arm/mach-omap2/Makefile +3 -1
@@ -11,8 +11,10 @@ prcm-common = prcm.o powerdomain.o clock-common = clock.o clock_common_data.o \ clockdomain.o clkt_dpll.o \ clkt_clksel.o +clock-omap2xxx = clkt2xxx_dpllcore.o -obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) +obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ + $(clock-omap2xxx) obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(omap-3-4-common) obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) $(prcm-common) $(clock-common)
arch/arm/mach-omap2/clkt2xxx_dpllcore.c new file +172 -0
172 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.c +0 -136
154 lines not on this page · raw message
Paul Walmsley
maintainerPATCH 7/18 OMAP2xxx clock: move the DVFS virtual clock code into clkt2xxx_virt_prcm_set.c
In reply to Paul WalmsleyMove the DVFS virtual clock functions from clock2xxx.c to clkt2xxx_virt_prcm_set.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 245 ++++++++++++++++++++++++++ arch/arm/mach-omap2/clock2xxx.c | 211 ---------------------- 3 files changed, 247 insertions(+), 212 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -11,7 +11,8 @@ prcm-common = prcm.o powerdomain.o clock-common = clock.o clock_common_data.o \ clockdomain.o clkt_dpll.o \ clkt_clksel.o -clock-omap2xxx = clkt2xxx_dpllcore.o +clock-omap2xxx = clkt2xxx_dpllcore.o \ + clkt2xxx_virt_prcm_set.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(clock-omap2xxx)
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c new file +245 -0
245 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.c +0 -211
223 lines not on this page · raw message
Paul Walmsley
maintainerPATCH 8/18 OMAP2xxx clock: move the APLL clock code into clkt2xxx_apll.c
In reply to Paul WalmsleyMove the APLL-related clock functions from clock2xxx.c to clkt2xxx_apll.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 + arch/arm/mach-omap2/clkt2xxx_apll.c | 120 +++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock2xxx.c | 86 ------------------------- arch/arm/mach-omap2/clock2xxx.h | 1 4 files changed, 124 insertions(+), 86 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt2xxx_apll.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -12,7 +12,8 @@ clock-common = clock.o clock_common_data.o \ clockdomain.o clkt_dpll.o \ clkt_clksel.o clock-omap2xxx = clkt2xxx_dpllcore.o \ - clkt2xxx_virt_prcm_set.o + clkt2xxx_virt_prcm_set.o \ + clkt2xxx_apll.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(clock-omap2xxx)
arch/arm/mach-omap2/clkt2xxx_apll.c new file +120 -0
120 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.c +1 -85
104 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.h +1 -0
@@ -17,6 +17,7 @@ unsigned long omap2_sys_clk_recalc(struct clk *clk);unsigned long omap2_dpllcore_recalc (struct clk *clk);int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate);unsigned long omap2xxx_clk_get_core_rate (struct clk *clk); +u32 omap2xxx_get_apll_clkin (void );/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */ #ifdef CONFIG_ARCH_OMAP2420
Paul Walmsley
maintainerPATCH 9/18 OMAP2xxx clock: move osc_clk code into clkt2xxx_osc.c
In reply to Paul WalmsleyMove the osc_clk clock functions from clock2xxx.c to clkt2xxx_osc.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/clkt2xxx_osc.c | 62 ++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock2xxx.c | 34 +------------------- arch/arm/mach-omap2/clock2xxx.h | 1 + 4 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt2xxx_osc.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -13,7 +13,7 @@ clock-common = clock.o clock_common_data.o \ clkt_clksel.o clock-omap2xxx = clkt2xxx_dpllcore.o \ clkt2xxx_virt_prcm_set.o \ - clkt2xxx_apll.o + clkt2xxx_apll.o clkt2xxx_osc.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(clock-omap2xxx)
arch/arm/mach-omap2/clkt2xxx_osc.c new file +62 -0
62 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.c +2 -32
@@ -79,31 +79,6 @@ const struct clkops clkops_omap2430_i2chs_wait = { .find_companion = omap2_clk_dflt_find_companion, }; -static int omap2_enable_osc_ck (struct clk *clk) -{ -u32 pcc; - - pcc =__raw_readl (prcm_clksrc_ctrl); - -__raw_writel (pcc & ~OMAP_AUTOEXTCLKMODE_MASK , prcm_clksrc_ctrl); - -return 0 ; -} - -static void omap2_disable_osc_ck (struct clk *clk) -{ -u32 pcc; - - pcc =__raw_readl (prcm_clksrc_ctrl); - -__raw_writel (pcc |OMAP_AUTOEXTCLKMODE_MASK , prcm_clksrc_ctrl); -} - -const struct clkops clkops_oscck = { - .enable = omap2_enable_osc_ck, - .disable = omap2_disable_osc_ck, -}; -#ifdef OLD_CK /* Recalculate SYST_CLK */ static void omap2_sys_clk_recalc (struct clk *clk)
@@ -116,7 +91,7 @@ static void omap2_sys_clk_recalc(struct clk *clk) }#endif /* OLD_CK */ -static u32 omap2_get_sysclkdiv (void ) +u32 omap2xxx_get_sysclkdiv (void ) {u32 div;
@@ -127,14 +102,9 @@ static u32 omap2_get_sysclkdiv(void)return div; } -unsigned long omap2_osc_clk_recalc (struct clk *clk) -{ -return omap2xxx_get_apll_clkin () *omap2_get_sysclkdiv (); -} -unsigned long omap2_sys_clk_recalc (struct clk *clk) { -return clk->parent->rate /omap2_get_sysclkdiv (); +return clk->parent->rate /omap2xxx_get_sysclkdiv (); }/*
arch/arm/mach-omap2/clock2xxx.h +1 -0
@@ -18,6 +18,7 @@ unsigned long omap2_dpllcore_recalc(struct clk *clk);int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate);unsigned long omap2xxx_clk_get_core_rate (struct clk *clk);u32 omap2xxx_get_apll_clkin (void ); +u32 omap2xxx_get_sysclkdiv (void );/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */ #ifdef CONFIG_ARCH_OMAP2420
Paul Walmsley
maintainerPATCH 10/18 OMAP2xxx clock: move sys_clk code into clkt2xxx_sys.c
In reply to Paul WalmsleyMove the sys_clk clock functions from clock2xxx.c to clkt2xxx_sys.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 +- arch/arm/mach-omap2/clkt2xxx_sys.c | 50 ++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock2xxx.c | 30 -------------------- arch/arm/mach-omap2/clock2xxx.h | 3 +- arch/arm/mach-omap2/clock2xxx_data.c | 4 +-- 5 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt2xxx_sys.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -13,7 +13,8 @@ clock-common = clock.o clock_common_data.o \ clkt_clksel.o clock-omap2xxx = clkt2xxx_dpllcore.o \ clkt2xxx_virt_prcm_set.o \ - clkt2xxx_apll.o clkt2xxx_osc.o + clkt2xxx_apll.o clkt2xxx_osc.o \ + clkt2xxx_sys.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(clock-omap2xxx)
arch/arm/mach-omap2/clkt2xxx_sys.c new file +50 -0
50 lines not on this page · raw message
arch/arm/mach-omap2/clock2xxx.c +0 -30
@@ -46,8 +46,6 @@struct clk *vclk, *sclk, *dclk; -void __iomem *prcm_clksrc_ctrl; -/*------------------------------------------------------------------------- * Omap24xx specific clock functions *-------------------------------------------------------------------------*/
@@ -79,34 +77,6 @@ const struct clkops clkops_omap2430_i2chs_wait = { .find_companion = omap2_clk_dflt_find_companion, }; -#ifdef OLD_CK -/* Recalculate SYST_CLK */ -static void omap2_sys_clk_recalc (struct clk *clk) -{ -u32 div =PRCM_CLKSRC_CTRL ; - div &= (1 <<7 ) | (1 <<6 );/* Test if ext clk divided by 1 or 2 */ - div >>= clk->rate_offset; - clk->rate = (clk->parent->rate / div); -propagate_rate (clk); -} -#endif /* OLD_CK */ - -u32 omap2xxx_get_sysclkdiv (void ) -{ -u32 div; - - div =__raw_readl (prcm_clksrc_ctrl); - div &=OMAP_SYSCLKDIV_MASK ; - div >>=OMAP_SYSCLKDIV_SHIFT ; - -return div; -} - -unsigned long omap2_sys_clk_recalc (struct clk *clk) -{ -return clk->parent->rate /omap2xxx_get_sysclkdiv (); -} -/* * Set clocks for bypass mode for reboot to work. */
arch/arm/mach-omap2/clock2xxx.h +1 -2
@@ -11,9 +11,8 @@unsigned long omap2_table_mpu_recalc (struct clk *clk);int omap2_select_table_rate (struct clk *clk,unsigned long rate);long omap2_round_to_table_rate (struct clk *clk,unsigned long rate); -unsigned long omap2_sys_clk_recalc (struct clk *clk); +unsigned long omap2xxx_sys_clk_recalc (struct clk *clk);unsigned long omap2_osc_clk_recalc (struct clk *clk); -unsigned long omap2_sys_clk_recalc (struct clk *clk);unsigned long omap2_dpllcore_recalc (struct clk *clk);int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate);unsigned long omap2xxx_clk_get_core_rate (struct clk *clk);
arch/arm/mach-omap2/clock2xxx_data.c +2 -2
@@ -79,7 +79,7 @@ static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */ .ops = &clkops_null, .parent = &osc_ck, .clkdm_name = "wkup_clkdm", - .recalc = &omap2_sys_clk_recalc, + .recalc = &omap2xxx_sys_clk_recalc, };static struct clk alt_ck = {/* Typical 54M or 48M, may not exist */
@@ -2264,7 +2264,7 @@ int __init omap2_clk_init(void) osc_ck.rate =omap2_osc_clk_recalc (&osc_ck);propagate_rate (&osc_ck); - sys_ck.rate =omap2_sys_clk_recalc (&sys_ck); + sys_ck.rate =omap2xxx_sys_clk_recalc (&sys_ck);propagate_rate (&sys_ck);for (c = omap24xx_clks; c < omap24xx_clks +ARRAY_SIZE (omap24xx_clks); c++)
Paul Walmsley
maintainerPATCH 11/18 OMAP2 clock: don't compile OMAP2430-only functions on non-2430 builds
In reply to Paul Walmsleyomap2430_clk_i2chs_find_idlest() doesn't need to be compiled in on non-2430 builds, so skip it in those cases to save memory.
--- arch/arm/mach-omap2/clock2xxx.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock2xxx.c +6 -0
@@ -50,6 +50,8 @@ struct clk *vclk, *sclk, *dclk;* Omap24xx specific clock functions *-------------------------------------------------------------------------*/ +#ifdef CONFIG_ARCH_OMAP2430 +/** * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS * @clk: struct clk * being enabled
@@ -69,6 +71,10 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk, *idlest_bit = clk->enable_bit; } +#else +#define omap2430_clk_i2chs_find_idlest NULL +#endif +/* 2430 I2CHS has non-standard IDLEST register */ const struct clkops clkops_omap2430_i2chs_wait = { .enable = omap2_dflt_clk_enable,
Paul Walmsley
maintainerPATCH 12/18 OMAP3 clock: split out DPLL3 M2 divider functions into clkt3xxx_dpll3m2.c
In reply to Paul WalmsleySplit the DPLL3 M2 divider clock functions out of clock34xx.c and move them into clkt3xxx_dpll3m2.c to improve maintainability.
--- arch/arm/mach-omap2/Makefile | 3 + arch/arm/mach-omap2/clkt3xxx_dpll3m2.c | 120 ++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.c | 90 ------------------------ 3 files changed, 122 insertions(+), 91 deletions(-) create mode 100644 arch/arm/mach-omap2/clkt3xxx_dpll3m2.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -15,11 +15,12 @@ clock-omap2xxx = clkt2xxx_dpllcore.o \ clkt2xxx_virt_prcm_set.o \ clkt2xxx_apll.o clkt2xxx_osc.o \ clkt2xxx_sys.o +clock-omap3xxx = clkt3xxx_dpll3m2.o obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ $(clock-omap2xxx) obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ - $(omap-3-4-common) + $(omap-3-4-common) $(clock-omap3xxx) obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) $(prcm-common) $(clock-common) obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
arch/arm/mach-omap2/clkt3xxx_dpll3m2.c new file +120 -0
120 lines not on this page · raw message
arch/arm/mach-omap2/clock34xx.c +0 -90
102 lines not on this page · raw message
Re: [PATCH 12/18] OMAP3 clock: split out DPLL3 M2 divider functions into clkt3xxx_dpll3m2.c
Quoted 2 lines · Paul Walmsley
Split the DPLL3 M2 divider clock functions out of
clock34xx.cand move them intoclkt3xxx_dpll3m2.cto improve maintainability.
I'm not very familiar with maintainability issues of dpll3m2, so forgive me if it is ignorant for me to ask you to elaborate on this. It does look like a bit of an overkill to have a separate file for a divider. But again, I might well be missing the point.
Regards,
--
Alex
Paul Walmsley
maintainerPATCH 12/18 OMAP3 clock: split out DPLL3 M2 divider functions into clkt3xxx_dpll3m2.c
(cc'ing Ranjith)
Hi Alexander,
Quoted 6 lines · Alexander Shishkin
Quoted 2 lines · Paul Walmsley
Split the DPLL3 M2 divider clock functions out of
clock34xx.cand move them intoclkt3xxx_dpll3m2.cto improve maintainability.I'm not very familiar with maintainability issues of dpll3m2, so forgive me if it is ignorant for me to ask you to elaborate on this.
That is a very good point, those original patch changelogs are pretty crappy. "OMAP clock code - same great taste, now with more maintainability!" I will update them and repost with more detail.
Quoted 2 lines
It does look like a bit of an overkill to have a separate file for a divider. But again, I might well be missing the point.
Yep, this is definitely a borderline case where it might be more appropriate to keep it in the clock34xx.c file. What ultimately motivated splitting it out was the thought that the AM3517/3505 chips probably won't need this function, since I don't believe they support DVFS [1], so we could skip compiling this function for kernels built for those devices via the Makefile, and not need #ifdefs.
Ranjith, could you correct me if I am wrong about the DVFS part?
regards,
- Paul
1. AM35x ARM Microprocessor Technical Reference Manual,
http://www.ti.com/litv/pdf/sprugr0
PATCH 12/18 OMAP3 clock: split out DPLL3 M2 divider functions into clkt3xxx_dpll3m2.c
Paul,
Quoted 19 lines · Paul Walmsley
(cc'ing Ranjith)
Hi Alexander,
Quoted 5 lines · Alexander Shishkin
Quoted 2 lines · Paul Walmsley
Split the DPLL3 M2 divider clock functions out of
clock34xx.cand move them intoclkt3xxx_dpll3m2.cto improve maintainability.I'm not very familiar with maintainability issues of dpll3m2, so forgive me if it is ignorant for me to ask you to elaborate on this.
That is a very good point, those original patch changelogs are pretty crappy. "OMAP clock code - same great taste, now with more maintainability!" I will update them and repost with more detail.
Quoted 2 lines
It does look like a bit of an overkill to have a separate file for a divider. But again, I might well be missing the point.
Quoted 8 lines
Yep, this is definitely a borderline case where it might be more appropriate to keep it in the
clock34xx.cfile. What ultimately motivated splitting it out was the thought that the AM3517/3505 chips probably won't need this function, since I don't believe they support DVFS [1], so we could skip compiling this function for kernels built for those devices via theMakefile, and not need #ifdefs.Ranjith, could you correct me if I am wrong about the DVFS part?
You are right, AM35xx devices do not support DVFS. In fact, the only power management support planned is for the suspend/resume capability with retention (no off mode)
Quoted 3 lines
1. AM35x ARM Microprocessor Technical Reference Manual,
http://www.ti.com/litv/pdf/sprugr0
- Ranjith
Paul Walmsley
maintainerPATCH 13/18 OMAP2/3 clock: clean up omap*_clk_arch_init()
In reply to Paul WalmsleyIn the OMAP3xxx clock code, remove the #ifdef CONFIG_ARCH_OMAP3 in clock34xx.c, since this file is only compiled for OMAP3xxx builds. Also, rename omap2_clk_arch_init in this file to omap3xxx_clk_arch_init() to pave the way for multi-OMAP kernels. Ensure that it is not executed on non-OMAP3xxx systems.
In the OMAP2xxx clock code, rename omap2_clk_arch_init in this file to omap2xxx_clk_arch_init() to pave the way for multi-OMAP kernels. Ensure that it is not executed on non-OMAP2xxx systems.
--- arch/arm/mach-omap2/clock2xxx.c | 7 +++++-- arch/arm/mach-omap2/clock34xx.c | 16 +++++----------- 2 files changed, 10 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/clock2xxx.c +5 -2
@@ -101,11 +101,14 @@ void omap2_clk_prepare_for_reboot(void)* Switch the MPU rate if specified on cmdline. * We cannot do this early until cmdline is parsed. */ -static int __init omap2_clk_arch_init (void ) +static int __init omap2xxx_clk_arch_init (void ) {struct clk *virt_prcm_set, *sys_ck, *dpll_ck, *mpu_ck;unsigned long sys_ck_rate; +if (!cpu_is_omap24xx ()) +return 0 ; +if (!mpurate)return -EINVAL ;
@@ -129,6 +132,6 @@ static int __init omap2_clk_arch_init(void)return 0 ; } -arch_initcall (omap2_clk_arch_init); +arch_initcall (omap2xxx_clk_arch_init);
arch/arm/mach-omap2/clock34xx.c +5 -11
@@ -163,12 +163,6 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)/* Common clock code */ /* -* As it is structured now, this will prevent an OMAP2/3 multiboot -* kernel from compiling. This will need further attention. -*/ -#if defined(CONFIG_ARCH_OMAP3 ) - -/* * Set clocks for bypass mode for reboot to work. */ void omap2_clk_prepare_for_reboot (void )
@@ -213,11 +207,14 @@ void omap3_clk_lock_dpll5(void)* Switch the MPU rate if specified on cmdline. * We cannot do this early until cmdline is parsed. */ -static int __init omap2_clk_arch_init (void ) +static int __init omap3xxx_clk_arch_init (void ) {struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;unsigned long osc_sys_rate; +if (!cpu_is_omap34xx ()) +return 0 ; +if (!mpurate)return -EINVAL ;
@@ -246,9 +243,6 @@ static int __init omap2_clk_arch_init(void)return 0 ; } -arch_initcall (omap2_clk_arch_init); - - -#endif +arch_initcall (omap3xxx_clk_arch_init);
Paul Walmsley
maintainerPATCH 14/18 OMAP2/3 clock: remove unnecessary includes and clean up header
In reply to Paul WalmsleyNow that almost all of the code has been removed from clock2xxx.c and clock34xx.c, many of the includes are now unnecessary and can be removed. While we're here, standardize the initial comment blocks.
--- arch/arm/mach-omap2/clock2xxx.c | 35 ++++++++++------------------------- arch/arm/mach-omap2/clock34xx.c | 16 +++------------- 2 files changed, 13 insertions(+), 38 deletions(-)
arch/arm/mach-omap2/clock2xxx.c +10 -25
@@ -1,15 +1,15 @@/* -* linux/arch/arm/mach-omap2/clock.c +* clock2xxx.c - OMAP2xxx-specific clock integration code * -* Copyright (C) 2005-2008 Texas Instruments, Inc. -* Copyright (C) 2004-2008 Nokia Corporation +* Copyright (C) 2005-2008 Texas Instruments, Inc. +* Copyright (C) 2004-2010 Nokia Corporation * -* Contacts: -* Richard Woodruff <[email protected]> -* Paul Walmsley +* Contacts: +* Richard Woodruff <[email protected]> +* Paul Walmsley * -* Based on earlier work by Tuukka Tikkanen, Tony Lindgren, -* Gordon McNutt and RidgeRun, Inc. +* Based on earlier work by Tuukka Tikkanen, Tony Lindgren, +* Gordon McNutt and RidgeRun, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -17,38 +17,23 @@*/ #undef DEBUG -#include <linux/module.h> #include <linux/kernel.h> -#include <linux/device.h> -#include <linux/list.h> #include <linux/errno.h> -#include <linux/delay.h> #include <linux/clk.h> #include <linux/io.h> -#include <linux/cpufreq.h> -#include <linux/bitops.h> #include <plat/clock.h> -#include <plat/sram.h> -#include <plat/prcm.h> -#include <plat/clkdev_omap.h> -#include <asm/div64.h> -#include <asm/clkdev.h> -#include <plat/sdrc.h> #include "clock.h" #include "clock2xxx.h" -#include "opp2xxx.h" -#include "prm.h" -#include "prm-regbits-24xx.h" #include "cm.h" #include "cm-regbits-24xx.h" struct clk *vclk, *sclk, *dclk; -/*------------------------------------------------------------------------- +/* * Omap24xx specific clock functions -*-------------------------------------------------------------------------*/ +*/ #ifdef CONFIG_ARCH_OMAP2430
arch/arm/mach-omap2/clock34xx.c +3 -13
@@ -2,10 +2,10 @@* OMAP3-specific clock framework functions * * Copyright (C) 2007-2008 Texas Instruments, Inc. -* Copyright (C) 2007-2009 Nokia Corporation +* Copyright (C) 2007-2010 Nokia Corporation * -* Written by Paul Walmsley -* Testing and integration fixes by Jouni H?gander +* Paul Walmsley +* Jouni H?gander * * Parts of this code are based on code written by * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
@@ -16,27 +16,17 @@*/ #undef DEBUG -#include <linux/module.h> #include <linux/kernel.h> -#include <linux/device.h> -#include <linux/list.h> #include <linux/errno.h> #include <linux/delay.h> #include <linux/clk.h> #include <linux/io.h> -#include <linux/limits.h> -#include <linux/bitops.h> #include <plat/cpu.h> #include <plat/clock.h> -#include <plat/sram.h> -#include <plat/sdrc.h> -#include <asm/div64.h> -#include <asm/clkdev.h> #include "clock.h" #include "clock34xx.h" -#include "sdrc.h" #include "prm.h" #include "prm-regbits-34xx.h" #include "cm.h"
Paul Walmsley
maintainerPATCH 15/18 OMAP2/3/4 clock: omap2_clk_prepare_for_reboot() is OMAP2xxx-only
In reply to Paul Walmsleyomap2_clk_prepare_for_reboot() is only applicable to OMAP2xxx chips, so rename it to omap2xxx_clk_prepare_for_reboot() and only call it when running on OMAP2xxx chips. Remove the old stub in the OMAP3 clock code.
--- arch/arm/mach-omap2/clock.h | 1 - arch/arm/mach-omap2/clock2xxx.c | 2 +- arch/arm/mach-omap2/clock2xxx.h | 1 + arch/arm/mach-omap2/clock34xx.c | 21 ++------------------- arch/arm/mach-omap2/clock44xx.c | 5 ----- arch/arm/mach-omap2/prcm.c | 8 +++++--- 6 files changed, 9 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/clock.h +0 -1
@@ -84,7 +84,6 @@ int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent);u32 omap2_get_dpll_rate (struct clk *clk);void omap2_init_dpll_parent (struct clk *clk);int omap2_wait_clock_ready (void __iomem *reg,u32 cval,const char *name); -void omap2_clk_prepare_for_reboot (void );int omap2_dflt_clk_enable (struct clk *clk);void omap2_dflt_clk_disable (struct clk *clk); void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
arch/arm/mach-omap2/clock2xxx.c +1 -1
@@ -71,7 +71,7 @@ const struct clkops clkops_omap2430_i2chs_wait = {/* * Set clocks for bypass mode for reboot to work. */ -void omap2_clk_prepare_for_reboot (void ) +void omap2xxx_clk_prepare_for_reboot (void ) {u32 rate;
arch/arm/mach-omap2/clock2xxx.h +1 -0
@@ -18,6 +18,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);unsigned long omap2xxx_clk_get_core_rate (struct clk *clk);u32 omap2xxx_get_apll_clkin (void );u32 omap2xxx_get_sysclkdiv (void ); +void omap2xxx_clk_prepare_for_reboot (void );/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */ #ifdef CONFIG_ARCH_OMAP2420
arch/arm/mach-omap2/clock34xx.c +2 -19
@@ -150,25 +150,6 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)return omap3_noncore_dpll_set_rate (clk, rate); } -/* Common clock code */ - -/* -* Set clocks for bypass mode for reboot to work. -*/ -void omap2_clk_prepare_for_reboot (void ) -{ -/* REVISIT: Not ready for 343x */ -#if 0 -u32 rate; - -if (vclk ==NULL || sclk ==NULL ) -return ; - - rate =clk_get_rate (sclk); -clk_set_rate (vclk, rate); -#endif -} -void omap3_clk_lock_dpll5 (void ) {struct clk *dpll5_clk;
@@ -191,6 +172,8 @@ void omap3_clk_lock_dpll5(void)return ; } +/* Common clock code */ +/* REVISIT: Move this init stuff out into clock.c */ /*
arch/arm/mach-omap2/clock44xx.c +0 -5
@@ -17,8 +17,3 @@ const struct clkops clkops_noncore_dpll_ops = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable, }; - -void omap2_clk_prepare_for_reboot (void ) -{ -return ; -}
arch/arm/mach-omap2/prcm.c +5 -3
@@ -29,6 +29,7 @@#include <plat/control.h> #include "clock.h" +#include "clock2xxx.h" #include "cm.h" #include "prm.h" #include "prm-regbits-24xx.h"
@@ -136,11 +137,12 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources);void omap_prcm_arch_reset (char mode) {s16 prcm_offs; -omap2_clk_prepare_for_reboot (); -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { +omap2xxx_clk_prepare_for_reboot (); + prcm_offs =WKUP_MOD ; -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {u32 l; prcm_offs =OMAP3430_GR_MOD ;
Paul Walmsley
maintainerPATCH 16/18 OMAP3 DPLL: reorganize static functions
In reply to Paul WalmsleyMove all static functions up to the top of the file to match the practice in other OMAP clock code. Make omap3_noncore_dpll_program() static (noted by sparse) and prepend an underscore to the function name to mark that it is file-local.
--- arch/arm/mach-omap2/dpll3xxx.c | 113 +++++++++++++++++++++------------------- 1 files changed, 58 insertions(+), 55 deletions(-)
arch/arm/mach-omap2/dpll3xxx.c +58 -55
@@ -44,17 +44,7 @@#define MAX_DPLL_WAIT_TRIES 1000000 - -/** -* omap3_dpll_recalc - recalculate DPLL rate -* @clk: DPLL struct clk -* -* Recalculate and propagate the DPLL rate. -*/ -unsigned long omap3_dpll_recalc (struct clk *clk) -{ -return omap2_get_dpll_rate (clk); -} +/* Private functions */ /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ static void _omap3_dpll_write_clken (struct clk *clk,u8 clken_bits)
@@ -136,8 +126,6 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)return f; } -/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */ -/* * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness * @clk: pointer to a DPLL struct clk
@@ -237,6 +225,63 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)return 0 ; } +/* +* _omap3_noncore_dpll_program - set non-core DPLL M,N values directly +* @clk: struct clk * of DPLL to set +* @m: DPLL multiplier to set +* @n: DPLL divider to set +* @freqsel: FREQSEL value to set +* +* Program the DPLL with the supplied M, N values, and wait for the DPLL to +* lock.. Returns -EINVAL upon error, or 0 upon success. +*/ +static int omap3_noncore_dpll_program (struct clk *clk,u16 m,u8 n,u16 freqsel) +{ +struct dpll_data *dd = clk->dpll_data; +u32 v; + +/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ +_omap3_noncore_dpll_bypass (clk); + +/* Set jitter correction */ +if (!cpu_is_omap44xx ()) { + v =__raw_readl (dd->control_reg); + v &= ~dd->freqsel_mask; + v |= freqsel <<__ffs (dd->freqsel_mask); +__raw_writel (v, dd->control_reg); + } + +/* Set DPLL multiplier, divider */ + v =__raw_readl (dd->mult_div1_reg); + v &= ~(dd->mult_mask | dd->div1_mask); + v |= m <<__ffs (dd->mult_mask); + v |= (n -1 ) <<__ffs (dd->div1_mask); +__raw_writel (v, dd->mult_div1_reg); + +/* We let the clock framework set the other output dividers later */ + +/* REVISIT: Set ramp-up delay? */ + +_omap3_noncore_dpll_lock (clk); + +return 0 ; +} + +/* Public functions */ + +/** +* omap3_dpll_recalc - recalculate DPLL rate +* @clk: DPLL struct clk +* +* Recalculate and propagate the DPLL rate. +*/ +unsigned long omap3_dpll_recalc (struct clk *clk) +{ +return omap2_get_dpll_rate (clk); +} + +/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */ +/** * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode * @clk: pointer to a DPLL struct clk
@@ -292,48 +337,6 @@ void omap3_noncore_dpll_disable(struct clk *clk)/* Non-CORE DPLL rate set code */ -/* -* omap3_noncore_dpll_program - set non-core DPLL M,N values directly -* @clk: struct clk * of DPLL to set -* @m: DPLL multiplier to set -* @n: DPLL divider to set -* @freqsel: FREQSEL value to set -* -* Program the DPLL with the supplied M, N values, and wait for the DPLL to -* lock.. Returns -EINVAL upon error, or 0 upon success. -*/ -int omap3_noncore_dpll_program (struct clk *clk,u16 m,u8 n,u16 freqsel) -{ -struct dpll_data *dd = clk->dpll_data; -u32 v; - -/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ -_omap3_noncore_dpll_bypass (clk); - -/* Set jitter correction */ -if (!cpu_is_omap44xx ()) { - v =__raw_readl (dd->control_reg); - v &= ~dd->freqsel_mask; - v |= freqsel <<__ffs (dd->freqsel_mask); -__raw_writel (v, dd->control_reg); - } - -/* Set DPLL multiplier, divider */ - v =__raw_readl (dd->mult_div1_reg); - v &= ~(dd->mult_mask | dd->div1_mask); - v |= m <<__ffs (dd->mult_mask); - v |= (n -1 ) <<__ffs (dd->div1_mask); -__raw_writel (v, dd->mult_div1_reg); - -/* We let the clock framework set the other output dividers later */ - -/* REVISIT: Set ramp-up delay? */ - -_omap3_noncore_dpll_lock (clk); - -return 0 ; -} -/** * omap3_noncore_dpll_set_rate - set non-core DPLL rate * @clk: struct clk * of DPLL to set
Paul Walmsley
maintainerPATCH 17/18 OMAP clock: resolve all remaining sparse warnings
In reply to Paul WalmsleyResolve all remaining sparse warnings in the OMAP clock code.
--- arch/arm/plat-omap/clock.c | 2 +- arch/arm/plat-omap/include/plat/clock.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-omap/clock.c +1 -1
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(clk_get_parent);* OMAP specific clock functions shared between omap1 and omap2 *-------------------------------------------------------------------------*/ -unsigned int __initdata mpurate; +int __initdata mpurate;/* * By default we use the rate set by the bootloader.
arch/arm/plat-omap/include/plat/clock.h +1 -1
@@ -123,7 +123,7 @@ struct clk_functions {#endif }; -extern unsigned int mpurate; +extern int mpurate;extern int clk_init (struct clk_functions *custom_clocks);extern void clk_preinit (struct clk *clk);
Paul Walmsley
maintainerPATCH 18/18 OMAP2/3/4 clock: rename and clean the omap2_clk_init() functions
In reply to Paul WalmsleyRename the omap2_clk_init() in the OMAP2, 3, and 4 clock code to be omap2xxx_clk_init(), omap3xxx_clk_init(), etc. Remove all traces of the (commented) old virt_prcm_set code from omap3xxx_clk_init() and omap4xxx_clk_init(), since this will be handled with the OPP code that is cooking in the PM branch.
After this patch, there should be very little else in the clock code that blocks a multi-OMAP 2+3 kernel. (OMAP2420+OMAP2430 still has some outstanding issues that need to be resolved; this is pending on some additions to the hwmod data.)
--- arch/arm/mach-omap2/clock.h | 1 - arch/arm/mach-omap2/clock2xxx.h | 1 + arch/arm/mach-omap2/clock2xxx_data.c | 2 +- arch/arm/mach-omap2/clock34xx.c | 2 +- arch/arm/mach-omap2/clock34xx.h | 1 + arch/arm/mach-omap2/clock34xx_data.c | 19 +------------------ arch/arm/mach-omap2/clock44xx.h | 2 ++ arch/arm/mach-omap2/clock44xx_data.c | 4 +--- arch/arm/mach-omap2/io.c | 15 +++++++++++++-- 9 files changed, 21 insertions(+), 26 deletions(-)
arch/arm/mach-omap2/clock.h +0 -1
@@ -47,7 +47,6 @@#define DPLL_LOW_POWER_BYPASS 0x5#define DPLL_LOCKED 0x7 -int omap2_clk_init (void );int omap2_clk_enable (struct clk *clk);void omap2_clk_disable (struct clk *clk);long omap2_clk_round_rate (struct clk *clk,unsigned long rate);
arch/arm/mach-omap2/clock2xxx.h +1 -0
@@ -19,6 +19,7 @@ unsigned long omap2xxx_clk_get_core_rate(struct clk *clk);u32 omap2xxx_get_apll_clkin (void );u32 omap2xxx_get_sysclkdiv (void );void omap2xxx_clk_prepare_for_reboot (void ); +int omap2xxx_clk_init (void );/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */ #ifdef CONFIG_ARCH_OMAP2420
arch/arm/mach-omap2/clock2xxx_data.c +1 -1
@@ -2238,7 +2238,7 @@ static struct omap_clk omap24xx_clks[] = {* init code */ -int __init omap2_clk_init (void ) +int __init omap2xxx_clk_init (void ) {const struct prcm_config *prcm;struct omap_clk *c;
arch/arm/mach-omap2/clock34xx.c +1 -1
@@ -150,7 +150,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)return omap3_noncore_dpll_set_rate (clk, rate); } -void omap3_clk_lock_dpll5 (void ) +void __init omap3_clk_lock_dpll5 (void ) {struct clk *dpll5_clk;struct clk *dpll5_m2_clk;
arch/arm/mach-omap2/clock34xx.h +1 -0
@@ -8,6 +8,7 @@#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_34XX_H#define __ARCH_ARM_MACH_OMAP2_CLOCK_34XX_H +int omap3xxx_clk_init (void );int omap3_dpll4_set_rate (struct clk *clk,unsigned long rate);int omap3_core_dpll_m2_set_rate (struct clk *clk,unsigned long rate);void omap3_clk_lock_dpll5 (void );
arch/arm/mach-omap2/clock34xx_data.c +1 -18
@@ -3212,11 +3212,9 @@ static struct omap_clk omap3xxx_clks[] = { }; -int __init omap2_clk_init (void ) +int __init omap3xxx_clk_init (void ) { -/* struct prcm_config *prcm; */ struct omap_clk *c; -/* u32 clkrate; */ u32 cpu_clkflg =CK_3XXX ;if (cpu_is_omap3517 ()) {
@@ -3254,21 +3252,6 @@ int __init omap2_clk_init(void)omap2_init_clk_clkdm (c->lk.clk); } -/* REVISIT: Not yet ready for OMAP3 */ -#if 0 -/* Check the MPU rate set by bootloader */ - clkrate =omap2_get_dpll_rate_24xx (&dpll_ck); -for (prcm = rate_table; prcm->mpu_speed; prcm++) { -if (!(prcm->flags & cpu_mask)) -continue ; -if (prcm->xtal_speed != sys_ck.rate) -continue ; -if (prcm->dpll_speed <= clkrate) -break ; - } - curr_prcm_set = prcm; -#endif -recalculate_root_clocks (); printk(KERN_INFO "Clocking rate (Crystal/Core/MPU): "
arch/arm/mach-omap2/clock44xx.h +2 -0
@@ -10,6 +10,8 @@#define OMAP4430_MAX_DPLL_MULT 2048#define OMAP4430_MAX_DPLL_DIV 128 +int omap4xxx_clk_init (void ); +extern const struct clkops clkops_noncore_dpll_ops;#endif
arch/arm/mach-omap2/clock44xx_data.c +1 -3
@@ -2726,11 +2726,9 @@ static struct omap_clk omap44xx_clks[] = { CLK(NULL, "utmi_p2_gfclk_ck", &utmi_p2_gfclk_ck, CK_443X), }; -int __init omap2_clk_init (void ) +int __init omap4xxx_clk_init (void ) { -/* struct prcm_config *prcm; */ struct omap_clk *c; -/* u32 clkrate; */ u32 cpu_clkflg;if (cpu_is_omap44xx ()) {
arch/arm/mach-omap2/io.c +13 -2
@@ -35,7 +35,9 @@#include <plat/serial.h> #include <plat/vram.h> -#include "clock.h" +#include "clock2xxx.h" +#include "clock34xx.h" +#include "clock44xx.h" #include <plat/omap-pm.h> #include <plat/powerdomain.h>
@@ -320,7 +322,16 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,omap2_mux_init ();omap_pm_if_early_init (mpu_opps, dsp_opps, l3_opps);#endif -omap2_clk_init (); + +if (cpu_is_omap24xx ()) +omap2xxx_clk_init (); +else if (cpu_is_omap34xx ()) +omap3xxx_clk_init (); +else if (cpu_is_omap44xx ()) +omap4xxx_clk_init (); +else +pr_err ("Could not init clock framework - unknown CPU\n" ); +omap_serial_early_init ();#ifndef CONFIG_ARCH_OMAP4 omap_hwmod_late_init ();