From: Luochongjun Date: Tue, 5 Jun 2018 06:38:27 +0000 (+0800) Subject: add gl-x750-4g X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27525de81dcca78b6d1c98742fd9117a7879f699;p=thirdparty%2Fopenwrt.git add gl-x750-4g --- diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index 308f53d6dbe..15b7e583ad7 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -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" diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 05c6dbe1309..574e6ba48c2 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -157,6 +157,7 @@ ar71xx_setup_interfaces() dr344|\ gl-ar150|\ gl-ar300m|\ + gl-x750-4g|\ gl-domino|\ gl-inet|\ gl-mifi|\ diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index f82026c7ad2..4f894220470 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -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) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index c64520d6f2d..9c24180312d 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -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" diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index ba710d800b3..f0ba468eacb 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -294,6 +294,7 @@ platform_check_image() { gl-ar300m|\ gl-ar300|\ gl-ar750|\ + gl-x750-4g|\ gl-domino|\ gl-mifi|\ gl-usb150|\ diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 9eae158ebeb..2e6cadaa648 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -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 diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 7400f2c86d4..bdf6e6a87ea 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -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 diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index b6c77b20298..09cb9b23e4b 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -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 index 00000000000..c361fd72386 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x750-4g.c @@ -0,0 +1,149 @@ +/* + * GL.iNet GL-X750-4G board support + * + * Copyright (C) 2018 Piotr Dymacz + * + * 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 +#include +#include +#include + +#include +#include + +#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); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 1457d8b3473..4c242ee1365 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -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 */ diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default index 53281c12508..dafcaf0d67b 100644 --- a/target/linux/ar71xx/generic/config-default +++ b/target/linux/ar71xx/generic/config-default @@ -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 diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index e57f8a27313..9c32bb5d386 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -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 \