diff options
author | Zoltan Herpai <wigyori@uid0.hu> | 2017-01-09 12:39:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-09 12:39:20 +0300 |
commit | 2e938332be52bb96d7c27dce6d7b4cc92c393ed6 (patch) | |
tree | 00a8e789645ea79cfa858d152c8bf7551886875a | |
parent | 98dcdc94697c90688bc4a3377459ad653f057362 (diff) | |
parent | aac4a5b6e9b52383df23e3b589f2458e7a08849d (diff) |
Merge pull request #320 from wigyori/anonabox-support
ar71xx: add support for Anonabox Pro
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 | ||||
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/config-4.4 | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 14 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/mach-anonabox-pro.c | 110 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/generic/profiles/anonabox.mk | 17 | ||||
-rw-r--r-- | target/linux/ar71xx/image/legacy.mk | 2 |
9 files changed, 150 insertions, 0 deletions
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 1e9da4d01a..74f4777d39 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -1106,6 +1106,9 @@ ar71xx_board_detect() { *"HiWiFi HC6361") name="hiwifi-hc6361" ;; + *"ANONABOX_PRO") + name="anonabox-pro" + ;; esac [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \ diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 0502ed7a2b..6afa154f21 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -181,6 +181,7 @@ platform_check_image() { alfa-ap96 | \ alfa-nx | \ arduino-yun | \ + anonabox-pro | \ ap113 | \ ap121 | \ ap121-mini | \ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index edba73306a..0312110cca 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -37,6 +37,7 @@ CONFIG_ATH79_MACH_ALFA_AP96=y CONFIG_ATH79_MACH_ALFA_NX=y CONFIG_ATH79_MACH_ALL0258N=y CONFIG_ATH79_MACH_ALL0315N=y +CONFIG_ATH79_MACH_ANONABOX_PRO=y CONFIG_ATH79_MACH_ANTMINER_S1=y CONFIG_ATH79_MACH_ANTMINER_S3=y CONFIG_ATH79_MACH_ANTROUTER_R1=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 2e0145cbb5..4b752ca8d5 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -60,6 +60,20 @@ config ATH79_MACH_ALL0315N select ATH79_DEV_LEDS_GPIO select ATH79_DEV_M25P80 +config ATH79_MACH_ANONABOX_PRO + bool "Anonabox Pro board" + select SOC_QCA953X + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_SPI + select ATH79_DEV_USB + select ATH79_DEV_WMAC + select ATH79_DEV_ETH + select ATH79_DEV_M25P80 + help + Say 'Y' here if you want your kernel to support the + Anonabox Pro board. + config ATH79_MACH_ANTMINER_S1 bool "Bitmain Antminer S1 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 d8f1b32d62..225812165e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_ATH79_MACH_ALFA_AP96) += mach-alfa-ap96.o obj-$(CONFIG_ATH79_MACH_ALFA_NX) += mach-alfa-nx.o obj-$(CONFIG_ATH79_MACH_ALL0258N) += mach-all0258n.o obj-$(CONFIG_ATH79_MACH_ALL0315N) += mach-all0315n.o +obj-$(CONFIG_ATH79_MACH_ANONABOX_PRO) += mach-anonabox-pro.o obj-$(CONFIG_ATH79_MACH_ANTMINER_S1)+= mach-antminer-s1.o obj-$(CONFIG_ATH79_MACH_ANTMINER_S3)+= mach-antminer-s3.o obj-$(CONFIG_ATH79_MACH_ANTROUTER_R1) += mach-antrouter-r1.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-anonabox-pro.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-anonabox-pro.c new file mode 100644 index 0000000000..3fc4c39061 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-anonabox-pro.c @@ -0,0 +1,110 @@ +/* + * AnonaBox QCA9531 board support + * + * 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. + * 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 <linux/platform_device.h> +#include <linux/ath9k_platform.h> +#include <linux/ar8216_platform.h> + +#include <asm/mach-ath79/ar71xx_regs.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 "dev-wmac.h" +#include "machtypes.h" + +#define ANONABOX_PRO_GPIO_LED_STATUS 14 + +#define ANONABOX_PRO_GPIO_BTN_RST 17 + +#define ANONABOX_PRO_KEYS_POLL_INTERVAL 20 /* msecs */ +#define ANONABOX_PRO_KEYS_DEBOUNCE_INTERVAL (3 * ANONABOX_PRO_KEYS_POLL_INTERVAL) + +#define ANONABOX_PRO_MAC0_OFFSET 0 +#define ANONABOX_PRO_MAC1_OFFSET 6 +#define ANONABOX_PRO_WMAC_CALDATA_OFFSET 0x1000 + +static struct gpio_led anonabox_pro_leds_gpio[] __initdata = { + { + .name = "anonabox_pro:green:status", + .gpio = ANONABOX_PRO_GPIO_LED_STATUS, + .active_low = 1, + }, +}; + +static struct gpio_keys_button anonabox_pro_gpio_keys[] __initdata = { + { + .desc = "reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = ANONABOX_PRO_KEYS_DEBOUNCE_INTERVAL, + .gpio = ANONABOX_PRO_GPIO_BTN_RST, + .active_low = 1, + }, +}; + +static void __init anonabox_pro_gpio_led_setup(void) +{ + ath79_register_leds_gpio(-1, ARRAY_SIZE(anonabox_pro_leds_gpio), + anonabox_pro_leds_gpio); + ath79_register_gpio_keys_polled(-1, ANONABOX_PRO_KEYS_POLL_INTERVAL, + ARRAY_SIZE(anonabox_pro_gpio_keys), + anonabox_pro_gpio_keys); +} + +static void __init anonabox_pro_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + + anonabox_pro_gpio_led_setup(); + + ath79_register_usb(); + + ath79_register_wmac(art + ANONABOX_PRO_WMAC_CALDATA_OFFSET, NULL); + + ath79_register_mdio(0, 0x0); + ath79_register_mdio(1, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + ANONABOX_PRO_MAC0_OFFSET, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, art + ANONABOX_PRO_MAC1_OFFSET, 0); + + /* WAN port */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_mask = BIT(4); + ath79_register_eth(0); + + /* LAN ports */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_eth1_data.speed = SPEED_1000; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_switch_data.phy_poll_mask |= BIT(4); + ath79_switch_data.phy4_mii_en = 1; + ath79_register_eth(1); +} + +MIPS_MACHINE(ATH79_MACH_ANONABOX_PRO, "ANONABOX_PRO", "Anonabox QCA9531", + anonabox_pro_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 2a6c61513f..fe2d40ac39 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -23,6 +23,7 @@ enum ath79_mach_type { ATH79_MACH_ALL0258N, /* Allnet ALL0258N */ ATH79_MACH_ALL0305, /* Allnet ALL0305 */ ATH79_MACH_ALL0315N, /* Allnet ALL0315N */ + ATH79_MACH_ANONABOX_PRO, /* AnonaBox Pro */ ATH79_MACH_ANTMINER_S1, /* Antminer S1 */ ATH79_MACH_ANTMINER_S3, /* Antminer S3 */ ATH79_MACH_ANTROUTER_R1, /* Antrouter R1 */ diff --git a/target/linux/ar71xx/generic/profiles/anonabox.mk b/target/linux/ar71xx/generic/profiles/anonabox.mk new file mode 100644 index 0000000000..1175b930d6 --- /dev/null +++ b/target/linux/ar71xx/generic/profiles/anonabox.mk @@ -0,0 +1,17 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/ANONABOX_PRO + NAME:=AnonaBox Pro board + PACKAGES:= \ + kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev + +endef + +define Profile/ANONABOX_PRO/Description + Package set optimized for the AnonaBox Pro board. +endef + +$(eval $(call Profile,ANONABOX_PRO)) diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index f8d4ed4cec..332d163df1 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -243,6 +243,7 @@ alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs) alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art) all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro +anonabox_pro_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) ap81_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,5120k(rootfs),2688k(kernel),64k(art)ro,7808k@0x50000(firmware) ap83_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,4096k(rootfs),3648k(kernel),64k(art)ro,7744k@0x60000(firmware) ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware) @@ -978,6 +979,7 @@ $(eval $(call SingleProfile,AthLzma,64k,ALFAAP120C,alfa-ap120c,ALFA-AP120C,ttyS0 $(eval $(call SingleProfile,AthLzma,64k,ALFAAP96,alfa-ap96,ALFA-AP96,ttyS0,115200,$$(alfa_ap96_mtdlayout),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,ALL0258N,all0258n,ALL0258N,ttyS0,115200,$$(all0258n_mtdlayout),KRuImage,65536)) $(eval $(call SingleProfile,AthLzma,256k,ALL0315N,all0315n,ALL0315N,ttyS0,115200,$$(all0315n_mtdlayout),KRuImage,262144)) +$(eval $(call SingleProfile,AthLzma,64k,ANONABOX_PRO,anonabox-pro-16M,ANONABOX_PRO,ttyS0,115200,$$(anonabox_pro_mtdlayout_16M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP113,ap113,AP113,ttyS0,115200,$$(ap113_mtd_layout),RK)) $(eval $(call SingleProfile,AthLzma,64k,AP121_2M,ap121-2M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_2M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP121_4M,ap121-4M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage)) |