aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/setup-r8a7779.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/setup-r8a7779.c')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c81
1 files changed, 74 insertions, 7 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 042df35e71a0..b0b394842ea5 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * r8a7779 processor support 2 * r8a7779 processor support
3 * 3 *
4 * Copyright (C) 2011 Renesas Solutions Corp. 4 * Copyright (C) 2011, 2013 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm 5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Cogent Embedded, Inc.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,7 @@
22#include <linux/interrupt.h> 23#include <linux/interrupt.h>
23#include <linux/irq.h> 24#include <linux/irq.h>
24#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26#include <linux/platform_data/gpio-rcar.h>
25#include <linux/platform_device.h> 27#include <linux/platform_device.h>
26#include <linux/delay.h> 28#include <linux/delay.h>
27#include <linux/input.h> 29#include <linux/input.h>
@@ -68,11 +70,6 @@ static struct resource r8a7779_pfc_resources[] = {
68 .end = 0xfffc023b, 70 .end = 0xfffc023b,
69 .flags = IORESOURCE_MEM, 71 .flags = IORESOURCE_MEM,
70 }, 72 },
71 [1] = {
72 .start = 0xffc40000,
73 .end = 0xffc46fff,
74 .flags = IORESOURCE_MEM,
75 }
76}; 73};
77 74
78static struct platform_device r8a7779_pfc_device = { 75static struct platform_device r8a7779_pfc_device = {
@@ -82,9 +79,59 @@ static struct platform_device r8a7779_pfc_device = {
82 .num_resources = ARRAY_SIZE(r8a7779_pfc_resources), 79 .num_resources = ARRAY_SIZE(r8a7779_pfc_resources),
83}; 80};
84 81
82#define R8A7779_GPIO(idx, npins) \
83static struct resource r8a7779_gpio##idx##_resources[] = { \
84 [0] = { \
85 .start = 0xffc40000 + 0x1000 * (idx), \
86 .end = 0xffc4002b + 0x1000 * (idx), \
87 .flags = IORESOURCE_MEM, \
88 }, \
89 [1] = { \
90 .start = gic_iid(0xad + (idx)), \
91 .flags = IORESOURCE_IRQ, \
92 } \
93}; \
94 \
95static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \
96 .gpio_base = 32 * (idx), \
97 .irq_base = 0, \
98 .number_of_pins = npins, \
99 .pctl_name = "pfc-r8a7779", \
100}; \
101 \
102static struct platform_device r8a7779_gpio##idx##_device = { \
103 .name = "gpio_rcar", \
104 .id = idx, \
105 .resource = r8a7779_gpio##idx##_resources, \
106 .num_resources = ARRAY_SIZE(r8a7779_gpio##idx##_resources), \
107 .dev = { \
108 .platform_data = &r8a7779_gpio##idx##_platform_data, \
109 }, \
110}
111
112R8A7779_GPIO(0, 32);
113R8A7779_GPIO(1, 32);
114R8A7779_GPIO(2, 32);
115R8A7779_GPIO(3, 32);
116R8A7779_GPIO(4, 32);
117R8A7779_GPIO(5, 32);
118R8A7779_GPIO(6, 9);
119
120static struct platform_device *r8a7779_pinctrl_devices[] __initdata = {
121 &r8a7779_pfc_device,
122 &r8a7779_gpio0_device,
123 &r8a7779_gpio1_device,
124 &r8a7779_gpio2_device,
125 &r8a7779_gpio3_device,
126 &r8a7779_gpio4_device,
127 &r8a7779_gpio5_device,
128 &r8a7779_gpio6_device,
129};
130
85void __init r8a7779_pinmux_init(void) 131void __init r8a7779_pinmux_init(void)
86{ 132{
87 platform_device_register(&r8a7779_pfc_device); 133 platform_add_devices(r8a7779_pinctrl_devices,
134 ARRAY_SIZE(r8a7779_pinctrl_devices));
88} 135}
89 136
90static struct plat_sci_port scif0_platform_data = { 137static struct plat_sci_port scif0_platform_data = {
@@ -347,6 +394,18 @@ static struct platform_device sata_device = {
347 }, 394 },
348}; 395};
349 396
397/* Ether */
398static struct resource ether_resources[] = {
399 {
400 .start = 0xfde00000,
401 .end = 0xfde003ff,
402 .flags = IORESOURCE_MEM,
403 }, {
404 .start = gic_iid(0xb4),
405 .flags = IORESOURCE_IRQ,
406 },
407};
408
350static struct platform_device *r8a7779_devices_dt[] __initdata = { 409static struct platform_device *r8a7779_devices_dt[] __initdata = {
351 &scif0_device, 410 &scif0_device,
352 &scif1_device, 411 &scif1_device,
@@ -382,6 +441,14 @@ void __init r8a7779_add_standard_devices(void)
382 ARRAY_SIZE(r8a7779_late_devices)); 441 ARRAY_SIZE(r8a7779_late_devices));
383} 442}
384 443
444void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
445{
446 platform_device_register_resndata(&platform_bus, "sh_eth", -1,
447 ether_resources,
448 ARRAY_SIZE(ether_resources),
449 pdata, sizeof(*pdata));
450}
451
385/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 452/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
386void __init __weak r8a7779_register_twd(void) { } 453void __init __weak r8a7779_register_twd(void) { }
387 454