aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-11-03 20:20:56 +0000
committerJohn Crispin <john@openwrt.org>2014-11-03 20:20:56 +0000
commit2c72ffc154c70b371a93f179587d899bbba921ca (patch)
treed0997efabb21a7836d89c95e78cc48d11bbdd40d /target/linux/ar71xx
parentb25b58a96aa700081cafe40625307f3ab4705995 (diff)
downloadupstream-2c72ffc154c70b371a93f179587d899bbba921ca.tar.gz
upstream-2c72ffc154c70b371a93f179587d899bbba921ca.tar.bz2
upstream-2c72ffc154c70b371a93f179587d899bbba921ca.zip
ar71xx: add support for Netgear WNR2000v4
Signed-off-by: Michaël Burtin <mburtin@gmail.com> SVN-Revision: 43173
Diffstat (limited to 'target/linux/ar71xx')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/01_leds10
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/02_network1
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh3
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh8
-rw-r--r--target/linux/ar71xx/config-3.101
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c175
-rw-r--r--target/linux/ar71xx/generic/profiles/netgear.mk12
-rw-r--r--target/linux/ar71xx/image/Makefile12
-rw-r--r--target/linux/ar71xx/patches-3.10/634-MIPS-ath79-WNR2000V4-support.patch39
9 files changed, 261 insertions, 0 deletions
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 599fc1920b..3547f49de4 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -432,6 +432,16 @@ wlae-ag300n)
ucidef_set_led_netdev "wireless" "WIRELESS" "buffalo:green:wireless" "wlan0"
;;
+wnr2000-v4)
+ ucidef_set_led_netdev "wan" "WAN" "wnr2000-v4:green:wan" "eth1"
+ ucidef_set_led_netdev "wlan" "WLAN" "wnr2000-v4:blue:wlan" "wlan0"
+ ucidef_set_led_switch "lan1" "LAN1" "wnr2000-v4:amber:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "wnr2000-v4:amber:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "wnr2000-v4:amber:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "wnr2000-v4:amber:lan4" "switch0" "0x02"
+ ucidef_set_led_usbdev "usb" "USB" "wnr2000-v4:amber:status" "1-1"
+ ;;
+
wzr-hp-ag300h)
ucidef_set_led_default "diag" "DIAG" "buffalo:red:diag" "0"
ucidef_set_led_netdev "router" "ROUTER" "buffalo:green:router" "eth1"
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 743f9de124..af8725e897 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -206,6 +206,7 @@ tl-mr3420-v2 |\
tl-wr841n-v8 |\
tl-wr842n-v2 |\
wnr2000-v3 |\
+wnr2000-v4 |\
wnr2200 |\
wnr612-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 40e930360c..a3cefc5043 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -698,6 +698,9 @@ ar71xx_board_detect() {
*"WNDR4300")
name="wndr4300"
;;
+ *"WNR2000 V4")
+ name="wnr2000-v4"
+ ;;
*"WNR2000 V3")
name="wnr2000-v3"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 6220f16a7e..7a02e37d22 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -385,6 +385,14 @@ platform_check_image() {
fi
return 0
;;
+ wnr2000-v4)
+ [ "$magic_long" != "32303034" ] && {
+ echo "Invalid image type."
+ return 1
+ }
+ return 0
+ ;;
+
esac
echo "Sysupgrade is not yet supported on $board."
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 1b3eddbb99..f2922c48d8 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -118,6 +118,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_WNR2000_V4=y
CONFIG_ATH79_MACH_WNR2200=y
CONFIG_ATH79_MACH_WP543=y
CONFIG_ATH79_MACH_WPE72=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c
new file mode 100644
index 0000000000..d8437dce4d
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c
@@ -0,0 +1,175 @@
+/*
+ * NETGEAR WNR2000v4 board support
+ *
+ * Copytight (C) 2014 Michaël Burtin <mburtin@gmail.com>
+ * Copytight (C) 2013 Mathieu Olivari <mathieu.olivari@gmail.com>
+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ * Copyright (C) 2008-2009 Andy Boyett <agb@openwrt.org>
+ *
+ * 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 <linux/platform_device.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+/* AR9341 GPIOs */
+#define WNR2000V4_GPIO_LED_WAN_AMBER 22
+#define WNR2000V4_GPIO_LED_WAN_GREEN 17
+#define WNR2000V4_GPIO_LED_WPS 2
+#define WNR2000V4_GPIO_LED_WLAN 12
+#define WNR2000V4_GPIO_LED_LAN1 18
+#define WNR2000V4_GPIO_LED_LAN2 19
+#define WNR2000V4_GPIO_LED_LAN3 20
+#define WNR2000V4_GPIO_LED_LAN4 21
+#define STATUS_LED_GPIO 1
+#define WNR2000V4_GPIO_LED_PWR_GREEN 0
+
+#define WNR2000V4_GPIO_BTN_WPS 3
+#define WNR2000V4_GPIO_BTN_RESET 4
+#define WNR2000V4_GPIO_BTN_WLAN 11
+
+#define WNR2000V4_KEYS_POLL_INTERVAL 20 /* msecs */
+#define WNR2000V4_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000V4_KEYS_POLL_INTERVAL)
+
+#define WNR2000V4_MAC0_OFFSET 0
+#define WNR2000V4_MAC1_OFFSET 6
+
+static struct gpio_led wnr2000v4_leds_gpio[] __initdata = {
+ {
+ .name = "wnr2000-v4:green:power",
+ .gpio = WNR2000V4_GPIO_LED_PWR_GREEN,
+ .active_low = 1,
+ .default_trigger = "default-on",
+ }, {
+ .name = "wnr2000-v4:green:wan",
+ .gpio = WNR2000V4_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "wnr2000-v4:green:wps",
+ .gpio = WNR2000V4_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+ {
+ .name = "wnr2000-v4:amber:status",
+ .gpio = STATUS_LED_GPIO,
+ .active_low = 1,
+ },
+ {
+ .name = "wnr2000-v4:blue:wlan",
+ .gpio = WNR2000V4_GPIO_LED_WLAN,
+ .active_low = 1,
+ },
+ {
+ .name = "wnr2000-v4:amber:lan1",
+ .gpio = WNR2000V4_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "wnr2000-v4:amber:lan2",
+ .gpio = WNR2000V4_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "wnr2000-v4:amber:lan3",
+ .gpio = WNR2000V4_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "wnr2000-v4:amber:lan4",
+ .gpio = WNR2000V4_GPIO_LED_LAN4,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button wnr2000v4_gpio_keys[] __initdata = {
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2000V4_GPIO_BTN_WPS,
+ },
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2000V4_GPIO_BTN_RESET,
+ },
+ {
+ .desc = "WLAN button",
+ .type = EV_KEY,
+ .code = KEY_WLAN,
+ .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2000V4_GPIO_BTN_WLAN,
+ },
+};
+
+static void __init wnr_common_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE |
+ AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ ath79_register_mdio(1, 0x0);
+
+ /* LAN */
+ ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V4_MAC0_OFFSET, 0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_register_eth(1);
+
+ /* WAN */
+ ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V4_MAC1_OFFSET, 0);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(4);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+
+ ath79_register_eth(0);
+
+ /* WLAN */
+ ath79_register_wmac(ee, art+WNR2000V4_MAC0_OFFSET);
+
+ /* USB */
+ ath79_register_usb();
+}
+
+static void __init wnr2000v4_setup(void)
+{
+ wnr_common_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000v4_leds_gpio),
+ wnr2000v4_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, WNR2000V4_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(wnr2000v4_gpio_keys),
+ wnr2000v4_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_WNR2000_V4, "WNR2000V4", "NETGEAR WNR2000 V4", wnr2000v4_setup);
diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk b/target/linux/ar71xx/generic/profiles/netgear.mk
index 78717a0a83..e8a2a3fbe6 100644
--- a/target/linux/ar71xx/generic/profiles/netgear.mk
+++ b/target/linux/ar71xx/generic/profiles/netgear.mk
@@ -39,6 +39,18 @@ endef
$(eval $(call Profile,WNR2000V3))
+define Profile/WNR2000V4
+ NAME:=NETGEAR WNR2000V4
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
+endef
+
+define Profile/WNR2000V4/Description
+ Package set optimized for the NETGEAR WNR2000V4
+endef
+
+$(eval $(call Profile,WNR2000V4))
+
+
define Profile/WNR612V2
NAME:=NETGEAR WNR612V2 / On Networks N150
endef
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 3256cb8bb5..8ab68f0e17 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -298,6 +298,7 @@ wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel)
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)
wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro
+wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro
wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro
wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro
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),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
@@ -888,6 +889,16 @@ define Image/Build/Netgear
fi
endef
+
+Image/Build/NetgearLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
+Image/Build/NetgearLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
+
+define Image/Build/NetgearLzma
+ $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
+ $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
+endef
+
+
Image/Build/NetgearNAND/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
# $(1): (empty)
@@ -1148,6 +1159,7 @@ $(eval $(call SingleProfile,MyLoader,64k,WPE72_8M,wpe72,,ttyS0,115200,0x800000,8
$(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M))
$(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,))
+$(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,))
$(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,"" NA,))
$(eval $(call SingleProfile,Netgear,64kraw,REALWNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",))
$(eval $(call SingleProfile,Netgear,64kraw,N150R,n150r,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,N150R,"",))
diff --git a/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-WNR2000V4-support.patch b/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-WNR2000V4-support.patch
new file mode 100644
index 0000000000..270095a962
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-WNR2000V4-support.patch
@@ -0,0 +1,39 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -470,6 +470,16 @@ config ATH79_MACH_WNR2000_V3
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+
++config ATH79_MACH_WNR2000_V4
++ bool "NETGEAR WNR2000 V4"
++ select SOC_AR934X
++ 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
++
+ config ATH79_MACH_OM2P
+ bool "OpenMesh OM2P board support"
+ select SOC_AR724X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -113,6 +113,7 @@ obj-$(CONFIG_ATH79_MACH_WNDR3700) += mac
+ 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_WNR2000_V4) += mach-wnr2000-v4.o
+ obj-$(CONFIG_ATH79_MACH_WNR2200) += mach-wnr2200.o
+ obj-$(CONFIG_ATH79_MACH_WP543) += mach-wp543.o
+ obj-$(CONFIG_ATH79_MACH_WPE72) += mach-wpe72.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -138,6 +138,7 @@ enum ath79_mach_type {
+ ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */
+ ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */
+ ATH79_MACH_WNR2000_V3, /* NETGEAR WNR2000 v3 */
++ ATH79_MACH_WNR2000_V4, /* NETGEAR WNR2000 v4 */
+ ATH79_MACH_WNR2200, /* NETGEAR WNR2200 */
+ ATH79_MACH_WNR612_V2, /* NETGEAR WNR612 v2 */
+ ATH79_MACH_WP543, /* Compex WP543 */