096eb9805212fe866099cfeefc211ddb657b084f
[pandora-kernel.git] / arch / arm / mach-at91 / setup.c
1 /*
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
19 struct at91_soc __initdata at91_boot_soc;
20
21 static struct map_desc at91_io_desc __initdata = {
22         .virtual        = AT91_VA_BASE_SYS,
23         .pfn            = __phys_to_pfn(AT91_BASE_SYS),
24         .length         = SZ_16K,
25         .type           = MT_DEVICE,
26 };
27
28 void __init at91_map_io(void)
29 {
30         /* Map peripherals */
31         iotable_init(&at91_io_desc, 1);
32
33         if (cpu_is_at91cap9())
34                 at91_boot_soc = at91cap9_soc;
35         else if (cpu_is_at91rm9200())
36                 at91_boot_soc = at91rm9200_soc;
37         else if (cpu_is_at91sam9260())
38                 at91_boot_soc = at91sam9260_soc;
39         else if (cpu_is_at91sam9261())
40                 at91_boot_soc = at91sam9261_soc;
41         else if (cpu_is_at91sam9263())
42                 at91_boot_soc = at91sam9263_soc;
43         else if (cpu_is_at91sam9g10())
44                 at91_boot_soc = at91sam9261_soc;
45         else if (cpu_is_at91sam9g20())
46                 at91_boot_soc = at91sam9260_soc;
47         else if (cpu_is_at91sam9g45())
48                 at91_boot_soc = at91sam9g45_soc;
49         else if (cpu_is_at91sam9rl())
50                 at91_boot_soc = at91sam9rl_soc;
51         else if (cpu_is_at91sam9x5())
52                 at91_boot_soc = at91sam9x5_soc;
53         else
54                 panic("Impossible to detect the SOC type");
55
56         if (at91_boot_soc.map_io)
57                 at91_boot_soc.map_io();
58 }
59
60 void __init at91_initialize(unsigned long main_clock)
61 {
62         at91_boot_soc.init(main_clock);
63 }