From patchwork Sun Oct 22 20:21:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Herpai X-Patchwork-Id: 829091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IHhc1o5A"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yKrbd3msSz9sRm for ; Mon, 23 Oct 2017 07:24:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U+5F9eWxFUS1O5NWwXPS0NoArxhJtQHZPeRX5OzISXs=; b=IHhc1o5A3TPnix EQp5xw0NQ9UxEHH1/R0hY4cg0OPF0N/M3E4FYIyDL9B6rHwIySK/ZMANQ7pp36CiJYZNt9afjAoog ZadzhXgN16LYCf/VvXda/HclQnPCik2tMKbv1zIFX/Ptj40LSO1/Vz9cCtdTT9QCLSUMTNxwop8On b8CgY2x+kiAXCYXIziZSK33UV09T67PwgHHOZeb3eaXTK4G0CvkR2WWZ2E//cSjIdjO4HHXVo2nt8 yyzPRqnzBqXrRj6E1z+x7vbqlSMJAj5R3IzDeCYJ8PqTaJGi8Cn0n/dkK8f1+7C6DWi9+Sn4v8NdG eA4bpKUoqgpjmzKEb5Nw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e6Mms-0000FI-8I; Sun, 22 Oct 2017 20:23:58 +0000 Received: from wigyori-1-pt.tunnel.tserv1.bud1.ipv6.he.net ([2001:470:1f1a:93::2] helo=trabant.uid0.hu) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e6Mkr-0006uX-8t for lede-dev@lists.infradead.org; Sun, 22 Oct 2017 20:22:11 +0000 Received: from wigyori by trabant.uid0.hu with local (Exim 4.84_2 #1 (Debian)) id 1e6MkR-0006iy-HR from ; Sun, 22 Oct 2017 22:21:27 +0200 From: Zoltan HERPAI To: lede-dev@lists.infradead.org Date: Sun, 22 Oct 2017 22:21:24 +0200 Message-Id: <1508703687-25650-7-git-send-email-wigyori@uid0.hu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508703687-25650-1-git-send-email-wigyori@uid0.hu> References: <1508703687-25650-1-git-send-email-wigyori@uid0.hu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171022_132153_638827_7A4D318C X-CRM114-Status: GOOD ( 14.79 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 6/9] ar71xx: add support for Anonabox Pro X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hauke@hauke-m.de, openwrt-devel@lists.openwrt.org MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: August Germar Chipset is a 650mhz Atheros with 128mb ram. Variation of QCA9531 SoC with two Ethernet ports and a 802.11n 2.4 GHz radio. Signed-off-by: August Germar [with review by Daniel Engberg] Reviewed-by: Zoltan HERPAI --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-4.9 | 1 + .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 11 +++ target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 + .../files/arch/mips/ath79/mach-anonabox-pro.c | 110 +++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/legacy-devices.mk | 6 ++ target/linux/ar71xx/image/legacy.mk | 2 + 9 files changed, 136 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-anonabox-pro.c diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index f89c009..bdba81b 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -687,6 +687,9 @@ ar71xx_board_detect() { *"HiWiFi HC6361") name="hiwifi-hc6361" ;; + *"ANONABOX_PRO") + name="anonabox-pro" + ;; *"Hornet-UB") local size="$(mtd_get_part_size 'firmware')" diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 3d6d9ed..a60e44c 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -310,6 +310,7 @@ platform_check_image() { ;; alfa-ap96|\ alfa-nx|\ + anonabox-pro|\ ap121-mini|\ ap121|\ ap135-020|\ diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 84b2a0b..285c638 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -36,6 +36,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 5cb4f7e..ac77aed 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -124,6 +124,17 @@ 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 + 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 7d12282..e6f0cae 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -45,6 +45,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 0000000..3fc4c39 --- /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 +#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-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 01472b6..bdf0167 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -26,6 +26,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/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk index e418282..0bbadc0 100644 --- a/target/linux/ar71xx/image/legacy-devices.mk +++ b/target/linux/ar71xx/image/legacy-devices.mk @@ -55,6 +55,12 @@ define LegacyDevice/ALL0315N endef LEGACY_DEVICES += ALL0315N +define LegacyDevice/ANONABOX_PRO + DEVICE_TITLE := AnonaBox Pro board + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev +endef +LEGACY_DEVICES += ANONABOX_PRO + define LegacyDevice/AP121_8M DEVICE_TITLE := Atheros AP121 reference board (8MB flash) DEVICE_PACKAGES := kmod-usb-core kmod-usb2 diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index 701116b..62d261e 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -227,6 +227,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)ro,64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)ro 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) ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware) ap121_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware) ap121_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,10944k(rootfs),4992k(kernel),64k(nvram),64k(art)ro,15936k@0x50000(firmware) @@ -882,6 +883,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,AP121_8M,ap121-8M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_8M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP121_16M,ap121-16M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_16M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP132,ap132,AP132,ttyS0,115200,$$(ap132_mtdlayout),KRuImage))