aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch/mips
diff options
context:
space:
mode:
authorPiotr Dymacz <pepe2k@gmail.com>2017-10-17 23:30:01 +0200
committerPiotr Dymacz <pepe2k@gmail.com>2018-01-15 00:12:13 +0100
commit2e5252d346e2ec832a203af778b5c1d949f0ae5f (patch)
treee52b574b76b90886364ab22f96ae028daad48eb4 /target/linux/ar71xx/files/arch/mips
parent6cf682e214910e0bbef440f372fd63590733a24b (diff)
downloadupstream-2e5252d346e2ec832a203af778b5c1d949f0ae5f.tar.gz
upstream-2e5252d346e2ec832a203af778b5c1d949f0ae5f.tar.bz2
upstream-2e5252d346e2ec832a203af778b5c1d949f0ae5f.zip
ar71xx: add support for GL.iNet GL-AR750
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>
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt11
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c146
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/machtypes.h1
4 files changed, 159 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index dae68d0fb7..3ca77550bc 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -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
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index b7caa5a770..e9f4d9852b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -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
index 0000000000..9ee6e29c02
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c
@@ -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);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 4afda05638..1a2c0386f8 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -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 */