Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 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/interrupt.h> |
| 22 | #include <linux/irqchip.h> |
| 23 | #include <linux/kernel.h> |
Simon Horman | 1034f4e | 2013-04-23 02:37:05 +0000 | [diff] [blame^] | 24 | #include <linux/leds.h> |
Laurent Pinchart | e3a28ac | 2013-04-08 11:36:22 +0200 | [diff] [blame] | 25 | #include <linux/pinctrl/machine.h> |
Simon Horman | 1034f4e | 2013-04-23 02:37:05 +0000 | [diff] [blame^] | 26 | #include <linux/platform_data/gpio-rcar.h> |
Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 27 | #include <linux/platform_device.h> |
| 28 | #include <mach/common.h> |
| 29 | #include <mach/r8a7790.h> |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | |
Simon Horman | 1034f4e | 2013-04-23 02:37:05 +0000 | [diff] [blame^] | 33 | /* LEDS */ |
| 34 | static struct gpio_led lager_leds[] = { |
| 35 | { |
| 36 | .name = "led8", |
| 37 | .gpio = RCAR_GP_PIN(5, 17), |
| 38 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 39 | }, { |
| 40 | .name = "led7", |
| 41 | .gpio = RCAR_GP_PIN(4, 23), |
| 42 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 43 | }, { |
| 44 | .name = "led6", |
| 45 | .gpio = RCAR_GP_PIN(4, 22), |
| 46 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 47 | }, |
| 48 | }; |
| 49 | |
| 50 | static struct gpio_led_platform_data lager_leds_pdata = { |
| 51 | .leds = lager_leds, |
| 52 | .num_leds = ARRAY_SIZE(lager_leds), |
| 53 | }; |
| 54 | |
Laurent Pinchart | e3a28ac | 2013-04-08 11:36:22 +0200 | [diff] [blame] | 55 | static const struct pinctrl_map lager_pinctrl_map[] = { |
| 56 | /* SCIF0 (CN19: DEBUG SERIAL0) */ |
| 57 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", |
| 58 | "scif0_data", "scif0"), |
| 59 | /* SCIF1 (CN20: DEBUG SERIAL1) */ |
| 60 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790", |
| 61 | "scif1_data", "scif1"), |
| 62 | }; |
| 63 | |
Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 64 | static void __init lager_add_standard_devices(void) |
| 65 | { |
| 66 | r8a7790_clock_init(); |
Laurent Pinchart | e3a28ac | 2013-04-08 11:36:22 +0200 | [diff] [blame] | 67 | |
| 68 | pinctrl_register_mappings(lager_pinctrl_map, |
| 69 | ARRAY_SIZE(lager_pinctrl_map)); |
| 70 | r8a7790_pinmux_init(); |
| 71 | |
Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 72 | r8a7790_add_standard_devices(); |
Simon Horman | 1034f4e | 2013-04-23 02:37:05 +0000 | [diff] [blame^] | 73 | platform_device_register_data(&platform_bus, "leds-gpio", -1, |
| 74 | &lager_leds_pdata, |
| 75 | sizeof(lager_leds_pdata)); |
Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | static const char *lager_boards_compat_dt[] __initdata = { |
| 79 | "renesas,lager", |
| 80 | NULL, |
| 81 | }; |
| 82 | |
| 83 | DT_MACHINE_START(LAGER_DT, "lager") |
| 84 | .init_irq = irqchip_init, |
Magnus Damm | 65be2de | 2013-04-08 10:23:37 +0900 | [diff] [blame] | 85 | .init_time = r8a7790_timer_init, |
Magnus Damm | 3cc828f | 2013-03-29 17:49:37 +0900 | [diff] [blame] | 86 | .init_machine = lager_add_standard_devices, |
| 87 | .dt_compat = lager_boards_compat_dt, |
| 88 | MACHINE_END |