From patchwork Sun Mar 15 10:34:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thibaut X-Patchwork-Id: 1254985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=slashdirt.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=fnhId3Kg; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=SooowYFD; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48gG700Xhhz9sQx for ; Sun, 15 Mar 2020 21:35:55 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version: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=SHD3AP6XngjtpvXQ18aPGlxiLuF3Occ08X/lETXMMwU=; b=fnhId3KgIHjhZk e9fZ482vzfu4PvMO0itVS7pgvs1bunIhLcYVp7mhdtgxj8zScusGInLuzAU62MC9PtMS3rKRRqD40 57C1cpzHBLInr9MSdmZ9JsVYo6Xd1g83HjSZf2FEssf/eJ4YhvbFdMDVuOGVnOf86Bm8lTMT/kAaI mVPD8GARuDCCPtTMcJrAfiVblwVK1Y6piNqfyB+x4J38Bs1o4GGwpTV/omuWzphXjfblOc7c1ZJxq 7Vtthk32jKl8oiOQzcQ4YH1LlZgePXIg1UkoqhA8UAHFf3Cmsq/ItoESssJweW+CyGvK1PAGdRQIc HyWN3FFo0GzEStUjiLBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jDQcY-0002Lj-3O; Sun, 15 Mar 2020 10:35:50 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jDQcW-0002Lb-Ru for openwrt-devel@bombadil.infradead.org; Sun, 15 Mar 2020 10:35:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=tMc5Xjfqsv0pmuO4chult4rX1MegmkH2az4yXnC2leU=; b=SooowYFDf2NUD+63+WVVLBUPJi p2gkwc+FndvvmWNjipdlY957RSMqEevGzIWhM/y5yL/Zg1oKEaSk5n4KNHWLL1g4mspNreNiZQZ5B zmtZBMg0Tf22sD+Zgerk9GEYVK/Ues48VdohPqXR+ChdzU2OgH1IiQixKxt62PgdmYLT6v67FB1/i l4xNECcrHfUGO/E/kzP394ckM20rpZ2QxwJUlwX/ZjWfhUuOD5ICbd5o8Y1o+aPqGpN06DbnAcHw6 x/pXJ9g6QCZrM4h/diWkRNnNT/7pvo3cNOf2/tTQ59RUgG6Y8pItT98YiTWQJUnRifjOquoHqofjv 4LP3e+Yw==; Received: from vps.slashdirt.org ([144.91.108.218]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jDQcN-0004kv-EX for openwrt-devel@lists.openwrt.org; Sun, 15 Mar 2020 10:35:46 +0000 Received: from supercopter (82-64-212-153.subs.proxad.net [82.64.212.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by vps.slashdirt.org (Postfix) with ESMTPS id 6E151602D7; Sun, 15 Mar 2020 11:35:25 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 vps.slashdirt.org 6E151602D7 Authentication-Results: vps.slashdirt.org; dmarc=fail (p=quarantine dis=none) header.from=slashdirt.org DKIM-Filter: OpenDKIM Filter v2.11.0 vps.slashdirt.org 6E151602D7 Received: by supercopter (sSMTP sendmail emulation); Sun, 15 Mar 2020 11:35:24 +0100 From: =?utf-8?q?Thibaut_VAR=C3=88NE?= To: openwrt-devel@lists.openwrt.org Date: Sun, 15 Mar 2020 11:34:51 +0100 Message-Id: <20200315103451.34439-1-hacks@slashdirt.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200314212303.29701-1-hacks@slashdirt.org> References: <20200314212303.29701-1-hacks@slashdirt.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, NO_DNS_FOR_FROM, TXREP, UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on vps.slashdirt.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200315_103540_153554_92E30BCE X-CRM114-Status: GOOD ( 24.99 ) X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.3 on casper.infradead.org summary: Content analysis details: (-1.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 NO_DNS_FOR_FROM RBL: Envelope sender has no MX or A DNS records [listed in slashdirt.org. IN A] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 DKIM_ADSP_ALL No valid author signature, domain signs all mail 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record Subject: [OpenWrt-Devel] [PATCH v2] ar71xx: add support for RB SXTsq 2nD X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thibaut_VAR=C3=88NE?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org [no change, commit msg update: fixed installation instructions] This patch adds support for the MikroTik RouterBOARD SXTsq Lite2 https://mikrotik.com/product/sxtsq_lite2 Specifications: - SoC: Qualcomm QCA9533 (650MHz) - RAM: 64MB - Storage: 16MB SPI NOR flash - Wireless: QCA9533 built-in, dual-chain 802.11b/g/n - Ethernet: 1x100M Note: the reset button shares its GPIO with the last RSSI LED: this is not supported, the last LED is thus disabled (reset works). That aside, the device is fully supported. Installation: (Standard Mikrotik TFTP) 1. Setup a DHCP/BOOTP Server with the following parameters: * DHCP-Option 66 (TFTP server name): pointing to a local TFTP server within the same subnet of the DHCP range * DHCP-Option 67 (Bootfile-Name): matching the initramfs filename of the to be booted image. The usable intramfs files are: - openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf - openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf - openwrt-ar71xx-mikrotik-rb-nor-flash-16M-initramfs-kernel.bin 2. Press the reset button on the board and keep that pressed. 3. Connect the board to your local network via its ethernet port. 4. Release the button after the LEDs on the board are turned off. Now the board should load and start the initramfs image from the TFTP server. 5. Upload the sysupgrade image to the board with scp: $ scp openwrt-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/fw.bin 6. Log in to the running system listening on 192.168.1.1 via ssh as root (without password): $ ssh root@192.168.1.1 7. Flash the uploaded firmware file from the ssh session via the sysupgrade command: root@OpenWrt:~# sysupgrade /tmp/fw.bin Signed-off-by: Thibaut VARĂˆNE --- target/linux/ar71xx/base-files/etc/board.d/01_leds | 3 +- .../linux/ar71xx/base-files/etc/board.d/02_network | 1 + target/linux/ar71xx/base-files/etc/diag.sh | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 2 + .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 1 + .../ar71xx/files/arch/mips/ath79/mach-rbspi.c | 78 +++++++++++++++++++++- .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/mikrotik.mk | 2 +- 9 files changed, 89 insertions(+), 3 deletions(-) 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 54727a6e52..4d50f489d5 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -683,7 +683,8 @@ rb-2011uias-2hnd-r2) ucidef_set_led_switch "eth9" "ETH9" "rb:green:eth9" "switch1" "0x04" ucidef_set_led_switch "eth10" "ETH10" "rb:green:eth10" "switch1" "0x02" ;; -rb-lhg-5nd) +rb-lhg-5nd|\ +rb-sxtsq-2nd) ucidef_set_led_netdev "lan" "LAN" "rb:green:eth" "eth0" ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "rb:green:rssi0" "wlan0" "1" "100" "0" "13" 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 1487ff58de..1334e48e7a 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -116,6 +116,7 @@ ar71xx_setup_interfaces() rb-sxt2n|\ rb-sxt-2nd-r3|\ rb-sxt5n|\ + rb-sxtsq-2nd|\ rb-wap-2nd|\ rb-wapr-2nd|\ rb-wapg-5hact2hnd|\ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index c5fe5bdcc1..b0e56fda8a 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -381,6 +381,7 @@ get_status_led() { rb-map-2nd|\ rb-mapl-2nd|\ rb-sxt-2nd-r3|\ + rb-sxtsq-2nd|\ rb-wap-2nd|\ rb-wapr-2nd) status_led="rb:green:user" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 044ef4eae5..cf792783c4 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -542,6 +542,9 @@ mikrotik_board_detect() { *"SXT Lite5") name="rb-sxt5n" ;; + *"SXTsq 2nD") + name="rb-sxtsq-2nd" + ;; *"wAP 2nD r2") name="rb-wap-2nd" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index a76842bdde..618fb3b8ca 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -726,6 +726,7 @@ platform_check_image() { rb-map-2nd|\ rb-mapl-2nd|\ rb-sxt-2nd-r3|\ + rb-sxtsq-2nd|\ rb-wap-2nd|\ rb-wapg-5hact2hnd|\ rb-wapr-2nd) @@ -786,6 +787,7 @@ platform_do_upgrade() { rb-map-2nd|\ rb-mapl-2nd|\ rb-sxt-2nd-r3|\ + rb-sxtsq-2nd|\ rb-wap-2nd|\ rb-wapg-5hact2hnd|\ rb-wapr-2nd) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 6fd78c46a0..3657f9ca49 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -1189,6 +1189,7 @@ config ATH79_MACH_RBSPI MikroTik RouterBOARD LHG 5 MikroTik RouterBOARD cAP (EXPERIMENTAL) MikroTik RouterBOARD SXT Lite 2 r3 + MikroTik RouterBOARD STXsq Lite2 MikroTik RouterBOARD wAP MikroTik RouterBOARD wAP R-2nD diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c index 6bb42c78e3..bf4518698e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c @@ -14,6 +14,7 @@ * - MikroTik RouterBOARD 750P-PBr2 * - MikroTik RouterBOARD 750 r2 * - MikroTik RouterBOARD LHG 5nD + * - MikroTik RouterBOARD SXTsq 2nD * - MikroTik RouterBOARD wAP2nD * - MikroTik RouterBOARD wAP G-5HacT2HnDwAP (wAP AC) * - MikroTik RouterBOARD wAP R-2nD @@ -24,7 +25,7 @@ * hardware as the mAP L-2nD. It is unknown if they share the same board * identifier. * - * Copyright (C) 2017-2018 Thibaut VARENE + * Copyright (C) 2017-2020 Thibaut VARENE * Copyright (C) 2016 David Hutchison * Copyright (C) 2017 Ryan Mounce * @@ -479,6 +480,55 @@ static struct gpio_led rblhg_leds[] __initdata = { }, }; +/* RB SXTsq 2nD gpios */ +#define RBSXTSQ_GPIO_LED_0 11 +#define RBSXTSQ_GPIO_LED_1 9 +#define RBSXTSQ_GPIO_LED_2 12 +#define RBSXTSQ_GPIO_LED_3 13 +#define RBSXTSQ_GPIO_LED_4 16 // shared with reset button +#define RBSXTSQ_GPIO_LED_ETH 4 +#define RBSXTSQ_GPIO_LED_POWER 17 +#define RBSXTSQ_GPIO_LED_USER 14 +#define RBSXTSQ_GPIO_BTN_RESET 16 + +static struct gpio_led rbsxtsq_leds[] __initdata = { + { + .name = "rb:green:rssi0", + .gpio = RBSXTSQ_GPIO_LED_0, + .active_low = 1, + }, { + .name = "rb:green:rssi1", + .gpio = RBSXTSQ_GPIO_LED_1, + .active_low = 1, + }, { + .name = "rb:green:rssi2", + .gpio = RBSXTSQ_GPIO_LED_2, + .active_low = 1, + }, { + .name = "rb:green:rssi3", + .gpio = RBSXTSQ_GPIO_LED_3, + .active_low = 1, +/* }, { + // LED_4 GPIO is shared with reset button => Do not register this LED + .name = "rb:green:rssi4", + .gpio = RBSXTSQ_GPIO_LED_4, + .active_low = 1, +*/ }, { + .name = "rb:green:eth", + .gpio = RBSXTSQ_GPIO_LED_ETH, + .active_low = 1, + }, { + .name = "rb:green:user", + .gpio = RBSXTSQ_GPIO_LED_USER, + .active_low = 1, + }, { + .name = "rb:green:power", + .gpio = RBSXTSQ_GPIO_LED_POWER, + .active_low = 0, + .default_state = LEDS_GPIO_DEFSTATE_ON, + }, +}; + /* RB w APG-5HacT2HnD (wAP AC) gpios*/ #define RBWAPGSC_WIFI_LED_1 1 #define RBWAPGSC_WIFI_LED_2 8 @@ -1021,6 +1071,31 @@ static void __init rblhg_setup(void) } /* + * Init the SXTsq Lite2 (QCA9533). + * This device has a single ethernet port connected to PHY0. + * Wireless is provided via 2.4GHz WLAN1. + */ +static void __init rbsxtsq_setup(void) +{ + u32 flags = RBSPI_HAS_WLAN1; + + if (!rbspi_platform_setup()) + return; + + rbspi_peripherals_setup(flags); + + /* GMAC1 is HW MAC, WLAN1 MAC is HW MAC + 1 */ + rbspi_network_setup(flags, 0, 0, 1); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(rbsxtsq_leds), rbsxtsq_leds); + + /* Make the eth LED controllable by software. */ + ath79_gpio_output_select(RBSXTSQ_GPIO_LED_ETH, AR934X_GPIO_OUT_GPIO); + + rbspi_register_reset_button(RBSXTSQ_GPIO_BTN_RESET); +} + +/* * Init the wAP hardware. * The wAP 2nD has a single ethernet port. */ @@ -1260,3 +1335,4 @@ MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAP, "cap-hb", rbcap_setup); MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAP, "map2-hb", rbmap_setup); MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAPAC, "wapg-sc", rbwapgsc_setup); MIPS_MACHINE_NONAME(ATH79_MACH_RB_931, "931", rb931_setup); +MIPS_MACHINE_NONAME(ATH79_MACH_RB_SXTSQL2, "lhg-hb", rbsxtsq_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 900b4ec87b..7954a62835 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -233,6 +233,7 @@ enum ath79_mach_type { ATH79_MACH_RB_WAPAC, /* Mikrotik RouterBOARD wAPG-5HacT2HnD */ ATH79_MACH_RB_SXTLITE2ND, /* Mikrotik RouterBOARD SXT Lite 2nD */ ATH79_MACH_RB_SXTLITE5ND, /* Mikrotik RouterBOARD SXT Lite 5nD */ + ATH79_MACH_RB_SXTSQL2, /* Mikrotik RouterBOARD SXTsq 2nD */ ATH79_MACH_RE355, /* TP-LINK RE355 */ ATH79_MACH_RE450, /* TP-LINK RE450 */ ATH79_MACH_RME_EG200, /* eTactica EG200 */ diff --git a/target/linux/ar71xx/image/mikrotik.mk b/target/linux/ar71xx/image/mikrotik.mk index dbbccb1c3f..d23e26c069 100644 --- a/target/linux/ar71xx/image/mikrotik.mk +++ b/target/linux/ar71xx/image/mikrotik.mk @@ -46,7 +46,7 @@ define Device/rb-nor-flash-16M DEVICE_PACKAGES := rbcfg rssileds -nand-utils kmod-ledtrig-gpio IMAGE_SIZE := 16000k KERNEL_INSTALL := 1 - SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-750p-pbr2 rb-911-2hn rb-911-5hn rb-931-2nd rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-map-2nd rb-mapl-2nd rb-wap-2nd rb-wapr-2nd rb-sxt-2nd-r3 + SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-750p-pbr2 rb-911-2hn rb-911-5hn rb-931-2nd rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-map-2nd rb-mapl-2nd rb-wap-2nd rb-wapr-2nd rb-sxt-2nd-r3 rb-sxtsq-2nd IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) endef