aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-07-02 04:47:40 -0400
committerPaul Walmsley <paul@pwsan.com>2014-07-15 16:08:59 -0400
commita24886e263ec4b7062c88cfa84577080ea00da94 (patch)
tree57a4f018bac5132f4cfdaaa3194ea7a8e9664940
parent8111e01045c1b3ac6b5d3c2ee3b8dc562efdf3ae (diff)
ARM: OMAP2+: clock: add fint values to the ti_clk_features struct
These are SoC specific and get their init values based on the SoC type. Previously the values were hard coded within the DPLL clock code, but having them inside the clock features avoids runtime cpu_is_X type checks. Signed-off-by: Tero Kristo <t-kristo@ti.com> Reviewed-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c34
-rw-r--r--arch/arm/mach-omap2/clock.c23
-rw-r--r--arch/arm/mach-omap2/clock.h4
3 files changed, 39 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 332af927f4d3..05168c98b3d9 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -44,20 +44,12 @@
44#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \ 44#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \
45 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE)) 45 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE))
46 46
47/* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */
48#define OMAP3430_DPLL_FINT_BAND1_MIN 750000
49#define OMAP3430_DPLL_FINT_BAND1_MAX 2100000
50#define OMAP3430_DPLL_FINT_BAND2_MIN 7500000
51#define OMAP3430_DPLL_FINT_BAND2_MAX 21000000
52
53/* 47/*
54 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx. 48 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx.
55 * From device data manual section 4.3 "DPLL and DLL Specifications". 49 * From device data manual section 4.3 "DPLL and DLL Specifications".
56 */ 50 */
57#define OMAP3PLUS_DPLL_FINT_JTYPE_MIN 500000 51#define OMAP3PLUS_DPLL_FINT_JTYPE_MIN 500000
58#define OMAP3PLUS_DPLL_FINT_JTYPE_MAX 2500000 52#define OMAP3PLUS_DPLL_FINT_JTYPE_MAX 2500000
59#define OMAP3PLUS_DPLL_FINT_MIN 32000
60#define OMAP3PLUS_DPLL_FINT_MAX 52000000
61 53
62/* _dpll_test_fint() return codes */ 54/* _dpll_test_fint() return codes */
63#define DPLL_FINT_UNDERFLOW -1 55#define DPLL_FINT_UNDERFLOW -1
@@ -87,33 +79,31 @@ static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
87 /* DPLL divider must result in a valid jitter correction val */ 79 /* DPLL divider must result in a valid jitter correction val */
88 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n; 80 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
89 81
90 if (cpu_is_omap24xx()) { 82 if (dd->flags & DPLL_J_TYPE) {
91 /* Should not be called for OMAP2, so warn if it is called */
92 WARN(1, "No fint limits available for OMAP2!\n");
93 return DPLL_FINT_INVALID;
94 } else if (cpu_is_omap3430()) {
95 fint_min = OMAP3430_DPLL_FINT_BAND1_MIN;
96 fint_max = OMAP3430_DPLL_FINT_BAND2_MAX;
97 } else if (dd->flags & DPLL_J_TYPE) {
98 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN; 83 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN;
99 fint_max = OMAP3PLUS_DPLL_FINT_JTYPE_MAX; 84 fint_max = OMAP3PLUS_DPLL_FINT_JTYPE_MAX;
100 } else { 85 } else {
101 fint_min = OMAP3PLUS_DPLL_FINT_MIN; 86 fint_min = ti_clk_features.fint_min;
102 fint_max = OMAP3PLUS_DPLL_FINT_MAX; 87 fint_max = ti_clk_features.fint_max;
88 }
89
90 if (!fint_min || !fint_max) {
91 WARN(1, "No fint limits available!\n");
92 return DPLL_FINT_INVALID;
103 } 93 }
104 94
105 if (fint < fint_min) { 95 if (fint < ti_clk_features.fint_min) {
106 pr_debug("rejecting n=%d due to Fint failure, lowering max_divider\n", 96 pr_debug("rejecting n=%d due to Fint failure, lowering max_divider\n",
107 n); 97 n);
108 dd->max_divider = n; 98 dd->max_divider = n;
109 ret = DPLL_FINT_UNDERFLOW; 99 ret = DPLL_FINT_UNDERFLOW;
110 } else if (fint > fint_max) { 100 } else if (fint > ti_clk_features.fint_max) {
111 pr_debug("rejecting n=%d due to Fint failure, boosting min_divider\n", 101 pr_debug("rejecting n=%d due to Fint failure, boosting min_divider\n",
112 n); 102 n);
113 dd->min_divider = n; 103 dd->min_divider = n;
114 ret = DPLL_FINT_INVALID; 104 ret = DPLL_FINT_INVALID;
115 } else if (cpu_is_omap3430() && fint > OMAP3430_DPLL_FINT_BAND1_MAX && 105 } else if (fint > ti_clk_features.fint_band1_max &&
116 fint < OMAP3430_DPLL_FINT_BAND2_MIN) { 106 fint < ti_clk_features.fint_band2_min) {
117 pr_debug("rejecting n=%d due to Fint failure\n", n); 107 pr_debug("rejecting n=%d due to Fint failure\n", n);
118 ret = DPLL_FINT_INVALID; 108 ret = DPLL_FINT_INVALID;
119 } 109 }
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 7897053ce676..7efe66e3a029 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -51,6 +51,19 @@ u16 cpu_mask;
51 */ 51 */
52struct ti_clk_features ti_clk_features; 52struct ti_clk_features ti_clk_features;
53 53
54/* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */
55#define OMAP3430_DPLL_FINT_BAND1_MIN 750000
56#define OMAP3430_DPLL_FINT_BAND1_MAX 2100000
57#define OMAP3430_DPLL_FINT_BAND2_MIN 7500000
58#define OMAP3430_DPLL_FINT_BAND2_MAX 21000000
59
60/*
61 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx.
62 * From device data manual section 4.3 "DPLL and DLL Specifications".
63 */
64#define OMAP3PLUS_DPLL_FINT_MIN 32000
65#define OMAP3PLUS_DPLL_FINT_MAX 52000000
66
54/* 67/*
55 * clkdm_control: if true, then when a clock is enabled in the 68 * clkdm_control: if true, then when a clock is enabled in the
56 * hardware, its clockdomain will first be enabled; and when a clock 69 * hardware, its clockdomain will first be enabled; and when a clock
@@ -744,4 +757,14 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
744 */ 757 */
745void __init ti_clk_init_features(void) 758void __init ti_clk_init_features(void)
746{ 759{
760 /* Fint setup for DPLLs */
761 if (cpu_is_omap3430()) {
762 ti_clk_features.fint_min = OMAP3430_DPLL_FINT_BAND1_MIN;
763 ti_clk_features.fint_max = OMAP3430_DPLL_FINT_BAND2_MAX;
764 ti_clk_features.fint_band1_max = OMAP3430_DPLL_FINT_BAND1_MAX;
765 ti_clk_features.fint_band2_min = OMAP3430_DPLL_FINT_BAND2_MIN;
766 } else {
767 ti_clk_features.fint_min = OMAP3PLUS_DPLL_FINT_MIN;
768 ti_clk_features.fint_max = OMAP3PLUS_DPLL_FINT_MAX;
769 }
747} 770}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 9b89cc03869e..02aa2e3ac036 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -228,6 +228,10 @@ extern u16 cpu_mask;
228 */ 228 */
229struct ti_clk_features { 229struct ti_clk_features {
230 u32 flags; 230 u32 flags;
231 long fint_min;
232 long fint_max;
233 long fint_band1_max;
234 long fint_band2_min;
231}; 235};
232extern struct ti_clk_features ti_clk_features; 236extern struct ti_clk_features ti_clk_features;
233 237