blob: 8962d9a1a8f6528da1b7f4871c480ed89dff6288 [file] [log] [blame]
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +08001/*
2 * Copyright (C) 2007 Atmel Corporation.
3 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
4 *
5 * Under GPLv2
6 */
7
8#include <linux/module.h>
9#include <linux/io.h>
10
11#include <asm/mach/map.h>
12
13#include <mach/hardware.h>
14#include <mach/cpu.h>
15
16#include "soc.h"
17#include "generic.h"
18
19struct at91_soc __initdata at91_boot_soc;
20
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +080021void __init at91_init_irq_default(void)
22{
23 at91_init_interrupts(at91_boot_soc.default_irq_priority);
24}
25
26void __init at91_init_interrupts(unsigned int *priority)
27{
28 /* Initialize the AIC interrupt controller */
29 at91_aic_init(priority);
30
31 /* Enable GPIO interrupts */
32 at91_gpio_irq_setup();
33}
34
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080035static struct map_desc at91_io_desc __initdata = {
36 .virtual = AT91_VA_BASE_SYS,
37 .pfn = __phys_to_pfn(AT91_BASE_SYS),
38 .length = SZ_16K,
39 .type = MT_DEVICE,
40};
41
42void __init at91_map_io(void)
43{
44 /* Map peripherals */
45 iotable_init(&at91_io_desc, 1);
46
47 if (cpu_is_at91cap9())
48 at91_boot_soc = at91cap9_soc;
49 else if (cpu_is_at91rm9200())
50 at91_boot_soc = at91rm9200_soc;
51 else if (cpu_is_at91sam9260())
52 at91_boot_soc = at91sam9260_soc;
53 else if (cpu_is_at91sam9261())
54 at91_boot_soc = at91sam9261_soc;
55 else if (cpu_is_at91sam9263())
56 at91_boot_soc = at91sam9263_soc;
57 else if (cpu_is_at91sam9g10())
58 at91_boot_soc = at91sam9261_soc;
59 else if (cpu_is_at91sam9g20())
60 at91_boot_soc = at91sam9260_soc;
61 else if (cpu_is_at91sam9g45())
62 at91_boot_soc = at91sam9g45_soc;
63 else if (cpu_is_at91sam9rl())
64 at91_boot_soc = at91sam9rl_soc;
65 else if (cpu_is_at91sam9x5())
66 at91_boot_soc = at91sam9x5_soc;
67 else
68 panic("Impossible to detect the SOC type");
69
70 if (at91_boot_soc.map_io)
71 at91_boot_soc.map_io();
72}
73
74void __init at91_initialize(unsigned long main_clock)
75{
76 at91_boot_soc.init(main_clock);
77}