ar71xx: add support for Zbtlink ZBT-WE1526
authorPiotr Dymacz <pepe2k@gmail.com>
Wed, 17 Aug 2016 22:05:03 +0000 (00:05 +0200)
committerJohn Crispin <john@phrozen.org>
Thu, 18 Aug 2016 07:49:18 +0000 (09:49 +0200)
Zbtlink ZBT-WE1526 is based on Qualcomm Atheros QCA9531 v2.
Short specification:

- 650/400/200 MHz (CPU/DDR/AHB)
- 5x 10/100 Mbps Ethernet
- 1x USB 2.0
- 128 MB of RAM (DDR2)
- 16 MB of FLASH
- 2T2R 2.4 GHz, up to 22 dBm
- two external, non-detachable antennas
- 8x LED, 1x button
- UART header (pinout: VCC, RX, TX, GND)

Flash instruction:

Use sysupgrade in vendor firmare which is based on OpenWrt.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
12 files changed:
target/linux/ar71xx/base-files/etc/board.d/01_leds
target/linux/ar71xx/base-files/etc/board.d/02_network
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-4.4
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/Makefile
target/linux/ar71xx/files/arch/mips/ath79/mach-zbt-we1526.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/image/legacy-devices.mk
target/linux/ar71xx/image/legacy.mk

index d731130..cf05859 100755 (executable)
@@ -813,6 +813,15 @@ wzr-hp-g300nh)
        ucidef_set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
        ;;
 
+zbt-we1526)
+       ucidef_set_led_netdev "wan" "WAN" "zbt-we1526:green:wan" "eth1"
+       ucidef_set_led_switch "lan1" "LAN1" "zbt-we1526:green:lan1" "switch0" "0x10"
+       ucidef_set_led_switch "lan2" "LAN2" "zbt-we1526:green:lan2" "switch0" "0x08"
+       ucidef_set_led_switch "lan3" "LAN3" "zbt-we1526:green:lan3" "switch0" "0x04"
+       ucidef_set_led_switch "lan4" "LAN4" "zbt-we1526:green:lan4" "switch0" "0x02"
+       ucidef_set_led_wlan "wlan" "WLAN" "zbt-we1526:green:wlan" "phy0tpt"
+       ;;
+
 zcn-1523h-2)
        ucidef_set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
        ;;
index 11e78a6..f185e05 100755 (executable)
@@ -479,7 +479,8 @@ tl-wr842n-v3 |\
 whr-g301n |\
 whr-hp-g300n |\
 whr-hp-gn |\
-wzr-hp-ag300h)
+wzr-hp-ag300h |\
+zbt-we1526)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
        ucidef_add_switch "switch0" \
                "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
index 71ebf89..69ef609 100644 (file)
@@ -426,6 +426,9 @@ get_status_led() {
        wrt160nl)
                status_led="wrt160nl:blue:wps"
                ;;
+       zbt-we1526)
+               status_led="zbt-we1526:green:status"
+               ;;
        zcn-1523h-2 | zcn-1523h-5)
                status_led="zcn-1523h:amber:init"
                ;;
index 1e7427d..e57701a 100755 (executable)
@@ -1098,6 +1098,9 @@ ar71xx_board_detect() {
        *WHR-HP-G300N)
                name="whr-hp-g300n"
                ;;
+       *ZBT-WE1526)
+               name="zbt-we1526"
+               ;;
        *ZCN-1523H-2)
                name="zcn-1523h-2"
                ;;
