From 0759aaa96d5adb9f68bd730e9e02a7485500547f Mon Sep 17 00:00:00 2001 From: imbrolla <2664456645@qq.com> Date: Tue, 28 Nov 2017 04:53:01 +0800 Subject: [PATCH] add mw316 v1, sgr w500 ebi fit v3,comba ap2600i,comba ap2600ifm. --- .../ar71xx/base-files/etc/board.d/01_leds | 19 +++ .../ar71xx/base-files/etc/board.d/02_network | 10 +- target/linux/ar71xx/base-files/etc/diag.sh | 10 ++ target/linux/ar71xx/base-files/lib/ar71xx.sh | 15 ++ .../ar71xx/base-files/lib/upgrade/platform.sh | 4 + target/linux/ar71xx/config-4.4 | 4 + target/linux/ar71xx/config-4.9 | 4 + .../files/arch/mips/ath79/Kconfig.openwrt | 37 +++++ .../ar71xx/files/arch/mips/ath79/Makefile | 4 + .../arch/mips/ath79/mach-maselink-ap2600i.c | 137 ++++++++++++++++ .../arch/mips/ath79/mach-maselink-ap2600ifm.c | 147 ++++++++++++++++++ .../files/arch/mips/ath79/mach-mw316r-v1.c | 143 +++++++++++++++++ .../mips/ath79/mach-sgr-w500-ebi-fit-v3.c | 116 ++++++++++++++ .../ar71xx/files/arch/mips/ath79/machtypes.h | 4 + target/linux/ar71xx/image/generic.mk | 9 ++ target/linux/ar71xx/image/legacy-devices.mk | 22 ++- target/linux/ar71xx/image/legacy.mk | 4 + 17 files changed, 686 insertions(+), 3 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600i.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600ifm.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-mw316r-v1.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-sgr-w500-ebi-fit-v3.c 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 61665fed9..a811d8faf 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -420,6 +420,14 @@ hornet-ub-x2) ucidef_set_led_wlan "wlan" "WLAN" "alfa:blue:wlan" "phy0tpt" ucidef_set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1" ;; +maselink-ap2600i) + ucidef_set_led_netdev "wan" "WAN" "ap2600i:green:run" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "ap2600i:green:wlan" "phy0tpt" + ;; +maselink-ap2600ifm) + ucidef_set_led_wlan "wlan1" "WLAN1" "ap2600ifm:green:rf1" "phy0tpt" + ucidef_set_led_wlan "wlan2" "WLAN2" "ap2600ifm:green:rf2" "phy1tpt" + ;; mc-mac1200r) ucidef_set_led_wlan "wlan2g" "WLAN2G" "mercury:green:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "mercury:green:wlan5g" "phy0tpt" @@ -463,6 +471,13 @@ mr900v2) ucidef_set_led_default "status-red" "Status (red)" "mr900:red:wifi" "0" ucidef_set_led_default "status-green" "Status (green)" "mr900:green:wifi" "0" ;; +mw316r-v1) + ucidef_set_led_netdev "wan" "WAN" "mercury:green:wan" "eth0" + ucidef_set_led_switch "lan1" "LAN1" "mercury:green:lan1" "switch0" "0x02" + ucidef_set_led_switch "lan2" "LAN2" "mercury:green:lan2" "switch0" "0x04" + ucidef_set_led_switch "lan3" "LAN3" "mercury:green:lan3" "switch0" "0x08" + ucidef_set_led_switch "lan4" "LAN4" "mercury:green:lan4" "switch0" "0x10" + ;; mynet-n600) ucidef_set_led_netdev "wan" "WAN" "wd:blue:internet" "eth1" ucidef_set_led_switch "lan1" "LAN1" "wd:green:lan1" "switch0" "0x02" @@ -565,6 +580,10 @@ re450) ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "$board:blue:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "$board:blue:wlan5g" "phy0tpt" ;; +sgr-w500-ebi-fit-v3) + ucidef_set_led_netdev "wan" "WAN" "grentech:green:wan" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "grentech:green:wlan" "phy0tpt" + ;; sgr-w500-n85b-v2) ucidef_set_led_wlan "wlan" "WLAN" "grentech:green:wlan2g" "phy0tpt" ;; 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 24501990f..7d47173ff 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -132,7 +132,10 @@ ar71xx_setup_interfaces() unifiac-lite|\ wi2a-ac200i|\ wndap360|\ - sgr-w500-n85b-v2 |\ + sgr-w500-n85b-v2|\ + sgr-w500-ebi-fit-v3|\ + maselink-ap2600i|\ + maselink-ap2600ifm|\ wp543) ucidef_set_interface_lan "eth0" ;; @@ -163,6 +166,11 @@ ar71xx_setup_interfaces() wrtnode2q) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; + mw316r-v1) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_add_switch "switch0" \ + "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; rb-750-r2|\ rb-750p-pbr2|\ rb-750up-r2) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 2ac3aea0a..d64493c5a 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -230,6 +230,13 @@ get_status_led() { ls-sr71) status_led="ubnt:green:d22" ;; + maselink-ap2600i) + status_led="ap2600i:green:power" + ;; + maselink-ap2600ifm) + status_led="ap2600ifm:green:power" + ;; + mw316r-v1|\ mc-mac1200r) status_led="mercury:green:system" ;; @@ -353,6 +360,9 @@ get_status_led() { sgr-w500-n85b-v2) status_led="grentech:green:status" ;; + sgr-w500-ebi-fit-v3) + status_led="grentech:green:status" + ;; smart-300) status_led="nc-link:green:system" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 3819b96b8..e6e698789 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -263,6 +263,9 @@ tplink_board_detect() { "120000"*) model="MERCURY MAC1200R" ;; ++ "031600"*) + model="Mercury MW316R" + ;; "254300"*) model="TP-Link TL-WR2543N/ND" ;; @@ -720,6 +723,15 @@ ar71xx_board_detect() { *"MAC1200R") name="mc-mac1200r" ;; + *"MW316R v1") + name="mw316r-v1" + ;; + *"MASELink AP2600-I") + name="maselink-ap2600i" + ;; + *"MASELink AP2600-IFM") + name="maselink-ap2600ifm" + ;; *"MiniBox V1.0") name="minibox-v1" ;; @@ -995,6 +1007,9 @@ ar71xx_board_detect() { "GRENTECH SGR-W500-N85b v2.0") name="sgr-w500-n85b-v2" ;; + "GRENTECH SGR-W500-EBI(FIT) v3.0") + name="sgr-w500-ebi-fit-v3" + ;; *"SMART-300") name="smart-300" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index a41f3b709..cb428a264 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -326,9 +326,12 @@ platform_check_image() { dw33d|\ f9k1115v2|\ hornet-ub|\ + maselink-ap2600i|\ + maselink-ap2600ifm|\ mr12|\ mr16|\ sgr-w500-n85b-v2|\ + sgr-w500-ebi-fit-v3|\ zbt-we1526|\ zcn-1523h-2|\ zcn-1523h-5) @@ -387,6 +390,7 @@ platform_check_image() { el-mini|\ gl-inet|\ mc-mac1200r|\ + mw316r-v1|\ minibox-v1|\ omy-g1|\ omy-x1|\ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 1cf7677f9..824e84720 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -128,6 +128,9 @@ CONFIG_ATH79_MACH_JWAP003=y CONFIG_ATH79_MACH_JWAP230=y CONFIG_ATH79_MACH_LIMA=y CONFIG_ATH79_MACH_MC_MAC1200R=y +CONFIG_ATH79_MACH_MW316R_V1=y +CONFIG_ATH79_MACH_MASELINK_AP2600I=y +CONFIG_ATH79_MACH_MASELINK_AP2600IFM=y CONFIG_ATH79_MACH_MR12=y CONFIG_ATH79_MACH_MR16=y CONFIG_ATH79_MACH_MR1750=y @@ -169,6 +172,7 @@ CONFIG_ATH79_MACH_SC1750=y CONFIG_ATH79_MACH_SC300M=y CONFIG_ATH79_MACH_SC450=y CONFIG_ATH79_MACH_SGR_W500_N85B_V2=y +CONFIG_ATH79_MACH_SGR_W500_EBI_FIT_V3=y CONFIG_ATH79_MACH_SMART_300=y CONFIG_ATH79_MACH_SOM9331=y CONFIG_ATH79_MACH_SR3200=y diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 2f963c730..ff0b63c3e 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -126,6 +126,9 @@ CONFIG_ATH79_MACH_JWAP003=y CONFIG_ATH79_MACH_JWAP230=y CONFIG_ATH79_MACH_LIMA=y CONFIG_ATH79_MACH_MC_MAC1200R=y +CONFIG_ATH79_MACH_MW316R_V1=y +CONFIG_ATH79_MACH_MASELINK_AP2600I=y +CONFIG_ATH79_MACH_MASELINK_AP2600IFM=y CONFIG_ATH79_MACH_MR12=y CONFIG_ATH79_MACH_MR16=y CONFIG_ATH79_MACH_MR1750=y @@ -167,6 +170,7 @@ CONFIG_ATH79_MACH_SC1750=y CONFIG_ATH79_MACH_SC300M=y CONFIG_ATH79_MACH_SC450=y CONFIG_ATH79_MACH_SGR_W500_N85B_V2=y +CONFIG_ATH79_MACH_SGR_W500_EBI_FIT_V3=y CONFIG_ATH79_MACH_SMART_300=y CONFIG_ATH79_MACH_SOM9331=y CONFIG_ATH79_MACH_SR3200=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index f0203c2a9..318d19dcf 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -2182,3 +2182,40 @@ config ATH79_MACH_SGR_W500_N85B_V2 select ATH79_DEV_M25P80 select ATH79_DEV_WMAC select ATH79_DEV_USB + +config ATH79_MACH_MASELINK_AP2600I + bool "Comba MASELink AP2600-I support" + select SOC_AR934X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + select ATH79_DEV_USB + +config ATH79_MACH_MASELINK_AP2600IFM + bool "Comba MASELink AP2600-IFM support" + select SOC_AR71XX + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + +config ATH79_MACH_SGR_W500_EBI_FIT_V3 + bool "GRENTECH SGR-W500-EBI(FIT) v3.0 support" + select SOC_AR71XX + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + +config ATH79_MACH_MW316R_V1 + bool "Mercury MW316R v1 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_WMAC diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index 6af6e8071..a273b235c 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -134,6 +134,9 @@ obj-$(CONFIG_ATH79_MACH_JWAP003) += mach-jwap003.o obj-$(CONFIG_ATH79_MACH_JWAP230) += mach-jwap230.o obj-$(CONFIG_ATH79_MACH_LIMA) += mach-lima.o obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o +obj-$(CONFIG_ATH79_MACH_MW316R_V1) += mach-mw316r-v1.o +obj-$(CONFIG_ATH79_MACH_MASELINK_AP2600I) += mach-maselink-ap2600i.o +obj-$(CONFIG_ATH79_MACH_MASELINK_AP2600IFM) += mach-maselink-ap2600ifm.o obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o obj-$(CONFIG_ATH79_MACH_MR16) += mach-mr16.o obj-$(CONFIG_ATH79_MACH_MR1750) += mach-mr1750.o @@ -176,6 +179,7 @@ obj-$(CONFIG_ATH79_MACH_SC1750) += mach-sc1750.o obj-$(CONFIG_ATH79_MACH_SC300M) += mach-sc300m.o obj-$(CONFIG_ATH79_MACH_SC450) += mach-sc450.o obj-$(CONFIG_ATH79_MACH_SGR_W500_N85B_V2) += mach-sgr-w500-n85b-v2.o +obj-$(CONFIG_ATH79_MACH_SGR_W500_EBI_FIT_V3) += mach-sgr-w500-ebi-fit-v3.o obj-$(CONFIG_ATH79_MACH_SMART_300) += mach-smart-300.o obj-$(CONFIG_ATH79_MACH_SOM9331) += mach-som9331.o obj-$(CONFIG_ATH79_MACH_SR3200) += mach-sr3200.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600i.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600i.c new file mode 100644 index 000000000..ad16b3daa --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600i.c @@ -0,0 +1,137 @@ +/* + * Comba MASELink AP2600-I board support + * + * Copyright (c) 2016 Weijie Gao + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#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-nfc.h" +#include "dev-spi.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define AP2600I_GPIO_LED_POWER_RED 11 +#define AP2600I_GPIO_LED_POWER_GREEN 12 +#define AP2600I_GPIO_LED_RUN 13 +#define AP2600I_GPIO_LED_WLAN 14 + +#define AP2600I_GPIO_BUTTON_RESET 15 + +#define AP2600I_KEYS_POLL_INTERVAL 20 /* msecs */ +#define AP2600I_KEYS_DEBOUNCE_INTERVAL (3 * AP2600I_KEYS_POLL_INTERVAL) + +#define AP2600I_MAC0_OFFSET 0 +#define AP2600I_WMAC_CALDATA_OFFSET 0x1000 +#define AP2600I_PCIE_CALDATA_OFFSET 0x5000 + +static struct gpio_led ap2600i_leds_gpio[] __initdata = { + { + .name = "ap2600i:red:power", + .gpio = AP2600I_GPIO_LED_POWER_RED, + .active_low = 1, + }, + { + .name = "ap2600i:green:power", + .gpio = AP2600I_GPIO_LED_POWER_GREEN, + .active_low = 1, + }, + { + .name = "ap2600i:green:run", + .gpio = AP2600I_GPIO_LED_RUN, + .active_low = 1, + }, + { + .name = "ap2600i:green:wlan", + .gpio = AP2600I_GPIO_LED_WLAN, + .active_low = 1, + } +}; + +static struct gpio_keys_button ap2600i_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = AP2600I_KEYS_DEBOUNCE_INTERVAL, + .gpio = AP2600I_GPIO_BUTTON_RESET, + .active_low = 1, + }, +}; + +static struct at803x_platform_data ap2600i_ar8035_data = { + .enable_rgmii_rx_delay = 1, + .fixup_rgmii_tx_delay = 1, +}; + +static struct mdio_board_info ap2600i_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 4, + .platform_data = &ap2600i_ar8035_data, + }, +}; + +static void __init ap2600i_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap2600i_leds_gpio), + ap2600i_leds_gpio); + ath79_register_gpio_keys_polled(-1, AP2600I_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ap2600i_gpio_keys), + ap2600i_gpio_keys); + + ath79_register_wmac(art + AP2600I_WMAC_CALDATA_OFFSET, NULL); + ap91_pci_init(art + AP2600I_PCIE_CALDATA_OFFSET, NULL); + + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | + AR934X_ETH_CFG_SW_ONLY_MODE); + + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + AP2600I_MAC0_OFFSET, 0); + + mdiobus_register_board_info(ap2600i_mdio0_info, + ARRAY_SIZE(ap2600i_mdio0_info)); + + /* GMAC0 is connected to an AR8035 Gigabit PHY */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_pll_data.pll_1000 = 0x0e000000; + ath79_eth0_pll_data.pll_100 = 0x0101; + ath79_eth0_pll_data.pll_10 = 0x1313; + ath79_register_eth(0); +} + +MIPS_MACHINE(ATH79_MACH_MASELINK_AP2600I, "AP2600I", "Comba MASELink AP2600-I", + ap2600i_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600ifm.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600ifm.c new file mode 100644 index 000000000..cffc64138 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-maselink-ap2600ifm.c @@ -0,0 +1,147 @@ +/* + * Comba MASELink AP2600-IFM board support + * + * Copyright (c) 2017 Weijie Gao + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include +#include +#include + +#include +#include + +#include "pci.h" +#include "common.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-spi.h" +#include "dev-usb.h" +#include "machtypes.h" +#include "nvram.h" + +#define AP2600IFM_GPIO_LED_RF1 2 +#define AP2600IFM_GPIO_LED_RF1_TOP 7 +#define AP2600IFM_GPIO_LED_RF2 4 +#define AP2600IFM_GPIO_LED_RF2_TOP 5 +#define AP2600IFM_GPIO_LED_D24 0 +#define AP2600IFM_GPIO_LED_D24_TOP 3 + +#define AP2600IFM_GPIO_BUTTON_RESET 8 + +#define AP2600IFM_KEYS_POLL_INTERVAL 20 /* msecs */ +#define AP2600IFM_KEYS_DEBOUNCE_INTERVAL (3 * AP2600IFM_KEYS_POLL_INTERVAL) + +#define AP2600IFM_NVRAM_ADDR 0x1f040004 +#define AP2600IFM_NVRAM_SIZE 0x3fffc + +static struct gpio_led ap2600ifm_leds_gpio[] __initdata = { + { + .name = "ap2600ifm:green:rf1", + .gpio = AP2600IFM_GPIO_LED_RF1, + .active_low = 1, + }, + { + .name = "ap2600ifm:green:rf1top", + .gpio = AP2600IFM_GPIO_LED_RF1_TOP, + .active_low = 1, + }, + { + .name = "ap2600ifm:green:rf2", + .gpio = AP2600IFM_GPIO_LED_RF2, + .active_low = 1, + }, + { + .name = "ap2600ifm:green:rf2top", + .gpio = AP2600IFM_GPIO_LED_RF2_TOP, + .active_low = 1, + }, + { + .name = "ap2600ifm:green:d24", + .gpio = AP2600IFM_GPIO_LED_D24, + .active_low = 1, + }, + { + .name = "ap2600ifm:green:d24top", + .gpio = AP2600IFM_GPIO_LED_D24_TOP, + .active_low = 1, + } +}; + +static struct gpio_keys_button ap2600ifm_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = AP2600IFM_KEYS_DEBOUNCE_INTERVAL, + .gpio = AP2600IFM_GPIO_BUTTON_RESET, + .active_low = 1, + }, +}; + +static struct mdio_board_info ap2600ifm_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 20, + }, +}; + +static void ap2600ifm_get_mac(const char *name, char *mac) +{ + u8 *nvram = (u8 *) KSEG1ADDR(AP2600IFM_NVRAM_ADDR); + int err; + + err = ath79_nvram_parse_mac_addr(nvram, AP2600IFM_NVRAM_SIZE, + name, mac); + if (err) + pr_err("%s not found in environment variables\n", name); +} + +static void __init ap2600ifm_setup(void) +{ + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap2600ifm_leds_gpio), + ap2600ifm_leds_gpio); + ath79_register_gpio_keys_polled(-1, AP2600IFM_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ap2600ifm_gpio_keys), + ap2600ifm_gpio_keys); + + ath79_register_pci(); + + ath79_register_mdio(0, 0); + + mdiobus_register_board_info(ap2600ifm_mdio0_info, + ARRAY_SIZE(ap2600ifm_mdio0_info)); + + ap2600ifm_get_mac("macaddr=", ath79_eth0_data.mac_addr); + + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(20); + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_pll_data.pll_1000 = 0x00110000; + ath79_eth0_pll_data.pll_100 = 0x0001099; + ath79_eth0_pll_data.pll_10 = 0x00991099; + + ath79_register_eth(0); +} + +MIPS_MACHINE(ATH79_MACH_MASELINK_AP2600IFM, "AP2600IFM", "Comba MASELink AP2600-IFM", + ap2600ifm_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mw316r-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mw316r-v1.c new file mode 100644 index 000000000..9b9e23faf --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mw316r-v1.c @@ -0,0 +1,143 @@ +/* + * Mercury MW316R v1 + * + * Copyright (C) 2014 Matthias Schiffer + * Copyright (C) 2017 Weijie Gao + * + * 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 "common.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-wmac.h" +#include "dev-usb.h" +#include "machtypes.h" + +#define MW316RV1_GPIO_LED_SYS 13 +#define MW316RV1_GPIO_LED_WAN 4 +#define MW316RV1_GPIO_LED_LAN1 11 +#define MW316RV1_GPIO_LED_LAN2 14 +#define MW316RV1_GPIO_LED_LAN3 15 +#define MW316RV1_GPIO_LED_LAN4 16 +#define MW316RV1_GPIO_LED_TURBO 17 + +#define MW316RV1_GPIO_BTN_RESET 12 +#define MW316RV1_GPIO_BTN_TURBO 1 + +#define MW316RV1_KEYS_POLL_INTERVAL 20 /* msecs */ +#define MW316RV1_KEYS_DEBOUNCE_INTERVAL (3 * MW316RV1_KEYS_POLL_INTERVAL) + +static const char *mw316r_v1_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data mw316r_v1_flash_data = { + .part_probes = mw316r_v1_part_probes, +}; + +static struct gpio_led mw316r_v1_leds_gpio[] __initdata = { + { + .name = "mercury:green:wan", + .gpio = MW316RV1_GPIO_LED_WAN, + .active_low = 1, + }, { + .name = "mercury:green:lan1", + .gpio = MW316RV1_GPIO_LED_LAN1, + .active_low = 1, + }, { + .name = "mercury:green:lan2", + .gpio = MW316RV1_GPIO_LED_LAN2, + .active_low = 1, + }, { + .name = "mercury:green:lan3", + .gpio = MW316RV1_GPIO_LED_LAN3, + .active_low = 1, + }, { + .name = "mercury:green:lan4", + .gpio = MW316RV1_GPIO_LED_LAN4, + .active_low = 1, + }, { + .name = "mercury:green:system", + .gpio = MW316RV1_GPIO_LED_SYS, + .active_low = 1, + }, { + .name = "mercury:green:turbo", + .gpio = MW316RV1_GPIO_LED_TURBO, + .active_low = 1, + }, +}; + +static struct gpio_keys_button mw316r_v1_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = MW316RV1_KEYS_DEBOUNCE_INTERVAL, + .gpio = MW316RV1_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "turbo", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = MW316RV1_KEYS_DEBOUNCE_INTERVAL, + .gpio = MW316RV1_GPIO_BTN_TURBO, + .active_low = 1, + } +}; + + +static void __init mw316r_v1_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(&mw316r_v1_flash_data); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(mw316r_v1_leds_gpio), + mw316r_v1_leds_gpio); + + ath79_register_gpio_keys_polled(1, MW316RV1_KEYS_POLL_INTERVAL, + ARRAY_SIZE(mw316r_v1_gpio_keys), + mw316r_v1_gpio_keys); + + ath79_setup_ar933x_phy4_switch(false, false); + + ath79_register_mdio(0, 0x0); + + /* WAN */ + ath79_switch_data.phy_poll_mask |= BIT(4); + ath79_switch_data.phy4_mii_en = 1; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.phy_mask = BIT(4); + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_register_eth(0); + + /* LAN */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + ath79_register_eth(1); + + ath79_init_mac(tmpmac, mac, 1); + ath79_register_wmac(ee, tmpmac); + + ath79_register_usb(); +} + +MIPS_MACHINE(ATH79_MACH_MW316R_V1, "MW316R-v1", "Mercury MW316R v1", + mw316r_v1_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-sgr-w500-ebi-fit-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sgr-w500-ebi-fit-v3.c new file mode 100644 index 000000000..742da3ba3 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-sgr-w500-ebi-fit-v3.c @@ -0,0 +1,116 @@ +/* + * GRENTECH SGR-W500-EBI(FIT) v3.0 board support + * + * Copyright (c) 2017 Weijie Gao + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include +#include +#include + +#include +#include + +#include "pci.h" +#include "common.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-spi.h" +#include "dev-usb.h" +#include "machtypes.h" + +#define GRENTECH_GPIO_LED_STATUS 5 +#define GRENTECH_GPIO_LED_WAN 4 +#define GRENTECH_GPIO_LED_WLAN 3 + +#define GRENTECH_GPIO_BUTTON_RESET 8 + +#define GRENTECH_KEYS_POLL_INTERVAL 20 /* msecs */ +#define GRENTECH_KEYS_DEBOUNCE_INTERVAL (3 * GRENTECH_KEYS_POLL_INTERVAL) + +static struct gpio_led grentech_leds_gpio[] __initdata = { + { + .name = "grentech:green:status", + .gpio = GRENTECH_GPIO_LED_STATUS, + .active_low = 1, + }, + { + .name = "grentech:green:wan", + .gpio = GRENTECH_GPIO_LED_WAN, + .active_low = 0, + }, + { + .name = "grentech:green:wlan", + .gpio = GRENTECH_GPIO_LED_WLAN, + .active_low = 0, + } +}; + +static struct gpio_keys_button grentech_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = GRENTECH_KEYS_DEBOUNCE_INTERVAL, + .gpio = GRENTECH_GPIO_BUTTON_RESET, + .active_low = 1, + }, +}; + +static struct mdio_board_info grentech_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 1, + }, +}; + +static void __init grentech_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(grentech_leds_gpio), + grentech_leds_gpio); + ath79_register_gpio_keys_polled(-1, GRENTECH_KEYS_POLL_INTERVAL, + ARRAY_SIZE(grentech_gpio_keys), + grentech_gpio_keys); + + ath79_register_pci(); + + ath79_register_mdio(0, 0); + + mdiobus_register_board_info(grentech_mdio0_info, + ARRAY_SIZE(grentech_mdio0_info)); + + ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); + + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(1); + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_pll_data.pll_1000 = 0x00110000; + ath79_eth0_pll_data.pll_100 = 0x0001099; + ath79_eth0_pll_data.pll_10 = 0x00991099; + + ath79_register_eth(0); +} + +MIPS_MACHINE(ATH79_MACH_SGR_W500_EBI_FIT_V3, "SGRW500EBIFITV3", "GRENTECH SGR-W500-EBI(FIT) v3.0", + grentech_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 8d9b6b080..cc6227737 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -127,6 +127,9 @@ enum ath79_mach_type { ATH79_MACH_JWAP230, /* jjPlus JWAP230 */ ATH79_MACH_LIMA, /* 8devices Lima */ ATH79_MACH_MC_MAC1200R, /* MERCURY MAC1200R */ + ATH79_MACH_MW316R_V1, /* Mercury MW316R v1 */ + ATH79_MACH_MASELINK_AP2600I, /* Comba MASELink AP2600-I */ + ATH79_MACH_MASELINK_AP2600IFM, /* Comba MASELink AP2600-IFM */ ATH79_MACH_MR12, /* Cisco Meraki MR12 */ ATH79_MACH_MR16, /* Cisco Meraki MR16 */ ATH79_MACH_MR1750, /* OpenMesh MR1750 */ @@ -204,6 +207,7 @@ enum ath79_mach_type { ATH79_MACH_SC300M, /* Abicom SC300M */ ATH79_MACH_SC450, /* Abicom SC450 */ ATH79_MACH_SGR_W500_N85B_V2, /* GRENTECH SGR-W500-N85B v2 */ + ATH79_MACH_SGR_W500_EBI_FIT_V3, /* GRENTECH SGR-W500-EBI(FIT) v3.0 */ ATH79_MACH_SMART_300, /* NC-LINK SMART-300 */ ATH79_MACH_SOM9331, /* OpenEmbed SOM9331 */ ATH79_MACH_SR3200, /* YunCore SR3200 */ diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 3c5fcc3f3..1d64ef45e 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -597,6 +597,15 @@ define Device/mc-mac1200r endef TARGET_DEVICES += mc-mac1200r +define Device/mw316r-v1 + $(Device/tplink-8mlzma) + DEVICE_TITLE := Mercury MW316R v1 + BOARDNAME := MW316R-v1 + DEVICE_PROFILE := MW316R + TPLINK_HWID := 0x03160001 +endef +TARGET_DEVICES += mw316r-v1 + define Device/minibox-v1 $(Device/tplink-16mlzma) DEVICE_TITLE := Gainstrong MiniBox V1.0 diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk index 5c37229e7..d6bc505eb 100644 --- a/target/linux/ar71xx/image/legacy-devices.mk +++ b/target/linux/ar71xx/image/legacy-devices.mk @@ -591,7 +591,25 @@ endef LEGACY_DEVICES += NBG_460N_550N_550NH define LegacyDevice/SGRW500N85BV2 - DEVICE_TITLE := GRENTECH SGR-W500-N85b v2.0 board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage + DEVICE_TITLE := GRENTECH SGR-W500-N85b v2.0 board + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage endef LEGACY_DEVICES += SGRW500N85BV2 + +define LegacyDevice/SGRW500EBIFITV3 + DEVICE_TITLE := GRENTECH SGR-W500-EBI(FIT) v3.0 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage +endef +LEGACY_DEVICES += SGRW500EBIFITV3 + +define LegacyDevice/AP2600I + DEVICE_TITLE := Comba MASELink AP2600-I board + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage +endef +LEGACY_DEVICES += AP2600I + +define LegacyDevice/AP2600IFM + DEVICE_TITLE := Comba MASELink AP2600-IFM board + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage +endef +LEGACY_DEVICES += AP2600IFM diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index f358b63e7..3069d4a30 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -275,6 +275,7 @@ wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(ca zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware) mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi) +ap2600ifm_256kblk_mtdlayout=mtdparts=spi0.0:256k(breed)ro,256k(breed-env)ro,1536k(kernel),14336k(rootfs),15872k@0x80000(firmware) define Image/BuildKernel cp $(KDIR)/vmlinux.elf $(VMLINUX).elf @@ -1005,6 +1006,9 @@ $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H516,zcn-1523h-5-16,ZCN-1523H-5,tt $(eval $(call SingleProfile,ZyXEL,64k,NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N)) $(eval $(call SingleProfile,AthLzma,64k,SGRW500N85BV2,sgr-w500-n85b-v2,SGRW500N85BV2,ttyS0,115200,$$(ap147_mtdlayout),RKuImage)) +$(eval $(call SingleProfile,AthLzma,64k,SGRW500EBIFITV3,sgr-w500-ebi-fit-v3,SGRW500EBIFITV3,ttyS0,115200,$$(ap96_mtdlayout),RKuImage)) +$(eval $(call SingleProfile,AthLzma,64k,AP2600I,maselink-ap2600i,AP2600I,ttyS0,115200,$$(ap147_mtdlayout),RKuImage)) +$(eval $(call SingleProfile,AthLzma,256k,AP2600IFM,maselink-ap2600ifm,AP2600IFM,ttyS0,115200,$$(ap2600ifm_256kblk_mtdlayout) ahbskip=1,KRuImage)) endif # ifeq ($(SUBTARGET),generic)