15 #include <linux/module.h>
20 #include <linux/device.h>
24 #include <linux/slab.h>
35 #include <plat/clock.h>
37 #define print_ns(x) ((x) / 10), ((x) % 10)
44 static void s3c2412_print_timing(
const char *pfx,
struct s3c_iotimings *iot)
49 for (bank = 0; bank <
MAX_BANKS; bank++) {
55 "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank,
70 static inline unsigned int to_div(
unsigned int cyc_tns,
unsigned int clk_tns)
81 static unsigned int calc_timing(
unsigned int hwtm,
unsigned int clk_tns,
84 unsigned int ret = to_div(hwtm, clk_tns);
100 unsigned int hclk = cfg->
freq.hclk_tns;
126 "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
127 "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n",
151 for (bank = 0; bank <
MAX_BANKS; bank++) {
156 ret = s3c2412_calc_bank(cfg, bt);
186 for (bank = 0; bank <
MAX_BANKS; bank++) {
202 static inline unsigned int s3c2412_decode_timing(
unsigned int clock,
u32 reg)
204 return (reg & 0xf) *
clock;
211 unsigned long clk = cfg->
freq.hclk_tns;
226 static inline bool bank_is_io(
unsigned int bank,
u32 bankcfg)
231 return !(bankcfg & (1 << bank));
243 for (bank = 0; bank <
MAX_BANKS; bank++) {
244 if (!bank_is_io(bank, bankcfg))
254 s3c2412_iotiming_getbank(cfg, bt, bank);
257 s3c2412_print_timing(
"get", timings);
279 refresh = (cfg->
freq.hclk / 100) * (board->
refresh / 10);
281 refresh &= ((1 << 16) - 1);
283 s3c_freq_dbg(
"%s: refresh value %u\n", __func__, (
unsigned int)refresh);