Subject: [PATCH] ar71xx: Add platform machine support for the WNR2000v4
From: Ralph Perlich
This patch adds platform machine support for the Netgear WNR2000v4.
Signed-off-by: Ralph Perlich <[email protected]>
---
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -189,6 +189,7 @@ get_status_led() {
wndr3700 | \
wndr4300 | \
wnr2000 | \
+ wnr2000-v4 | \
wnr2200 |\
wnr612-v2)
status_led="netgear:green:power"
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -172,6 +172,7 @@ tl-mr3420-v2 |\
tl-wr841n-v8 |\
tl-wr842n-v2 |\
wnr2000-v3 |\
+wnr2000-v4 | \
wnr2200 |\
wnr612-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -567,6 +567,9 @@ ar71xx_board_detect() {
*"WNR2000 V3")
name="wnr2000-v3"
;;
+ *"WNR2000 V4")
+ name="wnr2000-v4"
+ ;;
*WNR2000)
name="wnr2000"
;;
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -101,6 +101,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
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c
@@ -0,0 +1,141 @@
+/*
+ * NETGEAR WNR2000v4 board support
+ *
+ * Copyright (C) 2013 Ralph Perlich <[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 <linux/pci.h>
+#include <linux/phy.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.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-spi.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define WNR2000V4_GPIO_LED_POWER 0
+#define WNR2000V4_GPIO_LED_STATUS 1
+#define WNR2000V4_GPIO_BTN_RESET 4
+#define WNR2000V4_GPIO_BTN_WPS 11
+#define WNR2000V4_GPIO_BTN_WIFI 10 /* ??? */
+#define WNR2000V4_GPIO_LED_WLAN 12
+#define WNR2000V4_GPIO_LED_WAN_GREEN 17
+#define WNR2000V4_GPIO_LED_WAN_AMBER 22
+#define WNR2000V4_GPIO_LED_LAN1_GREEN 13
+#define WNR2000V4_GPIO_LED_LAN2_GREEN 14
+#define WNR2000V4_GPIO_LED_LAN3_GREEN 15
+#define WNR2000V4_GPIO_LED_LAN4_GREEN 16
+#define WNR2000V4_GPIO_LED_LAN1_AMBER 18
+#define WNR2000V4_GPIO_LED_LAN2_AMBER 19
+#define WNR2000V4_GPIO_LED_LAN3_AMBER 20
+#define WNR2000V4_GPIO_LED_LAN4_AMBER 21
+
+#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 0x6
+#define WNR2000V4_WMAC_CALDATA_OFFSET 0x1000
+
+static struct gpio_led wnr2000v4_leds_gpio[] __initdata = {
+ {
+ .name = "netgear:green:power",
+ .gpio = WNR2000V4_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "netgear:amber:power",
+ .gpio = WNR2000V4_GPIO_LED_STATUS,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wan",
+ .gpio = WNR2000V4_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:amber:wan",
+ .gpio = WNR2000V4_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "netgear:blue:wlan",
+ .gpio = WNR2000V4_GPIO_LED_WLAN,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button wnr2000v4_gpio_keys[] __initdata = {
+ {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2000V4_GPIO_BTN_WPS,
+ }, {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2000V4_GPIO_BTN_RESET,
+ }
+};
+
+static void __init wnr_common_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V4_MAC0_OFFSET, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V4_MAC1_OFFSET, 0);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch, GE0 */
+ 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_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch, GE1 */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(ee, art);
+}
+
+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);
--- a/target/linux/ar71xx/generic/profiles/netgear.mk
+++ b/target/linux/ar71xx/generic/profiles/netgear.mk
@@ -38,6 +38,15 @@ endef
$(eval $(call Profile,WNR2000V3))
+define Profile/WNR2000V4
+ NAME:=NETGEAR WNR2000V4
+endef
+
+define Profile/WNR2000V4/Description
+ Package set optimized for the NETGEAR WNR2000V4
+endef
+
+$(eval $(call Profile,WNR2000V4))
define Profile/WNR612V2
NAME:=NETGEAR WNR612V2
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -216,6 +216,7 @@ wlr8100_mtdlayout=mtdparts=spi0.0:192k(u
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:320k(u-boot)ro,128k(u-boot-env)ro,7680k(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(ubiroot),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
ubi.mtd=ubiroot
@@ -932,6 +933,7 @@ $(eval $(call SingleProfile,MyLoader,64k
$(eval $(call
SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),1769472,6160384,KRuImage))
$(eval $(call
SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,""
NA,))
+$(eval $(call
SingleProfile,Netgear,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"",-H
29763904+4+32))
$(eval $(call
SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,""
NA,))
$(eval $(call
SingleProfile,Netgear,64kraw,WNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",))
$(eval $(call
SingleProfile,Netgear,64kraw,WNDR3700V1,wndr3700,WNDR3700,ttyS0,115200,$$(wndr3700_mtdlayout),0x33373030,WNDR3700,""
NA,,7 864 320))
--- /dev/null
+++
b/target/linux/ar71xx/patches-3.10/704-MIPS-ath79-add-WNR2000V4-support.patch
@@ -0,0 +1,65 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -470,6 +470,17 @@ config ATH79_MACH_WNR2000_V3
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+
++config ATH79_MACH_WNR2000_V4
++ bool "NETGEAR WNR2000 V4 board support"
++ select SOC_AR934X
++ select ATH79_DEV_AP9X_PCI if PCI
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++ select ATH79_DEV_M25P80
++
+ config ATH79_MACH_WNR2200
+ bool "NETGEAR WNR2200 board support"
+ select SOC_AR724X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -116,6 +116,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
+@@ -144,6 +144,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 */
+--- a/drivers/mtd/mtdsplit_uimage.c
++++ b/drivers/mtd/mtdsplit_uimage.c
+@@ -230,6 +230,7 @@ static struct mtd_part_parser uimage_gen
+ };
+
+ #define FW_MAGIC_WNR2000V3 0x32303033
++#define FW_MAGIC_WNR2000V4 0x32303034
+ #define FW_MAGIC_WNR2200 0x32323030
+ #define FW_MAGIC_WNR612V2 0x32303631
+ #define FW_MAGIC_WNDR3700 0x33373030
+@@ -240,6 +241,7 @@ static bool uimage_verify_wndr3700(struc
+ switch be32_to_cpu(header->ih_magic) {
+ case FW_MAGIC_WNR612V2:
+ case FW_MAGIC_WNR2000V3:
++ case FW_MAGIC_WNR2000V4:
+ case FW_MAGIC_WNR2200:
+ case FW_MAGIC_WNDR3700:
+ case FW_MAGIC_WNDR3700V2:
+@@ -290,4 +292,4 @@ err_unregister_generic:
+ return ret;
+ }
+
+-module_init(mtdsplit_uimage_init);
+\ No newline at end of file
++module_init(mtdsplit_uimage_init);
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel