aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-03-09 21:31:51 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-04-02 21:30:37 -0400
commit37a72d074d9658172dfef69c56ea7c0e9a9f6d1e (patch)
treecc9864071f91cb23b76644ded253e0278efedfce /arch/arm/mach-shmobile
parente3c470510babd8ed385f1e09ec616787022b77b1 (diff)
ARM: shmobile: r8a7779: Register GPIO devices
Move GPIOs handling from the PFC device to separate GPIO devices. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c58
1 files changed, 52 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 042df35e71a0..a460ba3dedcb 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -22,6 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/gpio-rcar.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/delay.h> 27#include <linux/delay.h>
27#include <linux/input.h> 28#include <linux/input.h>
@@ -68,11 +69,6 @@ static struct resource r8a7779_pfc_resources[] = {
68 .end = 0xfffc023b, 69 .end = 0xfffc023b,
69 .flags = IORESOURCE_MEM, 70 .flags = IORESOURCE_MEM,
70 }, 71 },
71 [1] = {
72 .start = 0xffc40000,
73 .end = 0xffc46fff,
74 .flags = IORESOURCE_MEM,
75 }
76}; 72};
77 73
78static struct platform_device r8a7779_pfc_device = { 74static struct platform_device r8a7779_pfc_device = {
@@ -82,9 +78,59 @@ static struct platform_device r8a7779_pfc_device = {
82 .num_resources = ARRAY_SIZE(r8a7779_pfc_resources), 78 .num_resources = ARRAY_SIZE(r8a7779_pfc_resources),
83}; 79};
84 80
81#define R8A7779_GPIO(idx, npins) \
82static struct resource r8a7779_gpio##idx##_resources[] = { \
83 [0] = { \
84 .start = 0xffc40000 + 0x1000 * (idx), \
85 .end = 0xffc4002b + 0x1000 * (idx), \
86 .flags = IORESOURCE_MEM, \
87 }, \
88 [1] = { \
89 .start = gic_iid(0xad + (idx)), \
90 .flags = IORESOURCE_IRQ, \
91 } \
92}; \
93 \
94static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \
95 .gpio_base = 32 * (idx), \
96 .irq_base = 0, \
97 .number_of_pins = npins, \
98 .pctl_name = "pfc-r8a7779", \
99}; \
100 \
101static struct platform_device r8a7779_gpio##idx##_device = { \
102 .name = "gpio_rcar", \
103 .id = idx, \
104 .resource = r8a7779_gpio##idx##_resources, \
105 .num_resources = ARRAY_SIZE(r8a7779_gpio##idx##_resources), \
106 .dev = { \
107 .platform_data = &r8a7779_gpio##idx##_platform_data, \
108 }, \
109}
110
111R8A7779_GPIO(0, 32);
112R8A7779_GPIO(1, 32);
113R8A7779_GPIO(2, 32);
114R8A7779_GPIO(3, 32);
115R8A7779_GPIO(4, 32);
116R8A7779_GPIO(5, 32);
117R8A7779_GPIO(6, 9);
118
119static struct platform_device *r8a7779_pinctrl_devices[] __initdata = {
120 &r8a7779_pfc_device,
121 &r8a7779_gpio0_device,
122 &r8a7779_gpio1_device,
123 &r8a7779_gpio2_device,
124 &r8a7779_gpio3_device,
125 &r8a7779_gpio4_device,
126 &r8a7779_gpio5_device,
127 &r8a7779_gpio6_device,
128};
129
85void __init r8a7779_pinmux_init(void) 130void __init r8a7779_pinmux_init(void)
86{ 131{
87 platform_device_register(&r8a7779_pfc_device); 132 platform_add_devices(r8a7779_pinctrl_devices,
133 ARRAY_SIZE(r8a7779_pinctrl_devices));
88} 134}
89 135
90static struct plat_sci_port scif0_platform_data = { 136static struct plat_sci_port scif0_platform_data = {