|
This patch adds OpenWRT support for the Netgear WNR2200 (N300)
wireless router with USB.
Technical details of this router can be found at
http://www.netgear.com/home/prod ... d-play/WNR2200.aspx
and http://wikidevi.com/wiki/Netgear_WNR2200
The patch includes a new ar71xx/files/arch/mips/ath79/mach-wnr2200.c
file and corresponding updates to the base-files/etc/diag.sh,
base-files/etc/uci-defaults/02_network,
ar71xx/base-files/lib/ar71xx.sh, ar71xx/config-3.10,
ar71xx/generic/profiles/netgear.mk and ar71xx/image/Makefile files. - diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
- b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
- new file mode 100644
- index 0000000..5126d3f
- --- /dev/null
- +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
- @@ -0,0 +1,170 @@
- +/*
- + * NETGEAR WNR2200 board support
- + *
- + * Copyright (C) 2013 Aidan Kissane <aidankissane@googlemail.com>
- + *
- + * 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 <linux/mtd/mtd.h>
- +#include <linux/mtd/partitions.h>
- +
- +#include <asm/mach-ath79/ath79.h>
- +
- +#include "dev-ap9x-pci.h"
- +#include "dev-eth.h"
- +#include "dev-gpio-buttons.h"
- +#include "dev-leds-gpio.h"
- +#include "dev-m25p80.h"
- +#include "dev-usb.h"
- +##include "machtypes.h"
- +
- +//#define WNR2200_GPIO_LED_LAN1_AMBER ??
- +#define WNR2200_GPIO_LED_LAN2_AMBER 0
- +#define WNR2200_GPIO_LED_LAN4_AMBER 1
- +#define WNR2200_GPIO_LED_WPS 5
- +#define WNR2200_GPIO_LED_WAN_GREEN 7
- +#define WNR2200_GPIO_LED_USB 8
- +#define WNR2200_GPIO_LED_LAN3_AMBER 11
- +#define WNR2200_GPIO_LED_WAN_AMBER 12
- +#define WNR2200_GPIO_LED_LAN1_GREEN 13
- +#define WNR2200_GPIO_LED_LAN2_GREEN 14
- +#define WNR2200_GPIO_LED_LAN3_GREEN 15
- +#define WNR2200_GPIO_LED_LAN4_GREEN 16
- +#define WNR2200_GPIO_LED_PWR_AMBER 21
- +#define WNR2200_GPIO_LED_PWR_GREEN 22
- +
- +#define WNR220_GPIO_USB_POWER 24
- +
- +//#define WNR2200_GPIO_BTN_RESET ??
- +//#define WNR2200_GPIO_BTN_WIRELESS ??
- +//#define WNR2200_GPIO_BTN_WPS ??
- +
- +#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */
- +#define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL)
- +
- +#define WNR2200_MAC0_OFFSET 0
- +#define WNR2200_MAC1_OFFSET 6
- +#define WNR2200_PCIE_CALDATA_OFFSET 0x1000
- +
- +static struct gpio_led wnr2200_leds_gpio[] __initdata = {
- + {
- + .name = "wnr2200:amber:lan2",
- + .gpio = WNR2200_GPIO_LED_LAN2_AMBER,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:amber:lan4",
- + .gpio = WNR2200_GPIO_LED_LAN4_AMBER,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:wps",
- + .gpio = WNR2200_GPIO_LED_WPS,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:wan",
- + .gpio = WNR2200_GPIO_LED_WAN_GREEN,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:usb",
- + .gpio = WNR2200_GPIO_LED_USB,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:amber:lan3",
- + .gpio = WNR2200_GPIO_LED_LAN3_AMBER,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:amber:wan",
- + .gpio = WNR2200_GPIO_LED_WAN_AMBER,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:lan1",
- + .gpio = WNR2200_GPIO_LED_LAN1_GREEN,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:lan2",
- + .gpio = WNR2200_GPIO_LED_LAN2_GREEN,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:lan3",
- + .gpio = WNR2200_GPIO_LED_LAN3_GREEN,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:lan4",
- + .gpio = WNR2200_GPIO_LED_LAN4_GREEN,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:anber:power",
- + .gpio = WNR2200_GPIO_LED_PWR_AMBER,
- + .active_low = 1,
- + }, {
- + .name = "wnr2200:green:power",
- + .gpio = WNR2200_GPIO_LED_PWR_GREEN,
- + .active_low = 1,
- + }
- +};
- +
- +/*
- +static struct gpio_keys_button wnr2200_gpio_keys[] __initdata = {
- + {
- + .desc = "Reset button",
- + .type = EV_KEY,
- + .code = KEY_RESTART,
- + .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
- + .gpio = WNR2200_GPIO_BTN_RESET,
- + }, {
- + .desc = "WPS button",
- + .type = EV_KEY,
- + .code = KEY_WPS_BUTTON,
- + .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
- + .gpio = WNR2200_GPIO_BTN_WPS,
- + }, {
- + .desc = "Wireless button",
- + .type = EV_KEY,
- + .code = BTN_0,
- + .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
- + .gpio = WNR2200_GPIO_BTN_WIRELESS,
- + }
- +};
- +*/
- +
- +static void __init wnr2200_setup(void)
- +{
- + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
- +
- + ath79_register_mdio(0, 0x0);
- +
- + ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2200_MAC0_OFFSET, 0);
- + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
- + ath79_eth0_data.speed = SPEED_100;
- + ath79_eth0_data.duplex = DUPLEX_FULL;
- +
- + ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2200_MAC1_OFFSET, 0);
- + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
- + ath79_eth1_data.phy_mask = 0x10;
- +
- + ath79_register_eth(0);
- + ath79_register_eth(1);
- +
- + ath79_register_m25p80(NULL);
- + ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, NULL);
- +
- + ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
- + wnr2200_leds_gpio);
- +
- +/* ath79_register_gpio_keys_polled(-1, WNR2200_KEYS_POLL_INTERVAL,
- + ARRAY_SIZE(wnr2200_gpio_keys),
- + wnr2200_gpio_keys);
- +*/
- +
- + /* enable power for the USB port */
- + gpio_request_one(WNR220_GPIO_USB_POWER,
- + GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
- + "USB power");
- +
- + ath79_register_usb();
- +
- +}
- +
- +MIPS_MACHINE(ATH79_MACH_WNR2200, "WNR2200", "NETGEAR WNR2200", wnr2200_setup);
- diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
- b/target/linux/ar71xx/base-files/etc/diag.sh
- index 7b790e2..49803ca 100755
- --- a/target/linux/ar71xx/base-files/etc/diag.sh
- +++ b/target/linux/ar71xx/base-files/etc/diag.sh
- @@ -175,7 +175,10 @@ get_status_led() {
- wnr2000)
- status_led="wnr2000:green:power"
- ;;
- - wnr612-v2)
- + wnr2200)
- + status_led="wnr2200:amber:power"
- + ;;
- + wnr612-v2)
- status_led="wnr612v2:green:power"
- ;;
- wp543)
- diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- index 176c485..cf56e46 100755
- --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- @@ -169,6 +169,7 @@ tl-wr941nd)
- tl-mr3420-v2 |\
- tl-wr841n-v8 |\
- wnr2000-v3 |\
- +wnr2200 |\
- wnr612-v2)
- ucidef_set_interfaces_lan_wan "eth1" "eth0"
- ucidef_add_switch "switch0" "1" "1"
- diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
- b/target/linux/ar71xx/base-files/lib/ar71xx.sh
- index e7fbfbe..352582f 100755
- --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
- +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
- @@ -516,7 +516,10 @@ ar71xx_board_detect() {
- *WNR2000)
- name="wnr2000"
- ;;
- - *"WNR612 V2")
- + *WNR2200)
- + name="wnr2200"
- + ;;
- + *"WNR612 V2")
- name="wnr612-v2"
- ;;
- *WRT160NL)
- diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
- index 6c75f14..ae1a481 100644
- --- a/target/linux/ar71xx/config-3.10
- +++ b/target/linux/ar71xx/config-3.10
- @@ -90,6 +90,7 @@ CONFIG_ATH79_MACH_WNDR3700=y
- CONFIG_ATH79_MACH_WNDR4300=y
- CONFIG_ATH79_MACH_WNR2000=y
- CONFIG_ATH79_MACH_WNR2000_V3=y
- +CONFIG_ATH79_MACH_WNR2200=y
- CONFIG_ATH79_MACH_WP543=y
- CONFIG_ATH79_MACH_WPE72=y
- CONFIG_ATH79_MACH_WRT160NL=y
- diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk
- b/target/linux/ar71xx/generic/profiles/netgear.mk
- index 99425ec..7e32977 100644
- --- a/target/linux/ar71xx/generic/profiles/netgear.mk
- +++ b/target/linux/ar71xx/generic/profiles/netgear.mk
- @@ -60,3 +60,14 @@ define Profile/WNR612V2/Description
- endef
- $(eval $(call Profile,WNR612V2))
- +
- +
- +define Profile/WNR2200
- + NAME:=NETGEAR WNR2200
- +endef
- +
- +define Profile/WNR2200/Description
- + Package set optimized for the NETGEAR WNR2200
- +endef
- +
- +$(eval $(call Profile,WNR2200))
- diff --git a/target/linux/ar71xx/image/Makefile
- b/target/linux/ar71xx/image/Makefile
- index b755a9d..842af55 100644
- --- a/target/linux/ar71xx/image/Makefile
- +++ b/target/linux/ar71xx/image/Makefile
- @@ -182,6 +182,7 @@
- ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware)
- whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
- wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware)
- wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),2688k(rootfs),64k(art)ro,3712k@0x50000(firmware)
- +wnr2200_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),6528k(rootfs),64k(art)ro,7680k@0x70000(firmware)
- wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),6528k(rootfs),64k(art)ro,7680k@0x70000(firmware)
- wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1152k(kernel),14720k(rootfs),64k(art)ro,15872k@0x70000(firmware)
复制代码 自己试了下,多出了wnr2200的选项
不过貌似是针对8Mflash写的补丁,网件官网注明是16M(中国版?),估计倒数第三行mtdlayout要修改。
http://patchwork.openwrt.org/patch/4011/
http://patchwork.openwrt.org/patch/3972/
请不要胡乱输入以及粘贴、复制等方式灌水
请尊重作者、并共同维护网站的正常阅读,否则账户将会被限制发帖、回帖,站内短信以及阅读权限等都会受到影响,谢谢。
具体限制方式:https://www.right.com.cn/forum/thread-8307840-1-1.html
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|