summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2014-11-26 08:28:22 +0000
committerImre Kaloz <kaloz@openwrt.org>2014-11-26 08:28:22 +0000
commit15f6f67d18bea6174d026d6af944f4553bcc3c98 (patch)
treec684fad218e062da2678a7beaa426ff319b68e61 /target/linux/ar71xx
parent9f803fca447d570ebab89fa5ed6ccf4e9f31632d (diff)
downloadmtk-20170518-15f6f67d18bea6174d026d6af944f4553bcc3c98.zip
mtk-20170518-15f6f67d18bea6174d026d6af944f4553bcc3c98.tar.gz
mtk-20170518-15f6f67d18bea6174d026d6af944f4553bcc3c98.tar.bz2
Netgear R6100 support
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> SVN-Revision: 43382
Diffstat (limited to 'target/linux/ar71xx')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh1
-rw-r--r--target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom1
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/01_leds6
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/02_network3
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh3
-rw-r--r--target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx6
-rw-r--r--target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin10
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh1
-rw-r--r--target/linux/ar71xx/config-3.141
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c146
-rw-r--r--target/linux/ar71xx/image/Makefile2
-rw-r--r--target/linux/ar71xx/nand/profiles/netgear.mk16
-rw-r--r--target/linux/ar71xx/patches-3.14/732-MIPS-ath79-add-R6100-support.patch40
13 files changed, 232 insertions, 4 deletions
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 39a54cb..5c1d92f 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -263,6 +263,7 @@ get_status_led() {
wzr-hp-g300nh2)
status_led="buffalo:red:diag"
;;
+ r6100 | \
wndap360 | \
wndr3700 | \
wndr3700v4 | \
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index eef7ee1..b5f0588 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -38,6 +38,7 @@ board=$(ar71xx_board_name)
case "$FIRMWARE" in
"soc_wmac.eeprom")
case $board in
+ r6100 | \
wndr3700v4 | \
wndr4300)
ath9k_eeprom_extract "caldata" 4096 2048
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 2678e55..4216071 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -421,6 +421,12 @@ wndr3700)
ucidef_set_led_usbdev "usb" "USB" "netgear:green:usb" "1-1"
;;
+r6100)
+ ucidef_set_led_netdev "wan" "WAN (green)" "netgear:green:wan" "eth0.2"
+ ucidef_set_led_usbdev "usb" "USB" "netgear:blue:usb" "1-1"
+ ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy1tpt"
+ ;;
+
wndr3700v4 | \
wndr4300)
ucidef_set_led_netdev "wan" "WAN (green)" "netgear:green:wan" "eth0.2"
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 1b0bea0..872db67 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -201,7 +201,8 @@ tl-wr941nd)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
-smart-300 | \
+r6100 |\
+smart-300 |\
tl-mr3420-v2 |\
tl-wr841n-v8 |\
tl-wr842n-v2 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 30163fb..8dde6ef 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -701,6 +701,9 @@ ar71xx_board_detect() {
*"WNDR3700/WNDR3800/WNDRMAC")
wndr3700_board_detect "$machine"
;;
+ *"R6100")
+ name="r6100"
+ ;;
*"WNDR3700v4")
name="wndr3700v4"
;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
index f8bb7b7..b40dff5 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
+++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
@@ -29,6 +29,12 @@ preinit_set_mac_address() {
fetch_mac_from_mtd config lan_mac wan_mac
echo 1 > /sys/class/leds/dir-615-c1:green:wancpu/brightness
;;
+ r6100)
+ mac_lan=$(mtd_get_mac_binary caldata 0)
+ [ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
+ mac_wan=$(mtd_get_mac_binary caldata 6)
+ [ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
+ ;;
wrt160nl)
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
index 2c06d7f..7190820 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
+++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
@@ -22,7 +22,17 @@ do_load_ath10k_board_bin() {
macaddr_2bin $mac >> /tmp/ath10k-board.bin
dd if=/dev/mtdblock4 \
bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
+ ;;
+ r6100)
+ local mac
+ mac=$(macaddr_add $(cat /sys/class/net/eth1/address) +2)
+ dd if=/dev/mtdblock2 \
+ bs=1 skip=20480 count=6 \
+ of=/tmp/ath10k-board.bin
+ macaddr_2bin $mac >> /tmp/ath10k-board.bin
+ dd if=/dev/mtdblock2 \
+ bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
;;
qihoo-c301)
local mac
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 1db72d8..598b33e 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -354,6 +354,7 @@ platform_check_image() {
return 0
;;
nbg6716 | \
+ r6100 | \
wndr3700v4 | \
wndr4300 )
nand_do_platform_check $board $1
diff --git a/target/linux/ar71xx/config-3.14 b/target/linux/ar71xx/config-3.14
index 2f1ccce..6d9be23 100644
--- a/target/linux/ar71xx/config-3.14
+++ b/target/linux/ar71xx/config-3.14
@@ -76,6 +76,7 @@ CONFIG_ATH79_MACH_PB42=y
CONFIG_ATH79_MACH_PB44=y
CONFIG_ATH79_MACH_PB92=y
CONFIG_ATH79_MACH_QIHOO_C301=y
+CONFIG_ATH79_MACH_R6100=y
# CONFIG_ATH79_MACH_RB2011 is not set
# CONFIG_ATH79_MACH_RB4XX is not set
# CONFIG_ATH79_MACH_RB750 is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c
new file mode 100644
index 0000000..c1f0e2c
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c
@@ -0,0 +1,146 @@
+/*
+ * NETGEAR R6100 board support
+ *
+ * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2014 Imre Kaloz <kaloz@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/pci.h>
+#include <linux/phy.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/platform/ar934x_nfc.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-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define R6100_GPIO_LED_WLAN 0
+#define R6100_GPIO_LED_USB 11
+#define R6100_GPIO_LED_WAN_GREEN 13
+#define R6100_GPIO_LED_POWER_AMBER 14
+#define R6100_GPIO_LED_WAN_AMBER 15
+#define R6100_GPIO_LED_POWER_GREEN 17
+
+#define R6100_GPIO_BTN_WIRELESS 1
+#define R6100_GPIO_BTN_WPS 3
+#define R6100_GPIO_BTN_RESET 12
+
+#define R6100_GPIO_USB_POWER 16
+
+#define R6100_KEYS_POLL_INTERVAL 20 /* msecs */
+#define R6100_KEYS_DEBOUNCE_INTERVAL (3 * R6100_KEYS_POLL_INTERVAL)
+
+static struct gpio_led r6100_leds_gpio[] __initdata = {
+ {
+ .name = "netgear:green:power",
+ .gpio = R6100_GPIO_LED_POWER_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "netgear:amber:power",
+ .gpio = R6100_GPIO_LED_POWER_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "netgear:green:wan",
+ .gpio = R6100_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "netgear:amber:wan",
+ .gpio = R6100_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "netgear:blue:usb",
+ .gpio = R6100_GPIO_LED_USB,
+ .active_low = 1,
+ },
+ {
+ .name = "netgear:blue:wlan",
+ .gpio = R6100_GPIO_LED_WLAN,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button r6100_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = R6100_GPIO_BTN_RESET,
+ .active_low = 0,
+ },
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = R6100_GPIO_BTN_WPS,
+ .active_low = 0,
+ },
+ {
+ .desc = "RFKILL switch",
+ .type = EV_SW,
+ .code = KEY_RFKILL,
+ .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = R6100_GPIO_BTN_WIRELESS,
+ .active_low = 0,
+ },
+};
+
+static void __init r6100_setup(void)
+{
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(r6100_leds_gpio),
+ r6100_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, R6100_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(r6100_gpio_keys),
+ r6100_gpio_keys);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ ath79_register_mdio(1, 0x0);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_register_eth(1);
+
+ gpio_request_one(R6100_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
+ ath79_register_nfc();
+
+ ath79_register_usb();
+
+ ath79_register_wmac_simple();
+
+ ap91_pci_init_simple();
+}
+
+MIPS_MACHINE(ATH79_MACH_R6100, "R6100", "NETGEAR R6100",
+ r6100_setup);
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index af7646c..255713a 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -301,6 +301,7 @@ wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmw
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
+r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter)
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)
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
@@ -1343,6 +1344,7 @@ endif # ifeq ($(SUBTARGET),generic)
ifeq ($(SUBTARGET),nand)
$(eval $(call SingleProfile,NetgearNAND,64k,WNDR3700V4,wndr3700v4,WNDR3700_V4,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR3700v4,"",-H 29763948+128+128,wndr4300))
$(eval $(call SingleProfile,NetgearNAND,64k,WNDR4300V1,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR4300,"",-H 29763948+0+128+128+2x2+3x3,wndr4300))
+$(eval $(call SingleProfile,NetgearNAND,64k,R6100,r6100,R6100,ttyS0,115200,$$(r6100_mtdlayout),0x36303030,R6100,"",-H 29764434+0+128+128+2x2+2x2,wndr4300))
$(eval $(call SingleProfile,ZyXELNAND,128k,NBG6716,nbg6716,NBG6716,ttyS0,115200,NBG6716,$$(zyx_nbg6716_mtdlayout),mem=256M))
diff --git a/target/linux/ar71xx/nand/profiles/netgear.mk b/target/linux/ar71xx/nand/profiles/netgear.mk
index d9ceee5..738aaba 100644
--- a/target/linux/ar71xx/nand/profiles/netgear.mk
+++ b/target/linux/ar71xx/nand/profiles/netgear.mk
@@ -1,10 +1,22 @@
#
-# Copyright (C) 2009-2013 OpenWrt.org
+# Copyright (C) 2009-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
+define Profile/R6100
+ NAME:=NETGEAR R6100
+ PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
+endef
+
+define Profile/R6100/Description
+ Package set optimized for the NETGEAR R6100
+endef
+
+$(eval $(call Profile,R6100))
+
+
define Profile/WNDR4300
NAME:=NETGEAR WNDR3700v4/WNDR4300
PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
@@ -15,5 +27,3 @@ define Profile/WNDR4300/Description
endef
$(eval $(call Profile,WNDR4300))
-
-
diff --git a/target/linux/ar71xx/patches-3.14/732-MIPS-ath79-add-R6100-support.patch b/target/linux/ar71xx/patches-3.14/732-MIPS-ath79-add-R6100-support.patch
new file mode 100644
index 0000000..5b61500
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.14/732-MIPS-ath79-add-R6100-support.patch
@@ -0,0 +1,40 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -483,6 +483,17 @@ config ATH79_MACH_WRT400N
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+
++config ATH79_MACH_R6100
++ bool "NETGEAR R6100 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_RB4XX
+ bool "MikroTik RouterBOARD 4xx series support"
+ select SOC_AR71XX
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -88,6 +88,7 @@ obj-$(CONFIG_ATH79_MACH_PB42) += mach-p
+ obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
+ obj-$(CONFIG_ATH79_MACH_PB92) += mach-pb92.o
+ obj-$(CONFIG_ATH79_MACH_QIHOO_C301) += mach-qihoo-c301.o
++obj-$(CONFIG_ATH79_MACH_R6100) += mach-r6100.o
+ obj-$(CONFIG_ATH79_MACH_RB4XX) += mach-rb4xx.o
+ obj-$(CONFIG_ATH79_MACH_RB750) += mach-rb750.o
+ obj-$(CONFIG_ATH79_MACH_RB91X) += mach-rb91x.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -84,6 +84,7 @@ enum ath79_mach_type {
+ ATH79_MACH_PB42, /* Atheros PB42 */
+ ATH79_MACH_PB92, /* Atheros PB92 */
+ ATH79_MACH_QIHOO_C301, /* Qihoo 360 C301 */
++ ATH79_MACH_R6100, /* NETGEAR R6100 */
+ ATH79_MACH_RB_411, /* MikroTik RouterBOARD 411/411A/411AH */
+ ATH79_MACH_RB_411U, /* MikroTik RouterBOARD 411U */
+ ATH79_MACH_RB_433, /* MikroTik RouterBOARD 433/433AH */