*/
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
-unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
+unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
{
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}
-EXPORT_SYMBOL(icst307_khz);
+EXPORT_SYMBOL(icst307_hz);
/*
* Ascending divisor S values.
static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
struct icst_vco
-icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
+icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
{
struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
unsigned long f;
return vco;
}
-EXPORT_SYMBOL(icst307_khz_to_vco);
+EXPORT_SYMBOL(icst307_hz_to_vco);
*/
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
-unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
+unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
{
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}
-EXPORT_SYMBOL(icst525_khz);
+EXPORT_SYMBOL(icst525_hz);
/*
* Ascending divisor S values.
static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
struct icst_vco
-icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
+icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
{
struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
unsigned long f;
return vco;
}
-EXPORT_SYMBOL(icst525_khz_to_vco);
+EXPORT_SYMBOL(icst525_hz_to_vco);
#include <asm/hardware/icst.h>
-unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
+unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long freq);
/*
* ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
* This frequency is pre-output divider.
*/
-#define ICST307_VCO_MIN 6000
-#define ICST307_VCO_MAX 200000
+#define ICST307_VCO_MIN 6000000
+#define ICST307_VCO_MAX 200000000
#endif
#include <asm/hardware/icst.h>
-unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
+unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long freq);
/*
* ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
* This frequency is pre-output divider.
*/
-#define ICST525_VCO_MIN 10000
-#define ICST525_VCO_MAX_3V 200000
-#define ICST525_VCO_MAX_5V 320000
+#define ICST525_VCO_MIN 10000000
+#define ICST525_VCO_MAX_3V 200000000
+#define ICST525_VCO_MAX_5V 320000000
#endif
long clk_round_rate(struct clk *clk, unsigned long rate)
{
struct icst_vco vco;
- vco = icst525_khz_to_vco(clk->params, rate / 1000);
- return icst525_khz(clk->params, vco) * 1000;
+ vco = icst525_hz_to_vco(clk->params, rate);
+ return icst525_hz(clk->params, vco);
}
EXPORT_SYMBOL(clk_round_rate);
if (clk->setvco) {
struct icst_vco vco;
- vco = icst525_khz_to_vco(clk->params, rate / 1000);
- clk->rate = icst525_khz(clk->params, vco) * 1000;
+ vco = icst525_hz_to_vco(clk->params, rate);
+ clk->rate = icst525_hz(clk->params, vco);
clk->setvco(clk, vco);
ret = 0;
}
#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
static const struct icst_params lclk_params = {
- .ref = 24000,
+ .ref = 24000000,
.vco_max = ICST525_VCO_MAX_5V,
.vd_min = 8,
.vd_max = 132,
};
static const struct icst_params cclk_params = {
- .ref = 24000,
+ .ref = 24000000,
.vco_max = ICST525_VCO_MAX_5V,
.vd_min = 12,
.vd_max = 160,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
- vco = icst525_khz_to_vco(&cclk_params, policy->max);
- policy->max = icst525_khz(&cclk_params, vco);
+ vco = icst525_hz_to_vco(&cclk_params, policy->max * 1000);
+ policy->max = icst525_hz(&cclk_params, vco) / 1000;
- vco = icst525_khz_to_vco(&cclk_params, policy->min);
- policy->min = icst525_khz(&cclk_params, vco);
+ vco = icst525_hz_to_vco(&cclk_params, policy->min * 1000);
+ policy->min = icst525_hz(&cclk_params, vco) / 1000;
cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
}
vco.v = cm_osc & 255;
vco.r = 22;
- freqs.old = icst525_khz(&cclk_params, vco);
+ freqs.old = icst525_hz(&cclk_params, vco) / 1000;
- /* icst525_khz_to_vco rounds down -- so we need the next
+ /* icst525_hz_to_vco rounds down -- so we need the next
* larger freq in case of CPUFREQ_RELATION_L.
*/
if (relation == CPUFREQ_RELATION_L)
target_freq += 999;
if (target_freq > policy->max)
target_freq = policy->max;
- vco = icst525_khz_to_vco(&cclk_params, target_freq);
- freqs.new = icst525_khz(&cclk_params, vco);
+ vco = icst525_hz_to_vco(&cclk_params, target_freq * 1000);
+ freqs.new = icst525_hz(&cclk_params, vco) / 1000;
freqs.cpu = policy->cpu;
vco.v = cm_osc & 255;
vco.r = 22;
- current_freq = icst525_khz(&cclk_params, vco); /* current freq */
+ current_freq = icst525_hz(&cclk_params, vco) / 1000; /* current freq */
set_cpus_allowed(current, cpus_allowed);
};
static const struct icst_params impd1_vco_params = {
- .ref = 24000, /* 24 MHz */
+ .ref = 24000000, /* 24 MHz */
.vco_max = ICST525_VCO_MAX_3V,
.vd_min = 12,
.vd_max = 519,
vco.r = (val >> 9) & 0x7f;
vco.s = (val >> 16) & 7;
- pr_debug("IM-PD1: VCO%d clock is %ld kHz\n",
- vconr, icst525_khz(&impd1_vco_params, vco));
+ pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
+ vconr, icst525_hz(&impd1_vco_params, vco));
#endif
}
#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
static const struct icst_params cp_auxvco_params = {
- .ref = 24000,
+ .ref = 24000000,
.vco_max = ICST525_VCO_MAX_5V,
.vd_min = 8,
.vd_max = 263,
long clk_round_rate(struct clk *clk, unsigned long rate)
{
struct icst_vco vco;
- vco = icst307_khz_to_vco(clk->params, rate / 1000);
- return icst307_khz(clk->params, vco) * 1000;
+ vco = icst307_hz_to_vco(clk->params, rate);
+ return icst307_hz(clk->params, vco);
}
EXPORT_SYMBOL(clk_round_rate);
if (clk->setvco) {
struct icst_vco vco;
- vco = icst307_khz_to_vco(clk->params, rate / 1000);
- clk->rate = icst307_khz(clk->params, vco) * 1000;
+ vco = icst307_hz_to_vco(clk->params, rate);
+ clk->rate = icst307_hz(clk->params, vco);
clk->setvco(clk, vco);
ret = 0;
}
* Clock handling
*/
static const struct icst_params realview_oscvco_params = {
- .ref = 24000,
+ .ref = 24000000,
.vco_max = ICST307_VCO_MAX,
.vd_min = 4 + 8,
.vd_max = 511 + 8,
long clk_round_rate(struct clk *clk, unsigned long rate)
{
struct icst_vco vco;
- vco = icst307_khz_to_vco(clk->params, rate / 1000);
- return icst307_khz(clk->params, vco) * 1000;
+ vco = icst307_hz_to_vco(clk->params, rate);
+ return icst307_hz(clk->params, vco);
}
EXPORT_SYMBOL(clk_round_rate);
if (clk->setvco) {
struct icst_vco vco;
- vco = icst307_khz_to_vco(clk->params, rate / 1000);
- clk->rate = icst307_khz(clk->params, vco) * 1000;
+ vco = icst307_hz_to_vco(clk->params, rate);
+ clk->rate = icst307_hz(clk->params, vco);
clk->setvco(clk, vco);
ret = 0;
}
* Clock handling
*/
static const struct icst_params versatile_oscvco_params = {
- .ref = 24000,
+ .ref = 24000000,
.vco_max = ICST307_VCO_MAX,
.vd_min = 4 + 8,
.vd_max = 511 + 8,