From: Gabor Juhos Date: Wed, 1 Aug 2012 12:24:52 +0000 (+0000) Subject: ar71xx: Buffalo WLAE-AG300N initial support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=010aec06194cff6b6619b8ca2155da4750d15bef;p=openwrt%2Fstaging%2Fflorian.git ar71xx: Buffalo WLAE-AG300N initial support 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 SVN-Revision: 32931 --- diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index f52012f75a..02cfa35516 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -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" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 4d21caf979..2829d9f290 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -354,6 +354,9 @@ ar71xx_board_detect() { *WHR-HP-GN) name="whr-hp-gn" ;; + *WLAE-AG300N) + name="wlae-ag300n" + ;; *WP543) name="wp543" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 5e5a54f6d2..0e086039c5 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -118,6 +118,7 @@ platform_check_image() { whr-g301n | \ whr-hp-g300n | \ whr-hp-gn | \ + wlae-ag300n | \ nbg460n_550n_550nh | \ unifi ) [ "$magic" != "2705" ] && { diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3 index ebb0553940..9e0f5b1b50 100644 --- a/target/linux/ar71xx/config-3.3 +++ b/target/linux/ar71xx/config-3.3 @@ -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 index 0000000000..11006fd1bc --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c @@ -0,0 +1,114 @@ +/* + * Buffalo WLAE-AG300N board support + */ + +#include +#include +#include + +#include + +#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); diff --git a/target/linux/ar71xx/generic/profiles/buffalo.mk b/target/linux/ar71xx/generic/profiles/buffalo.mk index afa47fb46b..887be26571 100644 --- a/target/linux/ar71xx/generic/profiles/buffalo.mk +++ b/target/linux/ar71xx/generic/profiles/buffalo.mk @@ -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)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 6c2581ddb5..6e6de706f5 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -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)) diff --git a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch index f0727ad81b..6ef787124c 100644 --- a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch @@ -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 */ @@ -186,7 +187,7 @@ 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. @@ -216,6 +217,14 @@ + 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 @@ -606,7 +615,7 @@ 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. @@ -631,7 +640,7 @@ 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 @@ -642,7 +651,7 @@ 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 @@ -658,7 +667,7 @@ 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 @@ -668,7 +677,7 @@ 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 # @@ -720,6 +729,7 @@ +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