Commit 1938a0e6 authored by Russell King's avatar Russell King

[ARM] cpufreq updates - new, more flexible initialisation handling.

This round of cpufreq cleanups came from Dominik's work on the core
cpufreq code.
parent 09146235
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 2001 Deep Blue Solutions Ltd. * Copyright (C) 2001 Deep Blue Solutions Ltd.
* *
* $Id: cpu.c,v 1.4 2002/05/29 11:41:55 rmk Exp $ * $Id: cpu.c,v 1.5 2002/07/06 16:53:17 rmk Exp $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -121,8 +121,16 @@ static int __init cpu_init(void) ...@@ -121,8 +121,16 @@ static int __init cpu_init(void)
cpu_freq_khz = vco_to_freq(vco, 1); cpu_freq_khz = vco_to_freq(vco, 1);
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
cpufreq_init(cpu_freq_khz, 1000, 0); {
cpufreq_setfunctions(integrator_validatespeed, integrator_setspeed); struct cpufreq_driver cpufreq_driver;
cpufreq_driver.freq.min = 12000;
cpufreq_driver.freq.max = 160000;
cpufreq_driver.freq.cur = cpu_freq_khz;
cpufreq_driver.validate = &integrator_validatespeed;
cpufreq_driver.setspeed = &integrator_setspeed;
cpufreq_register(cpufreq_driver);
}
#endif #endif
cm_stat = __raw_readl(CM_STAT); cm_stat = __raw_readl(CM_STAT);
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz); extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
extern unsigned int sa11x0_validatespeed(unsigned int khz); extern unsigned int sa11x0_validatespeed(unsigned int khz);
extern unsigned int sa11x0_getspeed(void);
typedef struct { typedef struct {
int speed; int speed;
...@@ -187,7 +187,7 @@ static void sa1100_update_dram_timings(int current_speed, int new_speed) ...@@ -187,7 +187,7 @@ static void sa1100_update_dram_timings(int current_speed, int new_speed)
static int sa1100_dram_notifier(struct notifier_block *nb, static int sa1100_dram_notifier(struct notifier_block *nb,
unsigned long val, void *data) unsigned long val, void *data)
{ {
struct cpufreq_info *ci = data; struct cpufreq_freqs *ci = data;
switch(val) { switch(val) {
case CPUFREQ_MINMAX: case CPUFREQ_MINMAX:
...@@ -195,13 +195,13 @@ static int sa1100_dram_notifier(struct notifier_block *nb, ...@@ -195,13 +195,13 @@ static int sa1100_dram_notifier(struct notifier_block *nb,
break; break;
case CPUFREQ_PRECHANGE: case CPUFREQ_PRECHANGE:
if(ci->new_freq > ci->old_freq) if(ci->new > ci->cur)
sa1100_update_dram_timings(ci->old_freq, ci->new_freq); sa1100_update_dram_timings(ci->cur, ci->new);
break; break;
case CPUFREQ_POSTCHANGE: case CPUFREQ_POSTCHANGE:
if(ci->new_freq < ci->old_freq) if(ci->new < ci->cur)
sa1100_update_dram_timings(ci->old_freq, ci->new_freq); sa1100_update_dram_timings(ci->cur, ci->new);
break; break;
default: default:
...@@ -230,9 +230,19 @@ static int __init sa1100_dram_init(void) ...@@ -230,9 +230,19 @@ static int __init sa1100_dram_init(void)
int ret = -ENODEV; int ret = -ENODEV;
if ((processor_id & CPU_SA1100_MASK) == CPU_SA1100_ID) { if ((processor_id & CPU_SA1100_MASK) == CPU_SA1100_ID) {
cpufreq_driver_t cpufreq_driver;
ret = cpufreq_register_notifier(&sa1100_dram_block); ret = cpufreq_register_notifier(&sa1100_dram_block);
if (ret)
return ret;
cpufreq_driver.freq.min = 59000;
cpufreq_driver.freq.max = 287000;
cpufreq_driver.freq.cur = sa11x0_getspeed();
cpufreq_driver.validate = &sa11x0_validatespeed;
cpufreq_driver.setspeed = &sa1100_setspeed;
cpufreq_setfunctions(sa11x0_validatespeed, sa1100_setspeed); ret = cpufreq_register(cpufreq_driver);<
} }
return ret; return ret;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 2001 Russell King * Copyright (C) 2001 Russell King
* *
* $Id: cpu-sa1110.c,v 1.8 2002/01/09 17:13:27 rmk Exp $ * $Id: cpu-sa1110.c,v 1.9 2002/07/06 16:53:18 rmk Exp $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz); extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
extern unsigned int sa11x0_validatespeed(unsigned int khz); extern unsigned int sa11x0_validatespeed(unsigned int khz);
extern unsigned int sa11x0_getspeed(void);
struct sdram_params { struct sdram_params {
u_char rows; /* bits */ u_char rows; /* bits */
...@@ -88,6 +89,16 @@ static struct sdram_params samsung_km416s4030ct __initdata = { ...@@ -88,6 +89,16 @@ static struct sdram_params samsung_km416s4030ct __initdata = {
cas_latency: 3, cas_latency: 3,
}; };
static struct sdram_params wbond_w982516ah75l_cl3_params __initdata = {
rows: 16,
tck: 8,
trcd: 20,
trp: 20,
twr: 8,
refresh: 64000,
cas_latency: 3,
};
static struct sdram_params sdram_params; static struct sdram_params sdram_params;
/* /*
...@@ -287,6 +298,8 @@ static int __init sa1110_clk_init(void) ...@@ -287,6 +298,8 @@ static int __init sa1110_clk_init(void)
sdram = &samsung_km416s4030ct; sdram = &samsung_km416s4030ct;
if (sdram) { if (sdram) {
struct cpufreq_driver cpufreq_driver;
printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d" printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d"
" twr: %d refresh: %d cas_latency: %d\n", " twr: %d refresh: %d cas_latency: %d\n",
sdram->tck, sdram->trcd, sdram->trp, sdram->tck, sdram->trcd, sdram->trp,
...@@ -294,8 +307,15 @@ static int __init sa1110_clk_init(void) ...@@ -294,8 +307,15 @@ static int __init sa1110_clk_init(void)
memcpy(&sdram_params, sdram, sizeof(sdram_params)); memcpy(&sdram_params, sdram, sizeof(sdram_params));
sa1110_setspeed(cpufreq_get(0)); sa1110_setspeed(sa11x0_getspeed());
cpufreq_setfunctions(sa11x0_validatespeed, sa1110_setspeed);
cpufreq_driver.freq.min = 59000;
cpufreq_driver.freq.max = 287000;
cpufreq_driver.freq.cur = sa11x0_getspeed();
cpufreq_driver.validate = &sa11x0_validatespeed;
cpufreq_driver.setspeed = &sa1110_setspeed;
return cpufreq_register(cpufreq_driver);
} }
return 0; return 0;
......
...@@ -76,13 +76,10 @@ unsigned int sa11x0_validatespeed(unsigned int khz) ...@@ -76,13 +76,10 @@ unsigned int sa11x0_validatespeed(unsigned int khz)
return cclk_frequency_100khz[sa11x0_freq_to_ppcr(khz)] * 100; return cclk_frequency_100khz[sa11x0_freq_to_ppcr(khz)] * 100;
} }
static int __init sa11x0_init_clock(void) unsigned int sa11x0_getspeed(void)
{ {
cpufreq_init(cclk_frequency_100khz[PPCR & 0xf] * 100, 59000, 287000); return cclk_frequency_100khz[PPCR & 0xf] * 100;
return 0;
} }
__initcall(sa11x0_init_clock);
#else #else
/* /*
* We still need to provide this so building without cpufreq works. * We still need to provide this so building without cpufreq works.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment