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/common.h>
31 #include <mach/emev2.h>
32 #include <mach/irqs.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
36 #include <asm/mach/time.h>
38 static struct map_desc emev2_io_desc
[] __initdata
= {
40 /* 2M mapping for SCU + L2 controller */
42 .virtual = 0xf0000000,
43 .pfn
= __phys_to_pfn(0x1e000000),
50 void __init
emev2_map_io(void)
52 iotable_init(emev2_io_desc
, ARRAY_SIZE(emev2_io_desc
));
56 static struct resource uart0_resources
[] = {
57 DEFINE_RES_MEM(0xe1020000, 0x38),
61 static struct resource uart1_resources
[] = {
62 DEFINE_RES_MEM(0xe1030000, 0x38),
66 static struct resource uart2_resources
[] = {
67 DEFINE_RES_MEM(0xe1040000, 0x38),
71 static struct resource uart3_resources
[] = {
72 DEFINE_RES_MEM(0xe1050000, 0x38),
76 #define emev2_register_uart(idx) \
77 platform_device_register_simple("serial8250-em", idx, \
78 uart##idx##_resources, \
79 ARRAY_SIZE(uart##idx##_resources))
82 static struct resource sti_resources
[] = {
83 DEFINE_RES_MEM(0xe0180000, 0x54),
87 #define emev2_register_sti() \
88 platform_device_register_simple("em_sti", 0, \
90 ARRAY_SIZE(sti_resources))
93 static struct gpio_em_config gio0_config
= {
95 .irq_base
= EMEV2_GPIO_IRQ(0),
99 static struct resource gio0_resources
[] = {
100 DEFINE_RES_MEM(0xe0050000, 0x2c),
101 DEFINE_RES_MEM(0xe0050040, 0x20),
106 static struct gpio_em_config gio1_config
= {
108 .irq_base
= EMEV2_GPIO_IRQ(32),
109 .number_of_pins
= 32,
112 static struct resource gio1_resources
[] = {
113 DEFINE_RES_MEM(0xe0050080, 0x2c),
114 DEFINE_RES_MEM(0xe00500c0, 0x20),
119 static struct gpio_em_config gio2_config
= {
121 .irq_base
= EMEV2_GPIO_IRQ(64),
122 .number_of_pins
= 32,
125 static struct resource gio2_resources
[] = {
126 DEFINE_RES_MEM(0xe0050100, 0x2c),
127 DEFINE_RES_MEM(0xe0050140, 0x20),
132 static struct gpio_em_config gio3_config
= {
134 .irq_base
= EMEV2_GPIO_IRQ(96),
135 .number_of_pins
= 32,
138 static struct resource gio3_resources
[] = {
139 DEFINE_RES_MEM(0xe0050180, 0x2c),
140 DEFINE_RES_MEM(0xe00501c0, 0x20),
145 static struct gpio_em_config gio4_config
= {
147 .irq_base
= EMEV2_GPIO_IRQ(128),
148 .number_of_pins
= 31,
151 static struct resource gio4_resources
[] = {
152 DEFINE_RES_MEM(0xe0050200, 0x2c),
153 DEFINE_RES_MEM(0xe0050240, 0x20),
158 #define emev2_register_gio(idx) \
159 platform_device_register_resndata(&platform_bus, "em_gio", \
160 idx, gio##idx##_resources, \
161 ARRAY_SIZE(gio##idx##_resources), \
162 &gio##idx##_config, \
163 sizeof(struct gpio_em_config))
165 static struct resource pmu_resources
[] = {
170 #define emev2_register_pmu() \
171 platform_device_register_simple("arm-pmu", -1, \
173 ARRAY_SIZE(pmu_resources))
175 void __init
emev2_add_standard_devices(void)
177 if (!IS_ENABLED(CONFIG_COMMON_CLK
))
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 */