]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
add gl-x750-4g
authorLuochongjun <luochongjun@gl-inet.com>
Tue, 5 Jun 2018 06:38:27 +0000 (14:38 +0800)
committerLuochongjun <luochongjun@gl-inet.com>
Tue, 5 Jun 2018 06:38:27 +0000 (14:38 +0800)
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/hotplug.d/firmware/11-ath10k-caldata
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
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-x750-4g.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 308f53d6dbedeed2405ee2e04cc075aff44ae90b..15b7e583ad7f8bdbfb146b39898f65218a3e4b68 100755 (executable)
@@ -381,6 +381,12 @@ fritz4020)
 gl-ar300m)
        ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
        ;;
+gl-x750-4g)
+       ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:white:wlan2g" "phy1tpt"
+       ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:white:wlan5g" "phy0tpt"
+       ucidef_set_led_netdev "wan" "WAN" "$board:white:wan" "eth0"
+       ucidef_set_led_netdev  "3gnet" "3GNET" "$board:white:4g" "3g-wan"
+       ;;
 gl-ar750s|\
 gl-ar750)
        ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:white:wlan2g" "phy1tpt"
index 05c6dbe1309230060d71098c32ce593fd78333f9..574e6ba48c21777a7bbab7b62ca9417414784df4 100755 (executable)
@@ -157,6 +157,7 @@ ar71xx_setup_interfaces()
        dr344|\
        gl-ar150|\
        gl-ar300m|\
+       gl-x750-4g|\
        gl-domino|\
        gl-inet|\
        gl-mifi|\
index f82026c7ad2d619f91d2f740525757f9ed8b511f..4f8942204703e7921f8840fd85f5405b7b4f9511 100644 (file)
@@ -99,6 +99,7 @@ case "$FIRMWARE" in
                ath10kcal_extract "caldata" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
                ;;
+       gl-x750-4g|\
        gl-ar750s|\
        gl-ar750|\
        tl-wpa8630)
index c64520d6f2dc3f10bb828075d8fd584661b388c2..9c24180312d70f56b13bcae43ffdd1b3f46e5493 100755 (executable)
@@ -730,6 +730,9 @@ ar71xx_board_detect() {
        *"GL-AR750S")
                name="gl-ar750s"
                ;;
+       *"GL-X750-4G")
+               name="gl-x750-4g"
+               ;;
        *"GL-CONNECT INET v1")
                name="gl-inet"
 
index ba710d800b3efcc08a99cbbefc2b6266e2b0a764..f0ba468eacbd4ab368940d3b3e7f7951f7cc7566 100755 (executable)
@@ -294,6 +294,7 @@ platform_check_image() {
        gl-ar300m|\
        gl-ar300|\
        gl-ar750|\
+       gl-x750-4g|\
        gl-domino|\
        gl-mifi|\
        gl-usb150|\
index 9eae158ebeb68b5664d751df445128e8843dc84b..2e6cadaa6484efec85d6c3df77ee9cf114fe992c 100644 (file)
@@ -125,6 +125,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_GL_INET is not set
 # CONFIG_ATH79_MACH_GL_MIFI is not set
 # CONFIG_ATH79_MACH_GL_USB150 is not set
+# CONFIG_ATH79_MACH_GL_X750_4G is not set
 # CONFIG_ATH79_MACH_GS_OOLITE_V1 is not set
 # CONFIG_ATH79_MACH_GS_OOLITE_V5_2 is not set
 # CONFIG_ATH79_MACH_HIVEAP_121 is not set
index 7400f2c86d455563a48d290d48b36420596225f8..bdf6e6a87eac28f446c2e027d49efdeac1c0145b 100644 (file)
@@ -814,6 +814,17 @@ config ATH79_MACH_GL_AR750
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 
+config ATH79_MACH_GL_X750_4G
+       bool "GL.iNet GL-X750_4G 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_AR750S
        bool "GL.iNet GL-AR750S support"
        select SOC_QCA956X
index b6c77b202986c2dedb1530c55af37799dad1eea0..09cb9b23e4b2223b4276c3186424af46e31631a1 100644 (file)
@@ -130,6 +130,7 @@ 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_X750_4G)            += mach-gl-x750-4g.o
 obj-$(CONFIG_ATH79_MACH_GL_AR750S)             += mach-gl-ar750s.o
 obj-$(CONFIG_ATH79_MACH_GL_DOMINO)             += mach-gl-domino.o
 obj-$(CONFIG_ATH79_MACH_GL_INET)               += mach-gl-inet.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x750-4g.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x750-4g.c
