Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board-marzen.c
Go to the documentation of this file.
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>
28 #include <linux/gpio.h>
29 #include <linux/dma-mapping.h>
30 #include <linux/regulator/fixed.h>
32 #include <linux/smsc911x.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>
43 
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"),
48 };
49 
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"),
54 };
55 
56 /* SMSC LAN89218 */
57 static 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 
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,
74 };
75 
76 static struct platform_device eth_device = {
77  .name = "smsc911x",
78  .id = -1,
79  .dev = {
80  .platform_data = &smsc911x_platdata,
81  },
82  .resource = smsc911x_resources,
83  .num_resources = ARRAY_SIZE(smsc911x_resources),
84 };
85 
86 static 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 
99 static struct sh_mobile_sdhi_info sdhi0_platform_data = {
101  .tmio_caps = MMC_CAP_SD_HIGHSPEED,
102 };
103 
104 static 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 
114 /* Thermal */
115 static struct resource thermal_resources[] = {
116  [0] = {
117  .start = 0xFFC48000,
118  .end = 0xFFC48038 - 1,
119  .flags = IORESOURCE_MEM,
120  },
121 };
122 
123 static struct platform_device thermal_device = {
124  .name = "rcar_thermal",
125  .resource = thermal_resources,
126  .num_resources = ARRAY_SIZE(thermal_resources),
127 };
128 
129 static struct platform_device *marzen_devices[] __initdata = {
130  &eth_device,
131  &sdhi0_device,
132  &thermal_device,
133 };
134 
135 static void __init marzen_init(void)
136 {
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));
141 
143 
144  /* SCIF2 (CN18: DEBUG0) */
147 
148  /* SCIF4 (CN19: DEBUG1) */
151 
152  /* LAN89218 */
153  gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
154  gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
155 
156  /* SD0 (CN20) */
165 
167  platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
168 }
169 
170 MACHINE_START(MARZEN, "marzen")
171  .smp = smp_ops(r8a7779_smp_ops),
172  .map_io = r8a7779_map_io,
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,