aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clkt_dpll.c
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 /arch/arm/mach-omap2/clkt_dpll.c
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>
Diffstat (limited to 'arch/arm/mach-omap2/clkt_dpll.c')
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c34
1 files changed, 12 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 }