Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Support for Raidsonic NAS-4220-B |
| 3 | * |
| 4 | * Copyright (C) 2009 Janos Laube <janos.dev@gmail.com> |
| 5 | * |
| 6 | * based on rut1xx.c |
| 7 | * Copyright (C) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/leds.h> |
| 19 | #include <linux/input.h> |
| 20 | #include <linux/gpio_keys.h> |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 21 | #include <linux/io.h> |
| 22 | |
| 23 | #include <asm/setup.h> |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/time.h> |
| 27 | |
| 28 | #include <mach/hardware.h> |
| 29 | #include <mach/global_reg.h> |
| 30 | |
| 31 | #include "common.h" |
| 32 | |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 33 | static struct gpio_led ib4220b_leds[] = { |
| 34 | { |
| 35 | .name = "nas4220b:orange:hdd", |
| 36 | .default_trigger = "none", |
| 37 | .gpio = 60, |
| 38 | }, |
| 39 | { |
| 40 | .name = "nas4220b:green:os", |
| 41 | .default_trigger = "heartbeat", |
| 42 | .gpio = 62, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | static struct gpio_led_platform_data ib4220b_leds_data = { |
| 47 | .num_leds = ARRAY_SIZE(ib4220b_leds), |
| 48 | .leds = ib4220b_leds, |
| 49 | }; |
| 50 | |
| 51 | static struct platform_device ib4220b_led_device = { |
| 52 | .name = "leds-gpio", |
| 53 | .id = -1, |
| 54 | .dev = { |
| 55 | .platform_data = &ib4220b_leds_data, |
| 56 | }, |
| 57 | }; |
| 58 | |
| 59 | static struct gpio_keys_button ib4220b_keys[] = { |
| 60 | { |
| 61 | .code = KEY_SETUP, |
| 62 | .gpio = 61, |
| 63 | .active_low = 1, |
| 64 | .desc = "Backup Button", |
| 65 | .type = EV_KEY, |
| 66 | }, |
| 67 | { |
| 68 | .code = KEY_RESTART, |
| 69 | .gpio = 63, |
| 70 | .active_low = 1, |
| 71 | .desc = "Softreset Button", |
| 72 | .type = EV_KEY, |
| 73 | }, |
| 74 | }; |
| 75 | |
| 76 | static struct gpio_keys_platform_data ib4220b_keys_data = { |
| 77 | .buttons = ib4220b_keys, |
| 78 | .nbuttons = ARRAY_SIZE(ib4220b_keys), |
| 79 | }; |
| 80 | |
| 81 | static struct platform_device ib4220b_key_device = { |
| 82 | .name = "gpio-keys", |
| 83 | .id = -1, |
| 84 | .dev = { |
| 85 | .platform_data = &ib4220b_keys_data, |
| 86 | }, |
| 87 | }; |
| 88 | |
| 89 | static void __init ib4220b_init(void) |
| 90 | { |
| 91 | gemini_gpio_init(); |
| 92 | platform_register_uart(); |
| 93 | platform_register_pflash(SZ_16M, NULL, 0); |
| 94 | platform_device_register(&ib4220b_led_device); |
| 95 | platform_device_register(&ib4220b_key_device); |
Hans Ulli Kroll | f512626 | 2010-12-26 11:02:29 +0100 | [diff] [blame] | 96 | platform_register_rtc(); |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") |
Nicolas Pitre | 2b078cd | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 100 | .atag_offset = 0x100, |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 101 | .map_io = gemini_map_io, |
| 102 | .init_irq = gemini_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 103 | .init_time = gemini_timer_init, |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 104 | .init_machine = ib4220b_init, |
Arnd Bergmann | 662146b | 2013-01-04 13:38:03 +0000 | [diff] [blame] | 105 | .restart = gemini_restart, |
Hans Ulli Kroll | a21e003 | 2010-05-13 06:37:26 +0100 | [diff] [blame] | 106 | MACHINE_END |