aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-12-18 22:20:17 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-12-18 22:20:17 +0000
commitb809bbc1003615769a361bbf22d26163e26aa04b (patch)
tree96a31ad6acfbab9ee12a1441fa348911c58f58c3
parent13d5284cbf8da4a56602983adb179986190a2d82 (diff)
downloadupstream-b809bbc1003615769a361bbf22d26163e26aa04b.tar.gz
upstream-b809bbc1003615769a361bbf22d26163e26aa04b.tar.bz2
upstream-b809bbc1003615769a361bbf22d26163e26aa04b.zip
ar71xx: add support for the wzr-hp-g300nh2
Signed-off-by: Mark Deneen <mdeneen@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29567 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh3
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh3
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh1
-rw-r--r--target/linux/ar71xx/config-2.6.391
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig9
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh2.c195
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h1
-rw-r--r--target/linux/ar71xx/generic/profiles/buffalo.mk11
-rw-r--r--target/linux/ar71xx/image/Makefile6
10 files changed, 231 insertions, 0 deletions
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index c0aadbc453..855d3a40b1 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -114,6 +114,9 @@ get_status_led() {
wzr-hp-g300nh)
status_led="buffalo:green:router"
;;
+ wzr-hp-g300nh2)
+ status_led="buffalo:red:diag"
+ ;;
wndr3700)
status_led="wndr3700:green:power"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 83cad364b1..ee242a43c4 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -295,6 +295,9 @@ ar71xx_board_detect() {
*WZR-HP-G450H)
name="wzr-hp-g450h"
;;
+ *WZR-HP-G300NH2)
+ name="wzr-hp-g300nh2"
+ ;;
*WHR-HP-G300N)
name="whr-hp-g300n"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 2800b05dfa..324edfba91 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -102,6 +102,7 @@ platform_check_image() {
bullet-m | \
nanostation-m | \
rocket-m | \
+ wzr-hp-g300nh2 | \
wzr-hp-g300nh | \
wzr-hp-g450h | \
wzr-hp-ag300h | \
diff --git a/target/linux/ar71xx/config-2.6.39 b/target/linux/ar71xx/config-2.6.39
index d1870c5eca..48fea9a890 100644
--- a/target/linux/ar71xx/config-2.6.39
+++ b/target/linux/ar71xx/config-2.6.39
@@ -55,6 +55,7 @@ CONFIG_AR71XX_MACH_WRT160NL=y
CONFIG_AR71XX_MACH_WRT400N=y
CONFIG_AR71XX_MACH_WZR_HP_AG300H=y
CONFIG_AR71XX_MACH_WZR_HP_G300NH=y
+CONFIG_AR71XX_MACH_WZR_HP_G300NH2=y
CONFIG_AR71XX_MACH_WZR_HP_G450H=y
CONFIG_AR71XX_MACH_ZCN_1523H=y
CONFIG_AR71XX_NVRAM=y
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
index 467286163b..52d8313da3 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
@@ -163,6 +163,15 @@ config AR71XX_MACH_WZR_HP_G300NH
select AR71XX_DEV_USB
select RTL8366_SMI
+config AR71XX_MACH_WZR_HP_G300NH2
+ bool "Buffalo WZR-HP-G300NH2 board support"
+ select SOC_AR724X
+ select AR71XX_DEV_M25P80
+ select AR71XX_DEV_GPIO_BUTTONS
+ select AR71XX_DEV_AP91_PCI if PCI
+ select AR71XX_DEV_LEDS_GPIO
+ select AR71XX_DEV_USB
+
config AR71XX_MACH_WHR_HP_G300N
bool "Buffalo WHR-HP-G300N board support"
select SOC_AR724X
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
index 7723bb0615..9300d7a500 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_AR71XX_MACH_WP543) += mach-wp543.o
obj-$(CONFIG_AR71XX_MACH_WRT160NL) += mach-wrt160nl.o
obj-$(CONFIG_AR71XX_MACH_WRT400N) += mach-wrt400n.o
obj-$(CONFIG_AR71XX_MACH_WZR_HP_G300NH) += mach-wzr-hp-g300nh.o
+obj-$(CONFIG_AR71XX_MACH_WZR_HP_G300NH2) += mach-wzr-hp-g300nh2.o
obj-$(CONFIG_AR71XX_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o
obj-$(CONFIG_AR71XX_MACH_WZR_HP_G450H) += mach-wzr-hp-g450h.o
obj-$(CONFIG_AR71XX_MACH_ZCN_1523H) += mach-zcn-1523h.o
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh2.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh2.c
new file mode 100644
index 0000000000..ef9923fdde
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh2.c
@@ -0,0 +1,195 @@
+/*
+ * Buffalo WZR-HP-G300NH2 board support
+ *
+ * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (C) 2011 Mark Deneen <mdeneen@gmail.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/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mips_machine.h>
+#include <asm/mach-ar71xx/ar71xx.h>
+#include <asm/mach-ar71xx/gpio.h>
+
+#include "machtype.h"
+#include "devices.h"
+#include "dev-ap91-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+
+
+#define WZRHPG300NH2_MAC_OFFSET 0x20c
+#define WZRHPG300NH2_KEYS_POLL_INTERVAL 20 /* msecs */
+#define WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG300NH2_KEYS_POLL_INTERVAL)
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition wzrhpg300nh2_flash_partitions[] = {
+ {
+ .name = "u-boot",
+ .offset = 0,
+ .size = 0x0040000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "u-boot-env",
+ .offset = 0x0040000,
+ .size = 0x0010000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "art",
+ .offset = 0x0050000,
+ .size = 0x0010000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "kernel",
+ .offset = 0x0060000,
+ .size = 0x0100000,
+ }, {
+ .name = "rootfs",
+ .offset = 0x0160000,
+ .size = 0x1e90000,
+ }, {
+ .name = "user_property",
+ .offset = 0x1ff0000,
+ .size = 0x0010000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "firmware",
+ .offset = 0x0060000,
+ .size = 0x1f90000,
+ }
+};
+
+#endif /* CONFIG_MTD_PARTITIONS */
+
+
+
+static struct flash_platform_data wzrhpg300nh2_flash_data = {
+#ifdef CONFIG_MTD_PARTITIONS
+ .parts = wzrhpg300nh2_flash_partitions,
+ .nr_parts = ARRAY_SIZE(wzrhpg300nh2_flash_partitions),
+#endif
+};
+
+
+static struct gpio_led wzrhpg300nh2_leds_gpio[] __initdata = {
+ {
+ .name = "buffalo:red:diag",
+ .gpio = 16,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_led wzrhpg300nh2_wmac_leds_gpio[] = {
+ {
+ .name = "buffalo:blue:usb",
+ .gpio = 4,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:green:wireless",
+ .gpio = 5,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:orange:security",
+ .gpio = 6,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:green:router",
+ .gpio = 7,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:blue:movie_engine_on",
+ .gpio = 8,
+ .active_low = 1,
+ },
+ {
+ .name = "buffalo:blue:movie_engine_off",
+ .gpio = 9,
+ .active_low = 1,
+ },
+};
+
+/* The AOSS button is wmac gpio 12 */
+static struct gpio_keys_button wzrhpg300nh2_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 1,
+ .active_low = 1,
+ }, {
+ .desc = "usb",
+ .type = EV_KEY,
+ .code = BTN_2,
+ .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 7,
+ .active_low = 1,
+ }, {
+ .desc = "qos",
+ .type = EV_KEY,
+ .code = BTN_3,
+ .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 11,
+ .active_low = 0,
+ }, {
+ .desc = "router_on",
+ .type = EV_KEY,
+ .code = BTN_5,
+ .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 8,
+ .active_low = 0,
+ },
+};
+
+
+static void __init wzrhpg300nh2_setup(void)
+{
+
+ u8 *eeprom = (u8 *) KSEG1ADDR(0x1f051000);
+ u8 *mac0 = eeprom + WZRHPG300NH2_MAC_OFFSET;
+ /* There is an eth1 but it is not connected to the switch */
+
+ ar71xx_add_device_m25p80_multi(&wzrhpg300nh2_flash_data);
+
+ ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac0, 0);
+ ar71xx_add_device_mdio(0, ~(BIT(0)));
+
+ ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac0, 0);
+ ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ar71xx_eth0_data.speed = SPEED_1000;
+ ar71xx_eth0_data.duplex = DUPLEX_FULL;
+ ar71xx_eth0_data.phy_mask = BIT(0);
+
+ ar71xx_add_device_eth(0);
+ ar71xx_add_device_usb();
+ /* gpio13 is usb power. Turn it on. */
+ gpio_request(13, "usb");
+ gpio_direction_output(13, 1);
+
+ ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg300nh2_leds_gpio),
+ wzrhpg300nh2_leds_gpio);
+ ar71xx_register_gpio_keys_polled(-1, WZRHPG300NH2_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(wzrhpg300nh2_gpio_keys),
+ wzrhpg300nh2_gpio_keys);
+ ap91_pci_setup_wmac_led_pin(22);
+ ap91_pci_setup_wmac_leds(wzrhpg300nh2_wmac_leds_gpio,
+ ARRAY_SIZE(wzrhpg300nh2_wmac_leds_gpio));
+
+ ap91_pci_init(eeprom, mac0);
+}
+
+MIPS_MACHINE(AR71XX_MACH_WZR_HP_AG300H, "WZR-HP-G300NH2",
+ "Buffalo WZR-HP-G300NH2", wzrhpg300nh2_setup);
+
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
index 6c93c5688a..00eee51602 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
@@ -77,6 +77,7 @@ enum ar71xx_mach_type {
AR71XX_MACH_WRT400N, /* Linksys WRT400N */
AR71XX_MACH_WZR_HP_AG300H, /* Buffalo WZR-HP-AG300H */
AR71XX_MACH_WZR_HP_G300NH, /* Buffalo WZR-HP-G300NH */
+ AR71XX_MACH_WZR_HP_G300NH2, /* Buffalo WZR-HP-G300NH2 */
AR71XX_MACH_WZR_HP_G450H, /* Buffalo WZR-HP-G450H */
AR71XX_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */
AR71XX_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */
diff --git a/target/linux/ar71xx/generic/profiles/buffalo.mk b/target/linux/ar71xx/generic/profiles/buffalo.mk
index e975eb8ad9..afa47fb46b 100644
--- a/target/linux/ar71xx/generic/profiles/buffalo.mk
+++ b/target/linux/ar71xx/generic/profiles/buffalo.mk
@@ -16,6 +16,17 @@ endef
$(eval $(call Profile,WZRHPG300NH))
+define Profile/WZRHPG300NH2
+ NAME:=Buffalo WZR-HP-G300NH2
+ PACKAGES:=kmod-ath9k wpad-mini kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
+endef
+
+define Profile/WZRHPG300NH/Description
+ Package set optimized for the Buffalo WZR-HP-G300NH2
+endef
+
+$(eval $(call Profile,WZRHPG300NH2))
+
define Profile/WZRHPAG300H
NAME:=Buffalo WZR-HP-AG300H
PACKAGES:=kmod-usb-ohci kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 8cd560273d..88e6aad129 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -856,6 +856,11 @@ define Image/Build/Profile/WZRHPG300NH
$(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g300nh,$(wzrhpg300nh_cmdline),WZR-HP-G300NH)
endef
+wzrhpg300nh2_cmdline=board=WZR-HP-G300NH2 console=ttyS0,115200
+define Image/Build/Profile/WZRHPG300NH2
+ $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g300nh2,$(wzrhpg300nh2_cmdline),WZR-HP-G300NH2)
+endef
+
wzrhpag300h_cmdline=board=WZR-HP-AG300H console=ttyS0,115200
define Image/Build/Profile/WZRHPAG300H
$(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-ag300h,$(wzrhpag300h_cmdline),WZR-HP-AG300H)
@@ -926,6 +931,7 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/WHRHPG300N,$(1))
$(call Image/Build/Profile/WHRHPGN,$(1))
$(call Image/Build/Profile/WZRHPG300NH,$(1))
+ $(call Image/Build/Profile/WZRHPG300NH2,$(1))
$(call Image/Build/Profile/WZRHPAG300H,$(1))
$(call Image/Build/Profile/WZRHPG450H,$(1))
$(call Image/Build/Profile/ZCN1523H28,$(1))