aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/setup-r8a7791.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2013-10-07 23:39:39 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-12-04 01:11:09 -0500
commit93ff916305517f909ba616414d3ce1e55e6a4e43 (patch)
tree4e79bb408574b074550c8829b1114327d45ffe11 /arch/arm/mach-shmobile/setup-r8a7791.c
parentcc3a17d799481c502485d8c0770b888c3b4d788d (diff)
ARM: shmobile: r8a7791 GPIO platform device support
Add GPIO controller platform devices for the r8a7791 SoC. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/setup-r8a7791.c')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index 84cad8cb6af4..59dd442f48ae 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -22,6 +22,7 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/kernel.h> 23#include <linux/kernel.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_data/irq-renesas-irqc.h> 26#include <linux/platform_data/irq-renesas-irqc.h>
26#include <linux/serial_sci.h> 27#include <linux/serial_sci.h>
27#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
@@ -39,9 +40,48 @@ static const struct resource pfc_resources[] __initconst = {
39 platform_device_register_simple("pfc-r8a7791", -1, pfc_resources, \ 40 platform_device_register_simple("pfc-r8a7791", -1, pfc_resources, \
40 ARRAY_SIZE(pfc_resources)) 41 ARRAY_SIZE(pfc_resources))
41 42
43#define R8A7791_GPIO(idx, base, nr) \
44static const struct resource r8a7791_gpio##idx##_resources[] __initconst = { \
45 DEFINE_RES_MEM((base), 0x50), \
46 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
47}; \
48 \
49static const struct gpio_rcar_config \
50r8a7791_gpio##idx##_platform_data __initconst = { \
51 .gpio_base = 32 * (idx), \
52 .irq_base = 0, \
53 .number_of_pins = (nr), \
54 .pctl_name = "pfc-r8a7791", \
55 .has_both_edge_trigger = 1, \
56}; \
57
58R8A7791_GPIO(0, 0xe6050000, 32);
59R8A7791_GPIO(1, 0xe6051000, 32);
60R8A7791_GPIO(2, 0xe6052000, 32);
61R8A7791_GPIO(3, 0xe6053000, 32);
62R8A7791_GPIO(4, 0xe6054000, 32);
63R8A7791_GPIO(5, 0xe6055000, 32);
64R8A7791_GPIO(6, 0xe6055400, 32);
65R8A7791_GPIO(7, 0xe6055800, 26);
66
67#define r8a7791_register_gpio(idx) \
68 platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
69 r8a7791_gpio##idx##_resources, \
70 ARRAY_SIZE(r8a7791_gpio##idx##_resources), \
71 &r8a7791_gpio##idx##_platform_data, \
72 sizeof(r8a7791_gpio##idx##_platform_data))
73
42void __init r8a7791_pinmux_init(void) 74void __init r8a7791_pinmux_init(void)
43{ 75{
44 r8a7791_register_pfc(); 76 r8a7791_register_pfc();
77 r8a7791_register_gpio(0);
78 r8a7791_register_gpio(1);
79 r8a7791_register_gpio(2);
80 r8a7791_register_gpio(3);
81 r8a7791_register_gpio(4);
82 r8a7791_register_gpio(5);
83 r8a7791_register_gpio(6);
84 r8a7791_register_gpio(7);
45} 85}
46 86
47#define SCIF_COMMON(scif_type, baseaddr, irq) \ 87#define SCIF_COMMON(scif_type, baseaddr, irq) \