From patchwork Wed Jan 26 06:38:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=qzxTMHaR; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=LEp12BFa; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDh658pJz9tD5 for ; Wed, 26 Jan 2022 17:43:34 +1100 (AEDT) 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=hRCCGCrvNtx0byvifXf3Rsnh/faVrYASRZgGM2/BDeY=; b=qzxTMHaRsgDr+i 0UAW13KhdgRgBW+qctA+pMA6DuzRNss1f/YiXtQfr355uW2yGycF3tBeCQp7ASLRarBqvSKOMOeHk uwy6SNSyAzkMzOtjLFRlZ0Sbkzoi4IowogQp70+d2rg8jDOfr8gh43p+VotrFwu4laDtgc+Mo/Ily zFL7NcS+UgT5v5m/l6jl2skvdeW4lo5iuzQZzUZAvkMMKR1XJ8RgbJMySQZQVuYrnnq3xRZBX78jH 8IjEGlDyqsPBfK7c83iOMKtTh48Y+4gXBMLroeSyZOCzeIoOmCklYRv0Q+ju/DKovfzlfKsW1irxe LpI5UMs5FpUZZwY1tVBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxX-00AJDS-MV; Wed, 26 Jan 2022 06:39:11 +0000 Received: from mail1.kuutio.org ([2001:41d0:701:1000::88b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxR-00AJAt-7s for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:06 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id D09D91FE0E; Wed, 26 Jan 2022 07:39:01 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179140; x=1645771141; bh=UnkoX dBO7zbTCsnnKB8UQdkSGULF1MBbindrPAuoVf0=; b=LEp12BFas3UiWax/+UasM XQquvJcrI3uFeY3nqrgSc7KQJSDC7hdYbHfofjdlmNBSzrRKDLCM9Y+w9JZMVrkQ LmgQ/WwxZd/PL13T7FFb6KxCzduv+V2QaphbO76ErBAmKsx2JF41wZb0jzDxDSAX tN8EQwJVtrJj5AgTFjJhOMU3WeJHKWBGkwMGzDyS3Cz0eUB399Yek2hTORlO09y7 n4ZJ0Rz8jcV6F+EzofN7rIm8jwh3Mw5y5yjHTgfze1oMEd5vH4y/E+gCGxcQZJu1 rOyAWm4ajx4dDaRWlwQgbDcRqtCReviLZ6XON+rpGYuwP6tR5T/ketrKtcycwdkX cwfXCnE7Ff0wQauAgnpFKnkydHD+d/1rhY6DEYdY8P9LzjbyqHUPBbExWVaKxI3E MA0cBJt+kSNoKvF4GKWwRwkr8R7JtnQQqDewIeOjQmKA5OYXStbhXa6xOpKLFxWl u8MmfJnX3/mQd9fUpFFfLd6zsQgKmmjgXpDZU78Yg6LrbPu1NwbGJAHv3H8tUMB7 kMxH42gNm9ef0s/GMbLcjYkj4ChExZ+novTwFgGY0fu04mClKTXLKapgYN58Za8S dDnuQhokavw0SR/iSvb/V5FnJcg88wKQaDRVxow82h4hlu6vBB2WNaN2bHvnfAqV YsIsf980nsmjFNuzvw18RE= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id h_PTSbtAnEwm; Wed, 26 Jan 2022 07:39:00 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 408C51FD27; Wed, 26 Jan 2022 07:39:00 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 1/5] ath79: mikrotik: change to qca8k DSA driver Date: Wed, 26 Jan 2022 08:38:41 +0200 Message-Id: <20220126063845.587284-2-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223905_644716_F26F7048 X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: Current mikrotik ath79 devices do not use switch drivers. Enable the QCA8K driver and disable the old AR8126 phy. Signed-off-by: Oskari Lemmela --- target/linux/ath79/mikrotik/config-default | 4 ++++ 1 file changed, 4 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 Current mikrotik ath79 devices do not use switch drivers. Enable the QCA8K driver and disable the old AR8126 phy. Signed-off-by: Oskari Lemmela --- target/linux/ath79/mikrotik/config-default | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 2ff8a14f1d..175c4fac1f 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -1,3 +1,5 @@ +CONFIG_AR8216_PHY=n +CONFIG_AR8216_PHY_LEDS=n CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y CONFIG_GPIO_LATCH=y @@ -27,6 +29,8 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_NET_DSA=y +CONFIG_NET_DSA_QCA8K=y +CONFIG_NET_DSA_TAG_QCA=y CONFIG_NET_SWITCHDEV=y CONFIG_PCI_AR71XX=y CONFIG_PHY_AR7100_USB=y From patchwork Wed Jan 26 06:38:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584365 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=LpsxA1VC; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=N9fdy2Op; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDh6577Rz9tB1 for ; Wed, 26 Jan 2022 17:43:33 +1100 (AEDT) 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=Jz/gEuzP1ThMGdY810jODeIfF7cdZVrUbcDmMamiLBE=; b=LpsxA1VCLVTr1r yk//rY9hjnFDQXxtNqOpLdA05v5wcQGOHMX6tLYLB1nTRmjMOQZtHIzby91zRRXpvpBvCugwfly5y E+Myn5eia/9r7DuQggYfPZ5K7XQHpVC4dH3ynGsNZFwsmyLMpHxxdjYozc7iSuaHIOW9rzQ7WLTEM 243VjwiU9BXRHVtdZevL2IGWRJNWs7sZ8KjT+C4NOKaZea3nZgbER7g9W8uUluDqUKZYUd2q5Bh8Y evZaXOUsTOOh1WTM6BszdQnyzS8G+7otEWc2EvQjUx+gXqa4RBvoGPSgniNMjg+qdbVjP8VG0CQBZ 7CQuJFXyPmNxvDAkS8Lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbyF-00AJMK-IM; Wed, 26 Jan 2022 06:39:55 +0000 Received: from mail1.kuutio.org ([2001:41d0:701:1000::88b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxU-00AJCU-5a for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:10 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 82EEB1FD71; Wed, 26 Jan 2022 07:39:06 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179142; x=1645771143; bh=hxxfo DRg7IwZEOdHtwlmXDVlgKBwTuJ5BPn60VWFCjI=; b=N9fdy2Op3CxBa9cvqy9ko 7XRMwLIuZLGYy/IgaHrrDGsJDLScu9YymSA+zth6Vs4qzUyt5UnKC3b2QtvvoiEc cTLTXacOv/89jiB5m6cCWEoVeFPIVn/X4LxHdGzhPYrjt7r+6rM7H7mBEJ7ZA/fh sCivX43odDw4IPCMcJE+/2bbFMswSzPfK6bG/ee+1hhFNiP1a/DtwjQ1XxbZ2X1W YQalkexjCm1bXxv3aK8YICArsCTzihT6+zoTX5JZdNSkZTiPdxyjtTYnsBLaEziQ f8xJU+hhYXHpBhYGiO6Nsl8jcCOF6l+zLdcpr54cFt8hxhqUlu/dHf5CtUD7l/PZ Kjt605Xc5XA2VsfaSV5OzQC4MSTV66QIn5SSyTY3h0T2VtOTx92iZmUza+87HX4V kQPgVrAWW39dXplgj/+X6BM11tiMJEDbTv0ClkSJTcv79QRTay6zyiwS8hoiErtq e6/tN3H3Ai2tOWDf/7GrbqVDLgg+lwdepyrf1awGlQ73+bPTxQBxSQi6MLgYkEc1 0yBCj/LNWmf8Zq7jIpK4x8ca1Wcndh8HMnqGM1y8cGI6ibqiO2IMkpK+DCHMKrUh e4T8WYdK5GRHhG+k7zSv43ynp2hi6O4bvKkoOsTpu6Y/Qy+gUQvaNd92CIgzR1YJ 3vBMrgbscmc3IfH9kKiCqI= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DtkmjtM6Z594; Wed, 26 Jan 2022 07:39:02 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 82F9D1FD85; Wed, 26 Jan 2022 07:39:00 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 2/5] ath79: add support for MikroTik RouterBOARD 960PGS (hEx PoE) Date: Wed, 26 Jan 2022 08:38:42 +0200 Message-Id: <20220126063845.587284-3-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223908_601947_1B4AF313 X-CRM114-Status: GOOD ( 18.16 ) X-Spam-Score: -0.2 (/) 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: This patch adds support for the MikroTik RouterBOARD 960PGS (hEx PoE) router. The device has a USB 2.0 port and a SFP port for adding optical fiber connectivity. The ports 2-5 can power other PoE capa [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 This patch adds support for the MikroTik RouterBOARD 960PGS (hEx PoE) router. The device has a USB 2.0 port and a SFP port for adding optical fiber connectivity. The ports 2-5 can power other PoE capable devices with the same voltage as applied to the unit. Specifications: - SoC: Qualcomm Atheros QCA9557 - Flash: 16 MB (SPI) - RAM: 128 MB - 1x Ethernet SFP: 1000 - 1x Ethernet RJ45: 10/100/1000 port with passive POE in - 4x Ethernet RJ45: 10/100/1000 ports with 802.3af/at PoE out - 1x USB 2.0 host port - 1x reset button See https://mikrotik.com/product/RB960PGS for more details. Flashing: TFTP boot initramfs image and then perform sysupgrade. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Signed-off-by: Oskari Lemmela --- .../qca9557_mikrotik_routerboard-960pgs.dts | 279 ++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 + .../base-files/etc/board.d/02_network | 14 + .../lib/preinit/10_rename_interfaces.sh | 11 + 4 files changed, 313 insertions(+) create mode 100644 target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts create mode 100644 target/linux/ath79/mikrotik/base-files/lib/preinit/10_rename_interfaces.sh diff --git a/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts b/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts new file mode 100644 index 0000000000..273357cf39 --- /dev/null +++ b/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,routerboard-960pgs", "qca,qca9557"; + model = "MikroTik RouterBOARD 960PGS"; + + aliases { + serial0 = &uart; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + buzzer { + /* Beeper requires PWM for frequency selection */ + gpio-export,name = "buzzer"; + gpio-export,output = <0>; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + }; + + i2c: i2c { + compatible = "i2c-gpio"; + + i2c-gpio,delay-us = <5>; + i2c-gpio,timeout-ms = <1>; + sda-gpios = <&gpio 18 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio 19 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + + sfp_eeprom@50 { + compatible = "at,24c04"; + reg = <0x50>; + }; + + sfp_eeprom@51 { + compatible = "at,24c04"; + reg = <0x51>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + debounce-interval = <60>; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_user: user { + label = "green:user"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + led_sfp: sfp { + label = "green:sfp"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + }; + + sfp1: sfp { + compatible = "sff,sfp"; + + i2c-bus = <&i2c>; + maximum-power-milliwatt = <1000>; + los-gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + tx-disable-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + + reg_usb_vbus { + compatible = "regulator-fixed"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "usb_vbus"; + gpio = <&gpio 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; + +&mdio0 { + status = "okay"; + + switch@0 { + compatible = "qca,qca8337"; + #address-cells = <1>; + #size-cells = <0>; + + reg = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "cpu"; + ethernet = <ð0>; + phy-mode = "rgmii-id"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&phy_port1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&phy_port3>; + }; + + port@4 { + reg = <4>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&phy_port4>; + }; + + port@5 { + reg = <5>; + label = "lan5"; + phy-mode = "internal"; + phy-handle = <&phy_port5>; + }; + }; + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy_port1: phy@0 { + reg = <0>; + }; + + phy_port2: phy@1 { + reg = <1>; + }; + + phy_port3: phy@2 { + reg = <2>; + }; + + phy_port4: phy@3 { + reg = <3>; + }; + + phy_port5: phy@4 { + reg = <4>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x8f000000 0xa0000101 0xa0001313>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&mdio1 { + status = "okay"; + + phy_sfp: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + sfp = <&sfp1>; + }; +}; + +ð1 { + status = "okay"; + + phy-handle = <&phy_sfp>; + pll-data = <0x03000000 0x00000101 0x00001616>; + qca955x-sgmii-fixup; + + gmac-config { + device = <&gmac>; + }; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "mikrotik,routerboot-partitions"; + label = "RouterBoot"; + reg = <0x0 0x20000>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader1"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0x0>; + read-only; + }; + + soft_config { + label = "soft_config"; + }; + }; + + partition@20000 { + compatible = "mikrotik,minor"; + label = "firmware"; + reg = <0x020000 0xfe0000>; + }; + }; + }; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 095a1cbc84..44ea708f48 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -38,6 +38,15 @@ define Device/mikrotik_routerboard-922uags-5hpacd endef TARGET_DEVICES += mikrotik_routerboard-922uags-5hpacd +define Device/mikrotik_routerboard-960pgs + $(Device/mikrotik_nor) + SOC := qca9557 + DEVICE_MODEL := RouterBOARD 960PGS (hEX PoE) + IMAGE_SIZE := 16256k + DEVICE_PACKAGES += kmod-usb2 kmod-i2c-gpio kmod-sfp +endef +TARGET_DEVICES += mikrotik_routerboard-960pgs + define Device/mikrotik_routerboard-lhg-2nd $(Device/mikrotik_nor) SOC := qca9533 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 4058742133..91a62e33c3 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,9 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-960pgs) + ucidef_set_interface_lan "sfp lan1 lan2 lan3 lan4 lan5" + ;; mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ @@ -50,6 +53,17 @@ ath79_setup_macs() lan_mac="$mac_base" wan_mac=$(macaddr_add $mac_base 1) ;; + mikrotik,routerboard-960pgs) + label_mac=$mac_base + ucidef_set_bridge_device switch + ucidef_set_bridge_mac "$mac_base" + ucidef_set_network_device_mac "sfp" "$mac_base" + ucidef_set_network_device_mac "lan1" "$(macaddr_add $mac_base 1)" + ucidef_set_network_device_mac "lan2" "$(macaddr_add $mac_base 2)" + ucidef_set_network_device_mac "lan3" "$(macaddr_add $mac_base 3)" + ucidef_set_network_device_mac "lan4" "$(macaddr_add $mac_base 4)" + ucidef_set_network_device_mac "lan5" "$(macaddr_add $mac_base 5)" + ;; *) label_mac="$mac_base" wan_mac="$mac_base" diff --git a/target/linux/ath79/mikrotik/base-files/lib/preinit/10_rename_interfaces.sh b/target/linux/ath79/mikrotik/base-files/lib/preinit/10_rename_interfaces.sh new file mode 100644 index 0000000000..66e7e24e5d --- /dev/null +++ b/target/linux/ath79/mikrotik/base-files/lib/preinit/10_rename_interfaces.sh @@ -0,0 +1,11 @@ +. /lib/functions.sh + +set_interface_names() { + case $(board_name) in + mikrotik,routerboard-960pgs) + ip link set dev eth1 name sfp + ;; + esac +} + +boot_hook_add preinit_main set_interface_names From patchwork Wed Jan 26 06:38:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584364 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: bilbo.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=abiHq/ji; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=IYkhRbyT; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDh64KCZz9t6h for ; Wed, 26 Jan 2022 17:43:34 +1100 (AEDT) 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=eq8I/g2nSwEVwxwO9vAG9GTmQaAIFmVOorTu47NhrNg=; b=abiHq/jiYJifCP QIyCqKlzgYoVbXqQIHHD+OUnkyqVwxzGTOmHkpGRVKKQGZTiuknk5MGGgWh/uNWuf7bDhcWfMO5wD trV9eiTR4f8tYcHHH+EYIvjWm+kC7XczS6CvCkzxZWdK7zrCWooacpR1TCGvgQs+llimz5ym/FfjX gZDr77ZlRrDvUHeXs+HbpLKNar/ZoqBJLs09ebPoiEYcZgSjlBhS7AFUDQXLH163WmBiZR6VAmYB0 rJaut8JvORmdc8BW9DeY/aZU3bwzfgEvtzthuLoPb0U1rk2ORE6muhxFWCu1VnjtEMOeQ/dmwIzaF NB0o1XiFmYxLtWFv5ijQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxz-00AJJd-2k; Wed, 26 Jan 2022 06:39:39 +0000 Received: from mail1.kuutio.org ([2001:41d0:701:1000::88b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxS-00AJCE-SO for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:08 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 6A4EF1FE02; Wed, 26 Jan 2022 07:39:05 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179142; x=1645771143; bh=40TPA Sa9bSzmdBx45ou4u8Yw11ZfWwTBnN0xXi2fFrQ=; b=IYkhRbyT33liKMN0bm8uq ghOLK/svt5I4VLTdvR5mWz0vbKtPX3RY4oJXjvvHcHNF7WygJiHvWggGZYkNQQOa 0O5qkB/PKE78iAfhpKD782qclKUrc6gkM3e4U6Yb8fETdFqwJjfvCGxEelLOI8Do JgaZdoy4fLan3m+agn1+dnsZeDrVOL5bzKMVTZ2c2A4UQ0ps/QUxVs9+Ksm0zuL2 s8Nf//lea9XKGyIAVaPxDXjCndlEApVNApfy2Vir18NZZh1g3zvNilfam2rqld2J nsvn5lUFpa6l7lppowZb0CfidDEowfYPls0Ttwg9qy04ZpswRQOVntZzgy3eCCUA NC+eCvg+lc2QBWJow3XpP6MqvBDctb2h1dZ5Pnu0hs2Rausz/n3xZdMr9c3eR7K1 31XM3O+STs+2NUDM1FTK9Hu/khNbqM91ZUxNQYGX8BVcMIUU+vq24gApVwaxzeZQ AuFR6JuRsfk1QwG9g2s+lxIGPRcwIUxEEPnCCPKzK0zY5VuXN8ZojMqBBOW4/QDI KEoRZWldj87U83Rp5bm/94HoDez0R2mgsvylGLSEEkiVZTsWopBxhsJ0f+/AT/Ax AXgwzlVsMkVF52+07OfGNTPhOgzUoygl9BoXKGGYfB8dQsDP4QE/Rxgu5/qoyM2T Iuve/pbTHe5Bn4GbKCOYuI= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id R-emfhz0ZIlq; Wed, 26 Jan 2022 07:39:02 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id CEA7C1FD87; Wed, 26 Jan 2022 07:39:00 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 3/5] ath79: fix ar934x spi driver delays Date: Wed, 26 Jan 2022 08:38:43 +0200 Message-Id: <20220126063845.587284-4-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223907_271681_36E64607 X-CRM114-Status: GOOD ( 19.25 ) X-Spam-Score: -0.2 (/) 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: Backport spi driver delay fixes from the 5.17-rc1 kernel. Signed-off-by: Oskari Lemmela --- ...-ar934x-fix-transfer-and-word-delays.patch | 32 +++++++++ ...3-v5.17-spi-ar934x-fix-transfer-size.patch | 67 +++++++++++++++++++ 2 files chang [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 Backport spi driver delay fixes from the 5.17-rc1 kernel. Signed-off-by: Oskari Lemmela --- ...-ar934x-fix-transfer-and-word-delays.patch | 32 +++++++++ ...3-v5.17-spi-ar934x-fix-transfer-size.patch | 67 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch create mode 100644 target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch diff --git a/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch new file mode 100644 index 0000000000..16aad7734a --- /dev/null +++ b/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch @@ -0,0 +1,32 @@ +From c70282457c380db7deb57c81a6894debc8f88efa Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:58 +0200 +Subject: [PATCH] spi: ar934x: fix transfer and word delays + +Add missing delay between transferred messages and words. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-3-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/spi/spi-ar934x.c b/drivers/spi/spi-ar934x.c +index def32e0aaefe..e1b64e35900c 100644 +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -137,8 +137,10 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + reg >>= 8; + } + } ++ spi_delay_exec(&t->word_delay, t); + } + m->actual_length += t->len; ++ spi_transfer_delay_exec(t); + } + + msg_done: +-- +2.25.1 + diff --git a/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch new file mode 100644 index 0000000000..361194e8ee --- /dev/null +++ b/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch @@ -0,0 +1,67 @@ +From ebe33e5a98dcf14a9630845f3f10c193584ac054 Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:57 +0200 +Subject: [PATCH] spi: ar934x: fix transfer size + +If bits_per_word is configured, transfer only word amount +of data per iteration. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-2-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/drivers/spi/spi-ar934x.c b/drivers/spi/spi-ar934x.c +index e1b64e35900c..ec7250c4c810 100644 +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -82,7 +82,7 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + struct spi_device *spi = m->spi; + unsigned long trx_done, trx_cur; + int stat = 0; +- u8 term = 0; ++ u8 bpw, term = 0; + int div, i; + u32 reg; + const u8 *tx_buf; +@@ -90,6 +90,11 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + + m->actual_length = 0; + list_for_each_entry(t, &m->transfers, transfer_list) { ++ if (t->bits_per_word >= 8 && t->bits_per_word < 32) ++ bpw = t->bits_per_word >> 3; ++ else ++ bpw = 4; ++ + if (t->speed_hz) + div = ar934x_spi_clk_div(sp, t->speed_hz); + else +@@ -105,10 +110,10 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + iowrite32(reg, sp->base + AR934X_SPI_REG_CTRL); + iowrite32(0, sp->base + AR934X_SPI_DATAOUT); + +- for (trx_done = 0; trx_done < t->len; trx_done += 4) { ++ for (trx_done = 0; trx_done < t->len; trx_done += bpw) { + trx_cur = t->len - trx_done; +- if (trx_cur > 4) +- trx_cur = 4; ++ if (trx_cur > bpw) ++ trx_cur = bpw; + else if (list_is_last(&t->transfer_list, &m->transfers)) + term = 1; + +@@ -193,7 +198,8 @@ static int ar934x_spi_probe(struct platform_device *pdev) + ctlr->mode_bits = SPI_LSB_FIRST; + ctlr->setup = ar934x_spi_setup; + ctlr->transfer_one_message = ar934x_spi_transfer_one_message; +- ctlr->bits_per_word_mask = SPI_BPW_MASK(8); ++ ctlr->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | ++ SPI_BPW_MASK(16) | SPI_BPW_MASK(8); + ctlr->dev.of_node = pdev->dev.of_node; + ctlr->num_chipselect = 3; + +-- +2.25.1 + From patchwork Wed Jan 26 06:38:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=ozXc8bnK; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=oY8O0Vi4; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDhF03Vnz9t6h for ; Wed, 26 Jan 2022 17:43:40 +1100 (AEDT) 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=SJwNT2V3KKpORGZbUSCxz3wcxKtVg0xwaXAxRPh/ZH4=; b=ozXc8bnK2SJ496 R40aiG2H+808kAV072OiQah99DcIRFmSMzFupLJ8qQflmD6K8PRpKMft5t2DmQjppCZEwYnOK+eid SNWz9CnG8lwsx2kdpQ3ptXO5FATfgC8nukT6/CliO/n9RbHFIVizgioHzh6DTF6Rn/MkkQMQzZEjM Ss0bZDv4sbR2wcIx8FEMu9iBaMZY6iPCnLDPFmQLuFf+xSmsoMeK+1Xay5O8H5AQfgb1WiBtxRSLL 3mRG8cZrDRYOSFG+sYV8plXPfxi5pUemn9MsrMgLuk+qmMafxJb4sS7I7s9tGVM7IFDXvDF1oMBB2 RZ82J+ED3GOj/QXYTUpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbyp-00AJV6-Lm; Wed, 26 Jan 2022 06:40:32 +0000 Received: from mail1.kuutio.org ([54.37.79.207]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxY-00AJEK-AT for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 1899E1FD85; Wed, 26 Jan 2022 07:39:10 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179145; x=1645771146; bh=4Wx5u UAadn6MFELaQdtaz6T0W+/h/pZ+fK3G2ipw98Y=; b=oY8O0Vi4yT9OEuD7H0CMH wBDDiifuGoSBmcqKCDlFOol91LIsSE25jiY6Fu7ux+1WCrxSAXGNLu8M8Kg/um/d fz9SC1TWlBc1ioWfWTAU5BcVEj3I/tQFeAKKbXw5B1dioZgmJ5FygFPXNvdvsS2o LtVSiX7kTakXdxX/kOx6d9/Az9K5qr3/XJx0eZNpD5UuYKMucfvi4+hVQtwIm8VW SOznpKDO3FdhVxJzSOBgjbwp6GgGHP0D8uwmmUI9YVqJnTnO12UseR8yM3FYHAlv JUgFmn7ZXIyefGSqLINujZSsvQ6S2HJCYDwKEANGubPssIWBVNID8cWsidbh9xcX C7rhw0N9JFh8Ct7Qtj0EQiFvlCaVJbKPT2ZYVyAObo7j+E0M1VtmrIlne/m46ltK iZT4VDwUJVJuwB4qw7WL2licwtVKbprEjMBiZUleOvgLIWF7avNySi9XT5tWH6Qg SlJ80ObJs801/VWKz7GQ76NGvYVSBoLBwyrfRBzOCp5Xvf95K/ZEMW5gFBkKmnpD FAx3arcN/8njDvzqxiPo50sqClvKhrYfDciGPWvdkBGgZt/hi6dkfkHuUBfvsYjD L1ic5Y/zzJtSiM54mFRfofRW2XSYR836rQmGeG/ETm6PvK5LMmXcOQ06xlf2L9mL 09tm8z4TPnTdZbjyAzhv0Q= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xeqnco_rbhv4; Wed, 26 Jan 2022 07:39:05 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 234F71FDD0; Wed, 26 Jan 2022 07:39:01 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 4/5] ath79: mikrotik: add poe driver Date: Wed, 26 Jan 2022 08:38:44 +0200 Message-Id: <20220126063845.587284-5-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223912_779318_AB4DA857 X-CRM114-Status: GOOD ( 24.20 ) X-Spam-Score: -0.2 (/) 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: Add hwmon based driver for mikrotik POE controllers. Signed-off-by: Oskari Lemmela --- .../linux/ath79/files/drivers/hwmon/rbpoe.c | 256 ++++++++++++++ .../linux/ath79/files/drivers/hwmon/rbpoe.h | 25 ++ .../ath79/files/drivers/hwmo [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 Add hwmon based driver for mikrotik POE controllers. Signed-off-by: Oskari Lemmela --- .../linux/ath79/files/drivers/hwmon/rbpoe.c | 256 ++++++++++++++ .../linux/ath79/files/drivers/hwmon/rbpoe.h | 25 ++ .../ath79/files/drivers/hwmon/rbpoeport.c | 311 ++++++++++++++++++ target/linux/ath79/mikrotik/config-default | 3 + .../902-hwmon-support-for-mikrotik-poe.patch | 51 +++ 5 files changed, 646 insertions(+) create mode 100644 target/linux/ath79/files/drivers/hwmon/rbpoe.c create mode 100644 target/linux/ath79/files/drivers/hwmon/rbpoe.h create mode 100644 target/linux/ath79/files/drivers/hwmon/rbpoeport.c create mode 100644 target/linux/ath79/patches-5.10/902-hwmon-support-for-mikrotik-poe.patch diff --git a/target/linux/ath79/files/drivers/hwmon/rbpoe.c b/target/linux/ath79/files/drivers/hwmon/rbpoe.c new file mode 100644 index 0000000000..fb5de6e6d7 --- /dev/null +++ b/target/linux/ath79/files/drivers/hwmon/rbpoe.c @@ -0,0 +1,256 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * Mikrotik POE driver + * + * Based on https://github.com/adron-s/mtpoe_ctrl + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rbpoe.h" + +DECLARE_CRC8_TABLE(rbpoe_crc_table); + +#define MAX_PORTS 4 + +int rb_poe_get_port_idx(struct rb_poe_data *poe, int reg) +{ + if (poe->data->reverse) + return (MAX_PORTS-reg); + else + return reg-1; +} +EXPORT_SYMBOL(rb_poe_get_port_idx); + +int rb_poe_write_cmd(struct rb_poe_data *poe, u16 *resp, u8 cmd, u8 arg1, u8 arg2) +{ + int ret; + u8 tx[4]; + u8 rx[6]; + u8 crc, retries; + + struct spi_transfer xfers[] = { + { + .tx_buf = tx, + .len = 4, + .delay.value = 10, + .delay.unit = SPI_DELAY_UNIT_USECS, + }, + { + .rx_buf = rx, + .len = 6, + }, + }; + + mutex_lock(&poe->lock); + + tx[0] = cmd; + tx[1] = arg1; + tx[2] = arg2; + tx[3] = crc8(rbpoe_crc_table, tx, 3, 0); + + for (retries = 0; retries < MAX_RETRIES; retries++) { + ret = spi_sync_transfer(poe->spi, xfers, ARRAY_SIZE(xfers)); + if (ret < 0) { + dev_err(&poe->spi->dev, "SPI transfer error"); + goto out; + } + + if (rx[1] != cmd) { + ndelay(13); + continue; + } + + crc = crc8(rbpoe_crc_table, rx+1, 3, 0); + + if (rx[4] != crc && rx[5] != crc) + continue; + + resp[0] = rx[2] << 8 | rx[3]; + goto out; + } +out: + mutex_unlock(&poe->lock); + return ret; +} +EXPORT_SYMBOL(rb_poe_write_cmd); + +static int rb_poe_read_version(struct rb_poe_data *data) +{ + int ret; + u16 vers; + + ret = rb_poe_write_cmd(data, &vers, 0x41, 0, 0); + if (ret < 0) + return ret; + return vers; +} + +int rb_poe_read_voltage(struct rb_poe_data *data) +{ + int ret; + u16 val; + + ret = rb_poe_write_cmd(data, &val, 0x42, 0, 0); + if (ret < 0) + return ret; + return val * data->data->volt_lsb; +} +EXPORT_SYMBOL(rb_poe_read_voltage); + +static int rb_poe_read_temperature(struct rb_poe_data *data) +{ + int ret; + u16 val; + + ret = rb_poe_write_cmd(data, &val, 0x43, 0, 0); + if (ret < 0) + return ret; + return (val * data->data->temp_lsb) - data->data->temp_offset; +} + +/* sysfs attributes */ +static ssize_t temp_input_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct rb_poe_data *data = dev_get_drvdata(dev); + int val; + + if (IS_ERR(data)) + return -ENODATA; + + val = rb_poe_read_temperature(data); + if (val < 0) + return -ENODATA; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t in_input_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct rb_poe_data *data = dev_get_drvdata(dev); + int val; + + if (IS_ERR(data)) + return -ENODATA; + + val = rb_poe_read_voltage(data); + if (val < 0) + return -ENODATA; + + return sprintf(buf, "%d\n", val); +} + +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(in0_input, in_input, 4); + +static struct attribute *rb_poe_attrs[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_in0_input.dev_attr.attr, + NULL +}; + +ATTRIBUTE_GROUPS(rb_poe); + +static int rb_poe_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct device *hwmon_dev; + struct rb_poe_data *data; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->data = (struct rb_poe_model *)of_device_get_match_data(dev); + data->spi = spi; + + spi->mode = SPI_MODE_0; + ret = spi_setup(spi); + if (ret) + return ret; + + crc8_populate_lsb(rbpoe_crc_table, 0x8C); + dev_set_drvdata(dev, data); + mutex_init(&data->lock); + + ret = rb_poe_read_version(data); + if (ret < 0) + return ret; + + dev_info(dev, "firmware: %d.%d", ret & 0xff, ret >> 8); + + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret < 0) { + dev_err(dev, "failed to populate DT children\n"); + return ret; + } + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, "rbpoe", data, rb_poe_groups); + + if (IS_ERR(hwmon_dev)) + dev_dbg(dev, "unable to register hwmon device\n"); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static const struct rb_poe_model v2_data = { + .reverse = 1, + .volt_lsb = 35, + .temp_lsb = 1000, + .temp_offset = 273000, +}; + +/* + * ATSAMD20J15 temperature sensor factory calibration is done at 25C 667mV with Vddana=3.3V + * Typical sensor slope 2.4mV/C. 667mV/2.4mV/C = 277.917C - 25C = 253.917C + * Measured Vddana is 3.29V, reduce slope a bit and tune calibration vdd. + * 680mV/2.375mV/C = 286.315C - 25C = 261.315C + * 1000/2.375 = 421 + */ +static const struct rb_poe_model v3_data = { + .reverse = 0, + .volt_lsb = 10, + .temp_lsb = 421, + .temp_offset = 261315, +}; + +static const struct of_device_id rb_poe_dt_match[] = { + { + .compatible = "mikrotik,poe-v2", + .data = (void *)&v2_data, + }, { + .compatible = "mikrotik,poe-v3", + .data = (void *)&v3_data, + }, { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, rb_poe_dt_match); + +static struct spi_driver rb_poe_driver = { + .probe = rb_poe_probe, + .driver = { + .name = "rb-poe-driver", + .bus = &spi_bus_type, + .of_match_table = of_match_ptr(rb_poe_dt_match), + }, +}; + +module_spi_driver(rb_poe_driver); + +MODULE_AUTHOR("Oskari Lemmela "); +MODULE_DESCRIPTION("Mikrotik POE driver"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/files/drivers/hwmon/rbpoe.h b/target/linux/ath79/files/drivers/hwmon/rbpoe.h new file mode 100644 index 0000000000..af1f59329f --- /dev/null +++ b/target/linux/ath79/files/drivers/hwmon/rbpoe.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only + * + * POE driver for the MikroTik RouterBoard series + */ +#include + +#define MAX_RETRIES 10 + +struct rb_poe_model { + bool reverse; + u8 volt_lsb; + u16 temp_lsb; + u32 temp_offset; +}; + +struct rb_poe_data { + struct spi_device *spi; + struct rb_poe_model *data; + + struct mutex lock; +}; + +int rb_poe_write_cmd(struct rb_poe_data *data, u16 *resp, u8 cmd, u8 arg1, u8 arg2); +int rb_poe_get_port_idx(struct rb_poe_data *data, int reg); +int rb_poe_read_voltage(struct rb_poe_data *data); diff --git a/target/linux/ath79/files/drivers/hwmon/rbpoeport.c b/target/linux/ath79/files/drivers/hwmon/rbpoeport.c new file mode 100644 index 0000000000..1b9852a0e7 --- /dev/null +++ b/target/linux/ath79/files/drivers/hwmon/rbpoeport.c @@ -0,0 +1,311 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * Mikrotik POE port driver + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rbpoe.h" + +#define PORT_DISABLED 0x0 +#define PORT_FORCE 0x1 +#define PORT_ENABLED 0x2 + +struct poeport_data { + struct rb_poe_data *poe; + struct device *dev; + + u8 state; + u8 force; + u32 reg; +}; + +static int read_state(struct poeport_data *port) +{ + int ret; + u16 status; + + ret = rb_poe_write_cmd(port->poe, &status, 0x45, 0, 0); + if (ret < 0) + return ret; + return status >> rb_poe_get_port_idx(port->poe, port->reg)*4 & 0xF; +} + +static int write_state(struct poeport_data *port, u8 state, u8 force) +{ + int ret; + u16 status; + + if (state) + if (force) + state = PORT_FORCE; + else + state = PORT_ENABLED; + else + state = PORT_DISABLED; + + ret = rb_poe_write_cmd(port->poe, &status, 0x44, port->reg, state); + if (ret < 0) { + usleep_range(100, 150); + ret = rb_poe_write_cmd(port->poe, &status, 0x44, port->reg, state); + } + return ret; +} + +static int read_current(struct poeport_data *port) +{ + int ret; + u16 curr; + + ret = rb_poe_write_cmd(port->poe, &curr, 0x58+port->reg, 0, 0); + if (ret < 0) + return ret; + return curr; +} + +/* sysfs attributes */ +static ssize_t in_input_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int state, curr; + + if (IS_ERR(data)) + return PTR_ERR(data); + + state = read_state(data); + if (state < 0 || state == PORT_DISABLED) + return -ENODATA; + + curr = read_current(data); + if (curr < 0 || (state == PORT_ENABLED && curr >> 15)) + return -ENODATA; + + return sprintf(buf, "%d\n", rb_poe_read_voltage(data->poe)); +} + +static ssize_t force_enable_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + return sprintf(buf, "%d\n", data->force); +} + +static ssize_t force_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int ret; + int state; + + ret = kstrtoint(buf, 0, &state); + if (ret) + return ret; + + data->force = state; + ret = write_state(data, data->state, state); + if (ret) + return ret; + return count; +} + +static ssize_t port_state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int curr; + + if (IS_ERR(data)) + return PTR_ERR(data); + + if (!data->state) + return sprintf(buf, "disabled\n"); + + curr = read_current(data); + if (curr == 0x800A) + return sprintf(buf, "short circuit\n"); + if (!data->force && curr >> 15) + return sprintf(buf, "searching\n"); + if (curr < 3) + return sprintf(buf, "no load\n"); + + return sprintf(buf, "delivering\n"); + +} + +static ssize_t in_enable_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + return sprintf(buf, "%d\n", data->state); +} + +static ssize_t in_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int ret; + int state; + + ret = kstrtoint(buf, 0, &state); + if (ret) + return ret; + + data->state = state; + ret = write_state(data, state, data->force); + if (ret) + return ret; + + return count; +} + +static ssize_t curr_input_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int curr; + + if (IS_ERR(data)) + return PTR_ERR(data); + + curr = read_current(data); + if (curr < 0 || curr >> 15) + return -ENODATA; + + return sprintf(buf, "%d\n", curr); +} + +static ssize_t power_input_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct poeport_data *data = dev_get_drvdata(dev); + int volt, curr; + + if (IS_ERR(data)) + return PTR_ERR(data); + + curr = read_current(data); + if (curr < 0 || curr >> 15) + return -ENODATA; + + volt = rb_poe_read_voltage(data->poe); + if (volt < 0) + return -ENODATA; + + return sprintf(buf, "%d\n", curr*volt); +} + +static SENSOR_DEVICE_ATTR_RO(curr1_input, curr_input, 0); +static SENSOR_DEVICE_ATTR_RO(power1_input, power_input, 0); +static SENSOR_DEVICE_ATTR_RW(in1_enable, in_enable, 0); +static SENSOR_DEVICE_ATTR_RO(in1_input, in_input, 0); +static SENSOR_DEVICE_ATTR_RW(force_enable, force_enable, 0); +static SENSOR_DEVICE_ATTR_RO(port_state, port_state, 0); + +static struct attribute *rb_poeport_attrs[] = { + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_in1_enable.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_force_enable.dev_attr.attr, + &sensor_dev_attr_port_state.dev_attr.attr, + NULL +}; +ATTRIBUTE_GROUPS(rb_poeport); + +static int rb_poeport_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device *hwmon_dev; + struct poeport_data *data; + const char *label; + int ret, val; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->dev = dev; + + ret = of_property_read_u32(dev->of_node, "reg", &val); + if (ret < 0) { + dev_err(dev, "missing 'reg' property (%d)\n", ret); + return ret; + } + + data->reg = val; + + if (of_property_read_string(dev->of_node, "label", &label) < 0) + label = "poeport"; + + if (!dev->parent) { + dev_err(dev, "no ctrl device\n"); + return -ENODEV; + } + + data->poe = dev_get_drvdata(dev->parent); + + switch (read_state(data)) { + case PORT_FORCE: + data->force = 1; + data->state = 1; + break; + case PORT_ENABLED: + data->force = 0; + data->state = 1; + break; + case PORT_DISABLED: + data->state = 0; + data->force = 0; + } + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, label, data, rb_poeport_groups); + + if (IS_ERR(hwmon_dev)) + dev_dbg(dev, "unable to register hwmon device\n"); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static const struct of_device_id rb_poeport_of_match[] = { + { .compatible = "mikrotik,poeport" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, rb_poeport_of_match); + +static struct platform_driver rb_poeport_driver = { + .probe = rb_poeport_probe, + .driver = { + .name = "rb-poeport-driver", + .of_match_table = of_match_ptr(rb_poeport_of_match), + }, +}; + +module_platform_driver(rb_poeport_driver); + +MODULE_AUTHOR("Oskari Lemmela "); +MODULE_DESCRIPTION("Mikrotik poeport driver"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 175c4fac1f..8348998421 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -7,6 +7,7 @@ CONFIG_GPIO_RB91X_KEY=y CONFIG_GPIO_RB4XX=y CONFIG_GPIO_WATCHDOG=y CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y +CONFIG_HWMON=y CONFIG_LEDS_RESET=y CONFIG_LZO_DECOMPRESS=y CONFIG_MDIO_GPIO=y @@ -36,6 +37,8 @@ CONFIG_PCI_AR71XX=y CONFIG_PHY_AR7100_USB=y CONFIG_PHY_AR7200_USB=y CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_SENSORS_MIKROTIK_POE=y +CONFIG_SENSORS_MIKROTIK_POEPORT=y CONFIG_SPI_RB4XX=y CONFIG_UBIFS_FS=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/ath79/patches-5.10/902-hwmon-support-for-mikrotik-poe.patch b/target/linux/ath79/patches-5.10/902-hwmon-support-for-mikrotik-poe.patch new file mode 100644 index 0000000000..ac33e2061c --- /dev/null +++ b/target/linux/ath79/patches-5.10/902-hwmon-support-for-mikrotik-poe.patch @@ -0,0 +1,51 @@ +From beb4c6b6e4c186ffaec860a7c5f83ff582c37413 Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Fri, 3 Dec 2021 15:28:49 +0200 +Subject: [PATCH] hwmon: support for mikrotik poe + +Signed-off-by: Oskari Lemmela +--- + drivers/hwmon/Kconfig | 13 +++++++++++++ + drivers/hwmon/Makefile | 2 ++ + 2 files changed, 15 insertions(+) + +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index c4578e8f34bb..9bcd1df93565 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1541,6 +1541,19 @@ config SENSORS_RASPBERRYPI_HWMON + This driver can also be built as a module. If so, the module + will be called raspberrypi-hwmon. + ++config SENSORS_MIKROTIK_POE ++ tristate "Mikrotik POE driver" ++ select CRC8 ++ depends on SPI ++ help ++ If you say yes here you get support for Mikrotik POE ++ ++config SENSORS_MIKROTIK_POEPORT ++ tristate "Mikrotik POE port driver" ++ depends on SENSORS_MIKROTIK_POE ++ help ++ If you say yes here you get support for Mikrotik POE ++ + config SENSORS_SL28CPLD + tristate "Kontron sl28cpld hardware monitoring driver" + depends on MFD_SL28CPLD || COMPILE_TEST +diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +index 162940270661..2778b2562ee1 100644 +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -162,6 +162,8 @@ obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o + obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o + obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o + obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o ++obj-$(CONFIG_SENSORS_MIKROTIK_POE) += rbpoe.o ++obj-$(CONFIG_SENSORS_MIKROTIK_POEPORT) += rbpoeport.o + obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o + obj-$(CONFIG_SENSORS_SBTSI) += sbtsi_temp.o + obj-$(CONFIG_SENSORS_SBRMI) += sbrmi.o +-- +2.25.1 + From patchwork Wed Jan 26 06:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584366 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=JVXnK89C; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=r2HThAnZ; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDh65P7qz9tT8 for ; Wed, 26 Jan 2022 17:43:33 +1100 (AEDT) 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=HMN07KU6QefaY1v53ARVZFIhKYl/scPG4z0F1CPISec=; b=JVXnK89CQIB2aG HBmWI/1KkjgU7IZjWnV1OAyO5ZFmKS5uGM1mBVF4g0GJDbRKCksJ1VDpihQdbEVK7KRbnaQDKZKs0 bylFUSm/k8hcP4YFZvOuE/ymze5YG8HhVT887UwisEYiX4QfUWUZwD70062MLf/jl1TOC7eo1b3xs iKGc8IZlb5GiwMFjxlRRiS8zTeuWVs8GvqO/8CqOqqiSv+toQ7BFhsrhwg9ZevXv08t1zmyV7b+NU nXEyo3DaYDRJnKWVs26f0NTwHDux4IJDQSlP6r4I5WS5LmWOBdZgnxHL9yY0QO/0DlTi0+wSzJz/z HJdsKBLXpAZElVIpJ0cQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbyX-00AJQ5-D8; Wed, 26 Jan 2022 06:40:13 +0000 Received: from mail1.kuutio.org ([2001:41d0:701:1000::88b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxV-00AJDC-KS for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:12 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 37E711FD27; Wed, 26 Jan 2022 07:39:08 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179146; x=1645771147; bh=tS5Ak tPhuPd7KYxNvmGN2hEsw0/XXdTmVtHFscIsil8=; b=r2HThAnZBtT0zkN5zxh6K EGL5k/2tmi+F4IPzdKzQpqkQqQpFBl1mlA++7WfHr1A8J/MopyjXEgvBq9wgA/oK Zhnf6a6J2xQV7JZxv4lifhBO1sYg4RsEuR578QRJUbXcSRyVP+pyl9fVG5MXr6tF e4ALFSMuTIBZmkJGgq4qAvX0Iqgshcy2++ycFuIVt4IAlXa2rZosQig4aoKZ3Poc 4Lk2ruhkvfyIuY9ICcgSvgZpYK3Q4GpIAsoinrdVcMJdVVEovlhivLUujsjwI2L6 f++RkLwMoBTzcpWoPmQkuBy5MXfp+hEkRkPfh4+EGQDHqynO1zq9JikDQenC+1hj r9u4L6Y/Jw6BtgDNg8lWC7Na2BtWaN8z0mOZxMD3QhCeCtbh2rlwie4vug4Hn79f e/WcNvSygQlfD4UWAax1+isdMWPbeEDR6NUQ/CwfNoxKKlt7JpqjH9HErkY92Or1 tDlpJW0pUssUaf9wdfTvoewOO5NgpBS/jqIFurrXHQxhh33hI0EeXpog500S5D+E VyZRRTGjYM7RR+Od3JzbK6q8vR1cmtj89o2wzMGAGNw7Rr06u333OAR8I0FKRC5H uWXfNrA/kvjp0w19xbFae57sR5GDOwEsdz5+mfS9itOdb0hCUAE9cTC6fVn+SRyI EmMryfxLRAQOmQYb+At9gY= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qTnZgE5nGXPq; Wed, 26 Jan 2022 07:39:06 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 6EFE61FD84; Wed, 26 Jan 2022 07:39:01 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 5/5] ath79: mikrotik: add poe to hex poe board Date: Wed, 26 Jan 2022 08:38:45 +0200 Message-Id: <20220126063845.587284-6-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223909_865260_62744D5B X-CRM114-Status: UNSURE ( 8.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: Enable poe controller to hex poe board. Signed-off-by: Oskari Lemmela --- .../qca9557_mikrotik_routerboard-960pgs.dts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts b/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts index 273357cf39..7748f3ec69 100644 --- a/target/linux/ath7 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 Enable poe controller to hex poe board. Signed-off-by: Oskari Lemmela --- .../qca9557_mikrotik_routerboard-960pgs.dts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts b/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts index 273357cf39..7748f3ec69 100644 --- a/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts +++ b/target/linux/ath79/dts/qca9557_mikrotik_routerboard-960pgs.dts @@ -268,6 +268,37 @@ }; }; }; + poe_ctrl@2 { + compatible = "mikrotik,poe-v3"; + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + spi-max-frequency = <2100000>; + + port@2 { + compatible = "mikrotik,poeport"; + reg = <4>; + label = "lan2"; + }; + + port@3 { + compatible = "mikrotik,poeport"; + reg = <3>; + label = "lan3"; + }; + + port@4 { + compatible = "mikrotik,poeport"; + reg = <2>; + label = "lan4"; + }; + + port@5 { + compatible = "mikrotik,poeport"; + reg = <1>; + label = "lan5"; + }; + }; }; &usb0 {