1 --- a/arch/arm/mach-kirkwood/Kconfig
2 +++ b/arch/arm/mach-kirkwood/Kconfig
3 @@ -142,6 +142,12 @@ config MACH_NAS6210
4 Say 'Y' here if you want your kernel to support the
5 RaidSonic ICY BOX IB-NAS6210 device.
10 + Say 'Y' here if you want your kernel to support the
11 + ZyXEL NSA-310 board.
16 --- a/arch/arm/mach-kirkwood/Makefile
17 +++ b/arch/arm/mach-kirkwood/Makefile
18 @@ -20,5 +20,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbi
19 obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
20 obj-$(CONFIG_MACH_T5325) += t5325-setup.o
21 obj-$(CONFIG_MACH_NAS6210) += nas6210-setup.o
22 +obj-$(CONFIG_MACH_NSA_310) += nsa-310-setup.o
24 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
26 +++ b/arch/arm/mach-kirkwood/nsa-310-setup.c
29 + * arch/arm/mach-kirkwood/nsa-310-setup.c
31 + * ZyXEL NSA-310 Setup
33 + * This file is licensed under the terms of the GNU General Public
34 + * License version 2. This program is licensed "as is" without any
35 + * warranty of any kind, whether express or implied.
38 +#include <linux/kernel.h>
39 +#include <linux/init.h>
40 +#include <linux/platform_device.h>
41 +#include <linux/ata_platform.h>
42 +#include <linux/i2c.h>
43 +#include <linux/mtd/mtd.h>
44 +#include <linux/mtd/partitions.h>
45 +#include <linux/gpio.h>
46 +#include <linux/gpio_keys.h>
47 +#include <linux/input.h>
48 +#include <linux/leds.h>
49 +#include <linux/delay.h>
51 +#include <asm/mach-types.h>
52 +#include <asm/mach/arch.h>
53 +#include <mach/kirkwood.h>
57 +#define NSA310_GPIO_LED_ESATA_GREEN 12
58 +#define NSA310_GPIO_LED_ESATA_RED 13
59 +#define NSA310_GPIO_LED_USB_GREEN 15
60 +#define NSA310_GPIO_LED_USB_RED 16
61 +#define NSA310_GPIO_USB_POWER_OFF 21
62 +#define NSA310_GPIO_LED_SYS_GREEN 28
63 +#define NSA310_GPIO_LED_SYS_RED 29
64 +#define NSA310_GPIO_KEY_RESTART 36
65 +#define NSA310_GPIO_KEY_COPY 37
66 +#define NSA310_GPIO_LED_COPY_GREEN 39
67 +#define NSA310_GPIO_LED_COPY_RED 40
68 +#define NSA310_GPIO_LED_HDD_GREEN 41
69 +#define NSA310_GPIO_LED_HDD_RED 42
70 +#define NSA310_GPIO_BUZZER 44
71 +#define NSA310_GPIO_KEY_POWER 46
72 +#define NSA310_GPIO_POWER_OFF 48
75 +static unsigned int nsa310_mpp_config[] __initdata = {
95 +static struct mtd_partition nsa310_mtd_parts[] = {
100 + .mask_flags = MTD_WRITEABLE,
102 + .name = "uboot_env",
103 + .offset = MTDPART_OFS_NXTBLK,
106 + .name = "key_store",
107 + .offset = MTDPART_OFS_NXTBLK,
111 + .offset = MTDPART_OFS_NXTBLK,
115 + .offset = MTDPART_OFS_NXTBLK,
118 + .name = "kernel_1",
119 + .offset = MTDPART_OFS_NXTBLK,
123 + .offset = MTDPART_OFS_NXTBLK,
126 + .name = "kernel_2",
127 + .offset = MTDPART_OFS_NXTBLK,
131 + .offset = MTDPART_OFS_NXTBLK,
136 +static struct gpio_led nsa310_leds[] = {
138 + .name = "nsa310:green:sys",
139 + .gpio = NSA310_GPIO_LED_SYS_GREEN,
141 + .name = "nsa310:red:sys",
142 + .gpio = NSA310_GPIO_LED_SYS_RED,
144 + .name = "nsa310:green:hdd",
145 + .gpio = NSA310_GPIO_LED_HDD_GREEN,
147 + .name = "nsa310:red:hdd",
148 + .gpio = NSA310_GPIO_LED_HDD_RED,
150 + .name = "nsa310:green:esata",
151 + .gpio = NSA310_GPIO_LED_ESATA_GREEN,
153 + .name = "nsa310:red:esata",
154 + .gpio = NSA310_GPIO_LED_ESATA_RED,
156 + .name = "nsa310:green:usb",
157 + .gpio = NSA310_GPIO_LED_USB_GREEN,
159 + .name = "nsa310:red:usb",
160 + .gpio = NSA310_GPIO_LED_USB_RED,
162 + .name = "nsa310:green:copy",
163 + .gpio = NSA310_GPIO_LED_COPY_GREEN,
165 + .name = "nsa310:red:copy",
166 + .gpio = NSA310_GPIO_LED_COPY_RED,
170 +static struct gpio_led_platform_data nsa310_leds_data = {
171 + .leds = nsa310_leds,
172 + .num_leds = ARRAY_SIZE(nsa310_leds),
175 +static struct platform_device nsa310_leds_device = {
176 + .name = "leds-gpio",
179 + .platform_data = &nsa310_leds_data,
183 +static struct gpio_keys_button nsa310_buttons[] = {
185 + .desc = "Power Button",
188 + .gpio = NSA310_GPIO_KEY_POWER,
189 + .debounce_interval = 1000,
191 + .desc = "Copy Button",
194 + .gpio = NSA310_GPIO_KEY_COPY,
196 + .debounce_interval = 1000,
198 + .desc = "Reset Button",
199 + .code = KEY_RESTART,
201 + .gpio = NSA310_GPIO_KEY_RESTART,
203 + .debounce_interval = 1000,
207 +static struct gpio_keys_platform_data nsa310_keys_data = {
208 + .buttons = nsa310_buttons,
209 + .nbuttons = ARRAY_SIZE(nsa310_buttons),
212 +static struct platform_device nsa310_keys_device = {
213 + .name = "gpio-keys",
216 + .platform_data = &nsa310_keys_data,
220 +static struct i2c_board_info __initdata nsa310_i2c_info[] = {
221 + { I2C_BOARD_INFO("adt7476", 0x2e) },
224 +static struct mv_sata_platform_data nsa310_sata_data = {
228 +static void nsa310_power_off(void)
230 + gpio_set_value(NSA310_GPIO_POWER_OFF, 1);
233 +static int __init nsa310_gpio_request(unsigned int gpio, unsigned long flags,
238 + err = gpio_request_one(gpio, flags, label);
240 + pr_err("NSA-310: can't setup GPIO%u (%s), err=%d\n",
246 +static void __init nsa310_gpio_init(void)
250 + err = nsa310_gpio_request(NSA310_GPIO_POWER_OFF, GPIOF_OUT_INIT_LOW,
253 + pm_power_off = nsa310_power_off;
255 + nsa310_gpio_request(NSA310_GPIO_USB_POWER_OFF, GPIOF_OUT_INIT_LOW,
259 +static void __init nsa310_init(void)
264 + kirkwood_mpp_conf(nsa310_mpp_config);
266 + nsa310_gpio_init();
268 + kirkwood_nand_init(ARRAY_AND_SIZE(nsa310_mtd_parts), 35);
269 + kirkwood_ehci_init();
271 + kirkwood_pcie_id(&dev, &rev);
273 + kirkwood_sata_init(&nsa310_sata_data);
274 + kirkwood_uart0_init();
276 + i2c_register_board_info(0, ARRAY_AND_SIZE(nsa310_i2c_info));
277 + kirkwood_i2c_init();
279 + platform_device_register(&nsa310_leds_device);
280 + platform_device_register(&nsa310_keys_device);
283 +static int __init nsa310_pci_init(void)
285 + if (machine_is_nsa310())
286 + kirkwood_pcie_init(KW_PCIE0);
290 +subsys_initcall(nsa310_pci_init);
292 +MACHINE_START(NSA310, "ZyXEL NSA-310")
293 + .atag_offset = 0x100,
294 + .init_machine = nsa310_init,
295 + .map_io = kirkwood_map_io,
296 + .init_early = kirkwood_init_early,
297 + .init_irq = kirkwood_init_irq,
298 + .timer = &kirkwood_timer,
299 + .restart = kirkwood_restart,