From b144a405e520c8f1c1e173708ff79e9b8b097c09 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Fri, 1 Feb 2013 15:50:42 +0000 Subject: ar71xx: add kernel support for the OpenMesh MR600v2 Signed-off-by: Marek Lindner Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35428 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ath79/mach-mr600.c | 75 ++++++++++++++++++++-- .../614-MIPS-ath79-MR600v2-support.patch | 10 +++ 2 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 target/linux/ar71xx/patches-3.7/614-MIPS-ath79-MR600v2-support.patch diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c index f47aad3783..8e3f6dac51 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c @@ -35,8 +35,17 @@ #include "machtypes.h" #define MR600_GPIO_LED_WLAN58 12 -#define MR600_GPIO_LED_WPS 13 -#define MR600_GPIO_LED_POWER 14 +#define MR600_GPIO_LED_WPS 13 +#define MR600_GPIO_LED_POWER 14 + +#define MR600V2_GPIO_LED_WLAN58_RED 12 +#define MR600V2_GPIO_LED_WPS 13 +#define MR600V2_GPIO_LED_POWER 14 +#define MR600V2_GPIO_LED_WLAN24_GREEN 18 +#define MR600V2_GPIO_LED_WLAN24_YELLOW 19 +#define MR600V2_GPIO_LED_WLAN24_RED 20 +#define MR600V2_GPIO_LED_WLAN58_GREEN 21 +#define MR600V2_GPIO_LED_WLAN58_YELLOW 22 #define MR600_GPIO_BTN_RESET 17 @@ -65,6 +74,49 @@ static struct gpio_led mr600_leds_gpio[] __initdata = { }, }; +static struct gpio_led mr600v2_leds_gpio[] __initdata = { + { + .name = "mr600:blue:power", + .gpio = MR600V2_GPIO_LED_POWER, + .active_low = 1, + }, + { + .name = "mr600:blue:wps", + .gpio = MR600V2_GPIO_LED_WPS, + .active_low = 1, + }, + { + .name = "mr600:red:wlan24", + .gpio = MR600V2_GPIO_LED_WLAN24_RED, + .active_low = 1, + }, + { + .name = "mr600:yellow:wlan24", + .gpio = MR600V2_GPIO_LED_WLAN24_YELLOW, + .active_low = 1, + }, + { + .name = "mr600:green:wlan24", + .gpio = MR600V2_GPIO_LED_WLAN24_GREEN, + .active_low = 1, + }, + { + .name = "mr600:red:wlan58", + .gpio = MR600V2_GPIO_LED_WLAN58_RED, + .active_low = 1, + }, + { + .name = "mr600:yellow:wlan58", + .gpio = MR600V2_GPIO_LED_WLAN58_YELLOW, + .active_low = 1, + }, + { + .name = "mr600:green:wlan58", + .gpio = MR600V2_GPIO_LED_WLAN58_GREEN, + .active_low = 1, + }, +}; + static struct gpio_keys_button mr600_gpio_keys[] __initdata = { { .desc = "Reset button", @@ -76,15 +128,14 @@ static struct gpio_keys_button mr600_gpio_keys[] __initdata = { }, }; -static void __init mr600_setup(void) +static void __init mr600_base_setup(unsigned num_leds, struct gpio_led *leds) { - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); u8 mac[6]; ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(mr600_leds_gpio), - mr600_leds_gpio); + ath79_register_leds_gpio(-1, num_leds, leds); ath79_register_gpio_keys_polled(-1, MR600_KEYS_POLL_INTERVAL, ARRAY_SIZE(mr600_gpio_keys), mr600_gpio_keys); @@ -110,4 +161,16 @@ static void __init mr600_setup(void) ath79_register_eth(0); } +static void __init mr600_setup(void) +{ + mr600_base_setup(ARRAY_SIZE(mr600_leds_gpio), mr600_leds_gpio); +} + MIPS_MACHINE(ATH79_MACH_MR600, "MR600", "OpenMesh MR600", mr600_setup); + +static void __init mr600v2_setup(void) +{ + mr600_base_setup(ARRAY_SIZE(mr600v2_leds_gpio), mr600v2_leds_gpio); +} + +MIPS_MACHINE(ATH79_MACH_MR600V2, "MR600v2", "OpenMesh MR600v2", mr600v2_setup); diff --git a/target/linux/ar71xx/patches-3.7/614-MIPS-ath79-MR600v2-support.patch b/target/linux/ar71xx/patches-3.7/614-MIPS-ath79-MR600v2-support.patch new file mode 100644 index 0000000000..cc441da512 --- /dev/null +++ b/target/linux/ar71xx/patches-3.7/614-MIPS-ath79-MR600v2-support.patch @@ -0,0 +1,10 @@ +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -47,6 +47,7 @@ enum ath79_mach_type { + ATH79_MACH_JA76PF2, /* jjPlus JA76PF2 */ + ATH79_MACH_JWAP003, /* jjPlus JWAP003 */ + ATH79_MACH_HORNET_UB, /* ALFA Networks Hornet-UB */ ++ ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */ + ATH79_MACH_MR600, /* OpenMesh MR600 */ + ATH79_MACH_MZK_W04NU, /* Planex MZK-W04NU */ + ATH79_MACH_MZK_W300NH, /* Planex MZK-W300NH */ -- cgit v1.2.3