Signed-off-by: Andrew 'Necromant' Andrianov <[email protected]> --- target/linux/ar71xx/config-3.3 | 1 + .../files/arch/mips/ath79/mach-mercury-mw150r.c | 120 ++++++++++++++++++++ .../610-MIPS-ath79-openwrt-machines.patch | 25 +++- 3 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3 index ebb0553..c17bc3d 100644 --- a/target/linux/ar71xx/config-3.3 +++ b/target/linux/ar71xx/config-3.3 @@ -37,6 +37,7 @@ CONFIG_ATH79_MACH_EW_DORIN=y CONFIG_ATH79_MACH_HORNET_UB=y CONFIG_ATH79_MACH_JA76PF=y CONFIG_ATH79_MACH_JWAP003=y +CONFIG_ATH79_MACH_MERCURY_MW150R=y CONFIG_ATH79_MACH_MZK_W04NU=y CONFIG_ATH79_MACH_MZK_W300NH=y CONFIG_ATH79_MACH_NBG460N=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c new file mode 100644 index 0000000..1efe96d --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c @@ -0,0 +1,120 @@ +/* + * Mercury MW150R board support + * + * Copyright (C) 2012 Andrew 'Necromant' Andrianov <[email protected]> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <asm/mach-ath79/ath79.h> +#include <asm/mach-ath79/ar71xx_regs.h> + +#include "common.h" +#include "dev-wmac.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "machtypes.h" + +#define MW150R_GPIO_LED_GEAR 27 +#define MW150R_GPIO_LED_WLAN 0 +#define MW150R_GPIO_LED_LOCK 26 +#define MW150R_GPIO_LED_LAN1 13 +#define MW150R_GPIO_LED_LAN2 14 +#define MW150R_GPIO_LED_LAN3 15 +#define MW150R_GPIO_LED_LAN4 16 +#define MW150R_GPIO_LED_WAN 17 + +#define MW150R_GPIO_BTN_RESET 11 + +#define MW150R_KEYS_POLL_INTERVAL 20 /* msecs */ +#define MW150R_KEYS_DEBOUNCE_INTERVAL (3 * MW150R_KEYS_POLL_INTERVAL) + +static const char *mw150r_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data mw150r_flash_data = { + .part_probes = mw150r_part_probes, +}; + +static struct gpio_led mw150r_leds_gpio[] __initdata = { + { + .name = "mercury:green:lan1", + .gpio = MW150R_GPIO_LED_LAN1, + }, { + .name = "mercury:green:lan2", + .gpio = MW150R_GPIO_LED_LAN2, + }, { + .name = "mercury:green:lan3", + .gpio = MW150R_GPIO_LED_LAN3, + }, { + .name = "mercury:green:lan4", + .gpio = MW150R_GPIO_LED_LAN4, + }, { + .name = "mercury:green:gear", + .gpio = MW150R_GPIO_LED_GEAR, + .active_low = 1, + }, { + .name = "mercury:green:lock", + .gpio = MW150R_GPIO_LED_LOCK, + }, { + .name = "mercury:green:wan", + .gpio = MW150R_GPIO_LED_WAN, + .active_low = 1, + }, { + .name = "mercury:green:wlan", + .gpio = MW150R_GPIO_LED_WLAN, + }, +}; + +static struct gpio_keys_button mw150r_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = MW150R_KEYS_DEBOUNCE_INTERVAL, + .gpio = MW150R_GPIO_BTN_RESET, + } +}; + +static void __init mw150r_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + ath79_register_m25p80(&mw150r_flash_data); + + ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(mw150r_leds_gpio), + mw150r_leds_gpio); + + ath79_register_gpio_keys_polled(-1, MW150R_KEYS_POLL_INTERVAL, + ARRAY_SIZE(mw150r_gpio_keys), + mw150r_gpio_keys); + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); + ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); + + ath79_register_mdio(0, 0x0); + + /* LAN ports */ + ath79_register_eth(1); + + /* WAN port */ + ath79_register_eth(0); + + ath79_register_wmac(ee, mac); + +} +MIPS_MACHINE(ATH79_MACH_MERCURY_MW150R, "MERCURY-MW150R", "Mercury MW150R", + mw150r_setup); diff --git a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch index f0727ad..68ebd3a 100644 --- a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,18 +16,91 @@ +@@ -16,18 +16,92 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -89,6 +89,7 @@ + ATH79_MACH_WZR_HP_G300NH2, /* Buffalo WZR-HP-G300NH2 */ + ATH79_MACH_WZR_HP_G450H, /* Buffalo WZR-HP-G450H */ + ATH79_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */ ++ ATH79_MACH_MERCURY_MW150R, /* Mercury MW150R */ }; #endif /* _ATH79_MACHTYPE_H */ @@ -606,7 +607,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM (rev 1.0) board" select SOC_AR724X -@@ -79,6 +563,24 @@ config ATH79_MACH_UBNT_XM +@@ -79,6 +563,35 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -628,10 +629,21 @@ + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + ++config ATH79_MACH_MERCURY_MW150R ++ bool "Mercury MW150R support" ++ select SOC_AR933X ++ select ATH79_DEV_AP9X_PCI if PCI ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++ endmenu config SOC_AR71XX -@@ -114,10 +616,6 @@ config SOC_QCA955X +@@ -114,10 +627,6 @@ config SOC_QCA955X select PCI_AR724X if PCI def_bool n @@ -642,7 +654,7 @@ config ATH79_DEV_AP9X_PCI select ATH79_PCI_ATH9K_FIXUP def_bool n -@@ -128,7 +626,14 @@ config ATH79_DEV_DSA +@@ -128,7 +637,14 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -658,7 +670,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -153,4 +658,7 @@ config ATH79_NVRAM +@@ -153,4 +669,7 @@ config ATH79_NVRAM config ATH79_PCI_ATH9K_FIXUP def_bool n @@ -668,7 +680,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -36,9 +36,61 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += p +@@ -36,9 +36,62 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += p # # Machines # @@ -730,6 +742,7 @@ +obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2) += mach-wzr-hp-g300nh2.o +obj-$(CONFIG_ATH79_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o +obj-$(CONFIG_ATH79_MACH_WZR_HP_G450H) += mach-wzr-hp-g450h.o ++obj-$(CONFIG_ATH79_MACH_MERCURY_MW150R) += mach-mercury-mw150r.o --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c @@ -180,6 +180,9 @@ void __init prom_init(void) -- 1.7.6 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
