2 * ZyXEL NBG-419N board support
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
25 #define NBG_419N_GPIO_LED_POWER 9
26 #define NBG_419N_GPIO_LED_WPS 14
28 #define NBG_419N_GPIO_BUTTON_WPS 0 /* active low */
29 #define NBG_419N_GPIO_BUTTON_RESET 10 /* active low */
31 #define NBG_419N_BUTTONS_POLL_INTERVAL 20
33 #ifdef CONFIG_MTD_PARTITIONS
34 static struct mtd_partition nbg_419n_partitions
[] = {
39 .mask_flags
= MTD_WRITEABLE
,
44 .mask_flags
= MTD_WRITEABLE
,
49 .mask_flags
= MTD_WRITEABLE
,
56 #endif /* CONFIG_MTD_PARTITIONS */
58 static struct physmap_flash_data nbg_419n_flash_data
= {
59 #ifdef CONFIG_MTD_PARTITIONS
60 .nr_parts
= ARRAY_SIZE(nbg_419n_partitions
),
61 .parts
= nbg_419n_partitions
,
65 static struct gpio_led nbg_419n_leds_gpio
[] __initdata
= {
67 .name
= "nbg-419n:green:power",
68 .gpio
= NBG_419N_GPIO_LED_POWER
,
71 .name
= "nbg-419n:green:wps",
72 .gpio
= NBG_419N_GPIO_LED_WPS
,
77 static struct gpio_button nbg_419n_gpio_buttons
[] __initdata
= {
83 .gpio
= NBG_419N_GPIO_BUTTON_RESET
,
88 .code
= KEY_WPS_BUTTON
,
90 .gpio
= NBG_419N_GPIO_BUTTON_WPS
,
95 static void __init
nbg_419n_init(void)
97 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
99 rt305x_register_flash(0, &nbg_419n_flash_data
);
100 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
101 rt305x_register_ethernet();
102 ramips_register_gpio_leds(-1, ARRAY_SIZE(nbg_419n_leds_gpio
),
104 ramips_register_gpio_buttons(-1, NBG_419N_BUTTONS_POLL_INTERVAL
,
105 ARRAY_SIZE(nbg_419n_gpio_buttons
),
106 nbg_419n_gpio_buttons
);
107 rt305x_register_wifi();
108 rt305x_register_wdt();
111 MIPS_MACHINE(RAMIPS_MACH_NBG_419N
, "NBG-419N", "ZyXEL NBG-419N", nbg_419n_init
);