23 #include <linux/kernel.h>
25 #include <linux/types.h>
27 #include <asm/cputype.h>
30 #include <mach/hardware.h>
55 .name =
"TC59SM716-CL2",
64 .name =
"TC59SM716-CL3",
82 .name =
"K4S281632B-1H",
90 .name =
"KM416S4030CT",
99 .name =
"W982516AH75L",
108 .name =
"MT48LC8M16A2TG-75",
128 return (ns * khz + 999999) / 1000000;
139 shift = delayed + 1 + rcd;
141 mdcas[0] = (1 << rcd) - 1;
142 mdcas[0] |= 0x55555555 << shift;
143 mdcas[1] = mdcas[2] = 0x55555555 << (shift & 1);
152 mem_khz = cpu_khz / 2;
162 if ((ns_to_cycles(sdram->
tck, sd_khz) > 1) ||
168 twr = ns_to_cycles(sdram->
twr, mem_khz);
171 trp = ns_to_cycles(sdram->
trp, mem_khz) - 1;
185 if (sd_khz != mem_khz)
189 set_mdcas(sd->
mdcas, sd_khz >= 62000,
190 ns_to_cycles(sdram->
trcd, mem_khz));
193 printk(
KERN_DEBUG "MDCNFG: %08x MDREFR: %08x MDCAS0: %08x MDCAS1: %08x MDCAS2: %08x\n",
202 static inline void sdram_set_refresh(
u_int dri)
220 u_int dri = ns_to_cycles(ns_row, cpu_khz / 2) / 32;
227 sdram_set_refresh(dri);
234 unsigned int target_freq,
235 unsigned int relation)
241 unsigned int ppcr,
unused;
263 sdram_calculate_timing(&sd, freqs.new, sdram);
271 if (policy->
max < 147500) {
273 sd.
mdcas[0] = 0xaaaaaa7f;
276 sd.
mdcas[0] = 0xaaaaaa9f;
278 sd.
mdcas[1] = 0xaaaaaaaa;
279 sd.
mdcas[2] = 0xaaaaaaaa;
290 sdram_set_refresh(2);
303 asm(
"mcr p15, 0, %0, c7, c10, 4" : :
"r" (0));
308 1: str %3, [%1, #0] @ MDCNFG \n\
309 str %4, [%1, #28] @ MDREFR \n\
310 str %5, [%1, #4] @ MDCAS0 \n\
311 str %6, [%1, #8] @ MDCAS1 \n\
312 str %7, [%1, #12] @ MDCAS2 \n\
313 str %8, [%2, #0] @ PPCR \n\
322 "r" (sd.
mdcas[1]),
"r" (sd.
mdcas[2]),
"r" (ppcr));
328 sdram_update_refresh(freqs.new, sdram);
337 if (policy->
cpu != 0)
340 policy->
cpuinfo.min_freq = 59000;
341 policy->
cpuinfo.max_freq = 287000;
351 .target = sa1110_target,
353 .init = sa1110_cpu_init,
361 for (sdram = sdram_tbl; sdram < sdram_tbl +
ARRAY_SIZE(sdram_tbl);
369 static char sdram_name[16];
371 static int __init sa1110_clk_init(
void)
374 const char *name = sdram_name;
380 if (machine_is_assabet())
381 name =
"TC59SM716-CL3";
382 if (machine_is_pt_system3())
384 if (machine_is_h3100())
385 name =
"KM416S4030CT";
386 if (machine_is_jornada720())
387 name =
"K4S281632B-1H";
388 if (machine_is_nanoengine())
389 name =
"MT48LC8M16A2TG-75";
392 sdram = sa1110_find_sdram(name);
395 " twr: %d refresh: %d cas_latency: %d\n",