index c02e5e7..716fa52 100755 (executable)
@@ -198,6 +198,7 @@ platform_check_image() {
        mr12 | \
        mr16 | \
        wpj558 | \
+       zbt-we1526 | \
        zcn-1523h-2 | \
        zcn-1523h-5)
                [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
index 5878b7a..a984b1e 100644 (file)
@@ -201,6 +201,7 @@ CONFIG_ATH79_MACH_WZR_HP_AG300H=y
 CONFIG_ATH79_MACH_WZR_HP_G300NH=y
 CONFIG_ATH79_MACH_WZR_HP_G300NH2=y
 CONFIG_ATH79_MACH_WZR_HP_G450H=y
+CONFIG_ATH79_MACH_ZBT_WE1526=y
 CONFIG_ATH79_MACH_ZCN_1523H=y
 CONFIG_ATH79_NVRAM=y
 CONFIG_ATH79_PCI_ATH9K_FIXUP=y
index a0ceecb..a6f19da 100644 (file)
@@ -1552,6 +1552,16 @@ config ATH79_MACH_MYNET_REXT
        select ATH79_DEV_WMAC
        select ATH79_NVRAM
 
+config ATH79_MACH_ZBT_WE1526
+       bool "Zbtlink ZBT-WE1526 board support"
+       select SOC_QCA953X
+       select ATH79_DEV_ETH
+       select ATH79_DEV_GPIO_BUTTONS
+       select ATH79_DEV_LEDS_GPIO
+       select ATH79_DEV_M25P80
+       select ATH79_DEV_USB
+       select ATH79_DEV_WMAC
+
 config ATH79_MACH_ZCN_1523H
        bool "Zcomax ZCN-1523H support"
        select SOC_AR724X
index ff4fe9f..3222a76 100644 (file)
@@ -205,6 +205,7 @@ obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2)     += mach-wzr-hp-g300nh2.o
 obj-$(CONFIG_ATH79_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o
 obj-$(CONFIG_ATH79_MACH_WZR_HP_G450H)  += mach-wzr-hp-g450h.o
 obj-$(CONFIG_ATH79_MACH_WZR_450HP2)    += mach-wzr-450hp2.o
+obj-$(CONFIG_ATH79_MACH_ZBT_WE1526)    += mach-zbt-we1526.o
 obj-$(CONFIG_ATH79_MACH_ZCN_1523H)     += mach-zcn-1523h.o
 obj-$(CONFIG_ATH79_MACH_CARAMBOLA2)    += mach-carambola2.o
 obj-$(CONFIG_ATH79_MACH_NBG6716)       += mach-nbg6716.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-zbt-we1526.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-zbt-we1526.c
new file mode 100644 (file)
index 0000000..42bad11
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Zbtlink ZBT-WE1526 board support
+ *
+ * Copyright (C) 2016 Piotr Dymacz <pepe2k@gmail.com>
+ *
+ * Based on mach-dr531.c and mach-tl-wr841n-v9.c
+ *
+ * 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/platform_device.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define ZBT_WE1526_GPIO_LED_STATUS     13
+#define ZBT_WE1526_GPIO_LED_LAN1       16
+#define ZBT_WE1526_GPIO_LED_LAN2       15
+#define ZBT_WE1526_GPIO_LED_LAN3       14
+#define ZBT_WE1526_GPIO_LED_LAN4       11
+#define ZBT_WE1526_GPIO_LED_WAN                4
+#define ZBT_WE1526_GPIO_LED_WLAN       12
+
+#define ZBT_WE1526_GPIO_BTN_RESET      17
+
+#define ZBT_WE1526_KEYS_POLL_INTERVAL  20      /* msecs */
+#define ZBT_WE1526_KEYS_DEBOUNCE_INTERVAL      \
+       (3 * ZBT_WE1526_KEYS_POLL_INTERVAL)
+
+#define ZBT_WE1526_MAC0_OFFSET         0x0
+#define ZBT_WE1526_MAC1_OFFSET         0x6
+#define ZBT_WE1526_WMAC_CALDATA_OFFSET 0x1000
+
+static struct gpio_led zbt_we1526_leds_gpio[] __initdata = {
+       {
+               .name           = "zbt-we1526:green:status",
+               .gpio           = ZBT_WE1526_GPIO_LED_STATUS,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:lan1",
+               .gpio           = ZBT_WE1526_GPIO_LED_LAN1,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:lan2",
+               .gpio           = ZBT_WE1526_GPIO_LED_LAN2,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:lan3",
+               .gpio           = ZBT_WE1526_GPIO_LED_LAN3,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:lan4",
+               .gpio           = ZBT_WE1526_GPIO_LED_LAN4,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:wan",
+               .gpio           = ZBT_WE1526_GPIO_LED_WAN,
+               .active_low     = 1,
+       },
+       {
+               .name           = "zbt-we1526:green:wlan",
+               .gpio           = ZBT_WE1526_GPIO_LED_WLAN,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button zbt_we1526_gpio_keys[] __initdata = {
+       {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = ZBT_WE1526_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = ZBT_WE1526_GPIO_BTN_RESET,
+               .active_low     = 1,
+       },
+};
+
+static void __init zbt_we1526_gpio_setup(void)
+{
+       /* For LED on GPIO4 */
+       ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN);
+       ath79_gpio_output_select(ZBT_WE1526_GPIO_LED_WAN, 0);
+
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_STATUS, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN1, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN2, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN3, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN4, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_WAN, true);
+       ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_WLAN, true);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(zbt_we1526_leds_gpio),
+                                zbt_we1526_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, ZBT_WE1526_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(zbt_we1526_gpio_keys),
+                                       zbt_we1526_gpio_keys);
+}
+
+static void __init zbt_we1526_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+       ath79_register_m25p80(NULL);
+
+       zbt_we1526_gpio_setup();
+
+       ath79_setup_ar933x_phy4_switch(false, false);
+
+       ath79_register_mdio(0, 0x0);
+
+       /* LAN */
+       ath79_eth1_data.duplex = DUPLEX_FULL;
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+       ath79_switch_data.phy_poll_mask |= BIT(4);
+       ath79_init_mac(ath79_eth1_data.mac_addr,
+                      art + ZBT_WE1526_MAC0_OFFSET, 0);
+       ath79_register_eth(1);
+
+       /* WAN */
+       ath79_switch_data.phy4_mii_en = 1;
+       ath79_eth0_data.duplex = DUPLEX_FULL;
+       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+       ath79_eth0_data.phy_mask = BIT(4);
+       ath79_eth0_data.speed = SPEED_100;
+       ath79_init_mac(ath79_eth0_data.mac_addr,
+                      art + ZBT_WE1526_MAC1_OFFSET, 0);
+       ath79_register_eth(0);
+
+       ath79_register_wmac(art + ZBT_WE1526_WMAC_CALDATA_OFFSET, NULL);
+
+       ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_ZBT_WE1526, "ZBT-WE1526", "Zbtlink ZBT-WE1526",
+            zbt_we1526_setup);
index 3051a25..a3b8c87 100644 (file)
@@ -266,6 +266,7 @@ enum ath79_mach_type {
        ATH79_MACH_WZR_HP_G300NH2,      /* Buffalo WZR-HP-G300NH2 */
        ATH79_MACH_WZR_HP_G450H,        /* Buffalo WZR-HP-G450H */
        ATH79_MACH_WZR_450HP2,          /* Buffalo WZR-450HP2 */
+       ATH79_MACH_ZBT_WE1526,          /* Zbtlink ZBT-WE1526 */
        ATH79_MACH_ZCN_1523H_2,         /* Zcomax ZCN-1523H-2-xx */
        ATH79_MACH_ZCN_1523H_5,         /* Zcomax ZCN-1523H-5-xx */
 };
