summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-09-19 16:56:48 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-09-19 16:56:48 +0000
commit49ed06e36f9f80e5e02860dafa5cdfb83a743954 (patch)
tree67f94e525c3cf689d3d943d5a6399445b52490ae /target/linux/ar71xx
parent9d24525b1de402c5a400b5d4e01c90badd4673c8 (diff)
downloadmaster-31e0f0ae-49ed06e36f9f80e5e02860dafa5cdfb83a743954.tar.gz
master-31e0f0ae-49ed06e36f9f80e5e02860dafa5cdfb83a743954.tar.bz2
master-31e0f0ae-49ed06e36f9f80e5e02860dafa5cdfb83a743954.zip
ar71xx: add kernel support for Netgear WNR2200 wireless router
This patch adds OpenWRT support for the Netgear WNR2200 (N300) wireless router with USB. Technical details of this router can be found at http://www.netgear.com/home/products/wirelessrouters/work-and-play/WNR2200.aspx and http://wikidevi.com/wiki/Netgear_WNR2200 Signed-off-by: Aidan Kissane <aidankissane@googlemail.com> Signed-off-by: Dirk Neukirchen <dirkneukirchen@web.de> Patchwork: http://patchwork.openwrt.org/patch/4055/ [juhosg: - add commit message and SoB line from the original patch - remove dead code from mach-wnr2200.c - refresh 624-MIPS-ath79-WNR2200-support.patch] Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 38059
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/config-3.101
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c137
-rw-r--r--target/linux/ar71xx/patches-3.10/624-MIPS-ath79-WNR2200-support.patch39
3 files changed, 177 insertions, 0 deletions
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 82559b8e12..6ae5671114 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -90,6 +90,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_WNR2200=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-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
new file mode 100644
index 0000000000..502fd5ecbc
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -0,0 +1,137 @@
+/*
+ * NETGEAR WNR2200 board support
+ *
+ * Copyright (C) 2013 Aidan Kissane <aidankissane at googlemail.com>
+ *
+ * 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/gpio.h>
+
+#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 "dev-usb.h"
+#include "machtypes.h"
+
+#define WNR2200_GPIO_LED_LAN2_AMBER 0
+#define WNR2200_GPIO_LED_LAN4_AMBER 1
+#define WNR2200_GPIO_LED_WPS 5
+#define WNR2200_GPIO_LED_WAN_GREEN 7
+#define WNR2200_GPIO_LED_USB 8
+#define WNR2200_GPIO_LED_LAN3_AMBER 11
+#define WNR2200_GPIO_LED_WAN_AMBER 12
+#define WNR2200_GPIO_LED_LAN1_GREEN 13
+#define WNR2200_GPIO_LED_LAN2_GREEN 14
+#define WNR2200_GPIO_LED_LAN3_GREEN 15
+#define WNR2200_GPIO_LED_LAN4_GREEN 16
+#define WNR2200_GPIO_LED_PWR_AMBER 21
+#define WNR2200_GPIO_LED_PWR_GREEN 22
+
+#define WNR2200_GPIO_USB_POWER 24
+
+#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */
+#define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL)
+
+#define WNR2200_MAC0_OFFSET 0
+#define WNR2200_MAC1_OFFSET 6
+#define WNR2200_PCIE_CALDATA_OFFSET 0x1000
+
+static struct gpio_led wnr2200_leds_gpio[] __initdata = {
+ {
+ .name = "wnr2200:amber:lan2",
+ .gpio = WNR2200_GPIO_LED_LAN2_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:amber:lan4",
+ .gpio = WNR2200_GPIO_LED_LAN4_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:wps",
+ .gpio = WNR2200_GPIO_LED_WPS,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:wan",
+ .gpio = WNR2200_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:usb",
+ .gpio = WNR2200_GPIO_LED_USB,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:amber:lan3",
+ .gpio = WNR2200_GPIO_LED_LAN3_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:amber:wan",
+ .gpio = WNR2200_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:lan1",
+ .gpio = WNR2200_GPIO_LED_LAN1_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:lan2",
+ .gpio = WNR2200_GPIO_LED_LAN2_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:lan3",
+ .gpio = WNR2200_GPIO_LED_LAN3_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:lan4",
+ .gpio = WNR2200_GPIO_LED_LAN4_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:anber:power",
+ .gpio = WNR2200_GPIO_LED_PWR_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "wnr2200:green:power",
+ .gpio = WNR2200_GPIO_LED_PWR_GREEN,
+ .active_low = 1,
+ }
+};
+
+static void __init wnr2200_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_mdio(0, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2200_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+WNR2200_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);
+ ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
+ wnr2200_leds_gpio);
+
+ /* enable power for the USB port */
+ gpio_request_one(WNR2200_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_WNR2200, "WNR2200", "NETGEAR WNR2200", wnr2200_setup);
diff --git a/target/linux/ar71xx/patches-3.10/624-MIPS-ath79-WNR2200-support.patch b/target/linux/ar71xx/patches-3.10/624-MIPS-ath79-WNR2200-support.patch
new file mode 100644
index 0000000000..9f028acd47
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/624-MIPS-ath79-WNR2200-support.patch
@@ -0,0 +1,39 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -128,6 +128,7 @@ enum ath79_mach_type {
+ ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */
+ ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */
+ ATH79_MACH_WNR2000_V3, /* NETGEAR WNR2000 v3 */
++ ATH79_MACH_WNR2200, /* NETGEAR WNR2200 */
+ ATH79_MACH_WNR612_V2, /* NETGEAR WNR612 v2 */
+ ATH79_MACH_WP543, /* Compex WP543 */
+ ATH79_MACH_WPE72, /* Compex WPE72 */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -437,6 +437,16 @@ config ATH79_MACH_WNR2000_V3
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+
++ config ATH79_MACH_WNR2200
++ bool "NETGEAR WNR2200 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
++ select ATH79_DEV_USB
++
+ config ATH79_MACH_OM2P
+ bool "OpenMesh OM2P board support"
+ select SOC_AR724X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -105,6 +105,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_WNR2200) += mach-wnr2200.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