15 #include <linux/kernel.h>
16 #include <linux/errno.h>
20 #include <linux/slab.h>
23 #include <mach/regs-mem.h>
24 #include <mach/regs-clock.h>
28 #define print_ns(x) ((x) / 10), ((x) % 10)
35 static void s3c2410_print_timing(
const char *pfx,
41 for (bank = 0; bank <
MAX_BANKS; bank++) {
47 "Tcoh=%d.%d, Tcah=%d.%d\n", pfx, bank,
60 static inline void __iomem *bank_reg(
unsigned int bank)
74 static inline int bank_is_io(
unsigned long bankcon)
87 static inline unsigned int to_div(
unsigned int cyc,
unsigned int hclk_tns)
105 static unsigned int calc_0124(
unsigned int cyc,
unsigned long hclk_tns,
106 unsigned long *
v,
int shift)
108 unsigned int div = to_div(cyc, hclk_tns);
112 __func__, cyc, hclk_tns, shift, div);
153 static int calc_tacc(
unsigned int cyc,
int nwait_en,
154 unsigned long hclk_tns,
unsigned long *v)
156 unsigned int div = to_div(cyc, hclk_tns);
160 __func__, cyc, nwait_en, hclk_tns, div);
163 if (nwait_en && div < 4)
220 unsigned long hclk = cfg->
freq.hclk_tns;
252 static unsigned int tacc_tab[] = {
268 static unsigned int get_tacc(
unsigned long hclk_tns,
272 return hclk_tns * tacc_tab[
val];
280 static unsigned int get_0124(
unsigned long hclk_tns,
284 return hclk_tns * ((val == 3) ? 4 : val);
299 unsigned long hclk = cfg->
freq.hclk_tns;
320 unsigned long hclk = cfg->
freq.hclk_tns;
327 seq_printf(seq,
"BANKCON=0x%08lx\n", bankcon);
336 "\tRead: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
344 "\t Set: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
369 for (bank = 0; bank <
MAX_BANKS; bank++) {
378 ret = s3c2410_calc_bank(cfg, bt);
411 for (bank = 0; bank <
MAX_BANKS; bank++) {
440 unsigned long bwscon;
447 for (bank = 0; bank <
MAX_BANKS; bank++) {
450 if (!bank_is_io(bankcon))
454 __func__, bank, bankcon);
476 s3c2410_print_timing(
"get", timings);