ar71xx: Buffalo WLAE-AG300N initial support
authorGabor Juhos <juhosg@openwrt.org>
Wed, 1 Aug 2012 12:24:52 +0000 (12:24 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Wed, 1 Aug 2012 12:24:52 +0000 (12:24 +0000)
The patch set for Buffalo WLAE-AG300N initial support.

There is another patch for wireless led support that
is posted separately.

Note on serial console:
This unit has buffalo standard 4 pin console, but the unit may not power
on if some console apparatus is connected. This is probably due to some
electronic interaction between the unit's electronic power switch circuit
and the serial console apparatus. If this happens, it is required to power
on the unit without the console, then quickly (re-)attach it.

[juhosg: fix coding style]

Signed-off-by: Yoichi Shinoda <shinoda@jaist.ac.jp>
SVN-Revision: 32931

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-3.3
target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c [new file with mode: 0644]
target/linux/ar71xx/generic/profiles/buffalo.mk
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch

index f52012f75a0767a477bd655a0500632d1a4ffd7b..02cfa3551638802ebcde7a37c12eac9d94cda092 100755 (executable)
@@ -141,6 +141,9 @@ get_status_led() {
        wzr-hp-g300nh)
                status_led="buffalo:green:router"
                ;;
+       wlae-ag300n)
+               status_led="buffalo:green:status"
+               ;;
        wzr-hp-g300nh2)
                status_led="buffalo:red:diag"
                ;;
index 4d21caf979acaf48ab49d1f69fd56768f7910e9a..2829d9f2909a98dd926d686ef4925153fb78fe8e 100755 (executable)
@@ -354,6 +354,9 @@ ar71xx_board_detect() {
        *WHR-HP-GN)
                name="whr-hp-gn"
                ;;
+       *WLAE-AG300N)
+               name="wlae-ag300n"
+               ;;
        *WP543)
                name="wp543"
                ;;
index 5e5a54f6d243432b011d7a316b0ea2a5baed68e4..0e086039c524c7c21df65211538b4ccad292566a 100755 (executable)
@@ -118,6 +118,7 @@ platform_check_image() {
        whr-g301n | \
        whr-hp-g300n | \
        whr-hp-gn | \
+       wlae-ag300n | \
        nbg460n_550n_550nh | \
        unifi )
                [ "$magic" != "2705" ] && {
index ebb0553940ef8ab2cddd41a937146ff24c932f81..9e0f5b1b503b66431f99d7d17132b2a310a52836 100644 (file)
@@ -66,6 +66,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y
 CONFIG_ATH79_MACH_UBNT=y
 CONFIG_ATH79_MACH_UBNT_XM=y
 CONFIG_ATH79_MACH_WHR_HP_G300N=y
+CONFIG_ATH79_MACH_WLAE_AG300N=y
 CONFIG_ATH79_MACH_WNDR3700=y
 CONFIG_ATH79_MACH_WNR2000=y
 CONFIG_ATH79_MACH_WP543=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c
new file mode 100644 (file)
index 0000000..11006fd
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ *  Buffalo WLAE-AG300N board support
+ */
+
+#include <linux/gpio.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mach-ath79/ath79.h>
+
+#include "dev-eth.h"
+#include "dev-ap9x-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "machtypes.h"
+
+#define WLAEAG300N_MAC_OFFSET          0x20c
+#define WLAEAG300N_KEYS_POLL_INTERVAL  20      /* msecs */
+#define WLAEAG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLAEAG300N_KEYS_POLL_INTERVAL)
+
+
+static struct gpio_led wlaeag300n_leds_gpio[] __initdata = {
+       /*
+        * Note: Writing 1 into GPIO 13 will power down the device.
+        */
+       {
+               .name           = "buffalo:green:wireless",
+               .gpio           = 14,
+               .active_low     = 1,
+       }, {
+               .name           = "buffalo:red:wireless",
+               .gpio           = 15,
+               .active_low     = 1,
+       }, {
+               .name           = "buffalo:green:status",
+               .gpio           = 16,
+               .active_low     = 1,
+       }, {
+               .name           = "buffalo:red:status",
+               .gpio           = 17,
+               .active_low     = 1,
+       }
+};
+
+
+static struct gpio_keys_button wlaeag300n_gpio_keys[] __initdata = {
+       {
+               .desc           = "function",
+               .type           = EV_KEY,
+               .code           = KEY_MODE,
+               .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 0,
+               .active_low     = 1,
+       }, {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 1,
+               .active_low     = 1,
+       }, {
+               .desc           = "power",
+               .type           = EV_KEY,
+               .code           = KEY_POWER,
+               .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 11,
+               .active_low     = 1,
+       }, {
+               .desc           = "aoss",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = 12,
+               .active_low     = 1,
+       }
+};
+
+static void __init wlaeag300n_setup(void)
+{
+       u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1fff1000);
+       u8 *mac1 = eeprom1 + WLAEAG300N_MAC_OFFSET;
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
+       ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 1);
+
+       ath79_register_mdio(0, ~(BIT(0) | BIT(4)));
+
+       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+       ath79_eth0_data.speed = SPEED_1000;
+       ath79_eth0_data.duplex = DUPLEX_FULL;
+       ath79_eth0_data.phy_mask = BIT(0);
+
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+       ath79_eth1_data.phy_mask = BIT(4);
+
+       ath79_register_eth(0);
+       ath79_register_eth(1);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(wlaeag300n_leds_gpio),
+                                       wlaeag300n_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, WLAEAG300N_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wlaeag300n_gpio_keys),
+                                        wlaeag300n_gpio_keys);
+
+       ath79_register_m25p80(NULL);
+
+       ap91_pci_init(eeprom1, mac1);
+}
+
+MIPS_MACHINE(ATH79_MACH_WLAE_AG300N, "WLAE-AG300N",
+            "Buffalo WLAE-AG300N", wlaeag300n_setup);
index afa47fb46b33220e65f3bf3a07aa9a0e1808ee17..887be265710a6ff140314690067c89d46fd8b86f 100644 (file)
@@ -83,3 +83,14 @@ define Profile/WHRHPGN/Description
 endef
 
 $(eval $(call Profile,WHRHPGN))
