Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Support for Teltonika RUT1xx |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/leds.h> |
| 15 | #include <linux/input.h> |
| 16 | #include <linux/gpio_keys.h> |
Arnd Bergmann | 662146b | 2013-01-04 13:38:03 +0000 | [diff] [blame] | 17 | #include <linux/sizes.h> |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 18 | |
| 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/time.h> |
| 22 | |
| 23 | #include "common.h" |
| 24 | |
| 25 | static struct gpio_keys_button rut1xx_keys[] = { |
| 26 | { |
| 27 | .code = KEY_SETUP, |
| 28 | .gpio = 60, |
| 29 | .active_low = 1, |
| 30 | .desc = "Reset to defaults", |
| 31 | .type = EV_KEY, |
| 32 | }, |
| 33 | }; |
| 34 | |
| 35 | static struct gpio_keys_platform_data rut1xx_keys_data = { |
| 36 | .buttons = rut1xx_keys, |
| 37 | .nbuttons = ARRAY_SIZE(rut1xx_keys), |
| 38 | }; |
| 39 | |
| 40 | static struct platform_device rut1xx_keys_device = { |
| 41 | .name = "gpio-keys", |
| 42 | .id = -1, |
| 43 | .dev = { |
| 44 | .platform_data = &rut1xx_keys_data, |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | static struct gpio_led rut100_leds[] = { |
| 49 | { |
| 50 | .name = "Power", |
| 51 | .default_trigger = "heartbeat", |
| 52 | .gpio = 17, |
| 53 | }, |
| 54 | { |
| 55 | .name = "GSM", |
| 56 | .default_trigger = "default-on", |
| 57 | .gpio = 7, |
| 58 | .active_low = 1, |
| 59 | }, |
| 60 | }; |
| 61 | |
| 62 | static struct gpio_led_platform_data rut100_leds_data = { |
| 63 | .num_leds = ARRAY_SIZE(rut100_leds), |
| 64 | .leds = rut100_leds, |
| 65 | }; |
| 66 | |
| 67 | static struct platform_device rut1xx_leds = { |
| 68 | .name = "leds-gpio", |
| 69 | .id = -1, |
| 70 | .dev = { |
| 71 | .platform_data = &rut100_leds_data, |
| 72 | }, |
| 73 | }; |
| 74 | |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 75 | static void __init rut1xx_init(void) |
| 76 | { |
| 77 | gemini_gpio_init(); |
| 78 | platform_register_uart(); |
| 79 | platform_register_pflash(SZ_8M, NULL, 0); |
| 80 | platform_device_register(&rut1xx_leds); |
| 81 | platform_device_register(&rut1xx_keys_device); |
Hans Ulli Kroll | f512626 | 2010-12-26 11:02:29 +0100 | [diff] [blame] | 82 | platform_register_rtc(); |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | MACHINE_START(RUT100, "Teltonika RUT100") |
Nicolas Pitre | 2b078cd | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 86 | .atag_offset = 0x100, |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 87 | .map_io = gemini_map_io, |
| 88 | .init_irq = gemini_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 89 | .init_time = gemini_timer_init, |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 90 | .init_machine = rut1xx_init, |
Arnd Bergmann | 662146b | 2013-01-04 13:38:03 +0000 | [diff] [blame] | 91 | .restart = gemini_restart, |
Paulius Zaleckas | 839e642 | 2009-03-26 10:06:27 +0200 | [diff] [blame] | 92 | MACHINE_END |