aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-marzen.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-marzen.c')
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c188
1 files changed, 8 insertions, 180 deletions
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index b9594e911ce7..b1b41b199f99 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -28,6 +28,7 @@
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/pinctrl/machine.h> 30#include <linux/pinctrl/machine.h>
31#include <linux/platform_data/gpio-rcar.h>
31#include <linux/regulator/fixed.h> 32#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
33#include <linux/smsc911x.h> 34#include <linux/smsc911x.h>
@@ -36,10 +37,6 @@
36#include <linux/mmc/host.h> 37#include <linux/mmc/host.h>
37#include <linux/mmc/sh_mobile_sdhi.h> 38#include <linux/mmc/sh_mobile_sdhi.h>
38#include <linux/mfd/tmio.h> 39#include <linux/mfd/tmio.h>
39#include <linux/usb/otg.h>
40#include <linux/usb/ehci_pdriver.h>
41#include <linux/usb/ohci_pdriver.h>
42#include <linux/pm_runtime.h>
43#include <mach/hardware.h> 40#include <mach/hardware.h>
44#include <mach/r8a7779.h> 41#include <mach/r8a7779.h>
45#include <mach/common.h> 42#include <mach/common.h>
@@ -60,6 +57,8 @@ static struct regulator_consumer_supply dummy_supplies[] = {
60 REGULATOR_SUPPLY("vdd33a", "smsc911x"), 57 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
61}; 58};
62 59
60static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
61
63/* SMSC LAN89218 */ 62/* SMSC LAN89218 */
64static struct resource smsc911x_resources[] = { 63static struct resource smsc911x_resources[] = {
65 [0] = { 64 [0] = {
@@ -149,39 +148,19 @@ static struct platform_device hspi_device = {
149 .num_resources = ARRAY_SIZE(hspi_resources), 148 .num_resources = ARRAY_SIZE(hspi_resources),
150}; 149};
151 150
152/* USB PHY */
153static struct resource usb_phy_resources[] = {
154 [0] = {
155 .start = 0xffe70000,
156 .end = 0xffe70900 - 1,
157 .flags = IORESOURCE_MEM,
158 },
159 [1] = {
160 .start = 0xfff70000,
161 .end = 0xfff70900 - 1,
162 .flags = IORESOURCE_MEM,
163 },
164};
165
166static struct platform_device usb_phy_device = {
167 .name = "rcar_usb_phy",
168 .resource = usb_phy_resources,
169 .num_resources = ARRAY_SIZE(usb_phy_resources),
170};
171
172/* LEDS */ 151/* LEDS */
173static struct gpio_led marzen_leds[] = { 152static struct gpio_led marzen_leds[] = {
174 { 153 {
175 .name = "led2", 154 .name = "led2",
176 .gpio = 157, 155 .gpio = RCAR_GP_PIN(4, 29),
177 .default_state = LEDS_GPIO_DEFSTATE_ON, 156 .default_state = LEDS_GPIO_DEFSTATE_ON,
178 }, { 157 }, {
179 .name = "led3", 158 .name = "led3",
180 .gpio = 158, 159 .gpio = RCAR_GP_PIN(4, 30),
181 .default_state = LEDS_GPIO_DEFSTATE_ON, 160 .default_state = LEDS_GPIO_DEFSTATE_ON,
182 }, { 161 }, {
183 .name = "led4", 162 .name = "led4",
184 .gpio = 159, 163 .gpio = RCAR_GP_PIN(4, 31),
185 .default_state = LEDS_GPIO_DEFSTATE_ON, 164 .default_state = LEDS_GPIO_DEFSTATE_ON,
186 }, 165 },
187}; 166};
@@ -204,161 +183,9 @@ static struct platform_device *marzen_devices[] __initdata = {
204 &sdhi0_device, 183 &sdhi0_device,
205 &thermal_device, 184 &thermal_device,
206 &hspi_device, 185 &hspi_device,
207 &usb_phy_device,
208 &leds_device, 186 &leds_device,
209}; 187};
210 188
211/* USB */
212static struct usb_phy *phy;
213static int usb_power_on(struct platform_device *pdev)
214{
215 if (IS_ERR(phy))
216 return PTR_ERR(phy);
217
218 pm_runtime_enable(&pdev->dev);
219 pm_runtime_get_sync(&pdev->dev);
220
221 usb_phy_init(phy);
222
223 return 0;
224}
225
226static void usb_power_off(struct platform_device *pdev)
227{
228 if (IS_ERR(phy))
229 return;
230
231 usb_phy_shutdown(phy);
232
233 pm_runtime_put_sync(&pdev->dev);
234 pm_runtime_disable(&pdev->dev);
235}
236
237static struct usb_ehci_pdata ehcix_pdata = {
238 .power_on = usb_power_on,
239 .power_off = usb_power_off,
240 .power_suspend = usb_power_off,
241};
242
243static struct resource ehci0_resources[] = {
244 [0] = {
245 .start = 0xffe70000,
246 .end = 0xffe70400 - 1,
247 .flags = IORESOURCE_MEM,
248 },
249 [1] = {
250 .start = gic_iid(0x4c),
251 .flags = IORESOURCE_IRQ,
252 },
253};
254
255static struct platform_device ehci0_device = {
256 .name = "ehci-platform",
257 .id = 0,
258 .dev = {
259 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
260 .coherent_dma_mask = 0xffffffff,
261 .platform_data = &ehcix_pdata,
262 },
263 .num_resources = ARRAY_SIZE(ehci0_resources),
264 .resource = ehci0_resources,
265};
266
267static struct resource ehci1_resources[] = {
268 [0] = {
269 .start = 0xfff70000,
270 .end = 0xfff70400 - 1,
271 .flags = IORESOURCE_MEM,
272 },
273 [1] = {
274 .start = gic_iid(0x4d),
275 .flags = IORESOURCE_IRQ,
276 },
277};
278
279static struct platform_device ehci1_device = {
280 .name = "ehci-platform",
281 .id = 1,
282 .dev = {
283 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
284 .coherent_dma_mask = 0xffffffff,
285 .platform_data = &ehcix_pdata,
286 },
287 .num_resources = ARRAY_SIZE(ehci1_resources),
288 .resource = ehci1_resources,
289};
290
291static struct usb_ohci_pdata ohcix_pdata = {
292 .power_on = usb_power_on,
293 .power_off = usb_power_off,
294 .power_suspend = usb_power_off,
295};
296
297static struct resource ohci0_resources[] = {
298 [0] = {
299 .start = 0xffe70400,
300 .end = 0xffe70800 - 1,
301 .flags = IORESOURCE_MEM,
302 },
303 [1] = {
304 .start = gic_iid(0x4c),
305 .flags = IORESOURCE_IRQ,
306 },
307};
308
309static struct platform_device ohci0_device = {
310 .name = "ohci-platform",
311 .id = 0,
312 .dev = {
313 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
314 .coherent_dma_mask = 0xffffffff,
315 .platform_data = &ohcix_pdata,
316 },
317 .num_resources = ARRAY_SIZE(ohci0_resources),
318 .resource = ohci0_resources,
319};
320
321static struct resource ohci1_resources[] = {
322 [0] = {
323 .start = 0xfff70400,
324 .end = 0xfff70800 - 1,
325 .flags = IORESOURCE_MEM,
326 },
327 [1] = {
328 .start = gic_iid(0x4d),
329 .flags = IORESOURCE_IRQ,
330 },
331};
332
333static struct platform_device ohci1_device = {
334 .name = "ohci-platform",
335 .id = 1,
336 .dev = {
337 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
338 .coherent_dma_mask = 0xffffffff,
339 .platform_data = &ohcix_pdata,
340 },
341 .num_resources = ARRAY_SIZE(ohci1_resources),
342 .resource = ohci1_resources,
343};
344
345static struct platform_device *marzen_late_devices[] __initdata = {
346 &ehci0_device,
347 &ehci1_device,
348 &ohci0_device,
349 &ohci1_device,
350};
351
352void __init marzen_init_late(void)
353{
354 /* get usb phy */
355 phy = usb_get_phy(USB_PHY_TYPE_USB2);
356
357 shmobile_init_late();
358 platform_add_devices(marzen_late_devices,
359 ARRAY_SIZE(marzen_late_devices));
360}
361
362static const struct pinctrl_map marzen_pinctrl_map[] = { 189static const struct pinctrl_map marzen_pinctrl_map[] = {
363 /* HSPI0 */ 190 /* HSPI0 */
364 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", 191 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
@@ -406,6 +233,7 @@ static void __init marzen_init(void)
406 r8a7779_pinmux_init(); 233 r8a7779_pinmux_init();
407 234
408 r8a7779_add_standard_devices(); 235 r8a7779_add_standard_devices();
236 r8a7779_add_usb_phy_device(&usb_phy_platform_data);
409 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 237 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
410} 238}
411 239
@@ -416,6 +244,6 @@ MACHINE_START(MARZEN, "marzen")
416 .nr_irqs = NR_IRQS_LEGACY, 244 .nr_irqs = NR_IRQS_LEGACY,
417 .init_irq = r8a7779_init_irq, 245 .init_irq = r8a7779_init_irq,
418 .init_machine = marzen_init, 246 .init_machine = marzen_init,
419 .init_late = marzen_init_late, 247 .init_late = r8a7779_init_late,
420 .init_time = r8a7779_earlytimer_init, 248 .init_time = r8a7779_earlytimer_init,
421MACHINE_END 249MACHINE_END