4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
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.
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.
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
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>
28 #include <linux/gpio.h>
29 #include <linux/dma-mapping.h>
30 #include <linux/regulator/fixed.h>
31 #include <linux/regulator/machine.h>
32 #include <linux/smsc911x.h>
33 #include <linux/mmc/sh_mobile_sdhi.h>
34 #include <linux/mfd/tmio.h>
35 #include <mach/hardware.h>
36 #include <mach/r8a7779.h>
37 #include <mach/common.h>
38 #include <mach/irqs.h>
39 #include <asm/mach-types.h>
40 #include <asm/mach/arch.h>
41 #include <asm/hardware/gic.h>
42 #include <asm/traps.h>
44 /* Fixed 3.3V regulator to be used by SDHI0 */
45 static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
46 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
47 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
50 /* Dummy supplies, where voltage doesn't matter */
51 static struct regulator_consumer_supply dummy_supplies[] = {
52 REGULATOR_SUPPLY("vddvario", "smsc911x"),
53 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
57 static struct resource smsc911x_resources[] = {
59 .start = 0x18000000, /* ExCS0 */
60 .end = 0x180000ff, /* A1->A7 */
61 .flags = IORESOURCE_MEM,
64 .start = gic_spi(28), /* IRQ 1 */
65 .flags = IORESOURCE_IRQ,
69 static 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,
76 static struct platform_device eth_device = {
80 .platform_data = &smsc911x_platdata,
82 .resource = smsc911x_resources,
83 .num_resources = ARRAY_SIZE(smsc911x_resources),
86 static struct resource sdhi0_resources[] = {
91 .flags = IORESOURCE_MEM,
94 .start = gic_spi(104),
95 .flags = IORESOURCE_IRQ,
99 static 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,
104 static struct platform_device sdhi0_device = {
105 .name = "sh_mobile_sdhi",
106 .num_resources = ARRAY_SIZE(sdhi0_resources),
107 .resource = sdhi0_resources,
110 .platform_data = &sdhi0_platform_data,
115 static struct resource thermal_resources[] = {
118 .end = 0xFFC48038 - 1,
119 .flags = IORESOURCE_MEM,
123 static struct platform_device thermal_device = {
124 .name = "rcar_thermal",
125 .resource = thermal_resources,
126 .num_resources = ARRAY_SIZE(thermal_resources),
129 static struct platform_device *marzen_devices[] __initdata = {
135 static void __init marzen_init(void)
137 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
138 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
139 regulator_register_fixed(1, dummy_supplies,
140 ARRAY_SIZE(dummy_supplies));
142 r8a7779_pinmux_init();
144 /* SCIF2 (CN18: DEBUG0) */
145 gpio_request(GPIO_FN_TX2_C, NULL);
146 gpio_request(GPIO_FN_RX2_C, NULL);
148 /* SCIF4 (CN19: DEBUG1) */
149 gpio_request(GPIO_FN_TX4, NULL);
150 gpio_request(GPIO_FN_RX4, NULL);
153 gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
154 gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
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);
166 r8a7779_add_standard_devices();
167 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
170 MACHINE_START(MARZEN, "marzen")
171 .smp = smp_ops(r8a7779_smp_ops),
172 .map_io = r8a7779_map_io,
173 .init_early = r8a7779_add_early_devices,
174 .nr_irqs = NR_IRQS_LEGACY,
175 .init_irq = r8a7779_init_irq,
176 .handle_irq = gic_handle_irq,
177 .init_machine = marzen_init,
178 .init_late = shmobile_init_late,
179 .timer = &shmobile_timer,