new file mode 100644 (file)
index 0000000..c361fd7
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * GL.iNet GL-X750-4G 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_X750_4G_GPIO_LED_POWER              12
+#define GL_X750_4G_GPIO_LED_WLAN2G     4
+#define GL_X750_4G_GPIO_LED_WLAN5G     13
+#define GL_X750_4G_GPIO_LED_4G 15
+#define GL_X750_4G_GPIO_LED_WAN                14
+
+#define GL_X750_4G_GPIO_BTN_RESET              3
+
+#define GL_X750_4G_GPIO_I2C_SCL                16
+#define GL_X750_4G_GPIO_I2C_SDA                1
+
+#define GL_X750_4G_GPIO_USB_POWER              2
+
+#define GL_X750_4G_KEYS_POLL_INTERVAL  20
+#define GL_X750_4G_KEYS_DEBOUNCE_INTERVAL      (3 * GL_X750_4G_KEYS_POLL_INTERVAL)
+
+#define GL_X750_4G_MAC0_OFFSET         0
+#define GL_X750_4G_WMAC2G_CALDATA_OFFSET       0x1000
+#define GL_X750_4G_WMAC5G_CALDATA_OFFSET       0x5000
+
+static struct gpio_led gl_x750_4g_leds_gpio[] __initdata = {
+       {
+               .name           = "gl-x750-4g:white:power",
+               .gpio           = GL_X750_4G_GPIO_LED_POWER,
+               .default_state  = LEDS_GPIO_DEFSTATE_KEEP,
+               .active_low     = 1,
+       }, {
+               .name           = "gl-x750-4g:white:wlan2g",
+               .gpio           = GL_X750_4G_GPIO_LED_WLAN2G,
+               .active_low     = 1,
+       }, {
+               .name           = "gl-x750-4g:white:wlan5g",
+               .gpio           = GL_X750_4G_GPIO_LED_WLAN5G,
+               .active_low     = 1,
+       },{
+               .name           = "gl-x750-4g:white:wan",
+               .gpio           = GL_X750_4G_GPIO_LED_WAN,
+               .active_low     = 1,
+       }, {
+               .name           = "gl-x750-4g:white:4g",
+               .gpio           = GL_X750_4G_GPIO_LED_4G,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button gl_x750_4g_gpio_keys[] __initdata = {
+       {
+               .desc                   = "reset",
+               .type                   = EV_KEY,
+               .code                   = KEY_RESTART,
+               .debounce_interval      = GL_X750_4G_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = GL_X750_4G_GPIO_BTN_RESET,
+               .active_low             = 1,
+       },
+};
+
+/*static struct i2c_gpio_platform_data gl_x750_4g_i2c_gpio_data = {
+       .sda_pin = GL_X750_4G_GPIO_I2C_SDA,
+       .scl_pin = GL_X750_4G_GPIO_I2C_SCL,
+};
+
+static struct platform_device gl_x750_4g_i2c_gpio = {
+       .name   = "i2c-gpio",
+       .id     = 0,
+       .dev    = {
+               .platform_data = &gl_x750_4g_i2c_gpio_data,
+       },
+};*/
+
+static void __init gl_x750_4g_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(0x1f050000);
+
+       ath79_register_m25p80(NULL);
+
+       ath79_register_mdio(0, 0x0);
+       //ath79_register_mdio(1, 0x0);
+
+       ath79_switch_data.phy4_mii_en = 1;
+       ath79_switch_data.phy_poll_mask |= BIT(4);
+
+       /* 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_X750_4G_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_eth1_data.speed = SPEED_1000;
+       ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_X750_4G_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_x750_4g_leds_gpio),
+                                gl_x750_4g_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, GL_X750_4G_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(gl_x750_4g_gpio_keys),
+                                       gl_x750_4g_gpio_keys);
+
+       gpio_request_one(GL_X750_4G_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
+
+//     platform_device_register(&gl_x750_4g_i2c_gpio);
+
+       ath79_register_usb();
+
+       ath79_register_wmac(art + GL_X750_4G_WMAC2G_CALDATA_OFFSET, NULL);
+
+       ap91_pci_init(art + GL_X750_4G_WMAC5G_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_GL_X750_4G, "GL-X750-4G", "GL.iNet GL-X750-4G",
+            gl_x750_4g_setup);
index 1457d8b34737c821e48f8093bd81368adf8fc503..4c242ee136508cf3fa7cd423f0d2d449c8126ee2 100644 (file)
@@ -125,6 +125,7 @@ enum ath79_mach_type {
        ATH79_MACH_GL_AR300,                    /* GL-AR300 */
        ATH79_MACH_GL_AR300M,                   /* GL-AR300M */
        ATH79_MACH_GL_AR750,                    /* GL.iNet GL-AR750 */
+       ATH79_MACH_GL_X750_4G,                  /* GL.iNet GL-X750-4G */
        ATH79_MACH_GL_AR750S,                   /* GL.iNet GL-AR750S */
        ATH79_MACH_GL_DOMINO,                   /* Domino */
        ATH79_MACH_GL_INET,                     /* GL-CONNECT GL-INET */
index 53281c12508cb819fd3b2c7d7497855c16512e63..dafcaf0d67b5e4a85db9e6436509e2edeb8d0343 100644 (file)
@@ -93,6 +93,7 @@ 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_X750_4G=y
 CONFIG_ATH79_MACH_GL_AR750S=y
 CONFIG_ATH79_MACH_GL_DOMINO=y
 CONFIG_ATH79_MACH_GL_INET=y
index e57f8a273135069fd80fc08de729f4cdb5452d15..9c32bb5d386f338cdb0a8bfb073e50ed41fbba7e 100644 (file)
@@ -461,6 +461,19 @@ define Device/gl-ar750
 endef
 TARGET_DEVICES += gl-ar750
 
+define Device/gl-x750-4g
+  DEVICE_TITLE := GL.iNet GL-X750-4G
+  DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 kmod-usb-core \
+       kmod-usb2 kmod-usb-storage
+  BOARDNAME := GL-X750-4G
+  SUPPORTED_DEVICES := gl-x750-4g
+  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-x750-4g
+
 define Device/gl-ar750s
   DEVICE_TITLE := GL.iNet GL-AR750S
   DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 kmod-usb-core \