index 1d295f1..72114cd 100644 (file)
@@ -705,6 +705,12 @@ define LegacyDevice/WZR450HP2
 endef
 LEGACY_DEVICES += WZR450HP2
 
+define LegacyDevice/ZBTWE1526
+  DEVICE_TITLE := Zbtlink ZBT-WE1526
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+endef
+LEGACY_DEVICES += ZBTWE1526
+
 define LegacyDevice/ZCN1523H28
   DEVICE_TITLE := Zcomax ZCN-1523H-2-8
 endef
index c2daba9..03af658 100644 (file)
@@ -964,6 +964,7 @@ $(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,11520
 $(eval $(call SingleProfile,AthLzma,64k,WRTNODE2Q,wrtnode2q,WRTNODE2Q,ttyS0,115200,$$(wrtnode2q_mtdlayout),KRuImage))
 $(eval $(call SingleProfile,AthLzma,64k,YUN_8M,yun-8M,Yun,ttyATH0,250000,$$(yun_mtdlayout_8M),RKuImage))
 $(eval $(call SingleProfile,AthLzma,64k,YUN_16M,yun-16M,Yun,ttyATH0,250000,$$(yun_mtdlayout_16M),RKuImage))
+$(eval $(call SingleProfile,AthLzma,64k,ZBTWE1526,zbt-we1526,ZBT-WE1526,ttyS0,115200,$$(ap147_mtdlayout),RKuImage))
 
 $(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))