ar71xx: add support for GL.iNet GL-AR750
authorPiotr Dymacz <pepe2k@gmail.com>
Tue, 17 Oct 2017 21:30:01 +0000 (23:30 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Sun, 14 Jan 2018 23:12:13 +0000 (00:12 +0100)
GL.iNet GL-AR750 is a small size, dual-band (AC750) router, based on
Qualcomm/Atheros QCA9531 v2 + QCA9887. FCC ID: 2AFIW-AR750.

Specification:

- 650/597/216 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3x 10/100 Mbps Ethernet
- 2T2R 2.4 GHz (QCA9531)
- 1T1R 5 GHz (QCA9887)
- 1x USB 2.0 (power controlled by GPIO)
- 1x microSD (GL857L)
- 3x LED (all driven by GPIO)
- 1x button (reset)
- 1x 2-pos switch
- header for optional PoE module
- 1x micro USB for main power input
- UART + I2C header on PCB

Flash instruction:

Vendor firmware is based on OpenWrt/LEDE. GUI or sysupgrade can be used
to flash OpenWrt/LEDE firmware.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
15 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/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-4.4
target/linux/ar71xx/config-4.9
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-gl-ar750.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/generic/config-default
target/linux/ar71xx/image/generic.mk

index f39109af445738f6c329b81dee0bb392e691cbc9..fac9dfa7abfa0a9d247031735be2cb3bf412e099 100755 (executable)
@@ -407,6 +407,10 @@ dlan-pro-1200-ac)
 gl-ar300m)
        ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
        ;;
+gl-ar750)
+       ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:white:wlan2g" "phy1tpt"
+       ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:white:wlan5g" "phy0tpt"
+       ;;
 gl-mifi)
        ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
        ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
index 6a338aeeba10c3bb46c2d4f34e8a295eb91753f1..558b0381f073142f4f5278d4d9f8c24c7a00c1f0 100755 (executable)
@@ -390,6 +390,12 @@ ar71xx_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
                ;;
+       gl-ar750|\
+       rb-435g)
+               ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
+               ucidef_add_switch "switch0" \
+                       "0@eth1" "1:lan" "2:lan"
+               ;;
        jwap230)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
                ucidef_add_switch "switch0" \
@@ -402,11 +408,6 @@ ar71xx_setup_interfaces()
        onion-omega)
                ucidef_set_interface_lan "wlan0"
                ;;
-       rb-435g)
-               ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
-               ucidef_add_switch "switch0" \
-                       "0@eth1" "1:lan" "2:lan"
-               ;;
        rb-450)
                ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
                ucidef_add_switch "switch0" \
index 00ddeeac50695e3888e6175b9b4bdfc15de52c6f..2720288e3d868e1ecb7831ec1d67420e6b6fc50b 100644 (file)
@@ -210,6 +210,7 @@ get_status_led() {
        esr1750)
                status_led="$board:amber:power"
                ;;
+       gl-ar750|\
        hiveap-121|\
        nbg6716)
                status_led="$board:white:power"
@@ -527,7 +528,8 @@ set_state() {
        done)
                status_led_on
                case $(board_name) in
-               gl-ar300m)
+               gl-ar300m|\
+               gl-ar750)
                        fw_printenv lc >/dev/null 2>&1 && fw_setenv "bootcount" 0
                        ;;
                qihoo-c301)
index d7d99f8edb2655843a9000b900a5388bce0e923f..1876b0084fd78f27466ad5a81bd73461aa0c508b 100644 (file)
@@ -89,6 +89,11 @@ case "$FIRMWARE" in
                ath10kcal_extract "caldata" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
                ;;
+       gl-ar750|\
+       tl-wpa8630)
+               ath10kcal_extract "art" 20480 2116
+               ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
+               ;;
        mc-mac1200r)
                ath10kcal_extract "art" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
@@ -105,10 +110,6 @@ case "$FIRMWARE" in
                ath10kcal_extract "art" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
                ;;
-       tl-wpa8630)
-               ath10kcal_extract "art" 20480 2116
-               ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
-               ;;
        unifiac-lite|\
        unifiac-pro)
                ath10kcal_extract "EEPROM" 20480 2116
index d62dff593e9ab7a95266dbf8c38ebc31bf874a2a..d2c68fbb2cfa1a7316e379e9bcce2ceff4b8c2c6 100755 (executable)
@@ -673,6 +673,9 @@ ar71xx_board_detect() {
        *"GL-AR300M")
                name="gl-ar300m"
                ;;
+       *"GL-AR750")
+               name="gl-ar750"
+               ;;
        *"GL-CONNECT INET v1")
                name="gl-inet"
 
