Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board-nas4220b.c
Go to the documentation of this file.
1 /*
2  * Support for Raidsonic NAS-4220-B
3  *
4  * Copyright (C) 2009 Janos Laube <[email protected]>
5  *
6  * based on rut1xx.c
7  * Copyright (C) 2008 Paulius Zaleckas <[email protected]>
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>
21 #include <linux/mdio-gpio.h>
22 #include <linux/io.h>
23 
24 #include <asm/setup.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/time.h>
28 
29 #include <mach/hardware.h>
30 #include <mach/global_reg.h>
31 
32 #include "common.h"
33 
34 static struct sys_timer ib4220b_timer = {
35  .init = gemini_timer_init,
36 };
37 
38 static struct gpio_led ib4220b_leds[] = {
39  {
40  .name = "nas4220b:orange:hdd",
41  .default_trigger = "none",
42  .gpio = 60,
43  },
44  {
45  .name = "nas4220b:green:os",
46  .default_trigger = "heartbeat",
47  .gpio = 62,
48  },
49 };
50 
51 static struct gpio_led_platform_data ib4220b_leds_data = {
52  .num_leds = ARRAY_SIZE(ib4220b_leds),
53  .leds = ib4220b_leds,
54 };
55 
56 static struct platform_device ib4220b_led_device = {
57  .name = "leds-gpio",
58  .id = -1,
59  .dev = {
60  .platform_data = &ib4220b_leds_data,
61  },
62 };
63 
64 static struct gpio_keys_button ib4220b_keys[] = {
65  {
66  .code = KEY_SETUP,
67  .gpio = 61,
68  .active_low = 1,
69  .desc = "Backup Button",
70  .type = EV_KEY,
71  },
72  {
73  .code = KEY_RESTART,
74  .gpio = 63,
75  .active_low = 1,
76  .desc = "Softreset Button",
77  .type = EV_KEY,
78  },
79 };
80 
81 static struct gpio_keys_platform_data ib4220b_keys_data = {
82  .buttons = ib4220b_keys,
83  .nbuttons = ARRAY_SIZE(ib4220b_keys),
84 };
85 
86 static struct platform_device ib4220b_key_device = {
87  .name = "gpio-keys",
88  .id = -1,
89  .dev = {
90  .platform_data = &ib4220b_keys_data,
91  },
92 };
93 
94 static void __init ib4220b_init(void)
95 {
99  platform_device_register(&ib4220b_led_device);
100  platform_device_register(&ib4220b_key_device);
102 }
103 
104 MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
105  .atag_offset = 0x100,
106  .map_io = gemini_map_io,
107  .init_irq = gemini_init_irq,
108  .timer = &ib4220b_timer,
109  .init_machine = ib4220b_init,