From patchwork Thu May 27 08:16:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis K X-Patchwork-Id: 1484495 X-Patchwork-Delegate: koen.vandeputte@ncentric.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QdUh5kRw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=iCbwH4jh; 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 4FrLRK22Hpz9sVt for ; Thu, 27 May 2021 18:22:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z7zh725teSTKxhqacHPR1ucbbvv78l1MPmyVZcWrTrs=; b=QdUh5kRw4Sq+Yo Rc0/4Qo3eF7a1LAd0Io7RvOWewvePS+cvewqJ/5XNGkAMIi1IuHc80u6q6ddIg0GD1CDoGHBUcaFo KAXPRd/dNLMOTAHBxQMelHebxbTpRQjb0ewGDbE61f42zqfboZ9z8da4mIuar42PB+0vB4IhvISF+ 2CZmakFq82dKt4eq18wlPbZTyTP53ECaRq/+S8Lv1ZaJrV8TbeV0fPm8+pbPoBSKA8EhOH13qdkuI o8UOxVSxPsaEomlgQGryq1Kai2NmYK8g+2S5IMOVysgF/uFe1DuMQFrfhk6CqHOOpyqQ1VBNrMTka LFJAoI7f12clYUw5ALMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmBG3-003oc3-4o; Thu, 27 May 2021 08:20:48 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmBDv-003nRz-W2 for openwrt-devel@lists.openwrt.org; Thu, 27 May 2021 08:18:38 +0000 Received: by mail-lj1-x22c.google.com with SMTP id p20so5170122ljj.8 for ; Thu, 27 May 2021 01:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IXvOlVxrsL/vGB/nue/o8b2+pEWtdSKC5iHb/ppG2sU=; b=iCbwH4jhBLok0JEqBKl2cjaBUFFj7kcJw66tdQhCaXJFDOacsz34ovaFTsmoDCPrL/ g5VzAmOhZZ7IlxbItuyf2KQNcCCWZaQeuJgLYwBqgmeA2gCzxcnPGPyCeiWTuPpjJcV9 MuMmaZaPIKbcmYxjFadrFE0RZ7PWclJGx9pRlqO0bTCVed5P5zXCQvo+qMaHG8mdgeEf Tza7ehSynUdZEwXloXarlwNWlTO0KS3N1xFzeIh/1hiqitkutN99w1oovYY9QbCC1ONd OPdQTaWUhesH8c8e5inTSryatDxgtEXQeOtLoTvxZNb0fr/KOFS8ci0pXM3tTRtKcJxj p/kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IXvOlVxrsL/vGB/nue/o8b2+pEWtdSKC5iHb/ppG2sU=; b=TohepGBOJGv5jRnS4OSExbNnCkrcXT26hehBaBJbyd/NfV8+4Fms5qNWhxZErrB7fZ K1Qz7ERU1F6eBKKRsO/C5swGb/Dm6JGm4fas9g3OmQUz8IBDdYhfImPyJJkJtowHiC3Z m0ZtnBKgURtF8+TwgEfqhpuOeWQXmW9vS3DW/hD+1zGk5rOB/abCFw5B3y8vrX4wtyeZ mOj7Fp8D8Ts7KuXiKcCvGU++uGVBrExiM9Fk36LdtRR60/4LMZCMvDrApwAnaZVGROOq Zw5GEnrNcBDwmsYIDGdEZfqpUo0h/zdHztlSEH0kQ9lGYSec0fInpSTeJxWV2nELKPs0 Ll8A== X-Gm-Message-State: AOAM531M8sZ8UCywNlfXYVgebrhmDOUoXiSAuJSWeKc4NUxBgDllghEh 4Q0casuoiwArxEG+e15o/qjDlHADrOlV/Q== X-Google-Smtp-Source: ABdhPJzBR9HvfxKKcThgo7am8Til4kMq7LBf0kDUvX6v2G+szbUQO8yHv4Ahgs/wVj3e+oeTzM507g== X-Received: by 2002:a2e:9601:: with SMTP id v1mr1711268ljh.45.1622103513604; Thu, 27 May 2021 01:18:33 -0700 (PDT) Received: from localhost.localdomain ([89.18.140.18]) by smtp.gmail.com with ESMTPSA id m10sm135406lfp.57.2021.05.27.01.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 01:18:33 -0700 (PDT) From: Denis Kalashnikov X-Google-Original-From: Denis Kalashnikov To: openwrt-devel@lists.openwrt.org Cc: Denis Kalashnikov , Gabor Juhos , Koen Vandeputte , Sergey Ryazanov Subject: [PATCH 3/3] ath79: add support for MikroTik RouterBOARD 912UAG-2HPnD Date: Thu, 27 May 2021 11:16:46 +0300 Message-Id: <20210527081646.4813-4-user@home.lan> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210527081646.4813-1-user@home.lan> References: <20210527081646.4813-1-user@home.lan> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_011836_091840_78CB6AC3 X-CRM114-Status: GOOD ( 20.21 ) X-Spam-Score: 0.1 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Denis Kalashnikov This board has been supported in the ar71xx. Links: * https://mikrotik.com/product/RB912UAG-2HPnD * https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb912uag-2hpnd Content analysis details: (0.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:22c listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [denis281089[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [denis281089[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Denis Kalashnikov This board has been supported in the ar71xx. Links: * https://mikrotik.com/product/RB912UAG-2HPnD * https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb912uag-2hpnd Hardware: * SoC: Atheros AR9342, * RAM: DDR 64MB, * SPI NOR: 64KB, * NAND: 128MB, * Ethernet: x1 10/100/1000 port with passive POE in, * Wi-Fi: 802.11 b/g/n, * PCIe, * USB: 2.0 EHCI controller, connected to mPCIe slot and a Type-A port -- both can be used for LTE modem. But only one can be used. * LEDs: 5 general purpose LEDs (led1..led5), power LED, user LED, Ethernet phy LED, * Button, * Beeper. Not working: * Button: it shares gpio line 15 with NAND ALE and NAND IO7, and current drivers doesn't easily support this configuration, * Beeper: it is connected to bit 5 of a serial shift register (tested with sysfs led trigger timer). But kmod-gpio-beeper doesn't work -- we left this as is for now. Flashing: * Use the RouterBOARD Reset button to enable TFTP netboot, boot kernel and initramfs and then perform sysupgrade. * From ar71xx OpenWrt firmware run: $ sysupgrade -F /tmp/ For more info see: https://openwrt.org/toh/mikrotik/common. Co-Developed-by: Koen Vandeputte Signed-off-by: Denis Kalashnikov Reviewed-by: Sergey Ryazanov --- Changelog: RFC v1 --> RFC v2 - Delete uneeded comments from DTS, - Delete ascii-art of board scheme near NAND latch from DTS, - Rewrite gpio_latch and nand_gpio nodes to be consistent with the new versions of drivers, - Fix SPI NOR flash and SPI serial shift register maximum speeds (thanks to Koen Vandeputte), - Add UART, PCIe, USB support and gpio exports (thanks to Koen Vandeputte), - Fix Ethernet node (thanks to Koen Vandeputte), - Add key and beeper nodes in disabled state just to be documented. RFC v2 --> v1 - Add led aliases -- now OpenWrt controls power led, - Remove disabled nodes (reset key and gpio-beeper), - Fix gpio-export node, - Fix model name, - Move gpio_nand and gpio_latch nodes from ahb node to the root node. --- ...9342_mikrotik_routerboard-912uag-2hpnd.dts | 214 ++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 + .../base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 227 insertions(+) create mode 100644 target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts new file mode 100644 index 0000000000..ffca700e0a --- /dev/null +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9344.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342"; + model = "MikroTik RouterBOARD 912UAG-2HPnD"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + gpio_latch: gpio_latch { + compatible = "gpio-latch"; + gpio-controller; + #gpio-cells = <2>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>, + <&gpio 1 GPIO_ACTIVE_HIGH>, + <&gpio 2 GPIO_ACTIVE_HIGH>, + <&gpio 3 GPIO_ACTIVE_HIGH>, + <0>, /* Not connected */ + <&gpio 13 GPIO_ACTIVE_HIGH>, + <&gpio 14 GPIO_ACTIVE_HIGH>, + <&gpio 15 GPIO_ACTIVE_HIGH>, + <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */ + }; + + nand_gpio { + compatible = "mikrotik,rb91x-nand"; + + gpios = <&gpio_latch 3 GPIO_ACTIVE_HIGH>, /* Read */ + <&gpio 4 GPIO_ACTIVE_HIGH>, /* Ready (RDY) */ + <&gpio_latch 5 GPIO_ACTIVE_LOW>, /* Chip Enable (nCE) */ + <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */ + <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */ + <&gpio 12 GPIO_ACTIVE_LOW>, /* Read/Write Enable (nRW) */ + <&gpio_latch 8 GPIO_ACTIVE_LOW>; /* Latch Enable (nLE) */ + + partitions { + compatible = "fixed-partitions"; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio_latch 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + user { + label = "green:user"; + gpios = <&gpio_latch 2 GPIO_ACTIVE_HIGH>; + }; + + led1 { + label = "green:led1"; + gpios = <&ssr 0 GPIO_ACTIVE_HIGH>; + }; + + led2 { + label = "green:led2"; + gpios = <&ssr 1 GPIO_ACTIVE_HIGH>; + }; + + led3 { + label = "green:led3"; + gpios = <&ssr 2 GPIO_ACTIVE_HIGH>; + }; + + led4 { + label = "green:led4"; + gpios = <&ssr 3 GPIO_ACTIVE_HIGH>; + }; + + led5 { + label = "green:led5"; + gpios = <&ssr 4 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + usb_power { + label = "power:usb"; + gpio-export,name = "power-usb"; + gpio-export,output = <1>; + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; + }; + + pcie_power { + label = "power:pcie"; + gpio-export,name = "power-pcie"; + gpio-export,output = <0>; + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + status = "okay"; + + compatible = "qca,ar7100-spi"; + + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <80000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + }; + }; + + ssr: ssr@1 { + compatible = "fairchild,74hc595"; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + reg = <1>; + spi-max-frequency = <50000000>; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy0>; + pll-data = <0x02000000 0x00000101 0x00001313>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rgmii-enabled = <1>; + rxd-delay = <1>; + txd-delay = <1>; + }; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; + +&pcie { + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 74f8603b5a..96a94793a9 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -9,6 +9,15 @@ define Device/mikrotik_routerboard-493g endef TARGET_DEVICES += mikrotik_routerboard-493g +define Device/mikrotik_routerboard-912uag-2hpnd + $(Device/mikrotik_nand) + SOC := ar9342 + DEVICE_MODEL := RouterBOARD 912UAG-2HPnD + DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 kmod-gpio-beeper + SUPPORTED_DEVICES += rb-912uag-2hpnd +endef +TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd + define Device/mikrotik_routerboard-921gs-5hpacd-15s $(Device/mikrotik_nand) SOC := qca9558 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 4ffe82588c..d4a32c1e1a 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ @@ -36,6 +37,7 @@ ath79_setup_macs() local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 7ef6fdbe0f..ae0c94d8ec 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,6 +23,7 @@ board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wapr-2nd) diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index 97d388168f..6962c6fdcc 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -32,6 +32,7 @@ platform_do_upgrade() { case "$board" in mikrotik,routerboard-493g|\ + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ mikrotik,routerboard-sxt-5nd-r2)