+
+define Profile/WLAEAG300N
+       NAME:=Buffalo WLAE-AG300N
+       PACKAGES:=kmod-ledtrig-netdev
+endef
+
+define Profile/WLAEAG300N/Description
+       Package set optimized for the Buffalo WLAE-AG300N
+endef
+
+$(eval $(call Profile,WLAEAG300N))
index 6c2581ddb511ac2537731286e8276a45bd156c59..6e6de706f5dfb2a89945327479526b42f60ad570 100644 (file)
@@ -1040,6 +1040,11 @@ define Image/Build/Profile/WHRHPGN
        $(call Image/Build/Template/$(fs_64k)/$(1),WHRHPG300N,whr-hp-gn,$(whrhpgn_cmdline),$(whrhpg300n_mtdlayout),WHR-HP-GN)
 endef
 
+wlaeag300n_cmdline=board=WLAE-AG300N console=ttyS0,115200
+define Image/Build/Profile/WLAEAG300N
+       $(call Image/Build/Template/$(fs_64k)/$(1),WHRHPG300N,wlae-ag300n,$(wlaeag300n_cmdline),$(whrhpg300n_mtdlayout),WLAE-AG300N)
+endef
+
 wzrhpg300nh_cmdline=board=WZR-HP-G300NH console=ttyS0,115200
 define Image/Build/Profile/WZRHPG300NH
        $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g300nh,$(wzrhpg300nh_cmdline),WZR-HP-G300NH)
@@ -1134,6 +1139,7 @@ define Image/Build/Profile/Default
        $(call Image/Build/Profile/WHRG301N,$(1))
        $(call Image/Build/Profile/WHRHPG300N,$(1))
        $(call Image/Build/Profile/WHRHPGN,$(1))
+       $(call Image/Build/Profile/WLAEAG300N,$(1))
        $(call Image/Build/Profile/WZRHPG300NH,$(1))
        $(call Image/Build/Profile/WZRHPG300NH2,$(1))
        $(call Image/Build/Profile/WZRHPAG300H,$(1))
