Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[deliverable/linux.git] / arch / arm / mach-shmobile / board-lager.c
1 /*
2 * Lager board support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 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/gpio.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/input.h>
24 #include <linux/interrupt.h>
25 #include <linux/kernel.h>
26 #include <linux/leds.h>
27 #include <linux/pinctrl/machine.h>
28 #include <linux/platform_data/gpio-rcar.h>
29 #include <linux/platform_device.h>
30 #include <mach/common.h>
31 #include <mach/r8a7790.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34
35 /* LEDS */
36 static struct gpio_led lager_leds[] = {
37 {
38 .name = "led8",
39 .gpio = RCAR_GP_PIN(5, 17),
40 .default_state = LEDS_GPIO_DEFSTATE_ON,
41 }, {
42 .name = "led7",
43 .gpio = RCAR_GP_PIN(4, 23),
44 .default_state = LEDS_GPIO_DEFSTATE_ON,
45 }, {
46 .name = "led6",
47 .gpio = RCAR_GP_PIN(4, 22),
48 .default_state = LEDS_GPIO_DEFSTATE_ON,
49 },
50 };
51
52 static __initdata struct gpio_led_platform_data lager_leds_pdata = {
53 .leds = lager_leds,
54 .num_leds = ARRAY_SIZE(lager_leds),
55 };
56
57 /* GPIO KEY */
58 #define GPIO_KEY(c, g, d, ...) \
59 { .code = c, .gpio = g, .desc = d, .active_low = 1 }
60
61 static struct gpio_keys_button gpio_buttons[] = {
62 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"),
63 GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"),
64 GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"),
65 GPIO_KEY(KEY_1, RCAR_GP_PIN(1, 14), "SW2-pin1"),
66 };
67
68 static __initdata struct gpio_keys_platform_data lager_keys_pdata = {
69 .buttons = gpio_buttons,
70 .nbuttons = ARRAY_SIZE(gpio_buttons),
71 };
72
73 static const struct pinctrl_map lager_pinctrl_map[] = {
74 /* SCIF0 (CN19: DEBUG SERIAL0) */
75 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
76 "scif0_data", "scif0"),
77 /* SCIF1 (CN20: DEBUG SERIAL1) */
78 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790",
79 "scif1_data", "scif1"),
80 };
81
82 static void __init lager_add_standard_devices(void)
83 {
84 r8a7790_clock_init();
85
86 pinctrl_register_mappings(lager_pinctrl_map,
87 ARRAY_SIZE(lager_pinctrl_map));
88 r8a7790_pinmux_init();
89
90 r8a7790_add_standard_devices();
91 platform_device_register_data(&platform_bus, "leds-gpio", -1,
92 &lager_leds_pdata,
93 sizeof(lager_leds_pdata));
94 platform_device_register_data(&platform_bus, "gpio-keys", -1,
95 &lager_keys_pdata,
96 sizeof(lager_keys_pdata));
97 }
98
99 static const char *lager_boards_compat_dt[] __initdata = {
100 "renesas,lager",
101 NULL,
102 };
103
104 DT_MACHINE_START(LAGER_DT, "lager")
105 .init_time = r8a7790_timer_init,
106 .init_machine = lager_add_standard_devices,
107 .dt_compat = lager_boards_compat_dt,
108 MACHINE_END
This page took 0.03372 seconds and 5 git commands to generate.