x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / arm / mach-shmobile / board-marzen.c
blob3f5044fda4e30ec20610c677188f9647430f1bf0
1 /*
2 * marzen board support
4 * Copyright (C) 2011, 2013 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Cogent Embedded, Inc.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <linux/kernel.h>
23 #include <linux/init.h>
24 #include <linux/interrupt.h>
25 #include <linux/irq.h>
26 #include <linux/platform_device.h>
27 #include <linux/delay.h>
28 #include <linux/io.h>
29 #include <linux/leds.h>
30 #include <linux/dma-mapping.h>
31 #include <linux/pinctrl/machine.h>
32 #include <linux/platform_data/gpio-rcar.h>
33 #include <linux/platform_data/usb-rcar-phy.h>
34 #include <linux/regulator/fixed.h>
35 #include <linux/regulator/machine.h>
36 #include <linux/smsc911x.h>
37 #include <linux/spi/spi.h>
38 #include <linux/spi/sh_hspi.h>
39 #include <linux/mmc/host.h>
40 #include <linux/mmc/sh_mobile_sdhi.h>
41 #include <linux/mfd/tmio.h>
42 #include <media/soc_camera.h>
43 #include <mach/r8a7779.h>
44 #include <mach/common.h>
45 #include <mach/irqs.h>
46 #include <asm/mach-types.h>
47 #include <asm/mach/arch.h>
48 #include <asm/traps.h>
50 /* Fixed 3.3V regulator to be used by SDHI0 */
51 static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
52 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
53 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
56 /* Dummy supplies, where voltage doesn't matter */
57 static struct regulator_consumer_supply dummy_supplies[] = {
58 REGULATOR_SUPPLY("vddvario", "smsc911x"),
59 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
62 /* USB PHY */
63 static struct resource usb_phy_resources[] = {
64 [0] = {
65 .start = 0xffe70800,
66 .end = 0xffe70900 - 1,
67 .flags = IORESOURCE_MEM,
71 static struct rcar_phy_platform_data usb_phy_platform_data;
73 static struct platform_device usb_phy = {
74 .name = "rcar_usb_phy",
75 .id = -1,
76 .dev = {
77 .platform_data = &usb_phy_platform_data,
79 .resource = usb_phy_resources,
80 .num_resources = ARRAY_SIZE(usb_phy_resources),
83 /* SMSC LAN89218 */
84 static struct resource smsc911x_resources[] = {
85 [0] = {
86 .start = 0x18000000, /* ExCS0 */
87 .end = 0x180000ff, /* A1->A7 */
88 .flags = IORESOURCE_MEM,
90 [1] = {
91 .start = irq_pin(1), /* IRQ 1 */
92 .flags = IORESOURCE_IRQ,
96 static struct smsc911x_platform_config smsc911x_platdata = {
97 .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
98 .phy_interface = PHY_INTERFACE_MODE_MII,
99 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
100 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
103 static struct platform_device eth_device = {
104 .name = "smsc911x",
105 .id = -1,
106 .dev = {
107 .platform_data = &smsc911x_platdata,
109 .resource = smsc911x_resources,
110 .num_resources = ARRAY_SIZE(smsc911x_resources),
113 static struct resource sdhi0_resources[] = {
114 [0] = {
115 .name = "sdhi0",
116 .start = 0xffe4c000,
117 .end = 0xffe4c0ff,
118 .flags = IORESOURCE_MEM,
120 [1] = {
121 .start = gic_iid(0x88),
122 .flags = IORESOURCE_IRQ,
126 static struct sh_mobile_sdhi_info sdhi0_platform_data = {
127 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
128 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
131 static struct platform_device sdhi0_device = {
132 .name = "sh_mobile_sdhi",
133 .num_resources = ARRAY_SIZE(sdhi0_resources),
134 .resource = sdhi0_resources,
135 .id = 0,
136 .dev = {
137 .platform_data = &sdhi0_platform_data,
141 /* Thermal */
142 static struct resource thermal_resources[] = {
143 [0] = {
144 .start = 0xFFC48000,
145 .end = 0xFFC48038 - 1,
146 .flags = IORESOURCE_MEM,
150 static struct platform_device thermal_device = {
151 .name = "rcar_thermal",
152 .resource = thermal_resources,
153 .num_resources = ARRAY_SIZE(thermal_resources),
156 /* HSPI */
157 static struct resource hspi_resources[] = {
158 [0] = {
159 .start = 0xFFFC7000,
160 .end = 0xFFFC7018 - 1,
161 .flags = IORESOURCE_MEM,
165 static struct platform_device hspi_device = {
166 .name = "sh-hspi",
167 .id = 0,
168 .resource = hspi_resources,
169 .num_resources = ARRAY_SIZE(hspi_resources),
172 /* LEDS */
173 static struct gpio_led marzen_leds[] = {
175 .name = "led2",
176 .gpio = RCAR_GP_PIN(4, 29),
177 .default_state = LEDS_GPIO_DEFSTATE_ON,
178 }, {
179 .name = "led3",
180 .gpio = RCAR_GP_PIN(4, 30),
181 .default_state = LEDS_GPIO_DEFSTATE_ON,
182 }, {
183 .name = "led4",
184 .gpio = RCAR_GP_PIN(4, 31),
185 .default_state = LEDS_GPIO_DEFSTATE_ON,
189 static struct gpio_led_platform_data marzen_leds_pdata = {
190 .leds = marzen_leds,
191 .num_leds = ARRAY_SIZE(marzen_leds),
194 static struct platform_device leds_device = {
195 .name = "leds-gpio",
196 .id = 0,
197 .dev = {
198 .platform_data = &marzen_leds_pdata,
202 static struct rcar_vin_platform_data vin_platform_data __initdata = {
203 .flags = RCAR_VIN_BT656,
206 #define MARZEN_CAMERA(idx) \
207 static struct i2c_board_info camera##idx##_info = { \
208 I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \
209 }; \
211 static struct soc_camera_link iclink##idx##_adv7180 = { \
212 .bus_id = 1 + 2 * (idx), \
213 .i2c_adapter_id = 0, \
214 .board_info = &camera##idx##_info, \
215 }; \
217 static struct platform_device camera##idx##_device = { \
218 .name = "soc-camera-pdrv", \
219 .id = idx, \
220 .dev = { \
221 .platform_data = &iclink##idx##_adv7180, \
222 }, \
225 MARZEN_CAMERA(0);
226 MARZEN_CAMERA(1);
228 static struct platform_device *marzen_devices[] __initdata = {
229 &eth_device,
230 &sdhi0_device,
231 &thermal_device,
232 &hspi_device,
233 &leds_device,
234 &usb_phy,
235 &camera0_device,
236 &camera1_device,
239 static const struct pinctrl_map marzen_pinctrl_map[] = {
240 /* HSPI0 */
241 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
242 "hspi0", "hspi0"),
243 /* SCIF2 (CN18: DEBUG0) */
244 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
245 "scif2_data_c", "scif2"),
246 /* SCIF4 (CN19: DEBUG1) */
247 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
248 "scif4_data", "scif4"),
249 /* SDHI0 */
250 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
251 "sdhi0_data4", "sdhi0"),
252 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
253 "sdhi0_ctrl", "sdhi0"),
254 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
255 "sdhi0_cd", "sdhi0"),
256 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
257 "sdhi0_wp", "sdhi0"),
258 /* SMSC */
259 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
260 "intc_irq1_b", "intc"),
261 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
262 "lbsc_ex_cs0", "lbsc"),
263 /* USB0 */
264 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
265 "usb0", "usb0"),
266 /* USB1 */
267 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
268 "usb1", "usb1"),
269 /* USB2 */
270 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
271 "usb2", "usb2"),
272 /* VIN1 */
273 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
274 "vin1_clk", "vin1"),
275 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
276 "vin1_data8", "vin1"),
277 /* VIN3 */
278 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
279 "vin3_clk", "vin3"),
280 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
281 "vin3_data8", "vin3"),
284 static void __init marzen_init(void)
286 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
287 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
288 regulator_register_fixed(1, dummy_supplies,
289 ARRAY_SIZE(dummy_supplies));
291 pinctrl_register_mappings(marzen_pinctrl_map,
292 ARRAY_SIZE(marzen_pinctrl_map));
293 r8a7779_pinmux_init();
294 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
296 r8a7779_add_standard_devices();
297 r8a7779_add_vin_device(1, &vin_platform_data);
298 r8a7779_add_vin_device(3, &vin_platform_data);
299 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
302 static const char *marzen_boards_compat_dt[] __initdata = {
303 "renesas,marzen",
304 NULL,
307 DT_MACHINE_START(MARZEN, "marzen")
308 .smp = smp_ops(r8a7779_smp_ops),
309 .map_io = r8a7779_map_io,
310 .init_early = r8a7779_add_early_devices,
311 .init_irq = r8a7779_init_irq_dt,
312 .init_machine = marzen_init,
313 .init_late = r8a7779_init_late,
314 .dt_compat = marzen_boards_compat_dt,
315 .init_time = r8a7779_earlytimer_init,
316 MACHINE_END