16 #include <linux/module.h>
17 #include <linux/kernel.h>
27 #include <mach/hardware.h>
29 #include <asm/suspend.h>
30 #include <mach/irqs.h>
32 #include <mach/reset.h>
49 static unsigned long ac97_reset_config[] = {
58 if (reset_gpio == 113)
60 &ac97_reset_config[1], 1);
64 &ac97_reset_config[3], 1);
69 #define BASE_CLK 13000000
78 unsigned long ccsr, clkcfg;
79 unsigned int l,
L,
m,
M, n2,
N,
S;
83 cccr_a =
CCCR & (1 << 25);
86 asm(
"mrc\tp14, 0, %0, c6, c0, 0" :
"=r" (clkcfg) );
87 t = clkcfg & (1 << 0);
88 ht = clkcfg & (1 << 2);
89 b = clkcfg & (1 << 3);
93 m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4;
97 M = (!cccr_a) ? (L/m) : ((
b) ? L : (L/2));
102 L / 1000000, (L % 1000000) / 10000, l );
104 N / 1000000, (N % 1000000)/10000, n2 / 2, (n2 % 2)*5,
107 M / 1000000, (M % 1000000) / 10000, m );
109 S / 1000000, (S % 1000000) / 10000 );
112 return (t) ? (N/1000) : (L/1000);
118 static unsigned long clk_pxa27x_mem_getrate(
struct clk *
clk)
120 unsigned long ccsr, clkcfg;
121 unsigned int l,
L,
m,
M;
125 cccr_a =
CCCR & (1 << 25);
128 asm(
"mrc\tp14, 0, %0, c6, c0, 0" :
"=r" (clkcfg) );
129 b = clkcfg & (1 << 3);
132 m = (
l <= 10) ? 1 : (
l <= 20) ? 2 : 4;
135 M = (!cccr_a) ? (L/
m) : ((
b) ? L : (L/2));
140 static const struct clkops clk_pxa27x_mem_ops = {
143 .getrate = clk_pxa27x_mem_getrate,
149 static unsigned int pxa27x_get_lcdclk_frequency_10khz(
void)
152 unsigned int l,
L,
k,
K;
157 k = (l <= 7) ? 1 : (l <= 16) ? 2 : 4;
165 static unsigned long clk_pxa27x_lcd_getrate(
struct clk *
clk)
167 return pxa27x_get_lcdclk_frequency_10khz() * 10000;
170 static const struct clkops clk_pxa27x_lcd_ops = {
173 .getrate = clk_pxa27x_lcd_getrate,
201 static DEFINE_CK(pxa27x_camera, CAMERA, &clk_pxa27x_lcd_ops);
202 static DEFINE_CLK(pxa27x_mem, &clk_pxa27x_mem_ops, 0, 0);
214 INIT_CLKREG(&clk_pxa27x_stuart,
"pxa2xx-ir",
"UARTCLK"),
215 INIT_CLKREG(&clk_pxa27x_ficp,
"pxa2xx-ir",
"FICPCLK"),
237 #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
238 #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x]
269 void pxa27x_cpu_pm_save(
unsigned long *
sleep_save)
277 void pxa27x_cpu_pm_restore(
unsigned long *
sleep_save)
289 extern void pxa_cpu_standby(
void);
290 #ifndef CONFIG_IWMMXT
293 asm volatile(
"mra %Q0, %R0, acc0" :
"=r" (acc0));
311 #ifndef CONFIG_IWMMXT
312 asm volatile(
"mar acc0, %Q0, %R0" :
"=r" (acc0));
323 static int pxa27x_cpu_pm_prepare(
void)
330 static void pxa27x_cpu_pm_finish(
void)
338 .save = pxa27x_cpu_pm_save,
339 .restore = pxa27x_cpu_pm_restore,
340 .valid = pxa27x_cpu_pm_valid,
342 .prepare = pxa27x_cpu_pm_prepare,
343 .finish = pxa27x_cpu_pm_finish,
346 static void __init pxa27x_init_pm(
void)
351 static inline void pxa27x_init_pm(
void) {}
357 static int pxa27x_set_wake(
struct irq_data *
d,
unsigned int on)
362 if (gpio >= 0 && gpio < 128)
396 .length = 0x00200000,
399 .virtual = 0xfe000000,
401 .length = 0x00100000,
445 static int __init pxa27x_init(
void)