index f0727ad81b7e5c1bb9e859b1c0102b1c252ac78f..6ef787124cf8c13032561870003cd39cf4a3bf6f 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,18 +16,91 @@
+@@ -16,18 +16,92 @@
  
  enum ath79_mach_type {
        ATH79_MACH_GENERIC = 0,
@@ -78,6 +78,7 @@
 +      ATH79_MACH_WHR_G301N,           /* Buffalo WHR-G301N */
 +      ATH79_MACH_WHR_HP_G300N,        /* Buffalo WHR-HP-G300N */
 +      ATH79_MACH_WHR_HP_GN,           /* Buffalo WHR-HP-GN */
++      ATH79_MACH_WLAE_AG300N,         /* Buffalo WLAE-AG300N */
 +      ATH79_MACH_WNDR3700,            /* NETGEAR WNDR3700/WNDR3800/WNDRMAC */
 +      ATH79_MACH_WNR2000,             /* NETGEAR WNR2000 */
 +      ATH79_MACH_WP543,               /* Compex WP543 */
  config ATH79_MACH_PB44
        bool "Atheros PB44 reference board"
        select SOC_AR71XX
-@@ -66,6 +137,419 @@ config ATH79_MACH_PB44
+@@ -66,6 +137,427 @@ config ATH79_MACH_PB44
          Say 'Y' here if you want your kernel to support the
          Atheros PB44 reference board.
  
 +      select ATH79_DEV_LEDS_GPIO
 +      select ATH79_DEV_M25P80
 +
++config ATH79_MACH_WLAE_AG300N
++      bool "Buffalo WLAE-AG300N board support"
++      select SOC_AR71XX
++      select ATH79_DEV_ETH
++      select ATH79_DEV_GPIO_BUTTONS
++      select ATH79_DEV_LEDS_GPIO
++      select ATH79_DEV_M25P80
++
 +config ATH79_MACH_WZR_HP_AG300H
 +      bool "Buffalo WZR-HP-AG300H board support"
 +      select SOC_AR71XX
  config ATH79_MACH_UBNT_XM
        bool "Ubiquiti Networks XM (rev 1.0) board"
        select SOC_AR724X
-@@ -79,6 +563,24 @@ config ATH79_MACH_UBNT_XM
+@@ -79,6 +571,24 @@ config ATH79_MACH_UBNT_XM
          Say 'Y' here if you want your kernel to support the
          Ubiquiti Networks XM (rev 1.0) board.
  
  endmenu
  
  config SOC_AR71XX
-@@ -114,10 +616,6 @@ config SOC_QCA955X
+@@ -114,10 +624,6 @@ config SOC_QCA955X
        select PCI_AR724X if PCI
        def_bool n
  
  config ATH79_DEV_AP9X_PCI
        select ATH79_PCI_ATH9K_FIXUP
        def_bool n
-@@ -128,7 +626,14 @@ config ATH79_DEV_DSA
+@@ -128,7 +634,14 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
        def_bool n
  
        def_bool n
  
  config ATH79_DEV_GPIO_BUTTONS
-@@ -153,4 +658,7 @@ config ATH79_NVRAM
+@@ -153,4 +666,7 @@ config ATH79_NVRAM
  config ATH79_PCI_ATH9K_FIXUP
        def_bool n
  
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -36,9 +36,61 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += p
+@@ -36,9 +36,62 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += pci-ath9k-fixup.o
  #
  # Machines
  #
 +obj-$(CONFIG_ATH79_MACH_UBNT)         += mach-ubnt.o
  obj-$(CONFIG_ATH79_MACH_UBNT_XM)      += mach-ubnt-xm.o
 +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o
++obj-$(CONFIG_ATH79_MACH_WLAE_AG300N)  += mach-wlae-ag300n.o
 +obj-$(CONFIG_ATH79_MACH_WNDR3700)     += mach-wndr3700.o
 +obj-$(CONFIG_ATH79_MACH_WNR2000)      += mach-wnr2000.o
 +obj-$(CONFIG_ATH79_MACH_WP543)                += mach-wp543.o