diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/icst307.c | 64 | ||||
-rw-r--r-- | arch/arm/common/icst525.c | 65 | ||||
-rw-r--r-- | arch/arm/include/asm/hardware/icst307.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/hardware/icst525.h | 1 |
4 files changed, 0 insertions, 131 deletions
diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst307.c index 2eebd960c01b..f78f5b5880c2 100644 --- a/arch/arm/common/icst307.c +++ b/arch/arm/common/icst307.c | |||
@@ -95,67 +95,3 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | EXPORT_SYMBOL(icst307_khz_to_vco); | 97 | EXPORT_SYMBOL(icst307_khz_to_vco); |
98 | |||
99 | struct icst_vco | ||
100 | icst307_ps_to_vco(const struct icst_params *p, unsigned long period) | ||
101 | { | ||
102 | struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; | ||
103 | unsigned long f, ps; | ||
104 | unsigned int i = 0, rd, best = (unsigned int)-1; | ||
105 | |||
106 | ps = 1000000000UL / p->vco_max; | ||
107 | |||
108 | /* | ||
109 | * First, find the PLL output divisor such | ||
110 | * that the PLL output is within spec. | ||
111 | */ | ||
112 | do { | ||
113 | f = period / s2div[idx2s[i]]; | ||
114 | |||
115 | /* | ||
116 | * f must be between 6MHz and 200MHz (3.3 or 5V) | ||
117 | */ | ||
118 | if (f >= ps && f < 1000000000UL / 6000 + 1) | ||
119 | break; | ||
120 | } while (i < ARRAY_SIZE(idx2s)); | ||
121 | |||
122 | if (i >= ARRAY_SIZE(idx2s)) | ||
123 | return vco; | ||
124 | |||
125 | vco.s = idx2s[i]; | ||
126 | |||
127 | ps = 500000000UL / p->ref; | ||
128 | |||
129 | /* | ||
130 | * Now find the closest divisor combination | ||
131 | * which gives a PLL output of 'f'. | ||
132 | */ | ||
133 | for (rd = p->rd_min; rd <= p->rd_max; rd++) { | ||
134 | unsigned long f_in_div, f_pll; | ||
135 | unsigned int vd; | ||
136 | int f_diff; | ||
137 | |||
138 | f_in_div = ps * rd; | ||
139 | |||
140 | vd = (f_in_div + f / 2) / f; | ||
141 | if (vd < p->vd_min || vd > p->vd_max) | ||
142 | continue; | ||
143 | |||
144 | f_pll = (f_in_div + vd / 2) / vd; | ||
145 | f_diff = f_pll - f; | ||
146 | if (f_diff < 0) | ||
147 | f_diff = -f_diff; | ||
148 | |||
149 | if ((unsigned)f_diff < best) { | ||
150 | vco.v = vd - 8; | ||
151 | vco.r = rd - 2; | ||
152 | if (f_diff == 0) | ||
153 | break; | ||
154 | best = f_diff; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | return vco; | ||
159 | } | ||
160 | |||
161 | EXPORT_SYMBOL(icst307_ps_to_vco); | ||
diff --git a/arch/arm/common/icst525.c b/arch/arm/common/icst525.c index fd5c2e7ed176..eadf983ee434 100644 --- a/arch/arm/common/icst525.c +++ b/arch/arm/common/icst525.c | |||
@@ -93,68 +93,3 @@ icst525_khz_to_vco(const struct icst_params *p, unsigned long freq) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | EXPORT_SYMBOL(icst525_khz_to_vco); | 95 | EXPORT_SYMBOL(icst525_khz_to_vco); |
96 | |||
97 | struct icst_vco | ||
98 | icst525_ps_to_vco(const struct icst_params *p, unsigned long period) | ||
99 | { | ||
100 | struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; | ||
101 | unsigned long f, ps; | ||
102 | unsigned int i = 0, rd, best = (unsigned int)-1; | ||
103 | |||
104 | ps = 1000000000UL / p->vco_max; | ||
105 | |||
106 | /* | ||
107 | * First, find the PLL output divisor such | ||
108 | * that the PLL output is within spec. | ||
109 | */ | ||
110 | do { | ||
111 | f = period / s2div[idx2s[i]]; | ||
112 | |||
113 | /* | ||
114 | * f must be between 10MHz and | ||
115 | * 320MHz (5V) or 200MHz (3V) | ||
116 | */ | ||
117 | if (f >= ps && f < 100000) | ||
118 | break; | ||
119 | } while (i < ARRAY_SIZE(idx2s)); | ||
120 | |||
121 | if (i >= ARRAY_SIZE(idx2s)) | ||
122 | return vco; | ||
123 | |||
124 | vco.s = idx2s[i]; | ||
125 | |||
126 | ps = 500000000UL / p->ref; | ||
127 | |||
128 | /* | ||
129 | * Now find the closest divisor combination | ||
130 | * which gives a PLL output of 'f'. | ||
131 | */ | ||
132 | for (rd = p->rd_min; rd <= p->rd_max; rd++) { | ||
133 | unsigned long f_in_div, f_pll; | ||
134 | unsigned int vd; | ||
135 | int f_diff; | ||
136 | |||
137 | f_in_div = ps * rd; | ||
138 | |||
139 | vd = (f_in_div + f / 2) / f; | ||
140 | if (vd < p->vd_min || vd > p->vd_max) | ||
141 | continue; | ||
142 | |||
143 | f_pll = (f_in_div + vd / 2) / vd; | ||
144 | f_diff = f_pll - f; | ||
145 | if (f_diff < 0) | ||
146 | f_diff = -f_diff; | ||
147 | |||
148 | if ((unsigned)f_diff < best) { | ||
149 | vco.v = vd - 8; | ||
150 | vco.r = rd - 2; | ||
151 | if (f_diff == 0) | ||
152 | break; | ||
153 | best = f_diff; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | return vco; | ||
158 | } | ||
159 | |||
160 | EXPORT_SYMBOL(icst525_ps_to_vco); | ||
diff --git a/arch/arm/include/asm/hardware/icst307.h b/arch/arm/include/asm/hardware/icst307.h index 85932e902e99..8d0820a654db 100644 --- a/arch/arm/include/asm/hardware/icst307.h +++ b/arch/arm/include/asm/hardware/icst307.h | |||
@@ -20,6 +20,5 @@ | |||
20 | 20 | ||
21 | unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco); | 21 | unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco); |
22 | struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq); | 22 | struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq); |
23 | struct icst_vco icst307_ps_to_vco(const struct icst_params *p, unsigned long period); | ||
24 | 23 | ||
25 | #endif | 24 | #endif |
diff --git a/arch/arm/include/asm/hardware/icst525.h b/arch/arm/include/asm/hardware/icst525.h index 170deb2b605b..42a274e59fa2 100644 --- a/arch/arm/include/asm/hardware/icst525.h +++ b/arch/arm/include/asm/hardware/icst525.h | |||
@@ -18,6 +18,5 @@ | |||
18 | 18 | ||
19 | unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco); | 19 | unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco); |
20 | struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq); | 20 | struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq); |
21 | struct icst_vco icst525_ps_to_vco(const struct icst_params *p, unsigned long period); | ||
22 | 21 | ||
23 | #endif | 22 | #endif |