20 #include <linux/types.h>
21 #include <linux/kernel.h>
23 #include <linux/list.h>
25 #include <linux/slab.h>
26 #include <linux/string.h>
42 #include <mach/hardware.h>
43 #include <mach/platform.h>
45 #include <asm/setup.h>
46 #include <asm/param.h>
51 #include <mach/irqs.h>
70 #define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE)
71 #define VA_SC_BASE __io_address(INTEGRATOR_SC_BASE)
72 #define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE)
73 #define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC)
157 static void __init ap_map_io(
void)
165 static unsigned long ic_irq_enable;
183 #define irq_suspend NULL
184 #define irq_resume NULL
192 static int __init irq_syscore_init(
void)
204 #define SC_CTRLC (VA_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET)
205 #define SC_CTRLS (VA_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET)
206 #define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
207 #define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
251 .init = ap_flash_init,
252 .exit = ap_flash_exit,
253 .set_vpp = ap_flash_set_vpp,
259 #define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
260 #define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
261 #define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
263 static unsigned long timer_reload;
265 static u32 notrace integrator_read_sched_clock(
void)
270 static void integrator_clocksource_init(
unsigned long inrate,
274 unsigned long rate = inrate;
276 if (rate >= 1500000) {
289 static void __iomem * clkevt_base;
301 evt->event_handler(evt);
306 static void clkevt_set_mode(
enum clock_event_mode
mode,
struct clock_event_device *evt)
314 case CLOCK_EVT_MODE_PERIODIC:
320 case CLOCK_EVT_MODE_ONESHOT:
325 case CLOCK_EVT_MODE_UNUSED:
326 case CLOCK_EVT_MODE_SHUTDOWN:
327 case CLOCK_EVT_MODE_RESUME:
335 static int clkevt_set_next_event(
unsigned long next,
struct clock_event_device *evt)
346 static struct clock_event_device integrator_clockevent = {
348 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
349 .set_mode = clkevt_set_mode,
350 .set_next_event = clkevt_set_next_event,
354 static struct irqaction integrator_timer_irq = {
357 .handler = integrator_timer_interrupt,
358 .dev_id = &integrator_clockevent,
361 static void integrator_clockevent_init(
unsigned long inrate,
364 unsigned long rate = inrate;
365 unsigned int ctrl = 0;
369 if (rate > 0x100000 *
HZ) {
372 }
else if (rate > 0x10000 * HZ) {
376 timer_reload = rate /
HZ;
392 static void __init ap_init_timer_of(
void)
404 clk_prepare_enable(clk);
408 "arm,timer-primary", &path);
416 integrator_clocksource_init(rate, base);
419 "arm,timer-secondary", &path);
428 integrator_clockevent_init(rate, base, irq);
432 .
init = ap_init_timer_of,
440 static void __init ap_init_irq_of(
void)
449 static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
456 OF_DEV_AUXDATA(
"arm,primecell",
KMI0_BASE,
458 OF_DEV_AUXDATA(
"arm,primecell",
KMI1_BASE,
461 "physmap-flash", &ap_flash_data),
465 static void __init ap_init_of(
void)
467 unsigned long sc_dec;
471 ap_auxdata_lookup,
NULL);
474 for (i = 0; i < 4; i++) {
477 if ((sc_dec & (16 << i)) == 0)
484 lmdev->
resource.start = 0xc0000000 + 0x10000000 *
i;
494 static const char * ap_dt_board_compat[] = {
504 .init_irq = ap_init_irq_of,
506 .timer = &ap_of_timer,
507 .init_machine = ap_init_of,
509 .dt_compat = ap_dt_board_compat,
521 static struct resource cfi_flash_resource = {
528 .
name =
"physmap-flash",
531 .platform_data = &ap_flash_data,
534 .resource = &cfi_flash_resource,
537 static void __init ap_init_timer(
void)
544 clk_prepare_enable(clk);
557 .
init = ap_init_timer,
560 #define INTEGRATOR_SC_VALID_INT 0x003fffff
562 static void __init ap_init_irq(
void)
573 -1, INTEGRATOR_SC_VALID_INT,
NULL);
577 static void __init ap_init(
void)
579 unsigned long sc_dec;
585 for (i = 0; i < 4; i++) {
588 if ((sc_dec & (16 << i)) == 0)
595 lmdev->
resource.start = 0xc0000000 + 0x10000000 *
i;
609 .atag_offset = 0x100,
614 .init_irq = ap_init_irq,
617 .init_machine = ap_init,