ARM: shmobile: armadillo800eva: enable restart
[GitHub/mt8127/android_kernel_alcatel_ttab.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>
14f691c1 28#include <linux/gpio.h>
f411fade 29#include <linux/dma-mapping.h>
b354e227
GL
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
db5eb994 32#include <linux/smsc911x.h>
894cda18
PE
33#include <linux/mmc/sh_mobile_sdhi.h>
34#include <linux/mfd/tmio.h>
f411fade
MD
35#include <mach/hardware.h>
36#include <mach/r8a7779.h>
37#include <mach/common.h>
250a2723 38#include <mach/irqs.h>
f411fade
MD
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
f411fade
MD
41#include <asm/hardware/gic.h>
42#include <asm/traps.h>
43
894cda18
PE
44/* Fixed 3.3V regulator to be used by SDHI0 */
45static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
46 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
47 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
48};
49
b354e227
GL
50/* Dummy supplies, where voltage doesn't matter */
51static struct regulator_consumer_supply dummy_supplies[] = {
52 REGULATOR_SUPPLY("vddvario", "smsc911x"),
53 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
54};
55
db5eb994
MD
56/* SMSC LAN89218 */
57static struct resource smsc911x_resources[] = {
58 [0] = {
59 .start = 0x18000000, /* ExCS0 */
60 .end = 0x180000ff, /* A1->A7 */
61 .flags = IORESOURCE_MEM,
62 },
63 [1] = {
64 .start = gic_spi(28), /* IRQ 1 */
65 .flags = IORESOURCE_IRQ,
66 },
67};
68
69static struct smsc911x_platform_config smsc911x_platdata = {
70 .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
71 .phy_interface = PHY_INTERFACE_MODE_MII,
72 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
73 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
74};
75
76static struct platform_device eth_device = {
77 .name = "smsc911x",
497dcf6f 78 .id = -1,
db5eb994
MD
79 .dev = {
80 .platform_data = &smsc911x_platdata,
81 },
82 .resource = smsc911x_resources,
83 .num_resources = ARRAY_SIZE(smsc911x_resources),
84};
85
894cda18
PE
86static struct resource sdhi0_resources[] = {
87 [0] = {
88 .name = "sdhi0",
89 .start = 0xffe4c000,
90 .end = 0xffe4c0ff,
91 .flags = IORESOURCE_MEM,
92 },
93 [1] = {
94 .start = gic_spi(104),
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99static struct sh_mobile_sdhi_info sdhi0_platform_data = {
100 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
101 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
102};
103
104static struct platform_device sdhi0_device = {
105 .name = "sh_mobile_sdhi",
106 .num_resources = ARRAY_SIZE(sdhi0_resources),
107 .resource = sdhi0_resources,
108 .id = 0,
109 .dev = {
110 .platform_data = &sdhi0_platform_data,
111 }
112};
113
eb8ca943
KM
114/* Thermal */
115static struct resource thermal_resources[] = {
116 [0] = {
117 .start = 0xFFC48000,
118 .end = 0xFFC48038 - 1,
119 .flags = IORESOURCE_MEM,
120 },
121};
122
123static struct platform_device thermal_device = {
124 .name = "rcar_thermal",
125 .resource = thermal_resources,
126 .num_resources = ARRAY_SIZE(thermal_resources),
127};
128
f411fade 129static struct platform_device *marzen_devices[] __initdata = {
db5eb994 130 &eth_device,
894cda18 131 &sdhi0_device,
eb8ca943 132 &thermal_device,
f411fade
MD
133};
134
f411fade
MD
135static void __init marzen_init(void)
136{
894cda18
PE
137 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
138 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
90b85afc 139 regulator_register_fixed(1, dummy_supplies,
894cda18 140 ARRAY_SIZE(dummy_supplies));
b354e227 141
19c43fc5
MD
142 r8a7779_pinmux_init();
143
14f691c1
MD
144 /* SCIF2 (CN18: DEBUG0) */
145 gpio_request(GPIO_FN_TX2_C, NULL);
146 gpio_request(GPIO_FN_RX2_C, NULL);
147
148 /* SCIF4 (CN19: DEBUG1) */
149 gpio_request(GPIO_FN_TX4, NULL);
150 gpio_request(GPIO_FN_RX4, NULL);
151
db5eb994
MD
152 /* LAN89218 */
153 gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
154 gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
155
894cda18
PE
156 /* SD0 (CN20) */
157 gpio_request(GPIO_FN_SD0_CLK, NULL);
158 gpio_request(GPIO_FN_SD0_CMD, NULL);
159 gpio_request(GPIO_FN_SD0_DAT0, NULL);
160 gpio_request(GPIO_FN_SD0_DAT1, NULL);
161 gpio_request(GPIO_FN_SD0_DAT2, NULL);
162 gpio_request(GPIO_FN_SD0_DAT3, NULL);
163 gpio_request(GPIO_FN_SD0_CD, NULL);
164 gpio_request(GPIO_FN_SD0_WP, NULL);
165
f411fade
MD
166 r8a7779_add_standard_devices();
167 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
168}
169
f411fade 170MACHINE_START(MARZEN, "marzen")
a62580e5 171 .smp = smp_ops(r8a7779_smp_ops),
3e353b87
MD
172 .map_io = r8a7779_map_io,
173 .init_early = r8a7779_add_early_devices,
f411fade
MD
174 .nr_irqs = NR_IRQS_LEGACY,
175 .init_irq = r8a7779_init_irq,
77761b63 176 .handle_irq = gic_handle_irq,
f411fade 177 .init_machine = marzen_init,
21cc1b7e 178 .init_late = shmobile_init_late,
df27a2d8 179 .timer = &shmobile_timer,
f411fade 180MACHINE_END