index ece961e7ce1a131a6ff32190ab3088bdec040cc8..909e61509248aa9b40cc7fae01a36afe9dae1745 100644 (file)
@@ -17,6 +17,7 @@ set_preinit_iface() {
        archer-c7|\
        bhr-4grv2|\
        dir-505-a1|\
+       gl-ar750|\
        gl-inet|\
        jwap003|\
        pb42|\
index 108c90b1fea22dafe079b3b0493a32517a829c40..2231069c4d31db7d7649c6eecd84d063a4dbfe78 100755 (executable)
@@ -242,6 +242,7 @@ platform_check_image() {
        gl-ar150|\
        gl-ar300m|\
        gl-ar300|\
+       gl-ar750|\
        gl-domino|\
        gl-mifi|\
        gl-usb150|\
index 44303f1be03ed14955e7b9cbd271811f5dc14641..8ecf7e1355c4828b7c38bf3f2f01508bf9077c0b 100644 (file)
@@ -114,6 +114,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_GL_AR150 is not set
 # CONFIG_ATH79_MACH_GL_AR300 is not set
 # CONFIG_ATH79_MACH_GL_AR300M is not set
+# CONFIG_ATH79_MACH_GL_AR750 is not set
 # CONFIG_ATH79_MACH_GL_DOMINO is not set
 # CONFIG_ATH79_MACH_GL_INET is not set
 # CONFIG_ATH79_MACH_GL_MIFI is not set
index 1e4b3ab87de6ab8830e76b4c44ecd086a0afd8d0..0e224ae1c443d9ebba428da4dc3d9bda3d2fd8ee 100644 (file)
@@ -112,6 +112,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_GL_AR150 is not set
 # CONFIG_ATH79_MACH_GL_AR300 is not set
 # CONFIG_ATH79_MACH_GL_AR300M is not set
+# CONFIG_ATH79_MACH_GL_AR750 is not set
 # CONFIG_ATH79_MACH_GL_DOMINO is not set
 # CONFIG_ATH79_MACH_GL_INET is not set
 # CONFIG_ATH79_MACH_GL_MIFI is not set
index dae68d0fb7dce2a3c109a334721575783c8e001c..3ca77550bc8a99c0eaaeb460c9147de7b4010802 100644 (file)
@@ -770,6 +770,17 @@ config ATH79_MACH_GL_AR300M
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 
+config ATH79_MACH_GL_AR750
+       bool "GL.iNet GL-AR750 support"
+       select SOC_QCA953X
+       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
+       select ATH79_DEV_WMAC
+
 config ATH79_MACH_GL_DOMINO
        bool "DOMINO support"
        select SOC_AR933X
index b7caa5a77012c952b1ce99b6398355f1e034bee2..e9f4d9852b838a422b42556eec9d374c7dd4f56d 100644 (file)
@@ -122,6 +122,7 @@ obj-$(CONFIG_ATH79_MACH_FRITZ300E)          += mach-fritz300e.o
 obj-$(CONFIG_ATH79_MACH_GL_AR150)              += mach-gl-ar150.o
 obj-$(CONFIG_ATH79_MACH_GL_AR300)              += mach-gl-ar300.o
 obj-$(CONFIG_ATH79_MACH_GL_AR300M)             += mach-gl-ar300m.o
+obj-$(CONFIG_ATH79_MACH_GL_AR750)              += mach-gl-ar750.o
 obj-$(CONFIG_ATH79_MACH_GL_DOMINO)             += mach-gl-domino.o
 obj-$(CONFIG_ATH79_MACH_GL_INET)               += mach-gl-inet.o
 obj-$(CONFIG_ATH79_MACH_GL_MIFI)               += mach-gl-mifi.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c
new file mode 100644 (file)
index 0000000..9ee6e29
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * GL.iNet GL-AR750 board support
+ *
+ * Copyright (C) 2018 Piotr Dymacz <pepe2k@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/gpio.h>
+#include <linux/i2c.h>
+#include <linux/i2c-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-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 "dev-wmac.h"
+#include "machtypes.h"
+
+#define GL_AR750_GPIO_LED_POWER                12
+#define GL_AR750_GPIO_LED_WLAN2G       14
+#define GL_AR750_GPIO_LED_WLAN5G       13
+
+#define GL_AR750_GPIO_BTN_RESET                3
+#define GL_AR750_GPIO_BTN_SW1          0
+
+#define GL_AR750_GPIO_I2C_SCL          16
+#define GL_AR750_GPIO_I2C_SDA          17
+
+#define GL_AR750_GPIO_USB_POWER                2
+
+#define GL_AR750_KEYS_POLL_INTERVAL    20
+#define GL_AR750_KEYS_DEBOUNCE_INTERVAL        (3 * GL_AR750_KEYS_POLL_INTERVAL)
+
+#define GL_AR750_MAC0_OFFSET           0
+#define GL_AR750_WMAC2G_CALDATA_OFFSET 0x1000
+#define GL_AR750_WMAC5G_CALDATA_OFFSET 0x5000
+
+static struct gpio_led gl_ar750_leds_gpio[] __initdata = {
+       {
+               .name           = "gl-ar750:white:power",
+               .gpio           = GL_AR750_GPIO_LED_POWER,
+               .default_state  = LEDS_GPIO_DEFSTATE_KEEP,
+               .active_low     = 1,
+       }, {
+               .name           = "gl-ar750:white:wlan2g",
+               .gpio           = GL_AR750_GPIO_LED_WLAN2G,
+               .active_low     = 1,
+       }, {
+               .name           = "gl-ar750:white:wlan5g",
+               .gpio           = GL_AR750_GPIO_LED_WLAN5G,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button gl_ar750_gpio_keys[] __initdata = {
+       {
+               .desc                   = "reset",
+               .type                   = EV_KEY,
+               .code                   = KEY_RESTART,
+               .debounce_interval      = GL_AR750_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = GL_AR750_GPIO_BTN_RESET,
+               .active_low             = 1,
+       }, {
+               .desc                   = "sw1",
+               .type                   = EV_KEY,
+               .code                   = BTN_0,
+               .debounce_interval      = GL_AR750_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = GL_AR750_GPIO_BTN_SW1,
+               .active_low             = 1,
+       },
+};
+
+static struct i2c_gpio_platform_data gl_ar750_i2c_gpio_data = {
+       .sda_pin = GL_AR750_GPIO_I2C_SDA,
+       .scl_pin = GL_AR750_GPIO_I2C_SCL,
+};
+
+static struct platform_device gl_ar750_i2c_gpio = {
+       .name   = "i2c-gpio",
+       .id     = 0,
+       .dev    = {
+               .platform_data = &gl_ar750_i2c_gpio_data,
+       },
+};
+
+static void __init gl_ar750_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(0x1f050000);
+
+       ath79_register_m25p80(NULL);
+
+       ath79_setup_ar933x_phy4_switch(false, false);
+       ath79_register_mdio(0, 0x0);
+
+       ath79_switch_data.phy4_mii_en = 1;
+       ath79_switch_data.phy_poll_mask = 0xfc;
+
+       /* WAN */
+       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 + GL_AR750_MAC0_OFFSET, 0);
+       ath79_register_eth(0);
+
+       /* LAN */
+       ath79_eth1_data.duplex = DUPLEX_FULL;
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+       ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR750_MAC0_OFFSET, 1);
+       ath79_register_eth(1);
+
+       /* Disable JTAG (enables GPIO0-3) */
+       ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar750_leds_gpio),
+                                gl_ar750_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, GL_AR750_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(gl_ar750_gpio_keys),
+                                       gl_ar750_gpio_keys);
+
+       gpio_request_one(GL_AR750_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
+
+       platform_device_register(&gl_ar750_i2c_gpio);
+
+       ath79_register_usb();
+
+       ath79_register_wmac(art + GL_AR750_WMAC2G_CALDATA_OFFSET, NULL);
+
+       ap91_pci_init(art + GL_AR750_WMAC5G_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_GL_AR750, "GL-AR750", "GL.iNet GL-AR750",
+            gl_ar750_setup);
index 4afda05638f30a690fcecaf9a5d892590e9dd304..1a2c0386f8a6b960308be98191199f004b0b48cb 100644 (file)
@@ -114,6 +114,7 @@ enum ath79_mach_type {
        ATH79_MACH_GL_AR150,                    /* GL-AR150 support */
        ATH79_MACH_GL_AR300,                    /* GL-AR300 */
        ATH79_MACH_GL_AR300M,                   /* GL-AR300M */
+       ATH79_MACH_GL_AR750,                    /* GL.iNet GL-AR750 */
        ATH79_MACH_GL_DOMINO,                   /* Domino */
        ATH79_MACH_GL_INET,                     /* GL-CONNECT GL-INET */
        ATH79_MACH_GL_MIFI,                     /* GL-MIFI support */
index 06d5223d6cbbd74c66bc700813a9e709c2336066..cac1a27c3b28d02c093e6ca0e42b41b525433327 100644 (file)
@@ -85,6 +85,7 @@ CONFIG_ATH79_MACH_FRITZ300E=y
 CONFIG_ATH79_MACH_GL_AR150=y
 CONFIG_ATH79_MACH_GL_AR300=y
 CONFIG_ATH79_MACH_GL_AR300M=y
+CONFIG_ATH79_MACH_GL_AR750=y
 CONFIG_ATH79_MACH_GL_DOMINO=y
 CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GL_MIFI=y
index 65a7eb79c0a17a2e2d05462eeaafc6189a2a9a52..88b9f930b6789dcf7ee5fb91bc82e9b8c0a6957e 100644 (file)
@@ -330,6 +330,19 @@ define Device/gl-ar300m
 endef
 TARGET_DEVICES += gl-ar300m
 
+define Device/gl-ar750
+  DEVICE_TITLE := GL.iNet GL-AR750
+  DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 kmod-usb-core \
+       kmod-usb2 kmod-usb-storage
+  BOARDNAME := GL-AR750
+  SUPPORTED_DEVICES := gl-ar750
+  IMAGE_SIZE := 16000k
+  MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(art)ro,-(firmware)
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+       append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += gl-ar750
+
 define Device/gl-domino
   DEVICE_TITLE := GL.iNet Domino Pi
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2