diff options
author | Paul Walmsley <paul@pwsan.com> | 2010-02-23 00:09:20 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-02-24 14:16:15 -0500 |
commit | 657ebfadc19c5a14f709dee1645082828330d5d4 (patch) | |
tree | 26d615ae6e76437e0852b8d7fc060a070786f369 /arch/arm/mach-omap2/clock3xxx.c | |
parent | b92c170d019db7554db95380d2e1dfb3a368e350 (diff) |
OMAP3/4 clock: split into per-chip family files
clock34xx_data.c now contains data for the OMAP34xx family, the
OMAP36xx family, and the OMAP3517 family, so rename it to
clock3xxx_data.c. Rename clock34xx.c to clock3xxx.c, and move the
chip family-specific clock functions to clock34xx.c, clock36xx.c, or
clock3517.c, as appropriate. So now "clock3xxx.*" refers to the OMAP3
superset.
The main goal here is to prepare to compile chip family-specific clock
functions only for kernel builds that target that chip family. To get to
that point, we also need to add CONFIG_SOC_* options for those other
chip families; that will be done in future patches, planned for 2.6.35.
OMAP4 is also affected by this. It duplicated the OMAP3 non-CORE DPLL
clkops structure. The OMAP4 variant of this clkops structure has been
removed, and since there was nothing else currently in clock44xx.c, it
too has been removed -- it can always be added back later when there
is some content for it. (The OMAP4 clock autogeneration scripts have been
updated accordingly.)
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Ranjith Lohithakshan <ranjithl@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock3xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/clock3xxx.c | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c new file mode 100644 index 000000000000..d142457cd041 --- /dev/null +++ b/arch/arm/mach-omap2/clock3xxx.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * OMAP3-specific clock framework functions | ||
3 | * | ||
4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2007-2010 Nokia Corporation | ||
6 | * | ||
7 | * Paul Walmsley | ||
8 | * Jouni Högander | ||
9 | * | ||
10 | * Parts of this code are based on code written by | ||
11 | * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | #undef DEBUG | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/err.h> | ||
25 | |||
26 | #include <plat/cpu.h> | ||
27 | #include <plat/clock.h> | ||
28 | |||
29 | #include "clock.h" | ||
30 | #include "clock3xxx.h" | ||
31 | #include "prm.h" | ||
32 | #include "prm-regbits-34xx.h" | ||
33 | #include "cm.h" | ||
34 | #include "cm-regbits-34xx.h" | ||
35 | |||
36 | /* | ||
37 | * DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks | ||
38 | * that are sourced by DPLL5, and both of these require this clock | ||
39 | * to be at 120 MHz for proper operation. | ||
40 | */ | ||
41 | #define DPLL5_FREQ_FOR_USBHOST 120000000 | ||
42 | |||
43 | /* needed by omap3_core_dpll_m2_set_rate() */ | ||
44 | struct clk *sdrc_ick_p, *arm_fck_p; | ||
45 | |||
46 | int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) | ||
47 | { | ||
48 | /* | ||
49 | * According to the 12-5 CDP code from TI, "Limitation 2.5" | ||
50 | * on 3430ES1 prevents us from changing DPLL multipliers or dividers | ||
51 | * on DPLL4. | ||
52 | */ | ||
53 | if (omap_rev() == OMAP3430_REV_ES1_0) { | ||
54 | pr_err("clock: DPLL4 cannot change rate due to " | ||
55 | "silicon 'Limitation 2.5' on 3430ES1.\n"); | ||
56 | return -EINVAL; | ||
57 | } | ||
58 | |||
59 | return omap3_noncore_dpll_set_rate(clk, rate); | ||
60 | } | ||
61 | |||
62 | void __init omap3_clk_lock_dpll5(void) | ||
63 | { | ||
64 | struct clk *dpll5_clk; | ||
65 | struct clk *dpll5_m2_clk; | ||
66 | |||
67 | dpll5_clk = clk_get(NULL, "dpll5_ck"); | ||
68 | clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST); | ||
69 | clk_enable(dpll5_clk); | ||
70 | |||
71 | /* Enable autoidle to allow it to enter low power bypass */ | ||
72 | omap3_dpll_allow_idle(dpll5_clk); | ||
73 | |||
74 | /* Program dpll5_m2_clk divider for no division */ | ||
75 | dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck"); | ||
76 | clk_enable(dpll5_m2_clk); | ||
77 | clk_set_rate(dpll5_m2_clk, DPLL5_FREQ_FOR_USBHOST); | ||
78 | |||
79 | clk_disable(dpll5_m2_clk); | ||
80 | clk_disable(dpll5_clk); | ||
81 | return; | ||
82 | } | ||
83 | |||
84 | /* Common clock code */ | ||
85 | |||
86 | /* REVISIT: Move this init stuff out into clock.c */ | ||
87 | |||
88 | /* | ||
89 | * Switch the MPU rate if specified on cmdline. | ||
90 | * We cannot do this early until cmdline is parsed. | ||
91 | */ | ||
92 | static int __init omap3xxx_clk_arch_init(void) | ||
93 | { | ||
94 | struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck; | ||
95 | unsigned long osc_sys_rate; | ||
96 | bool err = 0; | ||
97 | |||
98 | if (!cpu_is_omap34xx()) | ||
99 | return 0; | ||
100 | |||
101 | if (!mpurate) | ||
102 | return -EINVAL; | ||
103 | |||
104 | /* XXX test these for success */ | ||
105 | dpll1_ck = clk_get(NULL, "dpll1_ck"); | ||
106 | if (WARN(IS_ERR(dpll1_ck), "Failed to get dpll1_ck.\n")) | ||
107 | err = 1; | ||
108 | |||
109 | arm_fck = clk_get(NULL, "arm_fck"); | ||
110 | if (WARN(IS_ERR(arm_fck), "Failed to get arm_fck.\n")) | ||
111 | err = 1; | ||
112 | |||
113 | core_ck = clk_get(NULL, "core_ck"); | ||
114 | if (WARN(IS_ERR(core_ck), "Failed to get core_ck.\n")) | ||
115 | err = 1; | ||
116 | |||
117 | osc_sys_ck = clk_get(NULL, "osc_sys_ck"); | ||
118 | if (WARN(IS_ERR(osc_sys_ck), "Failed to get osc_sys_ck.\n")) | ||
119 | err = 1; | ||
120 | |||
121 | if (err) | ||
122 | return -ENOENT; | ||
123 | |||
124 | /* REVISIT: not yet ready for 343x */ | ||
125 | if (clk_set_rate(dpll1_ck, mpurate)) | ||
126 | printk(KERN_ERR "*** Unable to set MPU rate\n"); | ||
127 | |||
128 | recalculate_root_clocks(); | ||
129 | |||
130 | osc_sys_rate = clk_get_rate(osc_sys_ck); | ||
131 | |||
132 | pr_info("Switched to new clocking rate (Crystal/Core/MPU): " | ||
133 | "%ld.%01ld/%ld/%ld MHz\n", | ||
134 | (osc_sys_rate / 1000000), | ||
135 | ((osc_sys_rate / 100000) % 10), | ||
136 | (clk_get_rate(core_ck) / 1000000), | ||
137 | (clk_get_rate(arm_fck) / 1000000)); | ||
138 | |||
139 | calibrate_delay(); | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | arch_initcall(omap3xxx_clk_arch_init); | ||
144 | |||
145 | |||