Network connectivity works fine (LAN and WAN). For GPIOs, only pwr led and the green wan leds are supported for now.
Signed-off-by: Mathieu Olivari <[email protected]> --- .../ar71xx/base-files/etc/uci-defaults/02_network | 3 +- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + target/linux/ar71xx/config-3.8 | 1 + .../ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c | 91 ++++++++++++++++++++++ target/linux/ar71xx/generic/profiles/netgear.mk | 11 +++ target/linux/ar71xx/image/Makefile | 2 + ...-MIPS-ath79-add-Netgear-WNR2000v3-support.patch | 38 +++++++++ 7 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c create mode 100644 target/linux/ar71xx/patches-3.8/617-MIPS-ath79-add-Netgear-WNR2000v3-support.patch 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 0329ea5..14a1229 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -152,7 +152,8 @@ tl-wr941nd) ;; tl-mr3420-v2 |\ -tl-wr841n-v8) +tl-wr841n-v8 |\ +wnr2000-v3) ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_add_switch "switch0" "1" "1" ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index a9e063b..383dcab 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -453,6 +453,9 @@ ar71xx_board_detect() { *"WNDR4300") name="wndr4300" ;; + *"WNR2000 V3") + name="wnr2000-v3" + ;; *WNR2000) name="wnr2000" ;; diff --git a/target/linux/ar71xx/config-3.8 b/target/linux/ar71xx/config-3.8 index 847b9a5..5326d78 100644 --- a/target/linux/ar71xx/config-3.8 +++ b/target/linux/ar71xx/config-3.8 @@ -84,6 +84,7 @@ CONFIG_ATH79_MACH_WLAE_AG300N=y CONFIG_ATH79_MACH_WNDR3700=y CONFIG_ATH79_MACH_WNDR4300=y CONFIG_ATH79_MACH_WNR2000=y +CONFIG_ATH79_MACH_WNR2000_V3=y CONFIG_ATH79_MACH_WP543=y CONFIG_ATH79_MACH_WPE72=y CONFIG_ATH79_MACH_WRT160NL=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c new file mode 100644 index 0000000..bb7b24c --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c @@ -0,0 +1,91 @@ +/* + * NETGEAR WNR2000v3 board support + * + * Copytight (C) 2013 Mathieu Olivari <[email protected]> + * Copyright (C) 2008-2009 Gabor Juhos <[email protected]> + * Copyright (C) 2008 Imre Kaloz <[email protected]> + * Copyright (C) 2008-2009 Andy Boyett <[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 <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 "machtypes.h" + +#define WNR2000V3_GPIO_LED_WAN_GREEN 0 +#define WNR2000V3_GPIO_LED_LAN1_AMBER 1 +#define WNR2000V3_GPIO_LED_LAN4_AMBER 12 +#define WNR2000V3_GPIO_LED_PWR_GREEN 14 +#define WNR2000V3_GPIO_BTN_WPS 11 + +#define WNR2000V3_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WNR2000V3_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000V3_KEYS_POLL_INTERVAL) + +#define WNR2000V3_MAC0_OFFSET 0 +#define WNR2000V3_MAC1_OFFSET 6 +#define WNR2000V3_PCIE_CALDATA_OFFSET 0x1000 + +static struct gpio_led wnr2000v3_leds_gpio[] __initdata = { + { + .name = "wnr2000v3:green:power", + .gpio = WNR2000V3_GPIO_LED_PWR_GREEN, + .active_low = 1, + }, { + .name = "wnr2000v3:green:wan", + .gpio = WNR2000V3_GPIO_LED_WAN_GREEN, + .active_low = 1, + } +}; + +static struct gpio_keys_button wnr2000v3_gpio_keys[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, + .gpio = WNR2000V3_GPIO_BTN_WPS, + } +}; + +static void __init wnr2000v3_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V3_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+WNR2000V3_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); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000v3_leds_gpio), + wnr2000v3_leds_gpio); + + ath79_register_gpio_keys_polled(-1, WNR2000V3_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wnr2000v3_gpio_keys), + wnr2000v3_gpio_keys); + + ap91_pci_init(art + WNR2000V3_PCIE_CALDATA_OFFSET, NULL); +} + +MIPS_MACHINE(ATH79_MACH_WNR2000_V3, "WNR2000V3", "NETGEAR WNR2000 V3", wnr2000v3_setup); diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk b/target/linux/ar71xx/generic/profiles/netgear.mk index ff25f69..684d0eb 100644 --- a/target/linux/ar71xx/generic/profiles/netgear.mk +++ b/target/linux/ar71xx/generic/profiles/netgear.mk @@ -28,3 +28,14 @@ endef $(eval $(call Profile,WNDR4300)) + +define Profile/WNR2000V3 + NAME:=NETGEAR WNR2000V3 +endef + +define Profile/WNR2000V3/Description + Package set optimized for the NETGEAR WNR2000V3 +endef + +$(eval $(call Profile,WNR2000V3)) + diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 7522926..07ab8a6 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -185,6 +185,7 @@ ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel), uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware) ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6464k(rootfs),64k(certs),256k(cfg)ro,64k(EEPROM)ro,7488k@0x50000(firmware) whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,1024k(kernel),2752k(rootfs),64k(art)ro,3712k@0x40000(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) wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware) wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),14848k(rootfs),64k(art)ro,15872k@0x70000(firmware) wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),1152k(kernel),24448k(rootfs),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved) @@ -876,6 +877,7 @@ $(eval $(call SingleProfile,MyLoader,$(fs_64k),WPE72_4M,wpe72,,ttyS0,115200,0x40 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WPE72_8M,wpe72,,ttyS0,115200,0x800000,8M)) $(eval $(call SingleProfile,MyLoader,$(fs_64k),WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M)) +$(eval $(call SingleProfile,Netgear,$(fs_64k),WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),2003,WNR2000V3,"" NA,)) $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3700V1,wndr3700,WNDR3700,ttyS0,115200,$$(wndr3700_mtdlayout),3700,WNDR3700,"" NA,)) $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3700V2,wndr3700v2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3700v2,"",-H 29763654+16+64)) $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3800,wndr3800,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3800,"",-H 29763654+16+128)) diff --git a/target/linux/ar71xx/patches-3.8/617-MIPS-ath79-add-Netgear-WNR2000v3-support.patch b/target/linux/ar71xx/patches-3.8/617-MIPS-ath79-add-Netgear-WNR2000v3-support.patch new file mode 100644 index 0000000..0b9c1ef --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/617-MIPS-ath79-add-Netgear-WNR2000v3-support.patch @@ -0,0 +1,38 @@ +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -119,6 +119,7 @@ enum ath79_mach_type { + ATH79_MACH_WNDR3700, /* NETGEAR WNDR3700/WNDR3800/WNDRMAC */ + ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */ + ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */ ++ ATH79_MACH_WNR2000_V3, /* NETGEAR WNR2000 v3 */ + ATH79_MACH_WP543, /* Compex WP543 */ + ATH79_MACH_WPE72, /* Compex WPE72 */ + ATH79_MACH_WRT160NL, /* Linksys WRT160NL */ +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -408,6 +408,15 @@ config ATH79_MACH_WNR2000 + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + ++config ATH79_MACH_WNR2000_V3 ++ bool "NETGEAR WNR2000 V3 board support" ++ select SOC_AR724X ++ 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 ++ + config ATH79_MACH_OM2P + bool "OpenMesh OM2P board support" + select SOC_AR724X +--- a/arch/mips/ath79/Makefile ++++ b/arch/mips/ath79/Makefile +@@ -100,6 +100,7 @@ obj-$(CONFIG_ATH79_MACH_WLAE_AG300N) += + obj-$(CONFIG_ATH79_MACH_WNDR3700) += mach-wndr3700.o + obj-$(CONFIG_ATH79_MACH_WNDR4300) += mach-wndr4300.o + obj-$(CONFIG_ATH79_MACH_WNR2000) += mach-wnr2000.o ++obj-$(CONFIG_ATH79_MACH_WNR2000_V3) += mach-wnr2000-v3.o + obj-$(CONFIG_ATH79_MACH_WP543) += mach-wp543.o + obj-$(CONFIG_ATH79_MACH_WPE72) += mach-wpe72.o + obj-$(CONFIG_ATH79_MACH_WRT160NL) += mach-wrt160nl.o -- 1.8.2.1 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
