2 * Emma Mobile EV2 processor support
4 * Copyright (C) 2012 Magnus Damm
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/interrupt.h>
22 #include <linux/irq.h>
23 #include <linux/platform_device.h>
24 #include <linux/platform_data/gpio-em.h>
25 #include <linux/of_platform.h>
26 #include <linux/delay.h>
27 #include <linux/input.h>
29 #include <linux/irqchip/arm-gic.h>
30 #include <mach/hardware.h>
31 #include <mach/common.h>
32 #include <mach/emev2.h>
33 #include <mach/irqs.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/time.h>
39 static struct map_desc emev2_io_desc[] __initdata = {
41 /* 2M mapping for SCU + L2 controller */
43 .virtual = 0xf0000000,
44 .pfn = __phys_to_pfn(0x1e000000),
51 void __init emev2_map_io(void)
53 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
57 static struct resource uart0_resources[] = {
58 DEFINE_RES_MEM(0xe1020000, 0x38),
62 static struct resource uart1_resources[] = {
63 DEFINE_RES_MEM(0xe1030000, 0x38),
67 static struct resource uart2_resources[] = {
68 DEFINE_RES_MEM(0xe1040000, 0x38),
72 static struct resource uart3_resources[] = {
73 DEFINE_RES_MEM(0xe1050000, 0x38),
77 #define emev2_register_uart(idx) \
78 platform_device_register_simple("serial8250-em", idx, \
79 uart##idx##_resources, \
80 ARRAY_SIZE(uart##idx##_resources))
83 static struct resource sti_resources[] = {
84 DEFINE_RES_MEM(0xe0180000, 0x54),
88 #define emev2_register_sti() \
89 platform_device_register_simple("em_sti", 0, \
91 ARRAY_SIZE(sti_resources))
94 static struct gpio_em_config gio0_config = {
96 .irq_base = EMEV2_GPIO_IRQ(0),
100 static struct resource gio0_resources[] = {
101 DEFINE_RES_MEM(0xe0050000, 0x2c),
102 DEFINE_RES_MEM(0xe0050040, 0x20),
107 static struct gpio_em_config gio1_config = {
109 .irq_base = EMEV2_GPIO_IRQ(32),
110 .number_of_pins = 32,
113 static struct resource gio1_resources[] = {
114 DEFINE_RES_MEM(0xe0050080, 0x2c),
115 DEFINE_RES_MEM(0xe00500c0, 0x20),
120 static struct gpio_em_config gio2_config = {
122 .irq_base = EMEV2_GPIO_IRQ(64),
123 .number_of_pins = 32,
126 static struct resource gio2_resources[] = {
127 DEFINE_RES_MEM(0xe0050100, 0x2c),
128 DEFINE_RES_MEM(0xe0050140, 0x20),
133 static struct gpio_em_config gio3_config = {
135 .irq_base = EMEV2_GPIO_IRQ(96),
136 .number_of_pins = 32,
139 static struct resource gio3_resources[] = {
140 DEFINE_RES_MEM(0xe0050180, 0x2c),
141 DEFINE_RES_MEM(0xe00501c0, 0x20),
146 static struct gpio_em_config gio4_config = {
148 .irq_base = EMEV2_GPIO_IRQ(128),
149 .number_of_pins = 31,
152 static struct resource gio4_resources[] = {
153 DEFINE_RES_MEM(0xe0050200, 0x2c),
154 DEFINE_RES_MEM(0xe0050240, 0x20),
159 #define emev2_register_gio(idx) \
160 platform_device_register_resndata(&platform_bus, "em_gio", \
161 idx, gio##idx##_resources, \
162 ARRAY_SIZE(gio##idx##_resources), \
163 &gio##idx##_config, \
164 sizeof(struct gpio_em_config))
166 static struct resource pmu_resources[] = {
171 #define emev2_register_pmu() \
172 platform_device_register_simple("arm-pmu", -1, \
174 ARRAY_SIZE(pmu_resources))
176 void __init emev2_add_standard_devices(void)
180 emev2_register_uart(0);
181 emev2_register_uart(1);
182 emev2_register_uart(2);
183 emev2_register_uart(3);
184 emev2_register_sti();
185 emev2_register_gio(0);
186 emev2_register_gio(1);
187 emev2_register_gio(2);
188 emev2_register_gio(3);
189 emev2_register_gio(4);
190 emev2_register_pmu();
193 void __init emev2_init_delay(void)
195 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
200 static const char *emev2_boards_compat_dt[] __initdata = {
205 DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
206 .smp = smp_ops(emev2_smp_ops),
207 .map_io = emev2_map_io,
208 .init_early = emev2_init_delay,
209 .dt_compat = emev2_boards_compat_dt,
212 #endif /* CONFIG_USE_OF */