This patch adds platform machine support for the Netgear WNDR3700v4.
Signed-off-by: Ralph Perlich <rps...@arcor.de>
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -218,6 +218,7 @@ mynet-n750)
;;
dir-835-a1 |\
+wndr3700-v4 |\
wndr4300)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -558,6 +558,9 @@ ar71xx_board_detect() {
*WNDAP360)
name="wndap360"
;;
+ *"WNDR3700V4")
+ name="wndr3700-v4"
+ ;;
*"WNDR3700/WNDR3800/WNDRMAC")
wndr3700_board_detect "$machine"
;;
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -98,6 +98,7 @@ CONFIG_ATH79_MACH_WLAE_AG300N=y
CONFIG_ATH79_MACH_WLR8100=y
CONFIG_ATH79_MACH_WNDAP360=y
CONFIG_ATH79_MACH_WNDR3700=y
+CONFIG_ATH79_MACH_WNDR3700_V4=y
CONFIG_ATH79_MACH_WNDR4300=y
CONFIG_ATH79_MACH_WNR2000=y
CONFIG_ATH79_MACH_WNR2000_V3=y
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -187,6 +187,7 @@ get_status_led() {
;;
wndap360 | \
wndr3700 | \
+ wndr3700-v4 | \
wndr4300 | \
wnr2000 | \
wnr2200 |\
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -218,6 +218,7 @@ wnr2200_mtdlayout=mtdparts=spi0.0:320k(u
wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(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
+wndr3700v4_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
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
zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
@@ -1081,6 +1082,7 @@ endif # ifeq ($(SUBTARGET),generic)
ifeq ($(SUBTARGET),nand)
$(eval $(call
SingleProfile,NetgearNAND,64k,WNDR4300,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR4300,"",-H
29763948+0+128+128+2x2+3x3))
+$(eval $(call
SingleProfile,NetgearNAND,64k,WNDR3700_V4,wndr3700v4,WNDR3700V4,ttyS0,115200,$$(wndr3700v4_mtdlayout),0x33373033,WNDR3700V4,"",-H
29763948+128+128))
endif # ifeq ($(SUBTARGET),nand)
--- /dev/null
+++ b/target/linux/ar71xx/image/ubinize-wndr3700v4.ini
@@ -0,0 +1,27 @@
+[rootfs]
+# Volume mode (other option is static)
+mode=ubi
+# Source image
+image=root.squashfs
+# Volume ID in UBI image
+vol_id=0
+# Allow for dynamic resize
+vol_type=dynamic
+# Volume name
+vol_name=rootfs
+# Autoresize volume at first mount
+# vol_flags=autoresize
+
+[rootfs_data]
+# Volume mode (other option is static)
+mode=ubi
+# Source image
+image=jffs2.eof
+# Volume ID in UBI image
+vol_id=1
+# Allow for dynamic resize
+vol_type=dynamic
+# Volume name
+vol_name=rootfs_data
+# Autoresize volume at first mount
+vol_flags=autoresize
--- a/target/linux/ar71xx/nand/profiles/netgear.mk
+++ b/target/linux/ar71xx/nand/profiles/netgear.mk
@@ -16,4 +16,13 @@ endef
$(eval $(call Profile,WNDR4300))
+define Profile/WNDR3700_V4
+ NAME:=NETGEAR WNDR3700 V4
+ PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
+endef
+define Profile/WNDR3700_V4/Description
+ Package set optimized for the NETGEAR WNDR3700 V4
+endef
+
+$(eval $(call Profile,WNDR3700_V4))
--- /dev/null
+++
b/target/linux/ar71xx/patches-3.10/705-MIPS-ath79-WNDR3700V4-support.patch
@@ -0,0 +1,40 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -441,6 +441,17 @@ config ATH79_MACH_WNDR3700
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+
++config ATH79_MACH_WNDR3700_V4
++ bool "NETGEAR WNDR3700 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_NFC
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+ config ATH79_MACH_WNDR4300
+ bool "NETGEAR WNDR4300 board support"
+ select SOC_AR934X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -113,6 +113,7 @@ obj-$(CONFIG_ATH79_MACH_WLAE_AG300N) +=
+ obj-$(CONFIG_ATH79_MACH_WLR8100) += mach-wlr8100.o
+ obj-$(CONFIG_ATH79_MACH_WNDAP360) += mach-wndap360.o
+ obj-$(CONFIG_ATH79_MACH_WNDR3700) += mach-wndr3700.o
++obj-$(CONFIG_ATH79_MACH_WNDR3700_V4) += mach-wndr3700-v4.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
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -141,6 +141,7 @@ enum ath79_mach_type {
+ ATH79_MACH_WLR8100, /* SITECOM WLR-8100 */
+ ATH79_MACH_WNDAP360, /* NETGEAR WNDAP360 */
+ ATH79_MACH_WNDR3700, /* NETGEAR WNDR3700/WNDR3800/WNDRMAC */
++ ATH79_MACH_WNDR3700_V4, /* NETGEAR WNDR3700 v4 */
+ ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */
+ ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */
+ ATH79_MACH_WNR2000_V3, /* NETGEAR WNR2000 v3 */
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndr3700-v4.c
@@ -0,0 +1,189 @@
+/*
+ * Netgear WNDR3700V4 board support
+ *
+ * Copyright (C) 2014 Ralph Perlich <rps...@arcor.de>
+ * Copyright (C) 2009 Marco Porsch
+ * Copyright (C) 2009-2012 Gabor Juhos <juh...@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/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/delay.h>
+
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <linux/platform/ar934x_nfc.h>
+#include <asm/mach-ath79/ar71xx_regs.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-usb.h"
+#include "dev-nfc.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+/* AR9344 GPIOs */
+#define WNDR3700_GPIO_LED_WPS_AMBER 17
+#define WNDR3700_GPIO_LED_WPS_GREEN 16
+#define WNDR3700_GPIO_LED_POWER_AMBER 2
+#define WNDR3700_GPIO_LED_POWER_GREEN 0
+#define WNDR3700_GPIO_LED_WAN_AMBER 3
+#define WNDR3700_GPIO_LED_WAN_GREEN 1
+#define WNDR3700_GPIO_LED_USB 13
+#define WNDR3700_GPIO_LED_WLAN_2G 11
+#define WNDR3700_GPIO_LED_WLAN_5G 14
+#define WNDR3700_GPIO_BTN_WPS 12
+#define WNDR3700_GPIO_BTN_RESET 21
+#define WNDR3700_GPIO_BTN_WLAN 15
+
+/* AR9580 GPIOs */
+#define WNDR3700_GPIO_USB_5V 0
+
+#define WNDR3700_KEYS_POLL_INTERVAL 20 /* msecs */
+#define WNDR3700_KEYS_DEBOUNCE_INTERVAL (3 * WNDR3700_KEYS_POLL_INTERVAL)
+
+static struct gpio_led wndr3700_leds_gpio[] __initdata = {
+ {
+ .name = "netgear:green:power",
+ .gpio = WNDR3700_GPIO_LED_POWER_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:amber:power",
+ .gpio = WNDR3700_GPIO_LED_POWER_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wps",
+ .gpio = WNDR3700_GPIO_LED_WPS_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:amber:wps",
+ .gpio = WNDR3700_GPIO_LED_WPS_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wan",
+ .gpio = WNDR3700_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:amber:wan",
+ .gpio = WNDR3700_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:usb",
+ .gpio = WNDR3700_GPIO_LED_USB,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wlan2g",
+ .gpio = WNDR3700_GPIO_LED_WLAN_2G,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wlan5g",
+ .gpio = WNDR3700_GPIO_LED_WLAN_5G,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button wndr3700_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNDR3700_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNDR3700_GPIO_BTN_WPS,
+ .active_low = 1,
+ }, {
+ .desc = "wlan",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNDR3700_GPIO_BTN_WLAN,
+ .active_low = 1,
+ }
+};
+
+static struct ar8327_pad_cfg wndr3700_ar8327_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_RGMII,
+ .txclk_delay_en = true,
+ .rxclk_delay_en = true,
+ .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
+ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
+};
+
+static struct ar8327_led_cfg wndr3700_ar8327_led_cfg = {
+ .led_ctrl0 = 0xc737c737,
+ .led_ctrl1 = 0x00000000,
+ .led_ctrl2 = 0x00000000,
+ .led_ctrl3 = 0x0030c300,
+ .open_drain = false,
+};
+
+static struct ar8327_platform_data wndr3700_ar8327_data = {
+ .pad0_cfg = &wndr3700_ar8327_pad0_cfg,
+ .port0_cfg = {
+ .force_link = 1,
+ .speed = AR8327_PORT_SPEED_1000,
+ .duplex = 1,
+ .txpause = 1,
+ .rxpause = 1,
+ },
+ .led_cfg = &wndr3700_ar8327_led_cfg,
+};
+
+static struct mdio_board_info wndr3700_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = 0,
+ .platform_data = &wndr3700_ar8327_data,
+ },
+};
+
+static void __init wndr3700v4_setup(void)
+{
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio),
+ wndr3700_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, WNDR3700_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(wndr3700_gpio_keys),
+ wndr3700_gpio_keys);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
+ mdiobus_register_board_info(wndr3700_mdio0_info,
+ ARRAY_SIZE(wndr3700_mdio0_info));
+ ath79_register_mdio(0, 0x0);
+
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_eth0_pll_data.pll_1000 = 0x06000000;
+ ath79_register_eth(0);
+
+ ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
+ ath79_register_nfc();
+ ath79_register_usb();
+
+ ap91_pci_init_simple();
+
+ /* enable power for the USB port */
+ ap9x_pci_setup_wmac_gpio(0, BIT(WNDR3700_GPIO_USB_5V),
BIT(WNDR3700_GPIO_USB_5V));
+
+ ath79_register_wmac_simple();
+}
+
+MIPS_MACHINE(ATH79_MACH_WNDR3700_V4, "WNDR3700V4",
+ "NETGEAR WNDR3700V4",
+ wndr3700v4_setup);
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel