ARM: shmobile: No need to use INTC header on r8a7779
[deliverable/linux.git] / arch / arm / mach-shmobile / board-marzen.c
CommitLineData
f411fade
MD
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>
48b1e3e8 28#include <linux/leds.h>
f411fade 29#include <linux/dma-mapping.h>
4a655ecd 30#include <linux/pinctrl/machine.h>
5fcf4a3c 31#include <linux/platform_data/gpio-rcar.h>
b354e227
GL
32#include <linux/regulator/fixed.h>
33#include <linux/regulator/machine.h>
db5eb994 34#include <linux/smsc911x.h>
b82573e1
KM
35#include <linux/spi/spi.h>
36#include <linux/spi/sh_hspi.h>
44e9ac45 37#include <linux/mmc/host.h>
894cda18
PE
38#include <linux/mmc/sh_mobile_sdhi.h>
39#include <linux/mfd/tmio.h>
f411fade
MD
40#include <mach/r8a7779.h>
41#include <mach/common.h>
250a2723 42#include <mach/irqs.h>
f411fade
MD
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
f411fade
MD
45#include <asm/traps.h>
46
894cda18
PE
47/* Fixed 3.3V regulator to be used by SDHI0 */
48static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
49 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
50 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
51};
52
b354e227
GL
53/* Dummy supplies, where voltage doesn't matter */
54static struct regulator_consumer_supply dummy_supplies[] = {
55 REGULATOR_SUPPLY("vddvario", "smsc911x"),
56 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
57};
58
2437b27c
SS
59static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
60
db5eb994
MD
61/* SMSC LAN89218 */
62static struct resource smsc911x_resources[] = {
63 [0] = {
64 .start = 0x18000000, /* ExCS0 */
65 .end = 0x180000ff, /* A1->A7 */
66 .flags = IORESOURCE_MEM,
67 },
68 [1] = {
6e267030 69 .start = irq_pin(1), /* IRQ 1 */
db5eb994
MD
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct smsc911x_platform_config smsc911x_platdata = {
75 .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
76 .phy_interface = PHY_INTERFACE_MODE_MII,
77 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
78 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
79};
80
81static struct platform_device eth_device = {
82 .name = "smsc911x",
497dcf6f 83 .id = -1,
db5eb994
MD
84 .dev = {
85 .platform_data = &smsc911x_platdata,
86 },
87 .resource = smsc911x_resources,
88 .num_resources = ARRAY_SIZE(smsc911x_resources),
89};
90
894cda18
PE
91static struct resource sdhi0_resources[] = {
92 [0] = {
93 .name = "sdhi0",
94 .start = 0xffe4c000,
95 .end = 0xffe4c0ff,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
0b6794ef 99 .start = gic_iid(0x88),
894cda18
PE
100 .flags = IORESOURCE_IRQ,
101 },
102};
103
104static struct sh_mobile_sdhi_info sdhi0_platform_data = {
105 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
106 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
107};
108
109static struct platform_device sdhi0_device = {
110 .name = "sh_mobile_sdhi",
111 .num_resources = ARRAY_SIZE(sdhi0_resources),
112 .resource = sdhi0_resources,
113 .id = 0,
114 .dev = {
115 .platform_data = &sdhi0_platform_data,
116 }
117};
118
eb8ca943
KM
119/* Thermal */
120static struct resource thermal_resources[] = {
121 [0] = {
122 .start = 0xFFC48000,
123 .end = 0xFFC48038 - 1,
124 .flags = IORESOURCE_MEM,
125 },
126};
127
128static struct platform_device thermal_device = {
129 .name = "rcar_thermal",
130 .resource = thermal_resources,
131 .num_resources = ARRAY_SIZE(thermal_resources),
132};
133
b82573e1
KM
134/* HSPI */
135static struct resource hspi_resources[] = {
136 [0] = {
137 .start = 0xFFFC7000,
138 .end = 0xFFFC7018 - 1,
139 .flags = IORESOURCE_MEM,
140 },
141};
142
143static struct platform_device hspi_device = {
144 .name = "sh-hspi",
145 .id = 0,
146 .resource = hspi_resources,
147 .num_resources = ARRAY_SIZE(hspi_resources),
148};
149
48b1e3e8
LP
150/* LEDS */
151static struct gpio_led marzen_leds[] = {
152 {
153 .name = "led2",
5fcf4a3c 154 .gpio = RCAR_GP_PIN(4, 29),
48b1e3e8
LP
155 .default_state = LEDS_GPIO_DEFSTATE_ON,
156 }, {
157 .name = "led3",
5fcf4a3c 158 .gpio = RCAR_GP_PIN(4, 30),
48b1e3e8
LP
159 .default_state = LEDS_GPIO_DEFSTATE_ON,
160 }, {
161 .name = "led4",
5fcf4a3c 162 .gpio = RCAR_GP_PIN(4, 31),
48b1e3e8
LP
163 .default_state = LEDS_GPIO_DEFSTATE_ON,
164 },
165};
166
167static struct gpio_led_platform_data marzen_leds_pdata = {
168 .leds = marzen_leds,
169 .num_leds = ARRAY_SIZE(marzen_leds),
170};
171
172static struct platform_device leds_device = {
173 .name = "leds-gpio",
174 .id = 0,
175 .dev = {
176 .platform_data = &marzen_leds_pdata,
177 },
178};
179
f411fade 180static struct platform_device *marzen_devices[] __initdata = {
db5eb994 181 &eth_device,
894cda18 182 &sdhi0_device,
eb8ca943 183 &thermal_device,
b82573e1 184 &hspi_device,
48b1e3e8 185 &leds_device,
f411fade
MD
186};
187
4a655ecd 188static const struct pinctrl_map marzen_pinctrl_map[] = {
a3217471
LP
189 /* HSPI0 */
190 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
191 "hspi0", "hspi0"),
e9cd49fa
LP
192 /* SCIF2 (CN18: DEBUG0) */
193 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
194 "scif2_data_c", "scif2"),
195 /* SCIF4 (CN19: DEBUG1) */
196 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
197 "scif4_data", "scif4"),
4a655ecd
LP
198 /* SDHI0 */
199 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
200 "sdhi0_data4", "sdhi0"),
201 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
202 "sdhi0_ctrl", "sdhi0"),
203 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
204 "sdhi0_cd", "sdhi0"),
205 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
206 "sdhi0_wp", "sdhi0"),
f423df8e 207 /* SMSC */
ee097e66
LP
208 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
209 "intc_irq1_b", "intc"),
f423df8e
LP
210 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
211 "lbsc_ex_cs0", "lbsc"),
a00f6e57
LP
212 /* USB0 */
213 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
214 "usb0", "usb0"),
215 /* USB1 */
216 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
217 "usb1", "usb1"),
218 /* USB2 */
219 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
220 "usb2", "usb2"),
4a655ecd
LP
221};
222
f411fade
MD
223static void __init marzen_init(void)
224{
894cda18
PE
225 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
226 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
90b85afc 227 regulator_register_fixed(1, dummy_supplies,
894cda18 228 ARRAY_SIZE(dummy_supplies));
b354e227 229
4a655ecd
LP
230 pinctrl_register_mappings(marzen_pinctrl_map,
231 ARRAY_SIZE(marzen_pinctrl_map));
19c43fc5 232 r8a7779_pinmux_init();
6e267030 233 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
19c43fc5 234
f411fade 235 r8a7779_add_standard_devices();
2437b27c 236 r8a7779_add_usb_phy_device(&usb_phy_platform_data);
f411fade
MD
237 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
238}
239
f411fade 240MACHINE_START(MARZEN, "marzen")
a62580e5 241 .smp = smp_ops(r8a7779_smp_ops),
3e353b87
MD
242 .map_io = r8a7779_map_io,
243 .init_early = r8a7779_add_early_devices,
f411fade
MD
244 .nr_irqs = NR_IRQS_LEGACY,
245 .init_irq = r8a7779_init_irq,
f411fade 246 .init_machine = marzen_init,
2c8788bf 247 .init_late = r8a7779_init_late,
6bb27d73 248 .init_time = r8a7779_earlytimer_init,
f411fade 249MACHINE_END
This page took 0.099751 seconds and 5 git commands to generate.