ARM: mach-shmobile: r8a7779 and Marzen base support V2
[pandora-kernel.git] / arch / arm / mach-shmobile / board-marzen.c
1 /*
2  * marzen board support
3  *
4  * Copyright (C) 2011  Renesas Solutions Corp.
5  * Copyright (C) 2011  Magnus Damm
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <linux/irq.h>
25 #include <linux/platform_device.h>
26 #include <linux/delay.h>
27 #include <linux/io.h>
28 #include <linux/dma-mapping.h>
29 #include <mach/hardware.h>
30 #include <mach/r8a7779.h>
31 #include <mach/common.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35 #include <asm/mach/time.h>
36 #include <asm/hardware/gic.h>
37 #include <asm/traps.h>
38
39 static struct platform_device *marzen_devices[] __initdata = {
40 };
41
42 static struct map_desc marzen_io_desc[] __initdata = {
43         /* 2M entity map for 0xf0000000 (MPCORE) */
44         {
45                 .virtual        = 0xf0000000,
46                 .pfn            = __phys_to_pfn(0xf0000000),
47                 .length         = SZ_2M,
48                 .type           = MT_DEVICE_NONSHARED
49         },
50         /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
51         {
52                 .virtual        = 0xfe000000,
53                 .pfn            = __phys_to_pfn(0xfe000000),
54                 .length         = SZ_16M,
55                 .type           = MT_DEVICE_NONSHARED
56         },
57 };
58
59 static void __init marzen_map_io(void)
60 {
61         iotable_init(marzen_io_desc, ARRAY_SIZE(marzen_io_desc));
62 }
63
64 static void __init marzen_init_early(void)
65 {
66         r8a7779_add_early_devices();
67
68         /* Early serial console setup is not included here due to
69          * memory map collisions. The SCIF serial ports in r8a7779
70          * are difficult to entity map 1:1 due to collision with the
71          * virtual memory range used by the coherent DMA code on ARM.
72          *
73          * Anyone wanting to debug early can remove UPF_IOREMAP from
74          * the sh-sci serial console platform data, adjust mapbase
75          * to a static M:N virt:phys mapping that needs to be added to
76          * the mappings passed with iotable_init() above.
77          *
78          * Then add a call to shmobile_setup_console() from this function.
79          *
80          * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
81          * command line.
82          */
83 }
84
85 static void __init marzen_init(void)
86 {
87         r8a7779_add_standard_devices();
88         platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
89 }
90
91 static void __init marzen_timer_init(void)
92 {
93         r8a7779_clock_init();
94         shmobile_timer.init();
95         return;
96 }
97
98 struct sys_timer marzen_timer = {
99         .init   = marzen_timer_init,
100 };
101
102 MACHINE_START(MARZEN, "marzen")
103         .map_io         = marzen_map_io,
104         .init_early     = marzen_init_early,
105         .nr_irqs        = NR_IRQS_LEGACY,
106         .init_irq       = r8a7779_init_irq,
107         .handle_irq     = shmobile_handle_irq_gic,
108         .init_machine   = marzen_init,
109         .timer          = &marzen_timer,
110 MACHINE_END