From c1ad78318c3e6421e60dd187477f38ca5f9a5752 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 5 Jan 2024 11:58:15 +0100 Subject: [PATCH 01/52] kernel: fix bridge proxyarp issue with some broken DHCP clients There are broken devices in the wild that handle duplicate IP address detection by sending out ARP requests for the IP that they received from a DHCP server and refuse the address if they get a reply. When proxyarp is enabled, they would go into a loop of requesting an address and then NAKing it again. Fixes: https://github.com/openwrt/openwrt/issues/14309 Signed-off-by: Felix Fietkau --- ...t-send-arp-replies-if-src-and-target.patch | 37 +++++++++++++++++++ ...t-send-arp-replies-if-src-and-target.patch | 37 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch create mode 100644 target/linux/generic/pending-6.1/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch diff --git a/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch b/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch new file mode 100644 index 0000000000..f420d210c2 --- /dev/null +++ b/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch @@ -0,0 +1,37 @@ +From: Felix Fietkau +Date: Thu, 4 Jan 2024 15:21:21 +0100 +Subject: [PATCH] net: bridge: do not send arp replies if src and target hw + addr is the same + +There are broken devices in the wild that handle duplicate IP address +detection by sending out ARP requests for the IP that they received from a +DHCP server and refuse the address if they get a reply. +When proxyarp is enabled, they would go into a loop of requesting an address +and then NAKing it again. + +Link: https://github.com/openwrt/openwrt/issues/14309 +Signed-off-by: Felix Fietkau +--- + +--- a/net/bridge/br_arp_nd_proxy.c ++++ b/net/bridge/br_arp_nd_proxy.c +@@ -204,7 +204,10 @@ void br_do_proxy_suppress_arp(struct sk_ + if ((p && (p->flags & BR_PROXYARP)) || + (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI | + BR_NEIGH_SUPPRESS)))) { +- if (!vid) ++ replied = true; ++ if (!memcmp(n->ha, sha, dev->addr_len)) ++ replied = false; ++ else if (!vid) + br_arp_send(br, p, skb->dev, sip, tip, + sha, n->ha, sha, 0, 0); + else +@@ -212,7 +215,6 @@ void br_do_proxy_suppress_arp(struct sk_ + sha, n->ha, sha, + skb->vlan_proto, + skb_vlan_tag_get(skb)); +- replied = true; + } + + /* If we have replied or as long as we know the diff --git a/target/linux/generic/pending-6.1/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch b/target/linux/generic/pending-6.1/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch new file mode 100644 index 0000000000..f420d210c2 --- /dev/null +++ b/target/linux/generic/pending-6.1/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch @@ -0,0 +1,37 @@ +From: Felix Fietkau +Date: Thu, 4 Jan 2024 15:21:21 +0100 +Subject: [PATCH] net: bridge: do not send arp replies if src and target hw + addr is the same + +There are broken devices in the wild that handle duplicate IP address +detection by sending out ARP requests for the IP that they received from a +DHCP server and refuse the address if they get a reply. +When proxyarp is enabled, they would go into a loop of requesting an address +and then NAKing it again. + +Link: https://github.com/openwrt/openwrt/issues/14309 +Signed-off-by: Felix Fietkau +--- + +--- a/net/bridge/br_arp_nd_proxy.c ++++ b/net/bridge/br_arp_nd_proxy.c +@@ -204,7 +204,10 @@ void br_do_proxy_suppress_arp(struct sk_ + if ((p && (p->flags & BR_PROXYARP)) || + (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI | + BR_NEIGH_SUPPRESS)))) { +- if (!vid) ++ replied = true; ++ if (!memcmp(n->ha, sha, dev->addr_len)) ++ replied = false; ++ else if (!vid) + br_arp_send(br, p, skb->dev, sip, tip, + sha, n->ha, sha, 0, 0); + else +@@ -212,7 +215,6 @@ void br_do_proxy_suppress_arp(struct sk_ + sha, n->ha, sha, + skb->vlan_proto, + skb_vlan_tag_get(skb)); +- replied = true; + } + + /* If we have replied or as long as we know the From 511c7ff03231752ea2adbdf7cc1af4be962c9b65 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 16 Dec 2023 17:12:33 -0800 Subject: [PATCH 02/52] kernel: backport ethtool_puts Will be used for conversions in the following commit. Signed-off-by: Rosen Penev --- ...8-net-ethtool-implement-ethtool_puts.patch | 139 ++++++++++++++++++ ...8-net-ethtool-implement-ethtool_puts.patch | 139 ++++++++++++++++++ 2 files changed, 278 insertions(+) create mode 100644 target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch create mode 100644 target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch diff --git a/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch new file mode 100644 index 0000000000..ef9e706cb4 --- /dev/null +++ b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch @@ -0,0 +1,139 @@ +From mboxrd@z Thu Jan 1 00:00:00 1970 +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sMUeie/T" +Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D + for ; Wed, 6 Dec 2023 15:16:16 -0800 (PST) +Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1 + for ; Wed, 06 Dec 2023 15:16:16 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20230601; t=1701904575; x=1702509375; darn=vger.kernel.org; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE + FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO + w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi + GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T + dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho + vDrA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1701904575; x=1702509375; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb + 4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y + +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62 + 3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK + 3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y + CLOw== +X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM + XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw== +X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A== +X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) + (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP + id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06 + Dec 2023 15:16:15 -0800 (PST) +Date: Wed, 06 Dec 2023 23:16:10 +0000 +In-Reply-To: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +Precedence: bulk +X-Mailing-List: bpf@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +Mime-Version: 1.0 +References: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= +X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840; + i=justinstitt@google.com; s=20230717; h=from:subject:message-id; + bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/ + b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF +X-Mailer: b4 0.12.3 +Message-ID: <20231206-ethtool_puts_impl-v5-1-5a2528e17bf8@google.com> +Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts() +From: justinstitt@google.com +To: "David S. Miller" , Eric Dumazet , + Jakub Kicinski , Paolo Abeni , Shay Agroskin , + Arthur Kiyanovski , David Arinzon , Noam Dagan , + Saeed Bishara , Rasesh Mody , + Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, + Dimitris Michailidis , Yisen Zhuang , + Salil Mehta , Jesse Brandeburg , + Tony Nguyen , Louis Peens , + Shannon Nelson , Brett Creeley , drivers@pensando.io, + "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , + Dexuan Cui , Ronak Doshi , + VMware PV-Drivers Reviewers , Andy Whitcroft , Joe Perches , + Dwaipayan Ray , Lukas Bulwahn , + Hauke Mehrtens , Andrew Lunn , + Florian Fainelli , Vladimir Oltean , + "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" , Daniel Golle , + Landen Chao , DENG Qingfang , + Sean Wang , Matthias Brugger , + AngeloGioacchino Del Regno , + Linus Walleij , + "=?utf-8?q?Alvin_=C5=A0ipraga?=" , Wei Fang , + Shenwei Wang , Clark Wang , + NXP Linux Team , Lars Povlsen , + Steen Hegelund , Daniel Machon , + UNGLinuxDriver@microchip.com, Jiawen Wu , + Mengyuan Lou , Heiner Kallweit , + Russell King , Alexei Starovoitov , + Daniel Borkmann , Jesper Dangaard Brouer , + John Fastabend +Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, + Nick Desaulniers , Nathan Chancellor , + Kees Cook , intel-wired-lan@lists.osuosl.org, + oss-drivers@corigine.com, linux-hyperv@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, + bpf@vger.kernel.org, Justin Stitt +Content-Type: text/plain; charset="utf-8" + +Use strscpy() to implement ethtool_puts(). + +Functionally the same as ethtool_sprintf() when it's used with two +arguments or with just "%s" format specifier. + +Signed-off-by: Justin Stitt +--- + include/linux/ethtool.h | 13 +++++++++++++ + net/ethtool/ioctl.c | 7 +++++++ + 2 files changed, 20 insertions(+) + +--- a/include/linux/ethtool.h ++++ b/include/linux/ethtool.h +@@ -788,4 +788,17 @@ int ethtool_get_phc_vclocks(struct net_d + * next string. + */ + extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); ++ ++/** ++ * ethtool_puts - Write string to ethtool string data ++ * @data: Pointer to a pointer to the start of string to update ++ * @str: String to write ++ * ++ * Write string to *data without a trailing newline. Update *data ++ * to point at start of next string. ++ * ++ * Prefer this function to ethtool_sprintf() when given only ++ * two arguments or if @fmt is just "%s". ++ */ ++extern void ethtool_puts(u8 **data, const char *str); + #endif /* _LINUX_ETHTOOL_H */ +--- a/net/ethtool/ioctl.c ++++ b/net/ethtool/ioctl.c +@@ -1953,6 +1953,13 @@ __printf(2, 3) void ethtool_sprintf(u8 * + } + EXPORT_SYMBOL(ethtool_sprintf); + ++void ethtool_puts(u8 **data, const char *str) ++{ ++ strscpy(*data, str, ETH_GSTRING_LEN); ++ *data += ETH_GSTRING_LEN; ++} ++EXPORT_SYMBOL(ethtool_puts); ++ + static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) + { + struct ethtool_value id; diff --git a/target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch new file mode 100644 index 0000000000..5094a6d774 --- /dev/null +++ b/target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch @@ -0,0 +1,139 @@ +From mboxrd@z Thu Jan 1 00:00:00 1970 +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sMUeie/T" +Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D + for ; Wed, 6 Dec 2023 15:16:16 -0800 (PST) +Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1 + for ; Wed, 06 Dec 2023 15:16:16 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20230601; t=1701904575; x=1702509375; darn=vger.kernel.org; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE + FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO + w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi + GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T + dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho + vDrA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1701904575; x=1702509375; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb + 4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y + +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62 + 3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK + 3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y + CLOw== +X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM + XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw== +X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A== +X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) + (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP + id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06 + Dec 2023 15:16:15 -0800 (PST) +Date: Wed, 06 Dec 2023 23:16:10 +0000 +In-Reply-To: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +Precedence: bulk +X-Mailing-List: bpf@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +Mime-Version: 1.0 +References: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= +X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840; + i=justinstitt@google.com; s=20230717; h=from:subject:message-id; + bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/ + b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF +X-Mailer: b4 0.12.3 +Message-ID: <20231206-ethtool_puts_impl-v5-1-5a2528e17bf8@google.com> +Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts() +From: justinstitt@google.com +To: "David S. Miller" , Eric Dumazet , + Jakub Kicinski , Paolo Abeni , Shay Agroskin , + Arthur Kiyanovski , David Arinzon , Noam Dagan , + Saeed Bishara , Rasesh Mody , + Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, + Dimitris Michailidis , Yisen Zhuang , + Salil Mehta , Jesse Brandeburg , + Tony Nguyen , Louis Peens , + Shannon Nelson , Brett Creeley , drivers@pensando.io, + "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , + Dexuan Cui , Ronak Doshi , + VMware PV-Drivers Reviewers , Andy Whitcroft , Joe Perches , + Dwaipayan Ray , Lukas Bulwahn , + Hauke Mehrtens , Andrew Lunn , + Florian Fainelli , Vladimir Oltean , + "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" , Daniel Golle , + Landen Chao , DENG Qingfang , + Sean Wang , Matthias Brugger , + AngeloGioacchino Del Regno , + Linus Walleij , + "=?utf-8?q?Alvin_=C5=A0ipraga?=" , Wei Fang , + Shenwei Wang , Clark Wang , + NXP Linux Team , Lars Povlsen , + Steen Hegelund , Daniel Machon , + UNGLinuxDriver@microchip.com, Jiawen Wu , + Mengyuan Lou , Heiner Kallweit , + Russell King , Alexei Starovoitov , + Daniel Borkmann , Jesper Dangaard Brouer , + John Fastabend +Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, + Nick Desaulniers , Nathan Chancellor , + Kees Cook , intel-wired-lan@lists.osuosl.org, + oss-drivers@corigine.com, linux-hyperv@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, + bpf@vger.kernel.org, Justin Stitt +Content-Type: text/plain; charset="utf-8" + +Use strscpy() to implement ethtool_puts(). + +Functionally the same as ethtool_sprintf() when it's used with two +arguments or with just "%s" format specifier. + +Signed-off-by: Justin Stitt +--- + include/linux/ethtool.h | 13 +++++++++++++ + net/ethtool/ioctl.c | 7 +++++++ + 2 files changed, 20 insertions(+) + +--- a/include/linux/ethtool.h ++++ b/include/linux/ethtool.h +@@ -843,4 +843,17 @@ int ethtool_get_phc_vclocks(struct net_d + * next string. + */ + extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); ++ ++/** ++ * ethtool_puts - Write string to ethtool string data ++ * @data: Pointer to a pointer to the start of string to update ++ * @str: String to write ++ * ++ * Write string to *data without a trailing newline. Update *data ++ * to point at start of next string. ++ * ++ * Prefer this function to ethtool_sprintf() when given only ++ * two arguments or if @fmt is just "%s". ++ */ ++extern void ethtool_puts(u8 **data, const char *str); + #endif /* _LINUX_ETHTOOL_H */ +--- a/net/ethtool/ioctl.c ++++ b/net/ethtool/ioctl.c +@@ -1974,6 +1974,13 @@ __printf(2, 3) void ethtool_sprintf(u8 * + } + EXPORT_SYMBOL(ethtool_sprintf); + ++void ethtool_puts(u8 **data, const char *str) ++{ ++ strscpy(*data, str, ETH_GSTRING_LEN); ++ *data += ETH_GSTRING_LEN; ++} ++EXPORT_SYMBOL(ethtool_puts); ++ + static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) + { + struct ethtool_value id; From 89ff407d68ca152a28811f94c0a8e9ebb11f44d7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 10 Dec 2023 15:12:24 -0800 Subject: [PATCH 03/52] treewide: use ethtool_puts instead of memcpy The former is a safer and more readable version. Signed-off-by: Rosen Penev --- .../files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c | 3 +-- .../700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch | 2 +- .../linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c | 2 +- target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c index e5adc821d2..b022a3e9fb 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c @@ -169,8 +169,7 @@ static void ag71xx_ethtool_get_strings(struct net_device *netdev, u32 sset, int i; for (i = 0; i < ARRAY_SIZE(ag71xx_statistics); i++) - memcpy(data + i * ETH_GSTRING_LEN, - ag71xx_statistics[i].name, ETH_GSTRING_LEN); + ethtool_puts(&data, ag71xx_statistics[i].name); } } diff --git a/target/linux/ipq40xx/patches-6.1/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch b/target/linux/ipq40xx/patches-6.1/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch index 254e85c284..ccc56d115e 100644 --- a/target/linux/ipq40xx/patches-6.1/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch +++ b/target/linux/ipq40xx/patches-6.1/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch @@ -1953,7 +1953,7 @@ Signed-off-by: Maxime Chevallier + switch (stringset) { + case ETH_SS_STATS: + for (i = 0; i < ARRAY_SIZE(ipqess_stats); i++) -+ ethtool_sprintf(&p, ipqess_stats[i].string); ++ ethtool_puts(&p, ipqess_stats[i].string); + break; + } +} diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c index 5732c28536..a3abf30c71 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c @@ -161,7 +161,7 @@ static void fe_get_strings(struct net_device *dev, u32 stringset, u8 *data) { switch (stringset) { case ETH_SS_STATS: - memcpy(data, *fe_gdma_str, sizeof(fe_gdma_str)); + ethtool_puts(&data, *fe_gdma_str); break; } } diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index d246e60cb2..9f608950c0 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -944,8 +944,7 @@ static void rtl83xx_get_strings(struct dsa_switch *ds, return; for (int i = 0; i < ARRAY_SIZE(rtl83xx_mib); i++) - strncpy(data + i * ETH_GSTRING_LEN, rtl83xx_mib[i].name, - ETH_GSTRING_LEN); + ethtool_puts(&data, rtl83xx_mib[i].name); } static void rtl83xx_get_ethtool_stats(struct dsa_switch *ds, int port, From 14362f22af62b74f61d6e7365fbf6960b048849e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 30 Nov 2023 12:08:31 -0800 Subject: [PATCH 04/52] ramips: fix dtc warnings Mostly leading 0 removals and wrong addresses. Signed-off-by: Rosen Penev --- target/linux/ramips/dts/mt7620a_engenius_epg600.dts | 4 ++-- target/linux/ramips/dts/mt7621_cudy_wr2100.dts | 2 +- target/linux/ramips/dts/mt7621_yuncore_fap640.dts | 6 +++--- target/linux/ramips/dts/mt7621_yuncore_fap690.dts | 6 +++--- target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts | 3 --- target/linux/ramips/dts/rt3662_engenius_esr600h.dts | 4 ++-- target/linux/ramips/dts/rt3883.dtsi | 4 +++- target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_engenius_epg600.dts b/target/linux/ramips/dts/mt7620a_engenius_epg600.dts index f64676d8fb..4b3332d2f0 100644 --- a/target/linux/ramips/dts/mt7620a_engenius_epg600.dts +++ b/target/linux/ramips/dts/mt7620a_engenius_epg600.dts @@ -215,9 +215,9 @@ }; &pcie0 { - wifi@0,1,0 { + wifi@0,0 { compatible = "pci1814,3091"; - reg = <0x0 1 0 0 0>; + reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; }; diff --git a/target/linux/ramips/dts/mt7621_cudy_wr2100.dts b/target/linux/ramips/dts/mt7621_cudy_wr2100.dts index fc38e27ac1..afccce15cc 100644 --- a/target/linux/ramips/dts/mt7621_cudy_wr2100.dts +++ b/target/linux/ramips/dts/mt7621_cudy_wr2100.dts @@ -97,7 +97,7 @@ }; &pcie1 { - wifi@1,0 { + wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_8000>; diff --git a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts index 8c662b86cd..ddbeceaff8 100644 --- a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts +++ b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts @@ -129,8 +129,8 @@ #address-cells = <1>; #size-cells = <1>; - macaddr_factory_0004: macaddr@0004 { - reg = <0x0004 0x6>; + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; }; macaddr_factory_e006: macaddr@e006 { @@ -171,7 +171,7 @@ label = "wan"; phy-handle = <ðphy4>; - nvmem-cells = <&macaddr_factory_0004>; + nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_yuncore_fap690.dts b/target/linux/ramips/dts/mt7621_yuncore_fap690.dts index ce6a60215e..ccfb0847aa 100644 --- a/target/linux/ramips/dts/mt7621_yuncore_fap690.dts +++ b/target/linux/ramips/dts/mt7621_yuncore_fap690.dts @@ -99,8 +99,8 @@ #address-cells = <1>; #size-cells = <1>; - macaddr_factory_0004: macaddr@0004 { - reg = <0x0004 0x6>; + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; }; }; }; @@ -128,7 +128,7 @@ }; &gmac0 { - nvmem-cells = <&macaddr_factory_0004>; + nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts index 3bdb06cec9..01c8bb942a 100644 --- a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts +++ b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts @@ -49,9 +49,6 @@ keys { compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; - reset { label = "reset"; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/rt3662_engenius_esr600h.dts b/target/linux/ramips/dts/rt3662_engenius_esr600h.dts index 6770e4cc9a..e142fe5347 100644 --- a/target/linux/ramips/dts/rt3662_engenius_esr600h.dts +++ b/target/linux/ramips/dts/rt3662_engenius_esr600h.dts @@ -161,9 +161,9 @@ &pci1 { status = "okay"; - wifi@0,1,0 { + wifi@0,0 { compatible = "pci1814,3091"; - reg = <0x0 1 0 0 0>; + reg = <0x10000 0 0 0 0>; ralink,5ghz = <0>; nvmem-cells = <&eeprom_factory_8000>; nvmem-cell-names = "eeprom"; diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi index 148922e8b9..8c76eb6631 100644 --- a/target/linux/ramips/dts/rt3883.dtsi +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -399,7 +399,7 @@ 0x9000 0 0 4 &pciintc 19 >; - pci1: pci@1 { + pci1: pci@1,0 { reg = <0x0800 0 0 0 0>; device_type = "pci"; #interrupt-cells = <1>; @@ -421,6 +421,7 @@ #address-cells = <3>; #size-cells = <2>; + interrupt-controller; status = "disabled"; }; @@ -430,6 +431,7 @@ #address-cells = <3>; #size-cells = <2>; + interrupt-controller; status = "disabled"; }; }; diff --git a/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi b/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi index 4a64d8a7fe..17c982a314 100644 --- a/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi +++ b/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi @@ -102,7 +102,7 @@ &pci1 { status = "okay"; - wifi@1,0 { + wifi@0,0 { compatible = "pci1814,3091"; reg = <0x10000 0 0 0 0>; ralink,5ghz = <0>; From a94abfadc42b02c2dd6c55df6c494ed8efdc41d7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 15:02:46 -0800 Subject: [PATCH 05/52] image.mk: reorder DTC_WARN_FLAGS based on upstream pci warnings got reenabled as they were fixed upstream. Signed-off-by: Rosen Penev --- include/image.mk | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/image.mk b/include/image.mk index 096ccb5f18..f5ab1d7953 100644 --- a/include/image.mk +++ b/include/image.mk @@ -151,17 +151,13 @@ endif # Disable noisy checks by default as in upstream DTC_WARN_FLAGS := \ + -Wno-interrupt_provider \ + -Wno-unique_unit_address \ -Wno-unit_address_vs_reg \ - -Wno-simple_bus_reg \ - -Wno-unit_address_format \ - -Wno-pci_bridge \ - -Wno-pci_device_bus_num \ - -Wno-pci_device_reg \ -Wno-avoid_unnecessary_addr_size \ -Wno-alias_paths \ -Wno-graph_child_address \ - -Wno-graph_port \ - -Wno-unique_unit_address + -Wno-simple_bus_reg DTC_FLAGS += $(DTC_WARN_FLAGS) DTCO_FLAGS += $(DTC_WARN_FLAGS) From b07b8aade7174f915932dc16120bfe0c02de7133 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 12:42:00 -0800 Subject: [PATCH 06/52] ath79: rename pcie-controller to pcie pcie-controller was renamed to pcie since at least kernel 4.14. Match it here to get rid of dtc warnings. Signed-off-by: Rosen Penev --- target/linux/ath79/dts/ar7100.dtsi | 2 +- target/linux/ath79/dts/ar724x.dtsi | 2 +- target/linux/ath79/dts/ar9344.dtsi | 2 +- target/linux/ath79/dts/qca953x.dtsi | 2 +- target/linux/ath79/dts/qca955x.dtsi | 4 ++-- target/linux/ath79/dts/qca956x.dtsi | 2 +- .../310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch | 2 +- .../312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch | 2 +- .../310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch | 2 +- .../312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/target/linux/ath79/dts/ar7100.dtsi b/target/linux/ath79/dts/ar7100.dtsi index a03f282a0f..6648311619 100644 --- a/target/linux/ath79/dts/ar7100.dtsi +++ b/target/linux/ath79/dts/ar7100.dtsi @@ -113,7 +113,7 @@ #reset-cells = <1>; }; - pcie0: pcie-controller@17010000 { + pcie0: pcie@17010000 { compatible = "qca,ar7100-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/dts/ar724x.dtsi b/target/linux/ath79/dts/ar724x.dtsi index c090eb5e0f..c758fc244e 100644 --- a/target/linux/ath79/dts/ar724x.dtsi +++ b/target/linux/ath79/dts/ar724x.dtsi @@ -121,7 +121,7 @@ #reset-cells = <1>; }; - pcie: pcie-controller@180c0000 { + pcie: pcie@180c0000 { compatible = "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/dts/ar9344.dtsi b/target/linux/ath79/dts/ar9344.dtsi index fb23c53d41..dff912f8ca 100644 --- a/target/linux/ath79/dts/ar9344.dtsi +++ b/target/linux/ath79/dts/ar9344.dtsi @@ -32,7 +32,7 @@ }; &ahb { - pcie: pcie-controller@180c0000 { + pcie: pcie@180c0000 { compatible = "qcom,ar9340-pci", "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi index 4300c741ad..cc26db5ba2 100644 --- a/target/linux/ath79/dts/qca953x.dtsi +++ b/target/linux/ath79/dts/qca953x.dtsi @@ -150,7 +150,7 @@ reg = <0x18070000 0x4>; }; - pcie0: pcie-controller@180c0000 { + pcie0: pcie@180c0000 { compatible = "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/dts/qca955x.dtsi b/target/linux/ath79/dts/qca955x.dtsi index e7daa9d827..13b051de20 100644 --- a/target/linux/ath79/dts/qca955x.dtsi +++ b/target/linux/ath79/dts/qca955x.dtsi @@ -185,7 +185,7 @@ reg = <0x18070000 0x58>; }; - pcie0: pcie-controller@180c0000 { + pcie0: pcie@180c0000 { compatible = "qcom,qca9550-pci", "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; @@ -222,7 +222,7 @@ status = "disabled"; }; - pcie1: pcie-controller@18250000 { + pcie1: pcie@18250000 { compatible = "qcom,qca9550-pci", "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/dts/qca956x.dtsi b/target/linux/ath79/dts/qca956x.dtsi index e46f0676e2..8b261568f0 100644 --- a/target/linux/ath79/dts/qca956x.dtsi +++ b/target/linux/ath79/dts/qca956x.dtsi @@ -157,7 +157,7 @@ status = "disabled"; }; - pcie: pcie-controller@18250000 { + pcie: pcie@18250000 { compatible = "qcom,ar7240-pci"; #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch index bf7eb691a5..cf0a75c791 100644 --- a/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch +++ b/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch @@ -37,7 +37,7 @@ Signed-off-by: John Crispin +- interrupt-parent: phandle to the MIPS IRQ controller + +* Example for ar7100 -+ pcie-controller@180c0000 { ++ pcie@180c0000 { + compatible = "qca,ar7100-pci"; + #address-cells = <3>; + #size-cells = <2>; diff --git a/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch index a0af79cb4d..a32c9bdcde 100644 --- a/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch +++ b/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch @@ -39,7 +39,7 @@ Signed-off-by: John Crispin +- interrupt-controller: define to enable the builtin IRQ cascade. + +* Example for qca9557 -+ pcie-controller@180c0000 { ++ pcie@180c0000 { + compatible = "qcom,ar7240-pci"; + #address-cells = <3>; + #size-cells = <2>; diff --git a/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch index bf7eb691a5..cf0a75c791 100644 --- a/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch +++ b/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch @@ -37,7 +37,7 @@ Signed-off-by: John Crispin +- interrupt-parent: phandle to the MIPS IRQ controller + +* Example for ar7100 -+ pcie-controller@180c0000 { ++ pcie@180c0000 { + compatible = "qca,ar7100-pci"; + #address-cells = <3>; + #size-cells = <2>; diff --git a/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch index a0af79cb4d..a32c9bdcde 100644 --- a/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch +++ b/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch @@ -39,7 +39,7 @@ Signed-off-by: John Crispin +- interrupt-controller: define to enable the builtin IRQ cascade. + +* Example for qca9557 -+ pcie-controller@180c0000 { ++ pcie@180c0000 { + compatible = "qcom,ar7240-pci"; + #address-cells = <3>; + #size-cells = <2>; From 2607e3fe247b87c193deb86d1c42930eb655cc54 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 12:51:58 -0800 Subject: [PATCH 07/52] ath79: fix avoid_unnecessary_addr_size warnings Raised to dtc. Signed-off-by: Rosen Penev --- target/linux/ath79/dts/ar9344_qihoo_c301.dts | 4 ---- target/linux/ath79/dts/ar934x.dtsi | 3 --- target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi | 2 -- target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts | 2 -- target/linux/ath79/dts/qca955x.dtsi | 3 --- 5 files changed, 14 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts index 616036fcfc..bf6706716f 100644 --- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts @@ -103,8 +103,6 @@ pinctrl-0 = <&pmx_spi_cs1>; flash@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; @@ -164,8 +162,6 @@ }; flash@1 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <1>; spi-max-frequency = <25000000>; diff --git a/target/linux/ath79/dts/ar934x.dtsi b/target/linux/ath79/dts/ar934x.dtsi index 94dfde4125..98cd76629f 100644 --- a/target/linux/ath79/dts/ar934x.dtsi +++ b/target/linux/ath79/dts/ar934x.dtsi @@ -197,9 +197,6 @@ nand-ecc-mode = "hw"; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; }; diff --git a/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi b/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi index e7044b60a4..f17dd513e2 100644 --- a/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi +++ b/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi @@ -53,8 +53,6 @@ status = "okay"; flash@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts index 762197f255..c3d42a8b35 100644 --- a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts +++ b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts @@ -95,8 +95,6 @@ status = "okay"; flash@0 { - #address-cells = <1>; - #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <25000000>; diff --git a/target/linux/ath79/dts/qca955x.dtsi b/target/linux/ath79/dts/qca955x.dtsi index 13b051de20..c17a15c55e 100644 --- a/target/linux/ath79/dts/qca955x.dtsi +++ b/target/linux/ath79/dts/qca955x.dtsi @@ -313,9 +313,6 @@ nand-ecc-mode = "hw"; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; }; From 6dbc300bafa34a229f342701551d3c4d65c9d22a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 12:54:08 -0800 Subject: [PATCH 08/52] ath79: fix unit_address_format warning Raised by dtc. Signed-off-by: Rosen Penev --- .../dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts | 2 +- target/linux/ath79/dts/qca9558_jjplus_jwap230.dts | 2 +- .../linux/ath79/dts/qca9561_tplink_tl-wdr6500-v2.dts | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index f14e138026..9faddcc37f 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -77,7 +77,7 @@ compatible = "gpio-keys-polled"; poll-interval = <20>; - button@0 { + button-reset { label = "reset"; linux,code = ; gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ath79/dts/qca9558_jjplus_jwap230.dts b/target/linux/ath79/dts/qca9558_jjplus_jwap230.dts index 6cd93f6b33..ee2e82ef10 100644 --- a/target/linux/ath79/dts/qca9558_jjplus_jwap230.dts +++ b/target/linux/ath79/dts/qca9558_jjplus_jwap230.dts @@ -109,7 +109,7 @@ &mdio0 { status = "okay"; - switch { + switch@0 { compatible = "qca,ar8327"; reg = <0>; diff --git a/target/linux/ath79/dts/qca9561_tplink_tl-wdr6500-v2.dts b/target/linux/ath79/dts/qca9561_tplink_tl-wdr6500-v2.dts index 04567e6b88..8767693c82 100644 --- a/target/linux/ath79/dts/qca9561_tplink_tl-wdr6500-v2.dts +++ b/target/linux/ath79/dts/qca9561_tplink_tl-wdr6500-v2.dts @@ -86,9 +86,9 @@ #address-cells = <1>; #size-cells = <1>; - macaddr_uboot_0fc00: macaddr@0fc00 { + macaddr_uboot_fc00: macaddr@fc00 { compatible = "mac-base"; - reg = <0x0fc00 0x6>; + reg = <0xfc00 0x6>; #nvmem-cell-cells = <1>; }; }; @@ -134,7 +134,7 @@ compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; - nvmem-cells = <&macaddr_uboot_0fc00 (-2)>, <&calibration_ath10k>; + nvmem-cells = <&macaddr_uboot_fc00 (-2)>, <&calibration_ath10k>; nvmem-cell-names = "mac-address", "calibration"; }; }; @@ -148,21 +148,21 @@ phy-handle = <&swphy4>; - nvmem-cells = <&macaddr_uboot_0fc00 1>; + nvmem-cells = <&macaddr_uboot_fc00 1>; nvmem-cell-names = "mac-address"; }; ð1 { status = "okay"; - nvmem-cells = <&macaddr_uboot_0fc00 0>; + nvmem-cells = <&macaddr_uboot_fc00 0>; nvmem-cell-names = "mac-address"; }; &wmac { status = "okay"; - nvmem-cells = <&macaddr_uboot_0fc00 (-1)>, <&calibration_ath9k>; + nvmem-cells = <&macaddr_uboot_fc00 (-1)>, <&calibration_ath9k>; nvmem-cell-names = "mac-address", "calibration"; }; From 991c8cabed6538455a7562c2aef1143b171ccff8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 13:11:39 -0800 Subject: [PATCH 09/52] ath79: fix pci_device_reg errors Found by dtc. Wrong numbers and wrong ordering. Signed-off-by: Rosen Penev --- target/linux/ath79/dts/ar7161_aruba_ap-105.dts | 4 ++-- target/linux/ath79/dts/ar7161_aruba_ap-175.dts | 4 ++-- target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi | 4 ++-- target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts | 4 ++-- target/linux/ath79/dts/ar7161_fortinet_fap-220-b.dts | 4 ++-- target/linux/ath79/dts/ar7161_meraki_mr16.dts | 4 ++-- target/linux/ath79/dts/ar7161_netgear_wndap360.dts | 4 ++-- target/linux/ath79/dts/ar7161_netgear_wndr.dtsi | 4 ++-- target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi | 4 ++-- target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts | 4 ++-- target/linux/ath79/dts/ar7242_engenius_eap350-v1.dts | 2 +- target/linux/ath79/dts/ar7242_engenius_ecb350-v1.dts | 2 +- target/linux/ath79/dts/ar7242_meraki_mr12.dts | 2 +- target/linux/ath79/dts/ar9344_araknis_an-300-ap-i-n.dts | 2 +- target/linux/ath79/dts/ar9344_engenius_eap600.dts | 2 +- target/linux/ath79/dts/ar9344_engenius_ecb600.dts | 2 +- target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi | 2 +- target/linux/ath79/dts/ar9344_netgear_r6100.dts | 2 +- target/linux/ath79/dts/ar9344_senao_ap-dual.dtsi | 2 +- target/linux/ath79/dts/ar9344_watchguard_ap100.dts | 2 +- target/linux/ath79/dts/ar9344_watchguard_ap200.dts | 2 +- target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts | 1 - .../linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts | 2 +- target/linux/ath79/dts/qca9558_engenius_esr900.dts | 2 +- target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi | 2 +- target/linux/ath79/dts/qca955x_senao_loader.dtsi | 6 +++--- target/linux/ath79/dts/qca955x_senao_router-dual.dtsi | 2 +- 27 files changed, 38 insertions(+), 39 deletions(-) diff --git a/target/linux/ath79/dts/ar7161_aruba_ap-105.dts b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts index c8510a8944..dd110fc185 100644 --- a/target/linux/ath79/dts/ar7161_aruba_ap-105.dts +++ b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts @@ -94,7 +94,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { /* 2.4 GHz */ + ath9k0: wifi@11,0 { /* 2.4 GHz */ compatible = "pci168c,0029"; nvmem-cells = <&macaddr_hwinfo_1c 1>; nvmem-cell-names = "mac-address"; @@ -103,7 +103,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { /* 5 GHz */ + ath9k1: wifi@12,0 { /* 5 GHz */ compatible = "pci168c,0029"; nvmem-cells = <&macaddr_hwinfo_1c 2>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/ath79/dts/ar7161_aruba_ap-175.dts b/target/linux/ath79/dts/ar7161_aruba_ap-175.dts index 96a76a3cfc..62a2083d20 100644 --- a/target/linux/ath79/dts/ar7161_aruba_ap-175.dts +++ b/target/linux/ath79/dts/ar7161_aruba_ap-175.dts @@ -120,7 +120,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { + ath9k0: wifi@11,0 { compatible = "pci168c,0029"; nvmem-cells = <&macaddr_hwinfo_1c 1>; nvmem-cell-names = "mac-address"; @@ -129,7 +129,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { + ath9k1: wifi@12,0 { compatible = "pci168c,0029"; nvmem-cells = <&macaddr_hwinfo_1c 2>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi index e3f48fee85..50c0748a38 100644 --- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi +++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi @@ -196,7 +196,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { + ath9k0: wifi@11,0 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; qca,no-eeprom; @@ -204,7 +204,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { + ath9k1: wifi@12,0 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; qca,no-eeprom; diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts index b62111c110..639736d9c4 100644 --- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts +++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts @@ -136,7 +136,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { + ath9k0: wifi@11,0 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>; @@ -145,7 +145,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { + ath9k1: wifi@12,0 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>; diff --git a/target/linux/ath79/dts/ar7161_fortinet_fap-220-b.dts b/target/linux/ath79/dts/ar7161_fortinet_fap-220-b.dts index ddcf68970d..e0aa5704cd 100644 --- a/target/linux/ath79/dts/ar7161_fortinet_fap-220-b.dts +++ b/target/linux/ath79/dts/ar7161_fortinet_fap-220-b.dts @@ -95,7 +95,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { /* 2.4 GHz */ + ath9k0: wifi@11,0 { /* 2.4 GHz */ compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; ieee80211-freq-limit = <2402000 2482000>; @@ -105,7 +105,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { /* 5 GHz */ + ath9k1: wifi@12,0 { /* 5 GHz */ compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; ieee80211-freq-limit = <2402000 2482000 4900000 5990000>; diff --git a/target/linux/ath79/dts/ar7161_meraki_mr16.dts b/target/linux/ath79/dts/ar7161_meraki_mr16.dts index 6b8574e880..b732010446 100644 --- a/target/linux/ath79/dts/ar7161_meraki_mr16.dts +++ b/target/linux/ath79/dts/ar7161_meraki_mr16.dts @@ -70,7 +70,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { /* 2.4 GHz */ + ath9k0: wifi@11,0 { /* 2.4 GHz */ compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; qca,no-eeprom; @@ -80,7 +80,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { /* 5 GHz */ + ath9k1: wifi@12,0 { /* 5 GHz */ compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; qca,no-eeprom; diff --git a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts index 9761234714..020b45d9e1 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts +++ b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts @@ -147,7 +147,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { + ath9k0: wifi@11,0 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; nvmem-cells = <&macaddr_art_120c>, <&calibration_art_1000>; @@ -156,7 +156,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { + ath9k1: wifi@12,0 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; nvmem-cells = <&macaddr_art_520c 1>, <&calibration_art_5000>; diff --git a/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi b/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi index 296ecc8c4e..d30b4dad30 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi +++ b/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi @@ -126,7 +126,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { + ath9k0: wifi@11,0 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; @@ -153,7 +153,7 @@ }; }; - ath9k1: wifi@0,12 { + ath9k1: wifi@12,0 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; diff --git a/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi index 065068571c..54a15c49c1 100644 --- a/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi +++ b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi @@ -131,7 +131,7 @@ &pcie0 { status = "okay"; - ath9k0: wifi@0,11 { /* 2.4 GHz */ + ath9k0: wifi@11,0 { /* 2.4 GHz */ compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; nvmem-cells = <&macaddr_bdata_60>; @@ -140,7 +140,7 @@ gpio-controller; }; - ath9k1: wifi@0,12 { /* 5 GHz */ + ath9k1: wifi@12,0 { /* 5 GHz */ compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; nvmem-cells = <&macaddr_bdata_76>; diff --git a/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts b/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts index a770ca04a8..7508be1df1 100644 --- a/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts +++ b/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts @@ -92,13 +92,13 @@ &pcie0 { status = "okay"; - wifi@0,11 { + wifi@11,0 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; qca,no-eeprom; }; - wifi@0,12 { + wifi@12,0 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; qca,no-eeprom; diff --git a/target/linux/ath79/dts/ar7242_engenius_eap350-v1.dts b/target/linux/ath79/dts/ar7242_engenius_eap350-v1.dts index 8e8deba933..861964fdfc 100644 --- a/target/linux/ath79/dts/ar7242_engenius_eap350-v1.dts +++ b/target/linux/ath79/dts/ar7242_engenius_eap350-v1.dts @@ -75,7 +75,7 @@ &pcie { status = "okay"; - ath9k: wifi@0,0,0 { + ath9k: wifi@0,0 { compatible = "pci168c,002a"; reg = <0x0 0 0 0 0>; nvmem-cells = <&macaddr_art_0 1>; diff --git a/target/linux/ath79/dts/ar7242_engenius_ecb350-v1.dts b/target/linux/ath79/dts/ar7242_engenius_ecb350-v1.dts index 69629335b3..a7def14c73 100644 --- a/target/linux/ath79/dts/ar7242_engenius_ecb350-v1.dts +++ b/target/linux/ath79/dts/ar7242_engenius_ecb350-v1.dts @@ -75,7 +75,7 @@ &pcie { status = "okay"; - ath9k: wifi@0,0,0 { + ath9k: wifi@0,0 { compatible = "pci168c,002a"; reg = <0x0 0 0 0 0>; nvmem-cells = <&macaddr_art_0 (-1)>; diff --git a/target/linux/ath79/dts/ar7242_meraki_mr12.dts b/target/linux/ath79/dts/ar7242_meraki_mr12.dts index adea2778ea..5218a5ce27 100644 --- a/target/linux/ath79/dts/ar7242_meraki_mr12.dts +++ b/target/linux/ath79/dts/ar7242_meraki_mr12.dts @@ -70,7 +70,7 @@ &pcie { status = "okay"; - wifi@0,0,0 { + wifi@0,0 { compatible = "pci168c,002a"; reg = <0x0000 0 0 0 0>; qca,no-eeprom; diff --git a/target/linux/ath79/dts/ar9344_araknis_an-300-ap-i-n.dts b/target/linux/ath79/dts/ar9344_araknis_an-300-ap-i-n.dts index a45aa444de..c2c7cbb960 100644 --- a/target/linux/ath79/dts/ar9344_araknis_an-300-ap-i-n.dts +++ b/target/linux/ath79/dts/ar9344_araknis_an-300-ap-i-n.dts @@ -84,7 +84,7 @@ &pcie { status = "okay"; - ath9k: wifi@0,0,0 { + ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0 0 0 0 0>; nvmem-cells = <&macaddr_art_0 1>, <&calibration_art_5000>; diff --git a/target/linux/ath79/dts/ar9344_engenius_eap600.dts b/target/linux/ath79/dts/ar9344_engenius_eap600.dts index 888e3f82ad..4d3a149e3e 100644 --- a/target/linux/ath79/dts/ar9344_engenius_eap600.dts +++ b/target/linux/ath79/dts/ar9344_engenius_eap600.dts @@ -34,7 +34,7 @@ }; &pcie { - wifi@0,0,0 { + wifi@0,0 { nvmem-cells = <&macaddr_art_0 0>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; }; diff --git a/target/linux/ath79/dts/ar9344_engenius_ecb600.dts b/target/linux/ath79/dts/ar9344_engenius_ecb600.dts index ac9bbea5d4..e7b8b9c3ce 100644 --- a/target/linux/ath79/dts/ar9344_engenius_ecb600.dts +++ b/target/linux/ath79/dts/ar9344_engenius_ecb600.dts @@ -29,7 +29,7 @@ }; &pcie { - wifi@0,0,0 { + wifi@0,0 { nvmem-cells = <&macaddr_art_0 (-2)>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; }; diff --git a/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi index c8f12a1bfb..6b1ae8ac93 100644 --- a/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi +++ b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi @@ -56,7 +56,7 @@ &pcie { status = "okay"; - ath9k: wifi@0,0,0 { + ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0 0 0 0 0>; }; diff --git a/target/linux/ath79/dts/ar9344_netgear_r6100.dts b/target/linux/ath79/dts/ar9344_netgear_r6100.dts index 419fa51f61..5952e0140f 100644 --- a/target/linux/ath79/dts/ar9344_netgear_r6100.dts +++ b/target/linux/ath79/dts/ar9344_netgear_r6100.dts @@ -203,7 +203,7 @@ &pcie { status = "okay"; - wifi@0,0,0 { + wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; diff --git a/target/linux/ath79/dts/ar9344_senao_ap-dual.dtsi b/target/linux/ath79/dts/ar9344_senao_ap-dual.dtsi index c0e95065d5..f1d6ffda7c 100644 --- a/target/linux/ath79/dts/ar9344_senao_ap-dual.dtsi +++ b/target/linux/ath79/dts/ar9344_senao_ap-dual.dtsi @@ -59,7 +59,7 @@ &pcie { status = "okay"; - ath9k: wifi@0,0,0 { + ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0 0 0 0 0>; ieee80211-freq-limit = <2402000 2482000>; diff --git a/target/linux/ath79/dts/ar9344_watchguard_ap100.dts b/target/linux/ath79/dts/ar9344_watchguard_ap100.dts index 2fd9a6e51b..e09d539c56 100644 --- a/target/linux/ath79/dts/ar9344_watchguard_ap100.dts +++ b/target/linux/ath79/dts/ar9344_watchguard_ap100.dts @@ -63,7 +63,7 @@ &pcie { status = "disabled"; - wifi@0,0,0 { + wifi@0,0 { nvmem-cells = <&calibration_art_5000>; nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/ar9344_watchguard_ap200.dts b/target/linux/ath79/dts/ar9344_watchguard_ap200.dts index 9cf6819958..c3d7c50813 100644 --- a/target/linux/ath79/dts/ar9344_watchguard_ap200.dts +++ b/target/linux/ath79/dts/ar9344_watchguard_ap200.dts @@ -61,7 +61,7 @@ }; &pcie { - wifi@0,0,0 { + wifi@0,0 { nvmem-cells = <&macaddr_art_0 (-1)>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; }; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts index 1c6dcee8bf..b81485f465 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts @@ -72,7 +72,6 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; - device_type = "pci"; }; }; diff --git a/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts b/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts index 59dd83d5f8..4a68f53075 100644 --- a/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts +++ b/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts @@ -75,7 +75,7 @@ &pcie0 { status = "okay"; - wifi@0,0,0 { + wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; }; diff --git a/target/linux/ath79/dts/qca9558_engenius_esr900.dts b/target/linux/ath79/dts/qca9558_engenius_esr900.dts index 269f743223..ef0e21a3b5 100644 --- a/target/linux/ath79/dts/qca9558_engenius_esr900.dts +++ b/target/linux/ath79/dts/qca9558_engenius_esr900.dts @@ -76,7 +76,7 @@ &pcie0 { status = "okay"; - wifi@0,0,0 { + wifi@0,0 { compatible = "pci168c,0033"; reg = <0x0000 0 0 0 0>; nvmem-cells = <&calibration_art_5000>; diff --git a/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi b/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi index e448cd3012..66f2e38853 100644 --- a/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi +++ b/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi @@ -119,7 +119,7 @@ &pcie0 { status = "okay"; - wifi@0,0,0 { + wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; qca,no-eeprom; diff --git a/target/linux/ath79/dts/qca955x_senao_loader.dtsi b/target/linux/ath79/dts/qca955x_senao_loader.dtsi index cf82c050b6..31e00ce063 100644 --- a/target/linux/ath79/dts/qca955x_senao_loader.dtsi +++ b/target/linux/ath79/dts/qca955x_senao_loader.dtsi @@ -26,16 +26,16 @@ }; &pcie0 { - ath10k_0: wifi@0,0,0 { + ath10k_0: wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; }; }; &pcie1 { - ath10k_1: wifi@0,1,0 { + ath10k_1: wifi@0,0 { compatible = "qcom,ath10k"; - reg = <0x0 1 0 0 0>; + reg = <0x0 0 0 0 0>; }; }; diff --git a/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi b/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi index 61446263c4..8f62cf442c 100644 --- a/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi +++ b/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi @@ -43,7 +43,7 @@ &pcie0 { status = "okay"; - ath10k_0: wifi@0,0,0 { + ath10k_0: wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; }; From 506b4d563eb735b6e1597cb9c58f9eb02e1d0221 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 15:44:34 -0800 Subject: [PATCH 10/52] ath79: gpio to gpios Fixes deprecated_gpio_property dtc warning Signed-off-by: Rosen Penev --- target/linux/ath79/dts/ar7242_avm_fritz300e.dts | 2 +- target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts | 2 +- target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts | 2 +- target/linux/ath79/dts/ar9331_onion_omega.dts | 2 +- target/linux/ath79/dts/ar9331_pisen_wmm003n.dts | 2 +- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-mr10u.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-wr703n.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi | 2 +- .../ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts | 2 +- target/linux/ath79/dts/ar9344_qihoo_c301.dts | 4 ++-- target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts | 2 +- target/linux/ath79/dts/qca9558_aruba_ap-115.dts | 2 +- target/linux/ath79/dts/qca9558_sophos_ap.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi | 4 ++-- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts index 310a2b1ee2..7a0d7dd268 100644 --- a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts +++ b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts @@ -85,7 +85,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; - gpio = <&gpio 11 GPIO_ACTIVE_LOW>; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; startup-delay-us = <300000>; enable-active-high; diff --git a/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts b/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts index 211c565c24..e4d2ff1e11 100644 --- a/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts +++ b/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts @@ -54,7 +54,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 6 GPIO_ACTIVE_LOW>; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; }; gpio-export { diff --git a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts index 3751374af6..b10f7fc965 100644 --- a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts +++ b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts @@ -52,7 +52,7 @@ regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; enable-active-high; - gpio = <&gpio 20 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/ath79/dts/ar9331_onion_omega.dts b/target/linux/ath79/dts/ar9331_onion_omega.dts index 81fab872b5..5d9e96e048 100644 --- a/target/linux/ath79/dts/ar9331_onion_omega.dts +++ b/target/linux/ath79/dts/ar9331_onion_omega.dts @@ -43,7 +43,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts index 61cbb1aae2..63f394a4f9 100644 --- a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts +++ b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts @@ -41,7 +41,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 69965f86a8..ad987dbca1 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -101,7 +101,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 19 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr10u.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr10u.dts index 3597a0d1bb..20f412e918 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr10u.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr10u.dts @@ -8,5 +8,5 @@ }; ®_usb_vbus { - gpio = <&gpio 18 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts index 7a1a577ed7..7b307cd6d0 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts @@ -76,7 +76,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts index b07f9a7820..91023111a6 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts @@ -72,7 +72,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 18 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n.dts b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n.dts index 0806bcc170..7fb87dab0f 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n.dts @@ -8,5 +8,5 @@ }; ®_usb_vbus { - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi index 329822ad10..303cb566ab 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi @@ -38,7 +38,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index 9faddcc37f..121a5d0396 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -20,7 +20,7 @@ compatible = "mikrotik,gpio-rb91x-key"; gpio-controller; #gpio-cells = <2>; - gpio = <&gpio 15 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; gpio_latch: gpio_latch { diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts index bf6706716f..d7e2e24239 100644 --- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts @@ -48,7 +48,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; - gpio = <&gpio 18 GPIO_ACTIVE_LOW>; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; }; usb_vbus: reg_usb_vbus { @@ -57,7 +57,7 @@ regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; enable-active-high; - gpio = <&gpio 19 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts index 227f57b9b4..6f96b61392 100644 --- a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts +++ b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts @@ -11,7 +11,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 11 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; }; diff --git a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts index c15cb677b9..9d95282451 100644 --- a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts +++ b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts @@ -83,7 +83,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 3 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; }; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap.dtsi b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi index 8abd3e60b7..0cf5eb6e66 100644 --- a/target/linux/ath79/dts/qca9558_sophos_ap.dtsi +++ b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi @@ -62,7 +62,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 11 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-boot-on; status = "disabled"; diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi index c4d910bf1e..35532f42c8 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi @@ -72,7 +72,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 21 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; enable-active-high; }; @@ -81,7 +81,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&gpio 22 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; enable-active-high; }; }; From 2e6ec200dfe6ee62380821bc001d0b546bc6f799 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Dec 2023 14:32:23 -0800 Subject: [PATCH 11/52] ath79: move kernel and ubi into subnodes Avoids dtc warnings regarding two sections having the same numbers. X: duplicate unit-address (also used in node Y) Signed-off-by: Rosen Penev --- .../linux/ath79/dts/ar9344_netgear_wndr.dtsi | 29 ++++++++++--------- .../linux/ath79/dts/qca9558_zyxel_nbg6716.dts | 20 ++++++++----- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi b/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi index d2a3000004..49057548f8 100644 --- a/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi +++ b/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi @@ -90,7 +90,7 @@ #address-cells = <1>; #size-cells = <1>; - ubi@ac0000 { + ubi@0 { label = "ubi"; reg = <0x0 0x7500000>; }; @@ -171,22 +171,23 @@ reg = <0x3c0000 0x300000>; }; - kernel@6c0000 { - label = "kernel"; - reg = <0x6c0000 0x400000>; - }; - - ubiconcat0: partition@ac0000 { - label = "ubiconcat0"; - reg = <0xac0000 0x1500000>; - }; - partition@6c0000 { label = "firmware"; reg = <0x6c0000 0x1900000>; - compatible = "openwrt,uimage", "denx,uimage"; - openwrt,ih-magic = <0x33373033>; - openwrt,ih-type = ; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + kernel@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + ubiconcat0: partition@400000 { + label = "ubiconcat0"; + reg = <0x400000 0x1500000>; + }; }; partition@1fc0000 { diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts index 9aee8c362c..20230e684e 100644 --- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts +++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts @@ -143,16 +143,20 @@ firmware@500000 { label = "firmware"; reg = <0x500000 0x7b00000>; - }; - partition@500000 { - label = "kernel"; - reg = <0x500000 0x400000>; - }; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@900000 { - label = "ubi"; - reg = <0x900000 0x7700000>; + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x7700000>; + }; }; }; }; From e4a43cda0efba562d0ed1973b584c21309040ccc Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 17 May 2022 17:50:23 -0400 Subject: [PATCH 12/52] build: allow var.% targets to bypass the prepare steps These targets are used to input variable values from the Make context into other things like python scripts, so log messages should be silenced and build prerequisites should be skipped. The same thing is done for the other variable print target "val.%". While at it, combine identical target rules into one definition. Signed-off-by: Michael Pratt --- include/toplevel.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index 328214be1b..96f32139d9 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -210,9 +210,7 @@ prereq:: prepare-tmpinfo .config @+$(NO_TRACE_MAKE) -r -s $@ check: .config FORCE - @+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s - -val.%: FORCE +check val.% var.%: FORCE @+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s WARN_PARALLEL_ERROR = $(if $(BUILD_LOG),,$(and $(filter -j,$(MAKEFLAGS)),$(findstring s,$(OPENWRT_VERBOSE)))) From fd3376c5eeccc1f1753483ed31ffff03808ce31d Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 Nov 2023 05:10:12 -0500 Subject: [PATCH 13/52] build: ensure silent Make behavior for json scripts Run the invocation of Make with verbosity in order to prevent the printing of Makefile level and subtarget status. e.g. make[3] -C target/linux val.DEFAULT_PACKAGES val.ARCH_PACKAGES Remove piping of stderr, which is only useful when using the "communicate" method over the "run" method, and this script would not be written to handle a captured error anyway. For error testing, stdout and stderr can be set to a file object with the open() function like this: out = open('json_out', 'w') err = open('json_err', 'w') ... ... stdout=out, stderr=err, Signed-off-by: Michael Pratt --- scripts/json_overview_image_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 89b7d4fe20..0d2cf7f1ef 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -55,9 +55,9 @@ if output: "target/linux/", "val.DEFAULT_PACKAGES", "val.ARCH_PACKAGES", + "V=s", ], stdout=PIPE, - stderr=PIPE, check=True, env=environ.copy().update({"TOPDIR": Path().cwd()}), universal_newlines=True, From 14a3eadf059dd3f7db75ab88e89cf25d0d1680da Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 17 May 2022 23:06:36 -0400 Subject: [PATCH 14/52] verbose.mk: fallback to standard file descriptors In order to pass a status message at runtime, which is usually listing subtargets of a Makefile target or an error message, from a child invocation of Make (submake) through the parent process to the terminal, the file descriptors 8 and 9 are opened to be used by the functions MESSAGE and ERROR_MESSAGE. However, there are situations where those functions can be called while not in a submake or a subshell or a child process which results in a shell error: /bin/bash: 8: Bad file descriptor Commit aee3594ffcb72ae3e18c3719012d52519ee2d160 ("verbose.mk: print ERROR messages in non-verbose") has exposed this issue to more cases, but it is not the root cause. To solve this, use the exit code of the first printf attempt to the alternative file descriptors in order to tell whether the standard file descriptors need to be used instead. In order to get rid of the "Bad file descriptor" error, stderr is redirected to null after grouping the two printf alternatives into one command to combine outputs. For ERROR_MESSAGE, the real message is redirected to stderr after redirecting the error from the attempted printing to null. For MESSAGE, without redirection, the Make function "shell" will absorb the actual message from stdout and input the value into the Makefile, therefore the dummy variable "_NULL", previously used merely for causing a call to the MESSAGE function to trigger without writing target rules, now has and a real value when defined, so rename it to "_MESSAGE" as a placeholder for the real message when the output should be stdout. When "_MESSAGE" has a value, use Make function "info" to finally bring it from the Makefile to the terminal. This also fixes what is likely a typo, in that while file descriptor 9 is meant to redirect to stderr for use in error messages like in the function ERROR_MESSAGE, that function has printf redirecting to file descriptor 8 instead. Fixes: a4c8d4e37 ("build: make the color of the 'configuration out of sync' warning red") Signed-off-by: Michael Pratt --- include/verbose.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/verbose.mk b/include/verbose.mk index 4487a207e8..f6aa0d7012 100644 --- a/include/verbose.mk +++ b/include/verbose.mk @@ -30,12 +30,18 @@ ifeq ($(IS_TTY),1) endif define ERROR_MESSAGE - printf "$(_R)%s$(_N)\n" "$(1)" >&8 + { \ + printf "$(_R)%s$(_N)\n" "$(1)" >&9 || \ + printf "$(_R)%s$(_N)\n" "$(1)"; \ + } >&2 2>/dev/null endef ifeq ($(findstring s,$(OPENWRT_VERBOSE)),) define MESSAGE - printf "$(_Y)%s$(_N)\n" "$(1)" >&8 + { \ + printf "$(_Y)%s$(_N)\n" "$(1)" >&8 || \ + printf "$(_Y)%s$(_N)\n" "$(1)"; \ + } 2>/dev/null endef ifeq ($(QUIET),1) @@ -44,9 +50,12 @@ ifeq ($(findstring s,$(OPENWRT_VERBOSE)),) else _DIR:= endif - _NULL:=$(if $(MAKECMDGOALS),$(shell \ + _MESSAGE:=$(if $(MAKECMDGOALS),$(shell \ $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \ )) + ifneq ($(strip $(_MESSAGE)),) + $(info $(_MESSAGE)) + endif SUBMAKE=$(MAKE) else SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1) From 6ca8752a9cadac810f8541ec1be67d02265175aa Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Wed, 3 Jan 2024 18:43:33 +0200 Subject: [PATCH 15/52] mac80211: add missing newline for "min_tx_power" This prevents min_tx_power from functioning properly in some circumstances. Add the missing newline. Signed-off-by: Rany Hany --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 1bf4db6e5f..b5378e556e 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -145,7 +145,7 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ channel_list="$channel" - [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N" set_default noscan 0 From ce4ee14a46f54403380afac88af912940f8f5ca8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 15 Oct 2023 13:53:11 -0700 Subject: [PATCH 16/52] ag71xx: fix wrong register definition issue Documentation fix from QCA SDK. Signed-off-by: Rosen Penev --- .../net/ethernet/atheros/ag71xx/ag71xx.h | 38 +++++++++---------- .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 10 ++--- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index 0773f1a5af..fca072a83a 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -310,11 +310,11 @@ ag71xx_ring_size_order(int size) #define FIFO_CFG4_MC BIT(8) /* Multicast Packet */ #define FIFO_CFG4_BC BIT(9) /* Broadcast Packet */ #define FIFO_CFG4_DR BIT(10) /* Dribble */ -#define FIFO_CFG4_LE BIT(11) /* Long Event */ -#define FIFO_CFG4_CF BIT(12) /* Control Frame */ -#define FIFO_CFG4_PF BIT(13) /* Pause Frame */ -#define FIFO_CFG4_UO BIT(14) /* Unsupported Opcode */ -#define FIFO_CFG4_VT BIT(15) /* VLAN tag detected */ +#define FIFO_CFG4_CF BIT(11) /* Control Frame */ +#define FIFO_CFG4_PF BIT(12) /* Pause Frame */ +#define FIFO_CFG4_UO BIT(13) /* Unsupported Opcode */ +#define FIFO_CFG4_VT BIT(14) /* VLAN tag detected */ +#define FIFO_CFG4_LE BIT(15) /* Long Event */ #define FIFO_CFG4_FT BIT(16) /* Frame Truncated */ #define FIFO_CFG4_UC BIT(17) /* Unicast Packet */ @@ -322,20 +322,20 @@ ag71xx_ring_size_order(int size) #define FIFO_CFG5_DV BIT(1) /* RX_DV Event */ #define FIFO_CFG5_FC BIT(2) /* False Carrier */ #define FIFO_CFG5_CE BIT(3) /* Code Error */ -#define FIFO_CFG5_LM BIT(4) /* Length Mismatch */ -#define FIFO_CFG5_LO BIT(5) /* Length Out of Range */ -#define FIFO_CFG5_OK BIT(6) /* Packet is OK */ -#define FIFO_CFG5_MC BIT(7) /* Multicast Packet */ -#define FIFO_CFG5_BC BIT(8) /* Broadcast Packet */ -#define FIFO_CFG5_DR BIT(9) /* Dribble */ -#define FIFO_CFG5_CF BIT(10) /* Control Frame */ -#define FIFO_CFG5_PF BIT(11) /* Pause Frame */ -#define FIFO_CFG5_UO BIT(12) /* Unsupported Opcode */ -#define FIFO_CFG5_VT BIT(13) /* VLAN tag detected */ -#define FIFO_CFG5_LE BIT(14) /* Long Event */ -#define FIFO_CFG5_FT BIT(15) /* Frame Truncated */ -#define FIFO_CFG5_16 BIT(16) /* unknown */ -#define FIFO_CFG5_17 BIT(17) /* unknown */ +#define FIFO_CFG5_CR BIT(4) /* CRC error */ +#define FIFO_CFG5_LM BIT(5) /* Length Mismatch */ +#define FIFO_CFG5_LO BIT(6) /* Length out of range */ +#define FIFO_CFG5_OK BIT(7) /* Packet is OK */ +#define FIFO_CFG5_MC BIT(8) /* Multicast Packet */ +#define FIFO_CFG5_BC BIT(9) /* Broadcast Packet */ +#define FIFO_CFG5_DR BIT(10) /* Dribble */ +#define FIFO_CFG5_CF BIT(11) /* Control Frame */ +#define FIFO_CFG5_PF BIT(12) /* Pause Frame */ +#define FIFO_CFG5_UO BIT(13) /* Unsupported Opcode */ +#define FIFO_CFG5_VT BIT(14) /* VLAN tag detected */ +#define FIFO_CFG5_LE BIT(15) /* Long Event */ +#define FIFO_CFG5_FT BIT(16) /* Frame Truncated */ +#define FIFO_CFG5_UC BIT(17) /* Unicast Packet */ #define FIFO_CFG5_SF BIT(18) /* Short Frame */ #define FIFO_CFG5_BM BIT(19) /* Byte Mode */ diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 8f95210e0f..8a5cd3bcde 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -407,11 +407,11 @@ static void ag71xx_dma_reset(struct ag71xx *ag) FIFO_CFG4_VT) #define FIFO_CFG5_INIT (FIFO_CFG5_DE | FIFO_CFG5_DV | FIFO_CFG5_FC | \ - FIFO_CFG5_CE | FIFO_CFG5_LO | FIFO_CFG5_OK | \ - FIFO_CFG5_MC | FIFO_CFG5_BC | FIFO_CFG5_DR | \ - FIFO_CFG5_CF | FIFO_CFG5_PF | FIFO_CFG5_VT | \ - FIFO_CFG5_LE | FIFO_CFG5_FT | FIFO_CFG5_16 | \ - FIFO_CFG5_17 | FIFO_CFG5_SF) + FIFO_CFG5_CE | FIFO_CFG5_LM | FIFO_CFG5_LO | \ + FIFO_CFG5_OK | FIFO_CFG5_MC | FIFO_CFG5_BC | \ + FIFO_CFG5_DR | FIFO_CFG5_CF | FIFO_CFG5_UO | \ + FIFO_CFG5_VT | FIFO_CFG5_LE | FIFO_CFG5_FT | \ + FIFO_CFG5_UC | FIFO_CFG5_SF) static void ag71xx_hw_stop(struct ag71xx *ag) { From 3acd5843611fd0902096871e97755ccef47803ba Mon Sep 17 00:00:00 2001 From: Michael 'ASAP' Weinrich Date: Sun, 1 Oct 2023 00:03:51 -0700 Subject: [PATCH 17/52] realtek: fix network connectivity on GS750E Currently OpenWRT does not know how to properly reset the network switch. This would result in a switch that seemed to come up properly but was unable to handle any traffic. Presumably something earlier in the boot chain is configuring a part of the switch that gets wiped out when its reset. For now comment out the reset GPIO entry in the device tree until the driver better supports bringing up the switch after a reset. Signed-off-by: Michael 'ASAP' Weinrich --- target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts b/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts index 750af3e94f..1d1e08db94 100644 --- a/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts +++ b/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts @@ -107,7 +107,8 @@ compatible = "realtek,rtl838x-mdio"; #address-cells = <1>; #size-cells = <0>; - reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + // Switch doesn't come back properly after a reset so don't. + // reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; /* External phy RTL8218B #1 */ EXTERNAL_PHY(0) From f1de1a090fadc74504b3ee1b5bcb914c9110bc6f Mon Sep 17 00:00:00 2001 From: Michael 'ASAP' Weinrich Date: Thu, 4 Jan 2024 15:42:07 -0500 Subject: [PATCH 18/52] realtek: correct typo in port numbering Port 10 was incorrectly labelled as nonexistent port 0. Signed-off-by: Michael 'ASAP' Weinrich --- target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts b/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts index 1d1e08db94..5a7ed276bf 100644 --- a/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts +++ b/target/linux/realtek/dts-5.15/rtl8393_netgear_gs750e.dts @@ -191,7 +191,7 @@ SWITCH_PORT(7, 8, qsgmii) SWITCH_PORT(8, 9, qsgmii) - SWITCH_PORT(9, 0, qsgmii) + SWITCH_PORT(9, 10, qsgmii) SWITCH_PORT(10, 11, qsgmii) SWITCH_PORT(11, 12, qsgmii) SWITCH_PORT(12, 13, qsgmii) From bcdab304678f0ea5ae2d57eb93c946e9416583cf Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 29 Oct 2023 08:47:17 +0000 Subject: [PATCH 19/52] mediatek: MERCUSYS MR90X v1: remove deprecated led "label" properties This commit: 1. Removes deprecated "label" property from the dts leds subnnodes; 2. Updates "01_leds" script. Link: https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/common.yaml Link: https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.yaml Signed-off-by: Mikhail Zhilkin --- .../dts/mt7986b-mercusys-mr90x-v1.dts | 24 +++++++++++++------ .../filogic/base-files/etc/board.d/01_leds | 6 ++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts index 42250be19a..f0a995820e 100644 --- a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -3,6 +3,7 @@ /dts-v1/; #include #include +#include #include "mt7986b.dtsi" @@ -41,34 +42,43 @@ compatible = "gpio-leds"; led-0 { - label = "green:lan2"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; gpios = <&pio 7 GPIO_ACTIVE_LOW>; }; led-1 { - label = "green:lan1"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; led-2 { - label = "green:lan0"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; led-3 { - label = "green:wan"; + color = ; + function = LED_FUNCTION_WAN; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; led-4 { - label = "orange:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + panic-indicator; }; led_status_green: led-5 { - label = "green:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&pio 17 GPIO_ACTIVE_HIGH>; - panic-indicator; }; }; }; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 360bdea9c8..b786558618 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -16,9 +16,9 @@ cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; mercusys,mr90x-v1) - ucidef_set_led_netdev "lan0" "lan0" "green:lan0" "lan0" "link tx rx" - ucidef_set_led_netdev "lan1" "lan2" "green:lan1" "lan1" "link tx rx" - ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" + ucidef_set_led_netdev "lan-1" "lan-1" "green:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan-2" "lan-2" "green:lan-2" "lan2" "link tx rx" ucidef_set_led_netdev "wan" "wan" "green:wan" "eth1" "link tx rx" ;; netgear,wax220) From 37bb3893929fc3277e7d26ff0012d86526c98b77 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 5 Jan 2024 15:40:08 -0500 Subject: [PATCH 20/52] kernel: bump 5.15 to 5.15.146 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.146 Removed upstreamed: generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.146&id=ac385518598f50dd1b9b41bd05f50ce9795481d5 Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.15 | 4 +-- .../209-b44-register-adm-switch.patch | 6 ++-- .../patches-5.15/210-b44_phy_fix.patch | 6 ++-- ...net-usb-ax88179_178a-add-TSO-feature.patch | 6 ++-- ...v6.4-0003-of-Rename-of_modalias_node.patch | 2 +- .../721-net-add-packet-mangeling.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 4 +-- ...ksmbd-have-a-dependency-on-cifs-arc4.patch | 31 ------------------- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 10 +++--- ...ional-threading-for-backlog-processi.patch | 18 +++++------ ...-Add-support-for-dynamic-calibration.patch | 6 ++-- ...move-drivers-from-strlcpy-to-strscpy.patch | 2 +- 12 files changed, 33 insertions(+), 64 deletions(-) delete mode 100644 target/linux/generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 2948d10bdc..f8ecac5742 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .145 -LINUX_KERNEL_HASH-5.15.145 = b2a49d87605f3a9491581150315e22337c1afb599efc1e2737481be3a2d6d620 +LINUX_VERSION-5.15 = .146 +LINUX_KERNEL_HASH-5.15.146 = 5a807a5fa2a80ada957d8079681dfb5cc196ec26f43244d1c8a4fd7af592d192 diff --git a/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch b/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch index 7728ec1094..772e905ecb 100644 --- a/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch +++ b/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch @@ -19,7 +19,7 @@ Subject: [PATCH 210/210] b44: register adm switch #include #include -@@ -2243,6 +2245,69 @@ static void b44_adjust_link(struct net_d +@@ -2245,6 +2247,69 @@ static void b44_adjust_link(struct net_d } } @@ -89,7 +89,7 @@ Subject: [PATCH 210/210] b44: register adm switch static int b44_register_phy_one(struct b44 *bp) { __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -@@ -2279,6 +2344,9 @@ static int b44_register_phy_one(struct b +@@ -2281,6 +2346,9 @@ static int b44_register_phy_one(struct b if (!mdiobus_is_registered_device(bp->mii_bus, bp->phy_addr) && (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) { @@ -99,7 +99,7 @@ Subject: [PATCH 210/210] b44: register adm switch dev_info(sdev->dev, "could not find PHY at %i, use fixed one\n", bp->phy_addr); -@@ -2473,6 +2541,7 @@ static void b44_remove_one(struct ssb_de +@@ -2475,6 +2543,7 @@ static void b44_remove_one(struct ssb_de unregister_netdev(dev); if (bp->flags & B44_FLAG_EXTERNAL_PHY) b44_unregister_phy_one(bp); diff --git a/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch b/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch index bedebc415e..ca7123f2a3 100644 --- a/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch +++ b/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c -@@ -429,10 +429,34 @@ static void b44_wap54g10_workaround(stru +@@ -430,10 +430,34 @@ static void b44_wap54g10_workaround(stru error: pr_warn("PHY: cannot reset MII transceiver isolate bit\n"); } @@ -35,7 +35,7 @@ #endif static int b44_setup_phy(struct b44 *bp) -@@ -441,6 +465,7 @@ static int b44_setup_phy(struct b44 *bp) +@@ -442,6 +466,7 @@ static int b44_setup_phy(struct b44 *bp) int err; b44_wap54g10_workaround(bp); @@ -43,7 +43,7 @@ if (bp->flags & B44_FLAG_EXTERNAL_PHY) return 0; -@@ -2173,6 +2198,8 @@ static int b44_get_invariants(struct b44 +@@ -2175,6 +2200,8 @@ static int b44_get_invariants(struct b44 * valid PHY address. */ bp->phy_addr &= 0x1F; diff --git a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch index a2168aaba5..598fa05e9b 100644 --- a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch +++ b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c -@@ -1377,11 +1377,12 @@ static int ax88179_bind(struct usbnet *d +@@ -1363,11 +1363,12 @@ static int ax88179_bind(struct usbnet *d dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1; @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | -@@ -1587,17 +1588,19 @@ ax88179_tx_fixup(struct usbnet *dev, str +@@ -1573,17 +1574,19 @@ ax88179_tx_fixup(struct usbnet *dev, str { u32 tx_hdr1, tx_hdr2; int frame_size = dev->maxpacket; @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller if ((skb_header_cloned(skb) || headroom < 0) && pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) { dev_kfree_skb_any(skb); -@@ -1608,6 +1611,8 @@ ax88179_tx_fixup(struct usbnet *dev, str +@@ -1594,6 +1597,8 @@ ax88179_tx_fixup(struct usbnet *dev, str put_unaligned_le32(tx_hdr1, ptr); put_unaligned_le32(tx_hdr2, ptr + 4); diff --git a/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch b/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch index 6c20521701..855d45311e 100644 --- a/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch +++ b/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch @@ -148,7 +148,7 @@ Signed-off-by: Greg Kroah-Hartman * of_find_node_by_phandle - Find a node given a phandle --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -2128,8 +2128,8 @@ of_register_spi_device(struct spi_contro +@@ -2140,8 +2140,8 @@ of_register_spi_device(struct spi_contro } /* Select device driver */ diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index 262a58036e..b03b4a674f 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3597,6 +3597,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3600,6 +3600,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 60f02f7143..0060fbbd2a 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -43,7 +43,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1146,6 +1151,11 @@ static const struct usb_device_id option +@@ -1147,6 +1152,11 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, @@ -55,7 +55,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support /* Quectel products using Qualcomm vendor ID */ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), -@@ -1187,6 +1197,11 @@ static const struct usb_device_id option +@@ -1188,6 +1198,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch b/target/linux/generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch deleted file mode 100644 index 4cf420a859..0000000000 --- a/target/linux/generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Namjae Jeon -To: sashal@kernel.org, gregkh@linuxfoundation.org, stable@vger.kernel.org -Cc: smfrench@gmail.com, Namjae Jeon -Subject: [PATCH v2 5.15.y 1/8] ksmbd: have a dependency on cifs ARC4 -Date: Wed, 27 Dec 2023 19:25:58 +0900 [thread overview] -Message-ID: <20231227102605.4766-2-linkinjeon@kernel.org> (raw) -In-Reply-To: <20231227102605.4766-1-linkinjeon@kernel.org> - -Omitted the change that has a dependency on cifs ARC4 from backporting -commit f9929ef6a2a5("ksmbd: add support for key exchange"). -This patch make ksmbd have a dependeny on cifs ARC4. - -Fixes: c5049d2d73b2 ("ksmbd: add support for key exchange") -Signed-off-by: Namjae Jeon ---- - fs/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig" - - config SMBFS_COMMON - tristate -- default y if CIFS=y -- default m if CIFS=m -+ default y if CIFS=y || SMB_SERVER=y -+ default m if CIFS=m || SMB_SERVER=m - - source "fs/coda/Kconfig" - source "fs/afs/Kconfig" diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 89b0c9f53c..c6a6c6e797 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6074,6 +6074,9 @@ static enum gro_result dev_gro_receive(s +@@ -6077,6 +6077,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8088,6 +8091,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8091,6 +8094,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8139,6 +8184,7 @@ static int __netdev_upper_dev_link(struc +@@ -8142,6 +8187,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8235,6 +8281,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8238,6 +8284,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9054,6 +9101,7 @@ int dev_set_mac_address(struct net_devic +@@ -9057,6 +9104,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index 685a11f22d..c8d0bc69f9 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4583,7 +4583,7 @@ static int rps_ipi_queued(struct softnet +@@ -4586,7 +4586,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5764,6 +5764,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5767,6 +5767,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5779,9 +5781,18 @@ static void flush_backlog(struct work_st +@@ -5782,9 +5784,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5789,7 +5800,18 @@ static void flush_backlog(struct work_st +@@ -5792,7 +5803,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6472,6 +6494,7 @@ static int process_backlog(struct napi_s +@@ -6475,6 +6497,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6481,7 +6504,8 @@ static int process_backlog(struct napi_s +@@ -6484,7 +6507,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6898,6 +6922,57 @@ int dev_set_threaded(struct net_device * +@@ -6901,6 +6925,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11378,6 +11453,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11381,6 +11456,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11717,6 +11795,7 @@ static int __init net_dev_init(void) +@@ -11720,6 +11798,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif diff --git a/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch b/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch index 4c980e9438..e795eda3b2 100644 --- a/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch +++ b/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch @@ -11,7 +11,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -1234,6 +1234,70 @@ static int spi_transfer_wait(struct spi_ +@@ -1246,6 +1246,70 @@ static int spi_transfer_wait(struct spi_ return 0; } @@ -82,7 +82,7 @@ Signed-off-by: SkyLake.Huang static void _spi_transfer_delay_ns(u32 ns) { if (!ns) -@@ -2021,6 +2085,75 @@ void spi_flush_queue(struct spi_controll +@@ -2033,6 +2097,75 @@ void spi_flush_queue(struct spi_controll /*-------------------------------------------------------------------------*/ #if defined(CONFIG_OF) @@ -158,7 +158,7 @@ Signed-off-by: SkyLake.Huang static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, struct device_node *nc) { -@@ -2139,6 +2272,10 @@ of_register_spi_device(struct spi_contro +@@ -2151,6 +2284,10 @@ of_register_spi_device(struct spi_contro if (rc) goto err_out; diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 69f2d2a545..d5c8a4e300 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -72,7 +72,7 @@ Signed-off-by: Wolfram Sang idev->adapter.dev.parent = &pdev->dev; --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1028,7 +1028,7 @@ static int aspeed_i2c_probe_bus(struct p +@@ -1044,7 +1044,7 @@ static int aspeed_i2c_probe_bus(struct p bus->adap.algo = &aspeed_i2c_algo; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; From f45fa6b45abf29a0d74c2f2ea4b8e18b6334f2e2 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 5 Jan 2024 15:37:47 -0500 Subject: [PATCH 21/52] kernel: bump 6.1 to 6.1.71 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.71 Manually rebased: gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch All patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia --- include/kernel-6.1 | 4 ++-- ...-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch | 4 ++-- ...g210-Collect-pieces-of-dual-mode-controller.patch | 5 +---- .../828-v6.4-0003-of-Rename-of_modalias_node.patch | 2 +- ...ers-spi-Add-support-for-dynamic-calibration.patch | 12 ++++++------ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/kernel-6.1 b/include/kernel-6.1 index 8cfdaad6d7..c52b94712f 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .70 -LINUX_KERNEL_HASH-6.1.70 = ed1365266456c07696a7499581aec5d851ca2296f4f6f90f23d189ea5a56afef +LINUX_VERSION-6.1 = .71 +LINUX_KERNEL_HASH-6.1.71 = 2df774dd53f9ffd4e57ebf804cf597709295df6a304fe261d25220a134b7f041 diff --git a/target/linux/bcm27xx/patches-6.1/950-0227-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch b/target/linux/bcm27xx/patches-6.1/950-0227-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch index dfbea6258f..974a516829 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0227-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0227-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch @@ -32,7 +32,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -3633,6 +3633,7 @@ static int __spi_validate_bits_per_word( +@@ -3675,6 +3675,7 @@ static int spi_set_cs_timing(struct spi_ */ int spi_setup(struct spi_device *spi) { @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell unsigned bad_bits, ugly_bits; int status = 0; -@@ -3653,6 +3654,14 @@ int spi_setup(struct spi_device *spi) +@@ -3695,6 +3696,14 @@ int spi_setup(struct spi_device *spi) (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL))) return -EINVAL; diff --git a/target/linux/gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch b/target/linux/gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch index 902bf4c68f..1ee4f27c46 100644 --- a/target/linux/gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch +++ b/target/linux/gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch @@ -104,7 +104,7 @@ Signed-off-by: Greg Kroah-Hartman +obj-$(CONFIG_USB_FOTG210_UDC) += fotg210-udc.o --- a/drivers/usb/host/fotg210-hcd.c +++ /dev/null -@@ -1,5727 +0,0 @@ +@@ -1,5724 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* Faraday FOTG210 EHCI-like driver - * @@ -536,8 +536,6 @@ Signed-off-by: Greg Kroah-Hartman - temp = size; - size -= temp; - next += temp; -- if (temp == size) -- goto done; - } - - temp = snprintf(next, size, "\n"); @@ -547,7 +545,6 @@ Signed-off-by: Greg Kroah-Hartman - size -= temp; - next += temp; - --done: - *sizep = size; - *nextp = next; -} diff --git a/target/linux/generic/backport-6.1/828-v6.4-0003-of-Rename-of_modalias_node.patch b/target/linux/generic/backport-6.1/828-v6.4-0003-of-Rename-of_modalias_node.patch index f82dc1428a..15af039a16 100644 --- a/target/linux/generic/backport-6.1/828-v6.4-0003-of-Rename-of_modalias_node.patch +++ b/target/linux/generic/backport-6.1/828-v6.4-0003-of-Rename-of_modalias_node.patch @@ -148,7 +148,7 @@ Signed-off-by: Greg Kroah-Hartman * of_find_node_by_phandle - Find a node given a phandle --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -2315,8 +2315,8 @@ of_register_spi_device(struct spi_contro +@@ -2326,8 +2326,8 @@ of_register_spi_device(struct spi_contro } /* Select device driver */ diff --git a/target/linux/mediatek/patches-6.1/432-drivers-spi-Add-support-for-dynamic-calibration.patch b/target/linux/mediatek/patches-6.1/432-drivers-spi-Add-support-for-dynamic-calibration.patch index 4f9ad9acef..9aeeb78658 100644 --- a/target/linux/mediatek/patches-6.1/432-drivers-spi-Add-support-for-dynamic-calibration.patch +++ b/target/linux/mediatek/patches-6.1/432-drivers-spi-Add-support-for-dynamic-calibration.patch @@ -11,7 +11,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -1374,6 +1374,70 @@ static int spi_transfer_wait(struct spi_ +@@ -1385,6 +1385,70 @@ static int spi_transfer_wait(struct spi_ return 0; } @@ -82,7 +82,7 @@ Signed-off-by: SkyLake.Huang static void _spi_transfer_delay_ns(u32 ns) { if (!ns) -@@ -2208,6 +2272,75 @@ void spi_flush_queue(struct spi_controll +@@ -2219,6 +2283,75 @@ void spi_flush_queue(struct spi_controll /*-------------------------------------------------------------------------*/ #if defined(CONFIG_OF) @@ -158,7 +158,7 @@ Signed-off-by: SkyLake.Huang static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, struct device_node *nc) { -@@ -2326,6 +2459,10 @@ of_register_spi_device(struct spi_contro +@@ -2337,6 +2470,10 @@ of_register_spi_device(struct spi_contro if (rc) goto err_out; @@ -171,7 +171,7 @@ Signed-off-by: SkyLake.Huang spi->dev.of_node = nc; --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h -@@ -298,6 +298,40 @@ struct spi_driver { +@@ -318,6 +318,40 @@ struct spi_driver { struct device_driver driver; }; @@ -212,7 +212,7 @@ Signed-off-by: SkyLake.Huang static inline struct spi_driver *to_spi_driver(struct device_driver *drv) { return drv ? container_of(drv, struct spi_driver, driver) : NULL; -@@ -683,6 +717,11 @@ struct spi_controller { +@@ -703,6 +737,11 @@ struct spi_controller { void *dummy_rx; void *dummy_tx; @@ -224,7 +224,7 @@ Signed-off-by: SkyLake.Huang int (*fw_translate_cs)(struct spi_controller *ctlr, unsigned cs); /* -@@ -1490,6 +1529,9 @@ spi_register_board_info(struct spi_board +@@ -1510,6 +1549,9 @@ spi_register_board_info(struct spi_board { return 0; } #endif From ee82d9606fd5cd38778604aabefccd61d4028733 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 12 Dec 2023 04:58:29 +0000 Subject: [PATCH 22/52] ramips: reset mt7620 frame engine via reset controller Use reset controller to reset mt7620 frame engine instead of directly writing system control registers. Tested on HiWiFi HC5861. Signed-off-by: Shiji Yang --- .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 7 ++----- .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h | 4 ---- .../ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c | 6 ------ 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index dab8a173f7..9c11e9cc89 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -141,7 +141,7 @@ void fe_reset(u32 reset_bits) usleep_range(10, 20); } -void fe_reset_fe(struct fe_priv *priv) +static void fe_reset_fe(struct fe_priv *priv) { if (!priv->resets) return; @@ -1366,10 +1366,7 @@ static int __init fe_init(struct net_device *dev) struct device_node *port; int err; - if (priv->soc->reset_fe) - priv->soc->reset_fe(priv); - else - fe_reset_fe(priv); + fe_reset_fe(priv); if (priv->soc->switch_init) { err = priv->soc->switch_init(priv); diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h index 892ffb2126..619319d18e 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h @@ -157,8 +157,6 @@ enum fe_work_flag { #define MT7620A_FE_GDMA1_MAC_ADRL (MT7620A_GDMA_OFFSET + 0x0C) #define MT7620A_FE_GDMA1_MAC_ADRH (MT7620A_GDMA_OFFSET + 0x10) -#define MT7620A_RESET_FE BIT(21) -#define MT7620A_RESET_ESW BIT(23) #define MT7620A_RESET_EPHY BIT(24) #define RT5350_TX_BASE_PTR0 (RT5350_PDMA_OFFSET + 0x00) @@ -382,7 +380,6 @@ struct fe_soc_data { const u16 *reg_table; void (*init_data)(struct fe_soc_data *data, struct net_device *netdev); - void (*reset_fe)(struct fe_priv *priv); void (*set_mac)(struct fe_priv *priv, unsigned char *mac); int (*fwd_config)(struct fe_priv *priv); void (*tx_dma)(struct fe_tx_dma *txd); @@ -517,7 +514,6 @@ void fe_reg_w32(u32 val, enum fe_reg reg); u32 fe_reg_r32(enum fe_reg reg); void fe_reset(u32 reset_bits); -void fe_reset_fe(struct fe_priv *priv); static inline void *priv_netdev(struct fe_priv *priv) { diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c index a4b2908d59..172dda11b7 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c @@ -286,11 +286,6 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) } } -static void mt7620_fe_reset(struct fe_priv *priv) -{ - fe_reset(MT7620A_RESET_FE | MT7620A_RESET_ESW); -} - static void mt7620_rxcsum_config(bool enable) { if (enable) @@ -348,7 +343,6 @@ static void mt7620_init_data(struct fe_soc_data *data, static struct fe_soc_data mt7620_data = { .init_data = mt7620_init_data, - .reset_fe = mt7620_fe_reset, .set_mac = mt7620_set_mac, .fwd_config = mt7620_fwd_config, .tx_dma = mt7620_tx_dma, From f547fc9d579e894257cccfebec3a374e27e69e0c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 12 Dec 2023 05:18:45 +0000 Subject: [PATCH 23/52] ramips: reset mt7620 ethernet phy via reset controller Use reset controller to reset mt7620 ethernet phy instead of directly writing system control registers. The reset line of "ephy" is 24, so the DTS resets properties have been updated to get the correct reset signal. Tested on HiWiFi HC5861. Signed-off-by: Shiji Yang --- target/linux/ramips/dts/mt7620a.dtsi | 4 ++-- target/linux/ramips/dts/mt7620n.dtsi | 4 ++-- .../drivers/net/ethernet/ralink/gsw_mt7620.c | 19 ++++++++++++++++++- .../drivers/net/ethernet/ralink/gsw_mt7620.h | 3 +++ .../drivers/net/ethernet/ralink/mtk_eth_soc.c | 16 ---------------- .../drivers/net/ethernet/ralink/mtk_eth_soc.h | 4 ---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi index a1dfa8c730..0fa503e7a2 100644 --- a/target/linux/ramips/dts/mt7620a.dtsi +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -490,8 +490,8 @@ compatible = "mediatek,mt7620-gsw"; reg = <0x10110000 0x8000>; - resets = <&sysc 23>; - reset-names = "esw"; + resets = <&sysc 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi index f4a5165704..4f07c6bc4b 100644 --- a/target/linux/ramips/dts/mt7620n.dtsi +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -317,8 +317,8 @@ compatible = "mediatek,mt7620-gsw"; reg = <0x10110000 0x8000>; - resets = <&sysc 23>; - reset-names = "esw"; + resets = <&sysc 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index 84b6e305a4..dcaff04db1 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -61,6 +61,17 @@ static irqreturn_t gsw_interrupt_mt7620(int irq, void *_priv) return IRQ_HANDLED; } +static void gsw_reset_ephy(struct mt7620_gsw *gsw) +{ + if (!gsw->rst_ephy) + return; + + reset_control_assert(gsw->rst_ephy); + usleep_range(10, 20); + reset_control_deassert(gsw->rst_ephy); + usleep_range(10, 20); +} + static void mt7620_ephy_init(struct mt7620_gsw *gsw) { u32 i; @@ -79,7 +90,7 @@ static void mt7620_ephy_init(struct mt7620_gsw *gsw) mtk_switch_w32(gsw, mtk_switch_r32(gsw, GSW_REG_GPC1) | (gsw->ephy_base << 16), GSW_REG_GPC1); - fe_reset(MT7620A_RESET_EPHY); + gsw_reset_ephy(gsw); pr_info("gsw: ephy base address: %d\n", gsw->ephy_base); } @@ -263,6 +274,12 @@ static int mt7620_gsw_probe(struct platform_device *pdev) gsw->irq = platform_get_irq(pdev, 0); + gsw->rst_ephy = devm_reset_control_get_exclusive(&pdev->dev, "ephy"); + if (IS_ERR(gsw->rst_ephy)) { + dev_err(gsw->dev, "failed to get EPHY reset: %pe\n", gsw->rst_ephy); + gsw->rst_ephy = NULL; + } + platform_set_drvdata(pdev, gsw); return 0; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h index cb5d098e9c..12cab39b77 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h @@ -12,6 +12,8 @@ * Copyright (C) 2013-2015 Michael Lee */ +#include + #ifndef _RALINK_GSW_MT7620_H__ #define _RALINK_GSW_MT7620_H__ @@ -90,6 +92,7 @@ enum { struct mt7620_gsw { struct device *dev; + struct reset_control *rst_ephy; void __iomem *base; int irq; bool ephy_disable; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 9c11e9cc89..c741c85f4a 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -61,8 +61,6 @@ #define NEXT_TX_DESP_IDX(X) (((X) + 1) & (ring->tx_ring_size - 1)) #define NEXT_RX_DESP_IDX(X) (((X) + 1) & (ring->rx_ring_size - 1)) -#define SYSC_REG_RSTCTRL 0x34 - static int fe_msg_level = -1; module_param_named(msg_level, fe_msg_level, int, 0); MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); @@ -127,20 +125,6 @@ void fe_m32(struct fe_priv *eth, u32 clear, u32 set, unsigned reg) spin_unlock(ð->page_lock); } -void fe_reset(u32 reset_bits) -{ - u32 t; - - t = rt_sysc_r32(SYSC_REG_RSTCTRL); - t |= reset_bits; - rt_sysc_w32(t, SYSC_REG_RSTCTRL); - usleep_range(10, 20); - - t &= ~reset_bits; - rt_sysc_w32(t, SYSC_REG_RSTCTRL); - usleep_range(10, 20); -} - static void fe_reset_fe(struct fe_priv *priv) { if (!priv->resets) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h index 619319d18e..7b291ff43e 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h @@ -157,8 +157,6 @@ enum fe_work_flag { #define MT7620A_FE_GDMA1_MAC_ADRL (MT7620A_GDMA_OFFSET + 0x0C) #define MT7620A_FE_GDMA1_MAC_ADRH (MT7620A_GDMA_OFFSET + 0x10) -#define MT7620A_RESET_EPHY BIT(24) - #define RT5350_TX_BASE_PTR0 (RT5350_PDMA_OFFSET + 0x00) #define RT5350_TX_MAX_CNT0 (RT5350_PDMA_OFFSET + 0x04) #define RT5350_TX_CTX_IDX0 (RT5350_PDMA_OFFSET + 0x08) @@ -513,8 +511,6 @@ void fe_fwd_config(struct fe_priv *priv); void fe_reg_w32(u32 val, enum fe_reg reg); u32 fe_reg_r32(enum fe_reg reg); -void fe_reset(u32 reset_bits); - static inline void *priv_netdev(struct fe_priv *priv) { return (char *)priv - ALIGN(sizeof(struct net_device), NETDEV_ALIGN); From 46a2490e8f24a1ad47e53b0b4ee875fa3658f2c1 Mon Sep 17 00:00:00 2001 From: Mohammad Sayful Islam Date: Wed, 3 Jan 2024 07:54:16 +0000 Subject: [PATCH 24/52] ipq807x: add support for Linksys MX4200 V1 and V2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linksys MX4200 is a 802.11ax Tri-band router/AP. Specifications: * CPU: Qualcomm IPQ8174 Quad core Cortex-A53 1.4GHz * RAM: 512MB of DDR3 * Storage: 512Mb NAND * Ethernet: 4x1G RJ45 ports (QCA8075) * WLAN: * 2.4GHz: Qualcomm QCN5024 2x2 802.11b/g/n/ax 574 Mbps PHY rate * 5GHz: Qualcomm QCN5054 2x2@80MHz or 2x2@160MHz 802.11a/b/g/n/ac/ax 2402 PHY rate * 5GHz: Qualcomm QCN5054 4x4@80MHz or 2x2@160MHz 802.11a/b/g/n/ac/ax 2402 PHY rate * LED-s: * RGB system led * Buttons: 1x Soft reset 1x WPS * Power: 12V DC Jack Installation instructions: Open Linksys Web UI - http://192.168.1.1/ca or http://10.65.1.1/ca depending on your setup. Login with your admin password. The default password can be found on a sticker under the device. To enter into the support mode, click on the “CA” link and the bottom of the page. Open the “Connectivity” menu and upload the squash-factory image with the “Choose file” button. Click start. Ignore all the prompts and warnings by click “yes” in all the popups. The Wifi radios are turned off by default. To configure the router, you will need to connect your computer to the LAN port of the device. Then you would need to write openwrt to the other partition for it to work - First Check booted partition fw_printenv -n boot_part - Then install Openwrt to the other partition if booted in slot 1: mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4200v(X)-squashfs-factory.bin alt_kernel - If in slot 2: mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4200v(X)-squashfs-factory.bin kernel Replace (X) with your model version either 1 or 2 Signed-off-by: Mohammad Sayful Islam Reviewed-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq807x | 6 + package/firmware/ipq-wifi/Makefile | 4 +- package/system/mtd/src/Makefile | 1 + .../arm64/boot/dts/qcom/ipq8174-mx4200.dtsi | 440 ++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4200v1.dts | 19 + .../arm64/boot/dts/qcom/ipq8174-mx4200v2.dts | 17 + target/linux/qualcommax/image/ipq807x.mk | 25 + .../ipq807x/base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 2 + .../ipq807x/base-files/etc/init.d/bootcount | 4 + .../base-files/lib/upgrade/platform.sh | 15 + 11 files changed, 534 insertions(+), 1 deletion(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 761d5dfcc9..bcedfd9adc 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -29,6 +29,12 @@ edimax,cax1800) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" ;; +linksys,mx4200v1|\ +linksys,mx4200v2) + idx="$(find_mtd_index u_env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ;; redmi,ax6|\ xiaomi,ax3600|\ xiaomi,ax9000) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index ef1a456403..189b8e9ec9 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -34,6 +34,7 @@ ALLWIFIBOARDS:= \ dynalink_dl-wrx36 \ edgecore_eap102 \ edimax_cax1800 \ + linksys_mx4200 \ netgear_rax120v2 \ netgear_wax218 \ netgear_wax620 \ @@ -83,7 +84,7 @@ define ipq-wifi-install-one $(call ipq-wifi-install-one-to,$(1),$(2),QCA9984/hw1.0),\ $(if $(filter $(suffix $(1)),.QCA99X0 .qca99x0),\ $(call ipq-wifi-install-one-to,$(1),$(2),QCA99X0/hw2.0),\ - $(if $(filter $(suffix $(1)),.IPQ8074 .ipq8074),\ + $(if $(filter $(suffix $(1)),.IPQ8074 .ipq8074 .ipq8174),\ $(call ipq-wifi-install-ath11-one-to,$(1),$(2),IPQ8074/hw2.0),\ $(if $(filter $(suffix $(1)),.QCN9074 .qcn9074),\ $(call ipq-wifi-install-ath11-one-to,$(1),$(2),QCN9074/hw1.0),\ @@ -144,6 +145,7 @@ $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) +$(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) $(eval $(call generate-ipq-wifi-package,netgear_rax120v2,Netgear RAX120v2)) $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218)) $(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620)) diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile index e204ecb221..a1277a6739 100644 --- a/package/system/mtd/src/Makefile +++ b/package/system/mtd/src/Makefile @@ -20,6 +20,7 @@ obj.mvebu = linksys_bootcount.o obj.kirkwood = linksys_bootcount.o obj.ipq806x = linksys_bootcount.o obj.ipq40xx = linksys_bootcount.o +obj.qualcommax = linksys_bootcount.o ifdef FIS_SUPPORT obj += fis.o diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi new file mode 100644 index 0000000000..ef67742c03 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -0,0 +1,440 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Mohammad Sayful Islam */ + +#include "ipq8074.dtsi" +#include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + + aliases { + serial0 = &blsp1_uart5; + serial1 = &blsp1_uart3; + /* + * Aliases as required by u-boot + * to patch MAC addresses + */ + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + led-boot = &led_system_blue; + led-running = &led_system_blue; + led-failsafe = &led_system_red; + led-upgrade = &led_system_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_0"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset-button { + label = "reset"; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps-button { + label = "wps"; + gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + button_pins: button-state { + pins = "gpio52", "gpio67"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio_pins: mdio-state { + mdc-pins { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio-pins { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + iot_pins: iot-state { + recovery-pins { + pins = "gpio22"; + function = "gpio"; + input; + }; + + reset-pins { + pins = "gpio21"; + function = "gpio"; + bias-pull-up; + }; + }; +}; + +&blsp1_uart3 { + status = "okay"; + + pinctrl-0 = <&hsuart_pins &iot_pins>; + pinctrl-names = "default"; + + /* Silicon Labs EFR32MG21 IoT */ +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + /* + * Bootloader will find the NAND DT node by the compatible and + * then "fixup" it by adding the partitions from the SMEM table + * using the legacy bindings thus making it impossible for us + * to change the partition table or utilize NVMEM for calibration. + * So add a dummy partitions node that bootloader will populate + * and set it as disabled so the kernel ignores it instead of + * printing warnings due to the broken way bootloader adds the + * partitions. + */ + partitions { + status = "disabled"; + }; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:sbl1"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "0:mibib"; + reg = <0x100000 0x100000>; + read-only; + }; + + partition@200000 { + label = "0:bootconfig"; + reg = <0x200000 0x80000>; + read-only; + }; + + partition@280000 { + label = "0:bootconfig1"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "0:qsee"; + reg = <0x300000 0x300000>; + read-only; + }; + + partition@600000 { + label = "0:qsee_1"; + reg = <0x600000 0x300000>; + read-only; + }; + + partition@900000 { + label = "0:devcfg"; + reg = <0x900000 0x80000>; + read-only; + }; + + partition@980000 { + label = "0:devcfg_1"; + reg = <0x980000 0x80000>; + read-only; + }; + + partition@a00000 { + label = "0:apdp"; + reg = <0xa00000 0x80000>; + read-only; + }; + + partition@a80000 { + label = "0:apdp_1"; + reg = <0xa80000 0x80000>; + read-only; + }; + + partition@b00000 { + label = "0:rpm"; + reg = <0xb00000 0x80000>; + read-only; + }; + + partition@b80000 { + label = "0:rpm_1"; + reg = <0xb80000 0x80000>; + read-only; + }; + + partition@c00000 { + label = "0:cdt"; + reg = <0xc00000 0x80000>; + read-only; + }; + + partition@c80000 { + label = "0:cdt_1"; + reg = <0xc80000 0x80000>; + read-only; + }; + + partition@d00000 { + label = "0:appsblenv"; + reg = <0xd00000 0x80000>; + }; + + partition@d80000 { + label = "0:appsbl"; + reg = <0xd80000 0x100000>; + read-only; + }; + + partition@e80000 { + label = "0:appsbl_1"; + reg = <0xe80000 0x100000>; + read-only; + }; + + partition@f80000 { + label = "0:art"; + reg = <0xf80000 0x80000>; + read-only; + }; + + partition@1000000 { + label = "u_env"; + reg = <0x1000000 0x40000>; + }; + + partition@1040000 { + label = "s_env"; + reg = <0x1040000 0x20000>; + }; + + partition@1060000 { + label = "devinfo"; + reg = <0x1060000 0x20000>; + read-only; + }; + + partition@1080000 { + label = "kernel"; + reg = <0x1080000 0x9600000>; + }; + + partition@1680000 { + label = "rootfs"; + reg = <0x1680000 0x9000000>; + }; + + partition@a680000 { + label = "alt_kernel"; + reg = <0xa680000 0x9600000>; + }; + + partition@ac80000 { + label = "alt_rootfs"; + reg = <0xac80000 0x9000000>; + }; + partition@13c80000 { + label = "sysdiag"; + reg = <0x13c80000 0x200000>; + read-only; + }; + partition@13e80000 { + label = "0:ethphyfw"; + reg = <0x13e80000 0x80000>; + read-only; + }; + partition@13f00000 { + label = "syscfg"; + reg = <0x13f00000 0xb800000>; + read-only; + }; + partition@1f700000 { + label = "0:wififw"; + reg = <0x1f700000 0x900000>; + read-only; + }; + }; + }; +}; + +&blsp1_i2c2 { + status = "okay"; + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + port@3 { + port_id = <3>; + phy_address = <2>; + }; + port@4 { + port_id = <4>; + phy_address = <3>; + }; + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "wan"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan1"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan3"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; + diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts new file mode 100644 index 0000000000..4bc1b8cc28 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Mohammad Sayful Islam */ + +/dts-v1/; + +#include "ipq8074-512m.dtsi" +#include "ipq8174-mx4200.dtsi" + +/ { + model = "Linksys MX4200v1"; + compatible = "linksys,mx4200v1", "qcom,ipq8074"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; + qcom,ath11k-fw-memory-mode = <1>; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts new file mode 100644 index 0000000000..44e1b72f16 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Mohammad Sayful Islam */ + +/dts-v1/; + +#include "ipq8174-mx4200.dtsi" + +/ { + model = "Linksys MX4200v2"; + compatible = "linksys,mx4200v2", "qcom,ipq8074"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-MX4200v2"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index d8416d10fb..5beff11309 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -115,6 +115,31 @@ define Device/edimax_cax1800 endef TARGET_DEVICES += edimax_cax1800 +define Device/linksys_mx4200v1 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := MX4200 + DEVICE_VARIANT := v1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 6144k + IMAGE_SIZE := 147456k + NAND_SIZE := 512m + KERNEL_IN_UBI := + SOC := ipq8174 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=MX4200 + DEVICE_PACKAGES := kmod-leds-pca963x ipq-wifi-linksys_mx4200 kmod-bluetooth +endef +TARGET_DEVICES += linksys_mx4200v1 + +define Device/linksys_mx4200v2 + $(call Device/linksys_mx4200v1) + DEVICE_VARIANT := v2 +endef +TARGET_DEVICES += linksys_mx4200v2 + define Device/netgear_rax120v2 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 5da17db3fa..ff9069091f 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -18,6 +18,8 @@ ipq807x_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; compex,wpq873|\ + linksys,mx4200v1|\ + linksys,mx4200v2|\ redmi,ax6|\ xiaomi,ax3600) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index ac1405739d..85d107079e 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -15,6 +15,8 @@ case "$FIRMWARE" in dynalink,dl-wrx36|\ edgecore,eap102|\ edimax,cax1800|\ + linksys,mx4200v1|\ + linksys,mx4200v2|\ netgear,rax120v2|\ netgear,wax218|\ netgear,wax620|\ diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount index 84f826b3b8..f5f6c909e9 100755 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount @@ -10,5 +10,9 @@ boot() { # Unset changed flag after sysupgrade complete fw_setenv changed ;; + linksys,mx4200v1|\ + linksys,mx4200v2) + mtd resetbc s_env || true + ;; esac } diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 67fd0f5402..78842e1c4d 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -73,6 +73,21 @@ platform_do_upgrade() { fw_setenv upgrade_available 1 nand_do_upgrade "$1" ;; + linksys,mx4200v1|\ + linksys,mx4200v2) + boot_part="$(fw_printenv -n boot_part)" + if [ "$boot_part" -eq "1" ]; then + fw_setenv boot_part 2 + CI_KERNPART="alt_kernel" + CI_UBIPART="alt_rootfs" + else + fw_setenv boot_part 1 + CI_UBIPART="rootfs" + fi + fw_setenv boot_part_ready 3 + fw_setenv auto_recovery yes + nand_do_upgrade "$1" + ;; prpl,haze|\ qnap,301w) kernelname="0:HLOS" From 29f6da43403c5131d0035de0bfc4107eee17953b Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 4 Dec 2023 03:09:28 -0800 Subject: [PATCH 25/52] kernel: include built-in module list Add modules.builtin to the kernel package for improved handling of loadable and builtin modules. As with other distros, this allows 'modprobe ' to consistently return success for both loaded/built-in modules, a useful feature for presence-testing. Given OpenWrt's few built-in modules, this change and related kmodloader support add ~1 KB to the compressed image size. Using sch_fq_codel (builtin) and sch_cake (loadable) for example: root@OpenWrt:/# modprobe sch_fq_codel && echo SUCCESS || echo FAIL SUCCESS root@OpenWrt:/# modprobe sch_cake && echo SUCCESS || echo FAIL SUCCESS root@OpenWrt:/# rmmod sch_fq_codel module is builtin Signed-off-by: Tony Ambardar --- package/kernel/linux/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index c88b5c1b31..b198882979 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -58,7 +58,9 @@ define Package/kernel endef define Package/kernel/install - # nothing to do + $(INSTALL_DIR) $(1)/$(MODULES_SUBDIR) + $(INSTALL_DATA) $(LINUX_DIR)/modules.builtin $(1)/$(MODULES_SUBDIR) + $(SED) 's,.*/,,' $(1)/$(MODULES_SUBDIR)/modules.builtin endef define Package/kernel/extra_provides From e1d8e576147d813398c6797ca866f9d8a41a350e Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Tue, 5 Dec 2023 01:09:46 -0800 Subject: [PATCH 26/52] kernel: include modinfo for built-in modules Add modules.builtin.modinfo to the kernel package, to support presence testing using module aliases and printing module details with 'modinfo'. With related kmodloader changes this adds ~2 KB to compressed image sizes. root@OpenWrt:/# modinfo unix name: unix filename: (builtin) alias: net-pf-1 license: GPL root@OpenWrt:/# modprobe net-pf-1 && echo SUCCESS || echo FAIL SUCCESS Signed-off-by: Tony Ambardar --- package/kernel/linux/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index b198882979..6592b01678 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -61,6 +61,9 @@ define Package/kernel/install $(INSTALL_DIR) $(1)/$(MODULES_SUBDIR) $(INSTALL_DATA) $(LINUX_DIR)/modules.builtin $(1)/$(MODULES_SUBDIR) $(SED) 's,.*/,,' $(1)/$(MODULES_SUBDIR)/modules.builtin + strings $(LINUX_DIR)/modules.builtin.modinfo | \ + grep -E -v "\.(file$(if CONFIG_MODULE_STRIPPED,|parmtype))=" | \ + tr '\n' '\0' > $(1)/$(MODULES_SUBDIR)/modules.builtin.modinfo endef define Package/kernel/extra_provides From 7dbcc1215a56cc1da68c81bf92d7efa174c5e051 Mon Sep 17 00:00:00 2001 From: Dim Fish Date: Mon, 27 Nov 2023 12:01:34 +0300 Subject: [PATCH 27/52] mediatek: filogic: add support for Xiaomi AX3000T **SoC**: MediaTek MT7981B 2x A53 **Flash**: ESMT F50L1G41LB 128MB **RAM**: NT52B128M16JR-FL 256MB **Ethernet**: 4x 10/100/1000 Mbps **Switch**: MediaTek MT7531AE **WiFi**: MediaTek MT7976C **Buttons**: Reset, Mesh **Power**: DC 12V 1A 1. Get ssh access. Supported stock firmware **1.0.47** ``` curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20set%20ssh_en%3D1%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20commit%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Ased%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%22debug%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=********/api/misystem/arn_switch" -d "open=1&model=1&level=%0Apasswd%20-d%20root%0A ``` 2. Backup stock partitions ``` nanddump -f /tmp/BL2.bin /dev/mtd1 nanddump -f /tmp/Nvram.bin /dev/mtd2 nanddump -f /tmp/Bdata.bin /dev/mtd3 nanddump -f /tmp/Factory.bin /dev/mtd4 nanddump -f /tmp/FIP.bin /dev/mtd5 nanddump -f /tmp/ubi.bin /dev/mtd8 nanddump -f /tmp/KF.bin /dev/mtd12 ``` Then transfer them to your computer in a safe place. 3. Get firmware information `cat /proc/cmdline` 4. Copy openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi to **/tmp** and flash If **firmware=0** ``` ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=1 nvram set flag_last_success=1 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit reboot ``` If **firmware=1** ``` ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=0 nvram set flag_last_success=0 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit reboot ``` Then reboot your router, it should boot to the OpenWrt initramfs system now. 5. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin` 1. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb `ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb` `reboot` 2. Install kmod-mtd-rw `opkg update && opkg install kmod-mtd-rw` `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 3. Format ubi and create new ubootenv volume ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB ``` 4. *(Optional **-10Mb** free space) Add recovery boot feature.* ``` ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB ubiupdatevol /dev/ubi0_2 /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb ``` 5. Flash Openwrt U-Boot ``` mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin BL2 mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip FIP ``` 6. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb` 1. Force flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb `sysupgrade -F -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb` 2. Format ubi and Nvram ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 mtd erase Nvram ``` 3. Install kmod-mtd-rw `opkg update && opkg install kmod-mtd-rw` `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 4. Flash stock images from backup ``` mtd write /tmp/BL2.bin BL2 mtd write /tmp/FIP.bin FIP mtd write /tmp/ubi.bin ubi ``` Then reboot your router, waiting it finished rollback in minutes. `ubiformat /dev/mtd7 -y -f /tmp/ubi.bin` Then reboot your router, waiting it finished rollback in minutes. Signed-off-by: Dim Fish --- .../uboot-envtools/files/mediatek_filogic | 2 + package/boot/uboot-mediatek/Makefile | 13 + .../440-add-xiaomi_mi-router-ax3000t.patch | 414 ++++++++++++++++++ ...981b-xiaomi-mi-router-ax3000t-ubootmod.dts | 16 + .../dts/mt7981b-xiaomi-mi-router-ax3000t.dts | 34 ++ .../dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi | 29 ++ .../dts/mt7981b-xiaomi-mi-router-common.dtsi | 245 +++++++++++ .../dts/mt7981b-xiaomi-mi-router-wr30u.dtsi | 257 +---------- .../filogic/base-files/etc/board.d/01_leds | 2 +- .../filogic/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 45 ++ 12 files changed, 821 insertions(+), 244 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b4957c212b..1e7b42b634 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -69,6 +69,7 @@ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ +xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) . /lib/upgrade/nand.sh @@ -94,6 +95,7 @@ routerich,ax3000) ubnt,unifi-6-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" ;; +xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index a9e6d35f00..37fb68be22 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -322,6 +322,18 @@ define U-Boot/mt7981_qihoo_360t7 DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_xiaomi_mi-router-ax3000t + NAME:=Xiaomi Router AX3000T + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=xiaomi_mi-router-ax3000t-ubootmod + UBOOT_CONFIG:=mt7981_xiaomi_mi-router-ax3000t + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7981_xiaomi_mi-router-wr30u NAME:=Xiaomi Router WR30U BUILD_SUBTARGET:=filogic @@ -556,6 +568,7 @@ UBOOT_TARGETS := \ mt7981_rfb-sd \ mt7981_rfb-snfi \ mt7981_qihoo_360t7 \ + mt7981_xiaomi_mi-router-ax3000t \ mt7981_xiaomi_mi-router-wr30u \ mt7986_bananapi_bpi-r3-emmc \ mt7986_bananapi_bpi-r3-sdmmc \ diff --git a/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch b/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch new file mode 100644 index 0000000000..9b50166a94 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch @@ -0,0 +1,414 @@ +--- /dev/null ++++ b/configs/mt7981_xiaomi_mi-router-ax3000t_defconfig +@@ -0,0 +1,163 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_xiaomi_mi-router-ax3000t" ++CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-ax3000t_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-ax3000t.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++# CONFIG_CMD_EXT4 is not set ++# CONFIG_CMD_FAT is not set ++CONFIG_CMD_FDT=y ++# CONFIG_CMD_FS_GENERIC is not set ++# CONFIG_CMD_FS_UUID is not set ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MTD=y ++# CONFIG_CMD_PCI is not set ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++# CONFIG_CMD_PWM is not set ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_USB is not set ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++# CONFIG_DM_USB is not set ++# CONFIG_DM_PWM is not set ++# CONFIG_PWM_MTK is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++# CONFIG_DM_SCSI is not set ++# CONFIG_AHCI is not set ++CONFIG_PHY=y ++# CONFIG_PHY_MTK_TPHY is not set ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++# CONFIG_PCI is not set ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++# CONFIG_DM_PCI is not set ++# CONFIG_PCIE_MEDIATEK is not set ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++# CONFIG_USB is not set ++# CONFIG_USB_HOST is not set ++# CONFIG_USB_XHCI_HCD is not set ++# CONFIG_USB_XHCI_MTK is not set ++# CONFIG_USB_STORAGE is not set ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_xiaomi_mi-router-ax3000t.dts +@@ -0,0 +1,187 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Xiaomi Router AX3000T"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ ++ mesh { ++ label = "mesh"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led_status_blue { ++ label = "blue:status"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_status_yellow { ++ label = "yellow:status"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x00 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "Nvram"; ++ reg = <0x100000 0x40000>; ++ }; ++ ++ partition@140000 { ++ label = "Bdata"; ++ reg = <0x140000 0x40000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "crash"; ++ reg = <0x580000 0x40000>; ++ }; ++ ++ partition@5c0000 { ++ label = "crash_log"; ++ reg = <0x5c0000 0x40000>; ++ }; ++ ++ partition@600000 { ++ label = "ubi"; ++ reg = <0x600000 0x7000000>; ++ }; ++ ++ partition@7600000 { ++ label = "KF"; ++ reg = <0x7600000 0x40000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/xiaomi_mi-router-ax3000t_env +@@ -0,0 +1,55 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootargs=console=ttyS0,115200n8 console_msg_format=syslog ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=yellow:status ++bootled_rec=blue:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts new file mode 100644 index 0000000000..809e625ce1 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-ax3000t.dtsi" + +/ { + model = "Xiaomi Mi Router AX3000T (OpenWrt U-Boot layout)"; + compatible = "xiaomi,mi-router-ax3000t-ubootmod", "mediatek,mt7981"; +}; + +&partitions { + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7000000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts new file mode 100644 index 0000000000..cc0d44fdf5 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-ax3000t.dtsi" + +/ { + model = "Xiaomi Mi Router AX3000T"; + compatible = "xiaomi,mi-router-ax3000t", "mediatek,mt7981"; +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; + +&partitions { + // ubi_kernel is the ubi partition in stock. + partition@600000 { + label = "ubi_kernel"; + reg = <0x600000 0x2200000>; + }; + + /* ubi is the result of squashing + * consecutive stock partitions: + * - ubi1 + * - overlay + * - data + */ + partition@2800000 { + label = "ubi"; + reg = <0x2800000 0x4e00000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi new file mode 100644 index 0000000000..7b6fde8465 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-common.dtsi" + +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-2)>; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + status = "okay"; + + nfc@57 { + compatible = "nt082c"; + reg = <0x57>; + }; +}; + +&pio { + i2c_pins: i2c-pins { + mux { + function = "i2c"; + groups = "i2c0_1"; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi new file mode 100644 index 0000000000..d6872395a9 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &led_status_yellow; + led-failsafe = &led_status_yellow; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mesh { + label = "mesh"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + button-reset { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + led_status_blue: led-status-blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: led-status-yellow { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00 0x100000>; + read-only; + }; + + partition@100000 { + label = "Nvram"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "Bdata"; + reg = <0x140000 0x40000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "crash"; + reg = <0x580000 0x40000>; + read-only; + }; + + partition@5c0000 { + label = "crash_log"; + reg = <0x5c0000 0x40000>; + read-only; + }; + + partition@7600000 { + label = "KF"; + reg = <0x7600000 0x40000>; + read-only; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi index 1e738a4474..87a2493a23 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi @@ -1,252 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include +#include "mt7981b-xiaomi-mi-router-common.dtsi" -#include "mt7981.dtsi" - -/ { - aliases { - serial0 = &uart0; - led-boot = &led_system_yellow; - led-failsafe = &led_system_yellow; - led-running = &led_system_blue; - led-upgrade = &led_system_yellow; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - reg = <0 0x40000000 0 0x10000000>; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - mesh { - label = "mesh"; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_system_blue: system_blue { - label = "blue:system"; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - }; - - led_system_yellow: system_yellow { - label = "yellow:system"; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - - led_network_blue { - label = "blue:network"; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - }; - - led_network_yellow { - label = "yellow:network"; - gpios = <&pio 12 GPIO_ACTIVE_LOW>; - }; - }; +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-1)>; }; -ð { - status = "okay"; +&leds { + led-wan-blue { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - - nvmem-cells = <&macaddr_factory_4 (-1)>; - nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; + led-wan-yellow { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; }; - -&mdio_bus { - switch: switch@1f { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; - interrupt-controller; - #interrupt-cells = <1>; - interrupt-parent = <&pio>; - interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; - }; -}; - -&switch { - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "wan"; - }; - - port@1 { - reg = <1>; - label = "lan2"; - }; - - port@2 { - reg = <2>; - label = "lan3"; - }; - - port@3 { - reg = <3>; - label = "lan4"; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; - - spi_nand: flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spi-nand"; - reg = <0>; - - spi-max-frequency = <52000000>; - spi-tx-bus-width = <4>; - spi-rx-bus-width = <4>; - - partitions: partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "BL2"; - reg = <0x00 0x100000>; - read-only; - }; - - partition@100000 { - label = "Nvram"; - reg = <0x100000 0x40000>; - }; - - partition@140000 { - label = "Bdata"; - reg = <0x140000 0x40000>; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x200000>; - read-only; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_4: macaddr@4 { - compatible = "mac-base"; - reg = <0x4 0x6>; - #nvmem-cell-cells = <1>; - }; - }; - }; - - partition@380000 { - label = "FIP"; - reg = <0x380000 0x200000>; - read-only; - }; - - partition@580000 { - label = "crash"; - reg = <0x580000 0x40000>; - read-only; - }; - - partition@5c0000 { - label = "crash_log"; - reg = <0x5c0000 0x40000>; - read-only; - }; - - partition@7600000 { - label = "KF"; - reg = <0x7600000 0x40000>; - read-only; - }; - }; - }; -}; - -&pio { - spi0_flash_pins: spi0-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - - conf-pu { - pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; - drive-strength = ; - bias-pull-up = ; - }; - - conf-pd { - pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; - drive-strength = ; - bias-pull-down = ; - }; - }; -}; - -&wifi { - status = "okay"; - - mediatek,mtd-eeprom = <&factory 0x0>; -}; - -&uart0 { - status = "okay"; -}; - -&watchdog { - status = "okay"; -}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index b786558618..51654ae87f 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -36,7 +36,7 @@ routerich,ax3000) xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) - ucidef_set_led_netdev "wan" "wan" "blue:network" "wan" + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ;; xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a36d998a40..dd3464b72c 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -72,6 +72,8 @@ mediatek_setup_interfaces() tplink,tl-xdr6086) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ @@ -158,6 +160,8 @@ mediatek_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add "$label_mac" 1) ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 9600f8745f..65ec5d8271 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -49,6 +49,7 @@ xiaomi_initial_setup() local board=$(board_name) case "$board" in + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" ;; @@ -126,6 +127,7 @@ platform_do_upgrade() { tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) CI_KERNPART="fit" @@ -140,6 +142,7 @@ platform_do_upgrade() { EMMC_ROOT_DEV="$(cmdline_get_var root)" emmc_do_upgrade "$1" ;; + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) CI_KERN_UBIPART=ubi_kernel @@ -211,6 +214,7 @@ platform_pre_upgrade() { asus,tuf-ax6000) asus_initial_setup ;; + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) xiaomi_initial_setup diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 15951df1ec..c079fae0b0 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -728,6 +728,51 @@ define Device/ubnt_unifi-6-plus endef TARGET_DEVICES += ubnt_unifi-6-plus +define Device/xiaomi_mi-router-ax3000t + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T + DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel +endif + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t + +define Device/xiaomi_mi-router-ax3000t-ubootmod + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t-ubootmod + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-ax3000t +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS += initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel +endif +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod + define Device/xiaomi_mi-router-wr30u-112m-nmbm DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) From ebed3f65ea681f55b3ccfeb208664552970cb7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samir=20Ibrad=C5=BEi=C4=87?= Date: Mon, 1 Jan 2024 16:23:09 +0900 Subject: [PATCH 28/52] qualcommax: Fix Buffalo WXR-5950AX12 wifi MAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, WiFi interfaces on WXR-5950AX12 / WXR-6000AX12 devices come up with some MAC addresses inconsistent with vendor and Ethernet addresses. This adds a hotplug override in order to make it consistent with what is in u-boot env as well as OAM firmware where 1st radio MAC is set at Ethernet MAC + 8, and 2nd radio mac at Ethernet MAC + 16. fw_printenv | grep addr ethaddr=68:e1:dc:xx:xx:d8 ipaddr=192.168.11.1 wlan0addr=68:e1:dc:xx:xx:e0 wlan1addr=68:e1:dc:xx:xx:e8 wlan2addr=00:00:00:00:00:00 For OEM bootlog and MAC assagnment check https://openwrt.org/toh/buffalo/wxr-5950ax12#openwrt_uimage_tftp_bootlog Tested-by: Samir Ibradžić # Buffalo WXR-6000AX12P Signed-off-by: Samir Ibradžić --- .../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3573942c54..f951d925ab 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -14,6 +14,10 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress ;; + buffalo,wxr-5950ax12) + [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 8 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 16 > /sys${DEVPATH}/macaddress + ;; zte,mf269) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress From 184bd28064bc591bf907c42afc9e0b9c1b9858b4 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 6 Jan 2024 09:26:33 -0800 Subject: [PATCH 29/52] build: fix toplevel check target Partially revert changes to verbose logging that break the 'check' target dependencies and trigger many runtime warnings like: /home/kodidev/openwrt-project/include/toplevel.mk:213: *** mixed implicit and normal rules: deprecated syntax Fixes: e4a43cda0 ("build: allow var.% targets to bypass the prepare steps") Signed-off-by: Tony Ambardar --- include/toplevel.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index 96f32139d9..f2dfde60cf 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -210,7 +210,9 @@ prereq:: prepare-tmpinfo .config @+$(NO_TRACE_MAKE) -r -s $@ check: .config FORCE -check val.% var.%: FORCE + @+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s + +val.% var.%: FORCE @+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s WARN_PARALLEL_ERROR = $(if $(BUILD_LOG),,$(and $(filter -j,$(MAKEFLAGS)),$(findstring s,$(OPENWRT_VERBOSE)))) From c0d7842bf2d0901697cc7d593f1db787252f549a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 30 Dec 2023 19:52:18 +0800 Subject: [PATCH 30/52] ramips: add missing syscon compatible strings for MT7688 and RT3052 MT7688 devices use the "mt7628an.dtsi" as the template. And RT3052 devices use the "rt3050.dtsi" as template. Therefore, we need to add the corresponding system controller compatible strings to make them work properly. Fixes: 1f818b09f8ae ("ramips: add proper system clock and reset driver support for legacy SoCs") Fixes: #14305 Signed-off-by: Shiji Yang --- target/linux/ramips/dts/mt7628an.dtsi | 2 +- target/linux/ramips/dts/rt3050.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index 97f77f6b38..906ea03fe9 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -39,7 +39,7 @@ #size-cells = <1>; sysc: syscon@0 { - compatible = "ralink,mt7628-sysc", "syscon"; + compatible = "ralink,mt7628-sysc", "ralink,mt7688-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; #reset-cells = <1>; diff --git a/target/linux/ramips/dts/rt3050.dtsi b/target/linux/ramips/dts/rt3050.dtsi index d23303964f..30a3f898cd 100644 --- a/target/linux/ramips/dts/rt3050.dtsi +++ b/target/linux/ramips/dts/rt3050.dtsi @@ -40,7 +40,7 @@ #size-cells = <1>; sysc: syscon@0 { - compatible = "ralink,rt3050-sysc", "syscon"; + compatible = "ralink,rt3050-sysc", "ralink,rt3052-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; #reset-cells = <1>; From d13d513b9f14b29175c15a8945e2ad772665e821 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 18 Nov 2023 16:53:20 +0100 Subject: [PATCH 31/52] ath79: mikrotik: add RB912UAG-5HPnD as alternative name Image for RB912UAG-2HPnD supports the 5GHz variant without modifications. Add it as alternative name, so it can be found easier. While at that, adjust board display name in device tree, to reflect that. Signed-off-by: Lech Perczak --- .../ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts | 2 +- target/linux/ath79/image/mikrotik.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index 121a5d0396..b550026f07 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -7,7 +7,7 @@ / { compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342"; - model = "MikroTik RouterBOARD 912UAG-2HPnD"; + model = "MikroTik RouterBOARD 912UAG-(2,5)HPnD"; aliases { led-boot = &led_power; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index d26420c7f5..fb98ccc122 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -32,6 +32,8 @@ define Device/mikrotik_routerboard-912uag-2hpnd $(Device/mikrotik_nand) SOC := ar9342 DEVICE_MODEL := RouterBOARD 912UAG-2HPnD + DEVICE_ALT0_VENDOR := Mikrotik + DEVICE_ALT0_MODEL := RouterBOARD 912UAG-5HPnD DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 SUPPORTED_DEVICES += rb-912uag-2hpnd endef From bcc44b1212b2369d04f68950f6422b8aff7ec09e Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 18 Nov 2023 16:53:45 +0100 Subject: [PATCH 32/52] ath79: support for MikroTik RouterBOARD 911G-(2,5)HPnD This is a stripped-down version of RB912UAG-(2,5)HPnD, without USB, miniPCIe and SIM sockets. This board has been supported in the ar71xx. Add support based on RB912UAG board, by splitting out the common part to .dtsi, and creating separate device tree for the stripped-down version. Links: * https://mikrotik.com/product/RB911G-2HPnD * https://mikrotik.com/product/RB911G-5HPnD * https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb911g-5hpnd 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 a/b/g/n (depending on band variant) * LEDs: 5 general purpose LEDs (led1..led5), power LED, user LED, Ethernet phy LED, * Button, * Beeper. 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. Signed-off-by: Lech Perczak --- ...ar9342_mikrotik_routerboard-911g-xhpnd.dts | 11 + .../dts/ar9342_mikrotik_routerboard-911g.dtsi | 224 ++++++++++++++++++ ...9342_mikrotik_routerboard-912uag-2hpnd.dts | 218 +---------------- target/linux/ath79/image/mikrotik.mk | 10 + .../base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 7 files changed, 250 insertions(+), 217 deletions(-) create mode 100644 target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts create mode 100644 target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts new file mode 100644 index 0000000000..5fa44b4412 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9342_mikrotik_routerboard-911g.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,routerboard-911g-xhpnd", "qca,ar9342"; + model = "MikroTik RouterBOARD 911G-(2,5)HPnD"; +}; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi new file mode 100644 index 0000000000..86b4bc358b --- /dev/null +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9344.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + gpio_key: gpio_key { + compatible = "mikrotik,gpio-rb91x-key"; + gpio-controller; + #gpio-cells = <2>; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + 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_key 0 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) */ + <&gpio_key 2 GPIO_ACTIVE_HIGH>; /* Key poll disable */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #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>; + }; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>; + }; + }; + + 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"; + + beeper { + gpio-export,name = "beeper"; + gpio-export,output = <1>; /* Must be 1 to avoid EMI induced clicking noise */ + gpios = <&ssr 5 GPIO_ACTIVE_HIGH>; + }; + + usb_power { + gpio-export,name = "power-usb"; + gpio-export,output = <1>; + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; + }; + + pcie_power { + gpio-export,name = "power-pcie"; + gpio-export,output = <0>; + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&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 = <50000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + 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"; + + 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>; + rxd-delay = <1>; + txd-delay = <1>; + }; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index b550026f07..81d7284b3d 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#include "ar9344.dtsi" +#include "ar9342_mikrotik_routerboard-911g.dtsi" #include #include @@ -8,222 +8,6 @@ / { compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342"; model = "MikroTik RouterBOARD 912UAG-(2,5)HPnD"; - - aliases { - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - gpio_key: gpio_key { - compatible = "mikrotik,gpio-rb91x-key"; - gpio-controller; - #gpio-cells = <2>; - gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - }; - - 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_key 0 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) */ - <&gpio_key 2 GPIO_ACTIVE_HIGH>; /* Key poll disable */ - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #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>; - }; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - button-reset { - label = "reset"; - linux,code = ; - gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>; - }; - }; - - 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"; - - beeper { - gpio-export,name = "beeper"; - gpio-export,output = <1>; /* Must be 1 to avoid EMI induced clicking noise */ - gpios = <&ssr 5 GPIO_ACTIVE_HIGH>; - }; - - usb_power { - gpio-export,name = "power-usb"; - gpio-export,output = <1>; - gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; - }; - - pcie_power { - gpio-export,name = "power-pcie"; - gpio-export,output = <0>; - gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&ref { - clock-frequency = <40000000>; -}; - -&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 = <50000000>; - - partitions { - compatible = "mikrotik,routerboot-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "routerboot"; - reg = <0x0 0x0>; - read-only; - }; - - 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"; - - 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>; - rxd-delay = <1>; - txd-delay = <1>; - }; -}; - -&wmac { - status = "okay"; - qca,no-eeprom; }; &pcie { diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index fb98ccc122..1bd1323f07 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -28,6 +28,16 @@ define Device/mikrotik_routerboard-911-lite endef TARGET_DEVICES += mikrotik_routerboard-911-lite +define Device/mikrotik_routerboard-911g-xhpnd + $(Device/mikrotik_nand) + SOC := ar9342 + DEVICE_MODEL := RouterBOARD 911G-2HPnD + DEVICE_ALT0_VENDOR := Mikrotik + DEVICE_ALT0_MODEL := RouterBOARD 911G-5HPnD + SUPPORTED_DEVICES += rb-912uag-2hpnd +endef +TARGET_DEVICES += mikrotik_routerboard-911g-xhpnd + define Device/mikrotik_routerboard-912uag-2hpnd $(Device/mikrotik_nand) SOC := ar9342 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 d45af6dbb3..f13eca243b 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 @@ -20,6 +20,7 @@ ath79_setup_interfaces() "0@eth0" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" ;; mikrotik,routerboard-911-lite|\ + mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ @@ -61,6 +62,7 @@ ath79_setup_macs() case "$board" in mikrotik,routerboard-911-lite|\ + mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ 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 cc05ba080b..e7bf17d0ec 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 @@ -24,6 +24,7 @@ case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in mikrotik,routerboard-911-lite|\ + mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ 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 e3887bfc50..db0509d290 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -30,6 +30,7 @@ platform_do_upgrade() { case "$board" in mikrotik,routerboard-493g|\ + mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ From 95b6d76c5a343d13aaf33df44d2d8518a2ede1b6 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 18 Nov 2023 16:54:18 +0100 Subject: [PATCH 33/52] ath79: mikrotik: add rssileds support for Routerboard 911G and RB912UAG LEDs 1 through 5 are used for RSSI monitoring on factory firmware. Reflect that by creating appropriate rssileds configuration. Signed-off-by: Lech Perczak --- target/linux/ath79/image/mikrotik.mk | 3 ++- .../linux/ath79/mikrotik/base-files/etc/board.d/01_leds | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 1bd1323f07..06a2417faa 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -34,6 +34,7 @@ define Device/mikrotik_routerboard-911g-xhpnd DEVICE_MODEL := RouterBOARD 911G-2HPnD DEVICE_ALT0_VENDOR := Mikrotik DEVICE_ALT0_MODEL := RouterBOARD 911G-5HPnD + DEVICE_PACKAGES += rssileds SUPPORTED_DEVICES += rb-912uag-2hpnd endef TARGET_DEVICES += mikrotik_routerboard-911g-xhpnd @@ -44,7 +45,7 @@ define Device/mikrotik_routerboard-912uag-2hpnd DEVICE_MODEL := RouterBOARD 912UAG-2HPnD DEVICE_ALT0_VENDOR := Mikrotik DEVICE_ALT0_MODEL := RouterBOARD 912UAG-5HPnD - DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 + DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 rssileds SUPPORTED_DEVICES += rb-912uag-2hpnd endef TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index 66fa2ee6ac..16cb628445 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -16,6 +16,15 @@ mikrotik,routerboard-lhg-5nd) ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" ;; +mikrotik,routerboard-911g-xhpnd|\ +mikrotik,routerboard-912uag-2hpnd) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "rssilow" "green:led1" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:led2" "wlan0" "20" "100" + ucidef_set_led_rssi "rssimedium" "rssimedium" "green:led3" "wlan0" "40" "100" + ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:led4" "wlan0" "60" "100" + ucidef_set_led_rssi "rssihigh" "rssihigh" "green:led5" "wlan0" "80" "100" + ;; mikrotik,routerboard-750-r2|\ mikrotik,routerboard-951ui-2hnd|\ mikrotik,routerboard-951ui-2nd|\ From c2ab56a7549b75b9592ddcfc0cf1040281f7d28a Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 18 Nov 2023 16:54:59 +0100 Subject: [PATCH 34/52] ath79: support MikroTik RouterBOARD 911G-5HPacD The MikroTik RouterBOARD 911G-5HPacD is a stripped-down version of RB921GS-5HPacD, removing the SFP cage. This ports the board from ar71xx, and is based on support for RB921GS-5HPacD. Disable mdio1 and eth1 nodes in routerboard-92x.dtsi, then re-enable them in devices using that, so the newly-added device has the port disabled properly. See https://mikrotik.com/product/RB911G-5HPacD for more info. Specifications: - SoC: Qualcomm Atheros QCA9558 (720 MHz) - RAM: 128 MB - Storage: 128 MB NAND - Wireless: external QCA9892 802.11a/ac 2x2:2 - Ethernet: 1x 1000/100/10 Mbps, integrated, via AR8031 PHY, passive PoE in Working: - NAND storage detection - Ethernet - Wireless - 1x user LED (blinks during boot, sysupgrade) - Reset button - Sysupgrade Installation: - Boot initramfs image via TFTP and then flash sysupgrade image Signed-off-by: Lech Perczak --- ...a9558_mikrotik_routerboard-911g-5hpacd.dts | 29 +++++++++++++++++++ ..._mikrotik_routerboard-921gs-5hpacd-15s.dts | 8 +++++ ...58_mikrotik_routerboard-922uags-5hpacd.dts | 8 +++++ .../dts/qca9558_mikrotik_routerboard-92x.dtsi | 4 --- target/linux/ath79/image/mikrotik.mk | 9 ++++++ .../base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 8 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 target/linux/ath79/dts/qca9558_mikrotik_routerboard-911g-5hpacd.dts diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-911g-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-911g-5hpacd.dts new file mode 100644 index 0000000000..22784075f6 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-911g-5hpacd.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_mikrotik_routerboard-92x.dtsi" + +/ { + compatible = "mikrotik,routerboard-911g-5hpacd", "qca,qca9558"; + model = "MikroTik RouterBOARD 911G-5HPacD"; + + ath10k-leds { + compatible = "gpio-leds"; + + wlan5g { + label = "green:wlan5g"; + gpios = <&ath10k 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +&pcie1 { + status = "okay"; + + ath10k: wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + #gpio-cells = <2>; + gpio-controller; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts index d1f307bd48..36283ec228 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts @@ -17,6 +17,14 @@ }; }; +&mdio1 { + status = "okay"; +}; + +ð1 { + status = "okay"; +}; + &pcie1 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts index 8ad834fe61..553dff0853 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts @@ -25,6 +25,14 @@ }; }; +&mdio1 { + status = "okay"; +}; + +ð1 { + status = "okay"; +}; + &pcie0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi index 82b8c2ae56..bc85cad9b3 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi @@ -86,8 +86,6 @@ }; &mdio1 { - status = "okay"; - phy_sfp: ethernet-phy@0 { reg = <0>; phy-mode = "sgmii"; @@ -96,8 +94,6 @@ }; ð1 { - status = "okay"; - phy-handle = <&phy_sfp>; pll-data = <0x03000000 0x00000101 0x00001616>; qca955x-sgmii-fixup; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 06a2417faa..19cbf30933 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -50,6 +50,15 @@ define Device/mikrotik_routerboard-912uag-2hpnd endef TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd +define Device/mikrotik_routerboard-911g-5hpacd + $(Device/mikrotik_nand) + SOC := qca9558 + DEVICE_MODEL := RouterBOARD 911G-5HPacD + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct + SUPPORTED_DEVICES += rb-921gs-5hpacd-r2 +endef +TARGET_DEVICES += mikrotik_routerboard-911g-5hpacd + 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 f13eca243b..4da5884045 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 @@ -62,6 +62,7 @@ ath79_setup_macs() case "$board" in mikrotik,routerboard-911-lite|\ + mikrotik,routerboard-911g-5hpacd|\ mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 5b918d966c..da331dc0ea 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -11,6 +11,7 @@ board=$(board_name) case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in + mikrotik,routerboard-911g-5hpacd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-951ui-2nd|\ mikrotik,routerboard-952ui-5ac2nd|\ 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 db0509d290..c4d401b8ae 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -30,6 +30,7 @@ platform_do_upgrade() { case "$board" in mikrotik,routerboard-493g|\ + mikrotik,routerboard-911g-5hpacd|\ mikrotik,routerboard-911g-xhpnd|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ From 8226c8d306be0d617016f9c8e3f1659ef41e8ca6 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 3 Dec 2023 12:40:46 +0000 Subject: [PATCH 35/52] ramips: update leds & buttons dts description This commit: 1. Removes deprecated "label" property from the dts leds subnnodes; 2. Updates buttons and leds dts description according to kernel docs examples. Scope: devices well known to me. Run-tested: TP-Link ec330-g5u, WiFire S1500.nbn Signed-off-by: Mikhail Zhilkin --- .../linux/ramips/dts/mt7620a_sercomm_cpj.dtsi | 2 - .../ramips/dts/mt7621_arcadyan_wg4xx223.dtsi | 8 ++-- .../dts/mt7621_beeline_smartbox-flash.dts | 3 +- .../dts/mt7621_beeline_smartbox-giga.dts | 5 +-- .../dts/mt7621_beeline_smartbox-pro.dts | 3 +- .../mt7621_beeline_smartbox-turbo-plus.dts | 7 +--- .../linux/ramips/dts/mt7621_etisalat_s3.dts | 7 +--- .../dts/mt7621_sercomm_dxx_nand_256m.dtsi | 11 ++---- .../ramips/dts/mt7621_sercomm_s1500.dtsi | 39 ++++++------------- .../ramips/dts/mt7621_tplink_ec330-g5u-v1.dts | 27 ++++--------- .../ramips/dts/mt7621_wifire_s1500-nbn.dts | 1 - .../mt7621/base-files/etc/board.d/01_leds | 14 +++---- 12 files changed, 39 insertions(+), 88 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi b/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi index e903f9f729..8c565385e8 100644 --- a/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi +++ b/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi @@ -38,14 +38,12 @@ compatible = "gpio-leds"; status_green: led-0 { - label = "green:status"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_STATUS; }; status_amber: led-1 { - label = "amber:status"; gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_STATUS; diff --git a/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi b/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi index 7b3f316a8c..93570823b3 100644 --- a/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi +++ b/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi @@ -17,15 +17,13 @@ leds { compatible = "gpio-leds"; - led_status_green: led-1 { - label = "green:status"; + led_status_green: led-0 { color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; }; - led_status_red: led-2 { - label = "red:status"; + led_status_red: led-1 { color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; @@ -35,7 +33,7 @@ keys { compatible = "gpio-keys"; - reset { + button-0 { label = "reset"; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; linux,code = ; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-flash.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-flash.dts index d373a801d2..36f2532161 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-flash.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-flash.dts @@ -7,8 +7,7 @@ model = "Beeline SmartBox Flash"; leds { - led-0 { - label = "blue:wan"; + led-2 { color = ; function = LED_FUNCTION_WAN; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts index f2a99a63a8..c1bf5c899b 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts @@ -23,21 +23,18 @@ compatible = "gpio-leds"; led_status_green: led-0 { - label = "green:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; }; led-1 { - label = "blue:wan"; color = ; function = LED_FUNCTION_WAN; gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; }; led_status_red: led-2 { - label = "red:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; @@ -47,7 +44,7 @@ keys { compatible = "gpio-keys"; - reset { + button-0 { label = "reset"; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; linux,code = ; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts index e2c0165e6b..912b191049 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts @@ -11,7 +11,7 @@ }; keys { - switch_bt { + switch-0 { label = "ROUT<->REP Switch_bt"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; linux,input-type = ; @@ -39,7 +39,6 @@ }; &led_wps { - label = "blue:wps"; color = ; }; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts index 00f4957c57..4af425a648 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts @@ -23,21 +23,18 @@ compatible = "gpio-leds"; led-0 { - label = "blue:wan"; color = ; function = LED_FUNCTION_WAN; gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; }; led_status_green: led-1 { - label = "green:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; led_status_red: led-2 { - label = "red:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; @@ -47,13 +44,13 @@ keys { compatible = "gpio-keys"; - wps { + button-0 { label = "wps"; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; linux,code = ; }; - reset { + button-1 { label = "reset"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; linux,code = ; diff --git a/target/linux/ramips/dts/mt7621_etisalat_s3.dts b/target/linux/ramips/dts/mt7621_etisalat_s3.dts index 64e21bb704..2581e05a90 100644 --- a/target/linux/ramips/dts/mt7621_etisalat_s3.dts +++ b/target/linux/ramips/dts/mt7621_etisalat_s3.dts @@ -23,21 +23,18 @@ compatible = "gpio-leds"; led-0 { - label = "blue:wan"; color = ; function = LED_FUNCTION_WAN; gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; }; led_status_green: led-1 { - label = "green:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; led_status_red: led-2 { - label = "red:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; @@ -47,13 +44,13 @@ keys { compatible = "gpio-keys"; - wps { + button-0 { label = "wps"; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; linux,code = ; }; - reset { + button-1 { label = "reset"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; linux,code = ; diff --git a/target/linux/ramips/dts/mt7621_sercomm_dxx_nand_256m.dtsi b/target/linux/ramips/dts/mt7621_sercomm_dxx_nand_256m.dtsi index 36d576108d..0416a5f980 100644 --- a/target/linux/ramips/dts/mt7621_sercomm_dxx_nand_256m.dtsi +++ b/target/linux/ramips/dts/mt7621_sercomm_dxx_nand_256m.dtsi @@ -19,22 +19,19 @@ leds { compatible = "gpio-leds"; - led-1 { - label = "blue:wan"; + led-0 { color = ; function = LED_FUNCTION_WAN; gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; }; - led_status_green: led-0 { - label = "green:status"; + led_status_green: led-1 { color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; led_status_red: led-2 { - label = "red:status"; color = ; function = LED_FUNCTION_STATUS; gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; @@ -44,13 +41,13 @@ keys { compatible = "gpio-keys"; - wps { + button-0 { label = "wps"; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; linux,code = ; }; - reset { + button-1 { label = "reset"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; linux,code = ; diff --git a/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi index 09862b8067..8b2bb6b949 100644 --- a/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi +++ b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi @@ -17,13 +17,13 @@ keys { compatible = "gpio-keys"; - reset { + button-0 { label = "reset"; gpios = <&gpio 7 GPIO_ACTIVE_LOW>; linux,code = ; }; - wps { + button-1 { label = "wps"; gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,code = ; @@ -34,33 +34,29 @@ compatible = "gpio-leds"; led-0 { - label = "amber:lan4"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <0>; + function-enumerator = <4>; linux,default-trigger = "mt7530-0:00:1Gbps"; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; led-1 { - label = "green:lan4"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <1>; + function-enumerator = <4>; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; }; led-2 { - label = "amber:lan3"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <2>; + function-enumerator = <3>; linux,default-trigger = "mt7530-0:01:1Gbps"; gpios = <&gpio 10 GPIO_ACTIVE_LOW>; }; led-3 { - label = "green:lan3"; color = ; function = LED_FUNCTION_LAN; function-enumerator = <3>; @@ -68,85 +64,72 @@ }; led-4 { - label = "amber:lan2"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <4>; + function-enumerator = <2>; linux,default-trigger = "mt7530-0:02:1Gbps"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; led-5 { - label = "amber:lan1"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <5>; + function-enumerator = <1>; linux,default-trigger = "mt7530-0:03:1Gbps"; gpios = <&gpio 22 GPIO_ACTIVE_LOW>; }; led-6 { - label = "green:lan1"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <6>; + function-enumerator = <1>; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; }; led-7 { - label = "amber:wan"; color = ; function = LED_FUNCTION_WAN; - function-enumerator = <0>; linux,default-trigger = "mt7530-0:04:1Gbps"; gpios = <&gpio 24 GPIO_ACTIVE_LOW>; }; led-8 { - label = "green:wan"; color = ; function = LED_FUNCTION_WAN; - function-enumerator = <1>; gpios = <&gpio 25 GPIO_ACTIVE_LOW>; }; led-9 { - label = "green:lan2"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <7>; + function-enumerator = <2>; gpios = <&gpio 26 GPIO_ACTIVE_LOW>; }; led-10 { - label = "white:wlan2g"; color = ; function = LED_FUNCTION_WLAN; - function-enumerator = <0>; + function-enumerator = <24>; linux,default-trigger = "phy1radio"; gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; led_wps: led-11 { function = LED_FUNCTION_WPS; - function-enumerator = <0>; gpios = <&gpio 29 GPIO_ACTIVE_LOW>; panic-indicator; }; led_status: led-12 { - label = "white:status"; color = ; function = LED_FUNCTION_STATUS; - function-enumerator = <0>; gpios = <&gpio 30 GPIO_ACTIVE_LOW>; }; led-13 { - label = "white:wlan5g"; color = ; function = LED_FUNCTION_WLAN; - function-enumerator = <1>; + function-enumerator = <50>; linux,default-trigger = "phy0radio"; gpios = <&gpio 32 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts index 84b3efe8df..a1b458edd5 100644 --- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts @@ -29,67 +29,54 @@ led-0 { color = ; function = LED_FUNCTION_USB; - function-enumerator = <0>; gpios = <&gpio 0 GPIO_ACTIVE_LOW>; trigger-sources = <&xhci_ehci_port1>; linux,default-trigger = "usbport"; }; led-1 { - label = "blue:wps"; color = ; function = LED_FUNCTION_WPS; - function-enumerator = <0>; gpios = <&gpio 5 GPIO_ACTIVE_LOW>; }; led-2 { - label = "blue:ethernet"; color = ; function = LED_FUNCTION_LAN; - function-enumerator = <0>; gpios = <&gpio 9 GPIO_ACTIVE_LOW>; }; led-3 { - label = "amber:internet"; color = ; function = LED_FUNCTION_WAN; - function-enumerator = <0>; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; led-4 { - label = "blue:internet"; color = ; function = LED_FUNCTION_WAN; - function-enumerator = <1>; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; led-5 { - label = "blue:wireless_5g"; color = ; function = LED_FUNCTION_WLAN; - function-enumerator = <0>; + function-enumerator = <50>; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; led-6 { - label = "blue:wireless_2g"; color = ; function = LED_FUNCTION_WLAN; - function-enumerator = <1>; + function-enumerator = <24>; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; led_power: led-7 { - label = "blue:power"; color = ; - function = LED_FUNCTION_STATUS; - function-enumerator = <0>; + function = LED_FUNCTION_POWER; gpios = <&gpio 18 GPIO_ACTIVE_LOW>; }; }; @@ -97,28 +84,28 @@ keys { compatible = "gpio-keys"; - led { + button-0 { label = "led"; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; debounce-interval = <60>; linux,code = ; }; - wifi { + button-1 { label = "wifi on/off"; gpios = <&gpio 7 GPIO_ACTIVE_LOW>; debounce-interval = <60>; linux,code = ; }; - reset { + button-2 { label = "reset"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; debounce-interval = <60>; linux,code = ; }; - wps { + button-3 { label = "wps"; gpios = <&gpio 10 GPIO_ACTIVE_LOW>; debounce-interval = <60>; diff --git a/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts b/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts index 4ffe988153..a3cc6038c0 100644 --- a/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts +++ b/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts @@ -28,7 +28,6 @@ }; &led_wps { - label = "white:wps"; color = ; }; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 51afb9cf41..1061de6f44 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -48,10 +48,10 @@ rostelecom,rt-sf-1) ;; beeline,smartbox-pro|\ wifire,s1500-nbn) - ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" "link tx rx" - ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" "link tx rx" - ucidef_set_led_netdev "lan3" "lan3" "green:lan3" "lan3" "link tx rx" - ucidef_set_led_netdev "lan4" "lan4" "green:lan4" "lan4" "link tx rx" + ucidef_set_led_netdev "lan1" "lan1" "green:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "green:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "green:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan4" "lan4" "green:lan-4" "lan4" "link tx rx" ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" ;; belkin,rt1800) @@ -202,9 +202,9 @@ tplink,deco-m4r-v4) ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" ;; tplink,ec330-g5u-v1) - ucidef_set_led_netdev "lan" "Ethernet" "blue:ethernet" "br-lan" "link tx rx" - ucidef_set_led_netdev "wan" "Internet" "blue:internet" "wan" "link tx rx" - ucidef_set_led_netdev "wan-off" "Internet-off" "amber:internet" "wan" "link" + ucidef_set_led_netdev "lan" "Ethernet" "blue:lan" "br-lan" "link tx rx" + ucidef_set_led_netdev "wan" "Internet" "blue:wan" "wan" "link tx rx" + ucidef_set_led_netdev "wan-off" "Internet-off" "amber:wan" "wan" "link" ;; tplink,re350-v1) ucidef_set_led_netdev "wifi2g" "Wifi 2.4G" "blue:wifi2G" "wlan0" From 5457996a9ea93ea1761fe29fb5809911927a508e Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 3 Dec 2023 12:42:47 +0000 Subject: [PATCH 36/52] ramips: sercomm s1500: enable wlan LEDs activity blinking This commit enables wireless LEDs activity blinking for Sercomm S1500 devices (Beeline Smartbox PRO, WiFire s1500.nbn). Run-tested: WiFire s1500.nbn Signed-off-by: Mikhail Zhilkin --- target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi index 8b2bb6b949..d03e0da548 100644 --- a/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi +++ b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi @@ -110,7 +110,7 @@ color = ; function = LED_FUNCTION_WLAN; function-enumerator = <24>; - linux,default-trigger = "phy1radio"; + linux,default-trigger = "phy1tpt"; gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; @@ -130,7 +130,7 @@ color = ; function = LED_FUNCTION_WLAN; function-enumerator = <50>; - linux,default-trigger = "phy0radio"; + linux,default-trigger = "phy0tpt"; gpios = <&gpio 32 GPIO_ACTIVE_LOW>; }; }; From 96580500d2806136a98cf38657e7c6082dab7e1c Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 3 Dec 2023 15:05:40 +0000 Subject: [PATCH 37/52] ramips: add alternative name to Etisalat (Sercomm) S3 This commit adds alternative name to Etisalat (Sercomm) S3 router. Signed-off-by: Mikhail Zhilkin --- target/linux/ramips/image/mt7621.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2c25b1ab28..ab1b829ba0 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1093,6 +1093,8 @@ define Device/etisalat_s3 SERCOMM_SWVER := 4009 DEVICE_VENDOR := Etisalat DEVICE_MODEL := S3 + DEVICE_ALT0_VENDOR := Sercomm + DEVICE_ALT0_MODEL := S3 DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += etisalat_s3 From 066b0fee76684a9fca44635d63bf2c699ef8e89c Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Sun, 7 Jan 2024 23:56:05 +0800 Subject: [PATCH 38/52] kernel: copy only *.ko for debug info Previous commits installed non-elf files into /lib/modules/$VER/. COLLECT_KERNEL_DEBUG tries to strip all files and these two files break the build. Fix it by copying only kernel modules for debug info collection. Fixes: e1d8e57614 ("kernel: include modinfo for built-in modules") Fixes: 29f6da4340 ("kernel: include built-in module list") Signed-off-by: Chuanhong Guo --- include/kernel-build.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 5b332258f8..b9513ec414 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -63,7 +63,7 @@ ifdef CONFIG_COLLECT_KERNEL_DEBUG mkdir -p $(KERNEL_BUILD_DIR)/debug/modules $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/debug/ -$(CP) \ - $(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/* \ + $(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/*.ko \ $(KERNEL_BUILD_DIR)/debug/modules/ $(FIND) $(KERNEL_BUILD_DIR)/debug -type f | $(XARGS) $(KERNEL_CROSS)strip --only-keep-debug $(TAR) c -C $(KERNEL_BUILD_DIR) debug \ From 1278d47beaabaa963b2956e81936269b7fea4003 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 30 Nov 2023 07:32:52 +0100 Subject: [PATCH 39/52] mac80211: avoid crashing on invalid band info Frequent crashes have been observed on MT7916 based platforms. While the root of these crashes are currently unknown, they happen when decoding rate information of connected STAs in AP mode. The rate-information is associated with a band which is not available on the PHY. Check for this condition in order to avoid crashing the whole system. This patch should be removed once the roout cause has been found and fixed. Link: https://github.com/freifunk-gluon/gluon/issues/2980 Signed-off-by: David Bauer --- .../780-avoid-crashing-missing-band.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch diff --git a/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch new file mode 100644 index 0000000000..2bc11efd00 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch @@ -0,0 +1,34 @@ +From: David Bauer +Date: Thu, 30 Nov 2023 07:32:52 +0100 +Subject: [PATCH] mac80211: avoid crashing on invalid band info + +Frequent crashes have been observed on MT7916 based platforms. While the +root of these crashes are currently unknown, they happen when decoding +rate information of connected STAs in AP mode. The rate-information is +associated with a band which is not available on the PHY. + +Check for this condition in order to avoid crashing the whole system. +This patch should be removed once the roout cause has been found and +fixed. + +Link: https://github.com/freifunk-gluon/gluon/issues/2980 + +Signed-off-by: David Bauer +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -2422,6 +2422,13 @@ static void sta_stats_decode_rate(struct + + sband = local->hw.wiphy->bands[band]; + ++ if (!sband) { ++ wiphy_warn(local->hw.wiphy, ++ "Invalid band %d\n", ++ band); ++ break; ++ } ++ + if (WARN_ON_ONCE(!sband->bitrates)) + break; + From c9e58f85f6e5d96711291f079413d2f34c36fdc3 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:02:01 +0100 Subject: [PATCH 40/52] ath79: move UniFi AC template into common This allows us to embrace alphabetical sorting for the UK-Ultra. Signed-off-by: David Bauer --- target/linux/ath79/image/common-ubnt.mk | 7 +++++++ target/linux/ath79/image/generic-ubnt.mk | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/image/common-ubnt.mk b/target/linux/ath79/image/common-ubnt.mk index 76d6de000b..f44e06e110 100644 --- a/target/linux/ath79/image/common-ubnt.mk +++ b/target/linux/ath79/image/common-ubnt.mk @@ -121,6 +121,13 @@ define Device/ubnt-xw UBNT_VERSION := 6.0.4 endef +define Device/ubnt_unifiac + DEVICE_VENDOR := Ubiquiti + SOC := qca9563 + IMAGE_SIZE := 15488k + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef + define Device/ubnt-unifi-jffs2 $(Device/ubnt) KERNEL_SIZE := 3072k diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index fa4daa3aaa..92b764c389 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -244,13 +244,6 @@ define Device/ubnt_unifi-ap-lr endef TARGET_DEVICES += ubnt_unifi-ap-lr -define Device/ubnt_unifiac - DEVICE_VENDOR := Ubiquiti - SOC := qca9563 - IMAGE_SIZE := 15488k - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct -endef - define Device/ubnt_unifiac-lite $(Device/ubnt_unifiac) DEVICE_MODEL := UniFi AC Lite From bf94e0a38389b2ce5d33be9c97d104d36dd5ebd6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:18:09 +0100 Subject: [PATCH 41/52] ath79: add support for UniFi UK-Ultra Hardware -------- CPU: Qualcomm Atheros QCA9563 RAM: 128M DDR2 FLASH: 16MB SPI-NOR WiFi: Qualcomm Atheros QCA9563 2x2:2 802.11n 2.4GHz Qualcomm Atheros QCA9880 2x2:2 802.11ac 5GHz Antennas -------- The device features internal antennas as well as external antenna connectors. By default, the internal antennas are used. Two GPIOs are exported by name, which can be used to control the antenna-path mux. Writing a logical 0 enables the external antenna connectors. Installation ------------ 1. Download the OpenWrt sysupgrade image to the device. You can use scp for this task. The default username and password are "ubnt" and the device is reachable at 192.168.1.20. $ scp -O openwrt-sysupgrade.bin ubnt@192.168.1.20:/tmp/firmware.bin 2. Connect to the device using SSH. $ ssh ubnt@192.168.1.20 3. Disable the write-protect $ echo "5edfacbf" > /proc/ubnthal/.uf 4. Verify kernel0 and kernel1 match mtd2 and mtd3 $ cat /proc/mtd 5. Write the sysupgrade image to kernel0 and kernel1 $ dd if=/tmp/firmware.bin of=/dev/mtdblock2 $ dd if=/tmp/firmware.bin of=/dev/mtdblock3 6. Write the bootselect flag to boot from kernel0 $ dd if=/dev/zero bs=1 count=1 of=/dev/mtd4 7. Reboot the device $ reboot Signed-off-by: David Bauer --- .../linux/ath79/dts/qca9563_ubnt_uk-ultra.dts | 35 +++++++++++++++++++ .../linux/ath79/dts/qca9563_ubnt_unifiac.dtsi | 2 +- .../generic/base-files/etc/board.d/01_leds | 7 ++++ .../generic/base-files/etc/board.d/02_network | 1 + .../base-files/etc/board.d/03_gpio_switches | 4 +++ .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic-ubnt.mk | 7 ++++ 7 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts diff --git a/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts new file mode 100644 index 0000000000..1ba635117e --- /dev/null +++ b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_ubnt_unifiac-lite.dtsi" + +/ { + compatible = "ubnt,uk-ultra", "qca,qca9563"; + model = "Ubiquiti UniFi Swiss Army Knife Ultra"; +}; + +&leds { + led-rssi0 { + label = "white:rssi0"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + + led-rssi1 { + label = "white:rssi1"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + + led-rssi2 { + label = "white:rssi2"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + led-rssi3 { + label = "white:rssi3"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; +}; + +/** + * Antenna selection on GPIO5 and GPIO6 + * High = Internal ; Low = External + */ diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi index da01251f3b..60d6fbc895 100644 --- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi +++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi @@ -13,7 +13,7 @@ led-upgrade = &led_blue; }; - leds { + leds: leds { compatible = "gpio-leds"; led_white: led_white { diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 615abe4b3b..ae6e3c4d30 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -516,6 +516,13 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:link3" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:link4" "wlan0" "76" "100" ;; +ubnt,uk-ultra) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "white:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "white:rssi1" "wlan0" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "white:rssi2" "wlan0" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "white:rssi3" "wlan0" "76" "100" + ;; wallys,dr531) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x2" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index b74a7ff6b4..70bfd95f9e 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -116,6 +116,7 @@ ath79_setup_interfaces() ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ diff --git a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches index 899a8ba97e..279f518409 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches @@ -92,6 +92,10 @@ ubnt,nanostation-m) ubnt,nanostation-m-xw) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2" ;; +ubnt,uk-ultra) + ucidef_add_gpio_switch "ant0_internal" "ANT0 Internal" "5" "1" + ucidef_add_gpio_switch "ant1_internal" "ANT1 Internal" "6" "1" + ;; zbtlink,zbt-wd323) ucidef_add_gpio_switch "io0" "IO#0" "0" ucidef_add_gpio_switch "io1" "IO#1" "1" diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index dd627ad2d6..1acbf35947 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -37,6 +37,7 @@ case "$FIRMWARE" in sophos,ap100|\ sophos,ap100c|\ ubnt,bullet-ac|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 92b764c389..68cef7d14b 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -229,6 +229,13 @@ define Device/ubnt_routerstation-pro endef TARGET_DEVICES += ubnt_routerstation-pro +define Device/ubnt_uk-ultra + $(Device/ubnt_unifiac) + DEVICE_MODEL := UniFi Swiss Army Knife Ultra + DEVICE_PACKAGES += rssileds -swconfig +endef +TARGET_DEVICES += ubnt_uk-ultra + define Device/ubnt_unifi-ap $(Device/ubnt-bz) DEVICE_MODEL := UniFi AP From 934873f4514b490307d2ba23cc48f5a056e75f66 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Sun, 7 Jan 2024 01:04:36 +0000 Subject: [PATCH 42/52] ipq-wifi: bump version to 2024-01-06-71f45cff 673662f ipq8074: add Wallys DR8072V01 BDF 7e8b237 ipq40xx: add ZyXEL WSQ50 QCA4019 BDF 831c1bd ipq40xx: add ZyXEL WSQ50 QCA9984 BDF f9ff251 ipq40xx: add ASUS MAP-AC2200 QCA9888 BDF 71f45cf ipq8074: Update MX4200 BDF Signed-off-by: Manuel Fombuena Reviewed-by: Robert Marko --- package/firmware/ipq-wifi/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 189b8e9ec9..7b71c63d6f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2023-11-10 -PKG_SOURCE_VERSION:=0c2e810e71ed0a59fb00246c7fa2c236ff67a0ee -PKG_MIRROR_HASH:=fc6016540bd2c67484952d0e4432d740f0e022d9b688e851bb6321def8d36844 +PKG_SOURCE_DATE:=2024-01-06 +PKG_SOURCE_VERSION:=71f45cff8944405b7cc2bf5c19df2bd8fe7f2421 +PKG_MIRROR_HASH:=799602d1519605bab3a952bc07d1a055617ab295e338121bf0e6cae2ebbb0dc9 PKG_FLAGS:=nonshared From 04ed95d1f92058ec26826791e309ec3ae09ee625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 5 Jan 2024 11:31:26 +0100 Subject: [PATCH 43/52] kernel: backport more NVMEM changes queued for v6.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...factor-.add_cells-callback-arguments.patch | 94 +++++++++++++ ...mem-drop-nvmem_layout_get_match_data.patch | 72 ++++++++++ ...nvmem-core-add-nvmem_dev_size-helper.patch | 53 ++++++++ ...-use-nvmem_add_one_cell-nvmem-subsys.patch | 126 ++++++++++++++++++ ...-u-boot-env-use-nvmem-device-helpers.patch | 81 +++++++++++ ...vmem-u-boot-env-improve-coding-style.patch | 62 +++++++++ ...factor-.add_cells-callback-arguments.patch | 94 +++++++++++++ ...mem-drop-nvmem_layout_get_match_data.patch | 72 ++++++++++ ...nvmem-core-add-nvmem_dev_size-helper.patch | 53 ++++++++ ...-use-nvmem_add_one_cell-nvmem-subsys.patch | 126 ++++++++++++++++++ ...-u-boot-env-use-nvmem-device-helpers.patch | 81 +++++++++++ ...vmem-u-boot-env-improve-coding-style.patch | 62 +++++++++ ...env-align-endianness-of-crc32-values.patch | 6 +- ...env-align-endianness-of-crc32-values.patch | 6 +- 14 files changed, 982 insertions(+), 6 deletions(-) create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch create mode 100644 target/linux/generic/backport-5.15/834-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch create mode 100644 target/linux/generic/backport-6.1/819-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch diff --git a/target/linux/generic/backport-5.15/834-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch b/target/linux/generic/backport-5.15/834-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch new file mode 100644 index 0000000000..1bf3ba35b6 --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch @@ -0,0 +1,94 @@ +From 401df0d4f4098ecc9c5278da2f50756d62e5b37d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 19 Dec 2023 13:01:03 +0100 +Subject: [PATCH] nvmem: layouts: refactor .add_cells() callback arguments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Simply pass whole "struct nvmem_layout" instead of single variables. +There is nothing in "struct nvmem_layout" that we have to hide from +layout drivers. They also access it during .probe() and .remove(). + +Thanks to this change: + +1. API gets more consistent + All layouts drivers callbacks get the same argument + +2. Layouts get correct device + Before this change NVMEM core code was passing NVMEM device instead + of layout device. That resulted in: + * Confusing prints + * Calling devm_*() helpers on wrong device + * Helpers like of_device_get_match_data() dereferencing NULLs + +3. It gets possible to get match data + First of all nvmem_layout_get_match_data() requires passing "struct + nvmem_layout" which .add_cells() callback didn't have before this. It + doesn't matter much as it's rather useless now anyway (and will be + dropped). + What's more important however is that of_device_get_match_data() can + be used now thanks to owning a proper device pointer. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Reviewed-by: Michael Walle +Link: https://lore.kernel.org/r/20231219120104.3422-1-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + drivers/nvmem/layouts/onie-tlv.c | 4 +++- + drivers/nvmem/layouts/sl28vpd.c | 4 +++- + include/linux/nvmem-provider.h | 2 +- + 4 files changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -855,7 +855,7 @@ int nvmem_layout_register(struct nvmem_l + return -EINVAL; + + /* Populate the cells */ +- ret = layout->add_cells(&layout->nvmem->dev, layout->nvmem); ++ ret = layout->add_cells(layout); + if (ret) + return ret; + +--- a/drivers/nvmem/layouts/onie-tlv.c ++++ b/drivers/nvmem/layouts/onie-tlv.c +@@ -182,8 +182,10 @@ static bool onie_tlv_crc_is_valid(struct + return true; + } + +-static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem) ++static int onie_tlv_parse_table(struct nvmem_layout *layout) + { ++ struct nvmem_device *nvmem = layout->nvmem; ++ struct device *dev = &layout->dev; + struct onie_tlv_hdr hdr; + size_t table_len, data_len, hdr_len; + u8 *table, *data; +--- a/drivers/nvmem/layouts/sl28vpd.c ++++ b/drivers/nvmem/layouts/sl28vpd.c +@@ -80,8 +80,10 @@ static int sl28vpd_v1_check_crc(struct d + return 0; + } + +-static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem) ++static int sl28vpd_add_cells(struct nvmem_layout *layout) + { ++ struct nvmem_device *nvmem = layout->nvmem; ++ struct device *dev = &layout->dev; + const struct nvmem_cell_info *pinfo; + struct nvmem_cell_info info = {0}; + struct device_node *layout_np; +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -173,7 +173,7 @@ struct nvmem_cell_table { + struct nvmem_layout { + struct device dev; + struct nvmem_device *nvmem; +- int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); ++ int (*add_cells)(struct nvmem_layout *layout); + }; + + struct nvmem_layout_driver { diff --git a/target/linux/generic/backport-5.15/834-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch b/target/linux/generic/backport-5.15/834-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch new file mode 100644 index 0000000000..514b5f2de5 --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch @@ -0,0 +1,72 @@ +From 43f60e3fb62edc7bd8891de8779fb422f4ae23ae Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 19 Dec 2023 13:01:04 +0100 +Subject: [PATCH] nvmem: drop nvmem_layout_get_match_data() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Thanks for layouts refactoring we now have "struct device" associated +with layout. Also its OF pointer points directly to the "nvmem-layout" +DT node. + +All it takes to get match data is a generic of_device_get_match_data(). + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Reviewed-by: Michael Walle +Link: https://lore.kernel.org/r/20231219120104.3422-2-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 13 ------------- + include/linux/nvmem-provider.h | 10 ---------- + 2 files changed, 23 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -877,19 +877,6 @@ void nvmem_layout_unregister(struct nvme + } + EXPORT_SYMBOL_GPL(nvmem_layout_unregister); + +-const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout) +-{ +- struct device_node __maybe_unused *layout_np; +- const struct of_device_id *match; +- +- layout_np = of_nvmem_layout_get_container(nvmem); +- match = of_match_node(layout->dev.driver->of_match_table, layout_np); +- +- return match ? match->data : NULL; +-} +-EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); +- + /** + * nvmem_register() - Register a nvmem device for given nvmem_config. + * Also creates a binary entry in /sys/bus/nvmem/devices/dev-name/nvmem +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -205,9 +205,6 @@ void nvmem_layout_driver_unregister(stru + module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \ + nvmem_layout_driver_unregister) + +-const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout); +- + #else + + static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) +@@ -238,13 +235,6 @@ static inline int nvmem_layout_register( + + static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} + +-static inline const void * +-nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout) +-{ +- return NULL; +-} +- + #endif /* CONFIG_NVMEM */ + + #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) diff --git a/target/linux/generic/backport-5.15/834-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch b/target/linux/generic/backport-5.15/834-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch new file mode 100644 index 0000000000..aa0bbaa0c5 --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch @@ -0,0 +1,53 @@ +From 33cf42e68efc8ff529a7eee08a4f0ba8c8d0a207 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:17 +0100 +Subject: [PATCH] nvmem: core: add nvmem_dev_size() helper +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is required by layouts that need to read whole NVMEM content. It's +especially useful for NVMEM devices without hardcoded layout (like +U-Boot environment data block). + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-2-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 13 +++++++++++++ + include/linux/nvmem-consumer.h | 1 + + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -2164,6 +2164,19 @@ const char *nvmem_dev_name(struct nvmem_ + } + EXPORT_SYMBOL_GPL(nvmem_dev_name); + ++/** ++ * nvmem_dev_size() - Get the size of a given nvmem device. ++ * ++ * @nvmem: nvmem device. ++ * ++ * Return: size of the nvmem device. ++ */ ++size_t nvmem_dev_size(struct nvmem_device *nvmem) ++{ ++ return nvmem->size; ++} ++EXPORT_SYMBOL_GPL(nvmem_dev_size); ++ + static int __init nvmem_init(void) + { + int ret; +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -81,6 +81,7 @@ int nvmem_device_cell_write(struct nvmem + struct nvmem_cell_info *info, void *buf); + + const char *nvmem_dev_name(struct nvmem_device *nvmem); ++size_t nvmem_dev_size(struct nvmem_device *nvmem); + + void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, + size_t nentries); diff --git a/target/linux/generic/backport-5.15/834-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch b/target/linux/generic/backport-5.15/834-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch new file mode 100644 index 0000000000..fc826f3f7e --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch @@ -0,0 +1,126 @@ +From 7c8979b42b1a9c5604f431ba804928e55919263c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:18 +0100 +Subject: [PATCH] nvmem: u-boot-env: use nvmem_add_one_cell() nvmem subsystem + helper +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Simplify adding NVMEM cells. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-3-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 55 +++++++++++++++----------------------- + 1 file changed, 21 insertions(+), 34 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -23,13 +23,10 @@ enum u_boot_env_format { + + struct u_boot_env { + struct device *dev; ++ struct nvmem_device *nvmem; + enum u_boot_env_format format; + + struct mtd_info *mtd; +- +- /* Cells */ +- struct nvmem_cell_info *cells; +- int ncells; + }; + + struct u_boot_env_image_single { +@@ -94,43 +91,36 @@ static int u_boot_env_read_post_process_ + static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, + size_t data_offset, size_t data_len) + { ++ struct nvmem_device *nvmem = priv->nvmem; + struct device *dev = priv->dev; + char *data = buf + data_offset; + char *var, *value, *eq; +- int idx; +- +- priv->ncells = 0; +- for (var = data; var < data + data_len && *var; var += strlen(var) + 1) +- priv->ncells++; +- +- priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); +- if (!priv->cells) +- return -ENOMEM; + +- for (var = data, idx = 0; ++ for (var = data; + var < data + data_len && *var; +- var = value + strlen(value) + 1, idx++) { ++ var = value + strlen(value) + 1) { ++ struct nvmem_cell_info info = {}; ++ + eq = strchr(var, '='); + if (!eq) + break; + *eq = '\0'; + value = eq + 1; + +- priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL); +- if (!priv->cells[idx].name) ++ info.name = devm_kstrdup(dev, var, GFP_KERNEL); ++ if (!info.name) + return -ENOMEM; +- priv->cells[idx].offset = data_offset + value - data; +- priv->cells[idx].bytes = strlen(value); +- priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name); ++ info.offset = data_offset + value - data; ++ info.bytes = strlen(value); ++ info.np = of_get_child_by_name(dev->of_node, info.name); + if (!strcmp(var, "ethaddr")) { +- priv->cells[idx].raw_len = strlen(value); +- priv->cells[idx].bytes = ETH_ALEN; +- priv->cells[idx].read_post_process = u_boot_env_read_post_process_ethaddr; ++ info.raw_len = strlen(value); ++ info.bytes = ETH_ALEN; ++ info.read_post_process = u_boot_env_read_post_process_ethaddr; + } +- } + +- if (WARN_ON(idx != priv->ncells)) +- priv->ncells = idx; ++ nvmem_add_one_cell(nvmem, &info); ++ } + + return 0; + } +@@ -209,7 +199,6 @@ static int u_boot_env_probe(struct platf + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct u_boot_env *priv; +- int err; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -224,17 +213,15 @@ static int u_boot_env_probe(struct platf + return PTR_ERR(priv->mtd); + } + +- err = u_boot_env_parse(priv); +- if (err) +- return err; +- + config.dev = dev; +- config.cells = priv->cells; +- config.ncells = priv->ncells; + config.priv = priv; + config.size = priv->mtd->size; + +- return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++ priv->nvmem = devm_nvmem_register(dev, &config); ++ if (IS_ERR(priv->nvmem)) ++ return PTR_ERR(priv->nvmem); ++ ++ return u_boot_env_parse(priv); + } + + static const struct of_device_id u_boot_env_of_match_table[] = { diff --git a/target/linux/generic/backport-5.15/834-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch b/target/linux/generic/backport-5.15/834-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch new file mode 100644 index 0000000000..70abc7cf14 --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch @@ -0,0 +1,81 @@ +From a832556d23c5a11115f300011a5874d6107a0d62 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:19 +0100 +Subject: [PATCH] nvmem: u-boot-env: use nvmem device helpers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use nvmem_dev_size() and nvmem_device_read() to make this driver less +mtd dependent. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-4-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -127,27 +127,34 @@ static int u_boot_env_add_cells(struct u + + static int u_boot_env_parse(struct u_boot_env *priv) + { ++ struct nvmem_device *nvmem = priv->nvmem; + struct device *dev = priv->dev; + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; + size_t data_offset; + size_t data_len; ++ size_t dev_size; + uint32_t crc32; + uint32_t calc; +- size_t bytes; + uint8_t *buf; ++ int bytes; + int err; + +- buf = kcalloc(1, priv->mtd->size, GFP_KERNEL); ++ dev_size = nvmem_dev_size(nvmem); ++ ++ buf = kcalloc(1, dev_size, GFP_KERNEL); + if (!buf) { + err = -ENOMEM; + goto err_out; + } + +- err = mtd_read(priv->mtd, 0, priv->mtd->size, &bytes, buf); +- if ((err && !mtd_is_bitflip(err)) || bytes != priv->mtd->size) { +- dev_err(dev, "Failed to read from mtd: %d\n", err); ++ bytes = nvmem_device_read(nvmem, 0, dev_size, buf); ++ if (bytes < 0) { ++ err = bytes; ++ goto err_kfree; ++ } else if (bytes != dev_size) { ++ err = -EIO; + goto err_kfree; + } + +@@ -169,8 +176,8 @@ static int u_boot_env_parse(struct u_boo + break; + } + crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); +- crc32_data_len = priv->mtd->size - crc32_data_offset; +- data_len = priv->mtd->size - data_offset; ++ crc32_data_len = dev_size - crc32_data_offset; ++ data_len = dev_size - data_offset; + + calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; + if (calc != crc32) { +@@ -179,7 +186,7 @@ static int u_boot_env_parse(struct u_boo + goto err_kfree; + } + +- buf[priv->mtd->size - 1] = '\0'; ++ buf[dev_size - 1] = '\0'; + err = u_boot_env_add_cells(priv, buf, data_offset, data_len); + if (err) + dev_err(dev, "Failed to add cells: %d\n", err); diff --git a/target/linux/generic/backport-5.15/834-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch b/target/linux/generic/backport-5.15/834-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch new file mode 100644 index 0000000000..273cfed874 --- /dev/null +++ b/target/linux/generic/backport-5.15/834-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch @@ -0,0 +1,62 @@ +From 6bafe07c930676d6430be471310958070816a595 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:20 +0100 +Subject: [PATCH] nvmem: u-boot-env: improve coding style +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Prefer kzalloc() over kcalloc() + See memory-allocation.rst which says: "to be on the safe side it's + best to use routines that set memory to zero, like kzalloc()" +2. Drop dev_err() for u_boot_env_add_cells() fail + It can fail only on -ENOMEM. We don't want to print error then. +3. Add extra "crc32_addr" variable + It makes code reading header's crc32 easier to understand / review. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-5-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -132,6 +132,7 @@ static int u_boot_env_parse(struct u_boo + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; ++ __le32 *crc32_addr; + size_t data_offset; + size_t data_len; + size_t dev_size; +@@ -143,7 +144,7 @@ static int u_boot_env_parse(struct u_boo + + dev_size = nvmem_dev_size(nvmem); + +- buf = kcalloc(1, dev_size, GFP_KERNEL); ++ buf = kzalloc(dev_size, GFP_KERNEL); + if (!buf) { + err = -ENOMEM; + goto err_out; +@@ -175,7 +176,8 @@ static int u_boot_env_parse(struct u_boo + data_offset = offsetof(struct u_boot_env_image_broadcom, data); + break; + } +- crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); ++ crc32_addr = (__le32 *)(buf + crc32_offset); ++ crc32 = le32_to_cpu(*crc32_addr); + crc32_data_len = dev_size - crc32_data_offset; + data_len = dev_size - data_offset; + +@@ -188,8 +190,6 @@ static int u_boot_env_parse(struct u_boo + + buf[dev_size - 1] = '\0'; + err = u_boot_env_add_cells(priv, buf, data_offset, data_len); +- if (err) +- dev_err(dev, "Failed to add cells: %d\n", err); + + err_kfree: + kfree(buf); diff --git a/target/linux/generic/backport-6.1/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch b/target/linux/generic/backport-6.1/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch new file mode 100644 index 0000000000..1bf3ba35b6 --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch @@ -0,0 +1,94 @@ +From 401df0d4f4098ecc9c5278da2f50756d62e5b37d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 19 Dec 2023 13:01:03 +0100 +Subject: [PATCH] nvmem: layouts: refactor .add_cells() callback arguments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Simply pass whole "struct nvmem_layout" instead of single variables. +There is nothing in "struct nvmem_layout" that we have to hide from +layout drivers. They also access it during .probe() and .remove(). + +Thanks to this change: + +1. API gets more consistent + All layouts drivers callbacks get the same argument + +2. Layouts get correct device + Before this change NVMEM core code was passing NVMEM device instead + of layout device. That resulted in: + * Confusing prints + * Calling devm_*() helpers on wrong device + * Helpers like of_device_get_match_data() dereferencing NULLs + +3. It gets possible to get match data + First of all nvmem_layout_get_match_data() requires passing "struct + nvmem_layout" which .add_cells() callback didn't have before this. It + doesn't matter much as it's rather useless now anyway (and will be + dropped). + What's more important however is that of_device_get_match_data() can + be used now thanks to owning a proper device pointer. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Reviewed-by: Michael Walle +Link: https://lore.kernel.org/r/20231219120104.3422-1-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + drivers/nvmem/layouts/onie-tlv.c | 4 +++- + drivers/nvmem/layouts/sl28vpd.c | 4 +++- + include/linux/nvmem-provider.h | 2 +- + 4 files changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -855,7 +855,7 @@ int nvmem_layout_register(struct nvmem_l + return -EINVAL; + + /* Populate the cells */ +- ret = layout->add_cells(&layout->nvmem->dev, layout->nvmem); ++ ret = layout->add_cells(layout); + if (ret) + return ret; + +--- a/drivers/nvmem/layouts/onie-tlv.c ++++ b/drivers/nvmem/layouts/onie-tlv.c +@@ -182,8 +182,10 @@ static bool onie_tlv_crc_is_valid(struct + return true; + } + +-static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem) ++static int onie_tlv_parse_table(struct nvmem_layout *layout) + { ++ struct nvmem_device *nvmem = layout->nvmem; ++ struct device *dev = &layout->dev; + struct onie_tlv_hdr hdr; + size_t table_len, data_len, hdr_len; + u8 *table, *data; +--- a/drivers/nvmem/layouts/sl28vpd.c ++++ b/drivers/nvmem/layouts/sl28vpd.c +@@ -80,8 +80,10 @@ static int sl28vpd_v1_check_crc(struct d + return 0; + } + +-static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem) ++static int sl28vpd_add_cells(struct nvmem_layout *layout) + { ++ struct nvmem_device *nvmem = layout->nvmem; ++ struct device *dev = &layout->dev; + const struct nvmem_cell_info *pinfo; + struct nvmem_cell_info info = {0}; + struct device_node *layout_np; +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -173,7 +173,7 @@ struct nvmem_cell_table { + struct nvmem_layout { + struct device dev; + struct nvmem_device *nvmem; +- int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); ++ int (*add_cells)(struct nvmem_layout *layout); + }; + + struct nvmem_layout_driver { diff --git a/target/linux/generic/backport-6.1/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch b/target/linux/generic/backport-6.1/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch new file mode 100644 index 0000000000..514b5f2de5 --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch @@ -0,0 +1,72 @@ +From 43f60e3fb62edc7bd8891de8779fb422f4ae23ae Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 19 Dec 2023 13:01:04 +0100 +Subject: [PATCH] nvmem: drop nvmem_layout_get_match_data() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Thanks for layouts refactoring we now have "struct device" associated +with layout. Also its OF pointer points directly to the "nvmem-layout" +DT node. + +All it takes to get match data is a generic of_device_get_match_data(). + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Reviewed-by: Michael Walle +Link: https://lore.kernel.org/r/20231219120104.3422-2-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 13 ------------- + include/linux/nvmem-provider.h | 10 ---------- + 2 files changed, 23 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -877,19 +877,6 @@ void nvmem_layout_unregister(struct nvme + } + EXPORT_SYMBOL_GPL(nvmem_layout_unregister); + +-const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout) +-{ +- struct device_node __maybe_unused *layout_np; +- const struct of_device_id *match; +- +- layout_np = of_nvmem_layout_get_container(nvmem); +- match = of_match_node(layout->dev.driver->of_match_table, layout_np); +- +- return match ? match->data : NULL; +-} +-EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); +- + /** + * nvmem_register() - Register a nvmem device for given nvmem_config. + * Also creates a binary entry in /sys/bus/nvmem/devices/dev-name/nvmem +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -205,9 +205,6 @@ void nvmem_layout_driver_unregister(stru + module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \ + nvmem_layout_driver_unregister) + +-const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout); +- + #else + + static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) +@@ -238,13 +235,6 @@ static inline int nvmem_layout_register( + + static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} + +-static inline const void * +-nvmem_layout_get_match_data(struct nvmem_device *nvmem, +- struct nvmem_layout *layout) +-{ +- return NULL; +-} +- + #endif /* CONFIG_NVMEM */ + + #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) diff --git a/target/linux/generic/backport-6.1/819-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch b/target/linux/generic/backport-6.1/819-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch new file mode 100644 index 0000000000..aa0bbaa0c5 --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0010-nvmem-core-add-nvmem_dev_size-helper.patch @@ -0,0 +1,53 @@ +From 33cf42e68efc8ff529a7eee08a4f0ba8c8d0a207 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:17 +0100 +Subject: [PATCH] nvmem: core: add nvmem_dev_size() helper +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is required by layouts that need to read whole NVMEM content. It's +especially useful for NVMEM devices without hardcoded layout (like +U-Boot environment data block). + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-2-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 13 +++++++++++++ + include/linux/nvmem-consumer.h | 1 + + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -2164,6 +2164,19 @@ const char *nvmem_dev_name(struct nvmem_ + } + EXPORT_SYMBOL_GPL(nvmem_dev_name); + ++/** ++ * nvmem_dev_size() - Get the size of a given nvmem device. ++ * ++ * @nvmem: nvmem device. ++ * ++ * Return: size of the nvmem device. ++ */ ++size_t nvmem_dev_size(struct nvmem_device *nvmem) ++{ ++ return nvmem->size; ++} ++EXPORT_SYMBOL_GPL(nvmem_dev_size); ++ + static int __init nvmem_init(void) + { + int ret; +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -81,6 +81,7 @@ int nvmem_device_cell_write(struct nvmem + struct nvmem_cell_info *info, void *buf); + + const char *nvmem_dev_name(struct nvmem_device *nvmem); ++size_t nvmem_dev_size(struct nvmem_device *nvmem); + + void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, + size_t nentries); diff --git a/target/linux/generic/backport-6.1/819-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch b/target/linux/generic/backport-6.1/819-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch new file mode 100644 index 0000000000..fc826f3f7e --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0011-nvmem-u-boot-env-use-nvmem_add_one_cell-nvmem-subsys.patch @@ -0,0 +1,126 @@ +From 7c8979b42b1a9c5604f431ba804928e55919263c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:18 +0100 +Subject: [PATCH] nvmem: u-boot-env: use nvmem_add_one_cell() nvmem subsystem + helper +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Simplify adding NVMEM cells. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-3-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 55 +++++++++++++++----------------------- + 1 file changed, 21 insertions(+), 34 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -23,13 +23,10 @@ enum u_boot_env_format { + + struct u_boot_env { + struct device *dev; ++ struct nvmem_device *nvmem; + enum u_boot_env_format format; + + struct mtd_info *mtd; +- +- /* Cells */ +- struct nvmem_cell_info *cells; +- int ncells; + }; + + struct u_boot_env_image_single { +@@ -94,43 +91,36 @@ static int u_boot_env_read_post_process_ + static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, + size_t data_offset, size_t data_len) + { ++ struct nvmem_device *nvmem = priv->nvmem; + struct device *dev = priv->dev; + char *data = buf + data_offset; + char *var, *value, *eq; +- int idx; +- +- priv->ncells = 0; +- for (var = data; var < data + data_len && *var; var += strlen(var) + 1) +- priv->ncells++; +- +- priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); +- if (!priv->cells) +- return -ENOMEM; + +- for (var = data, idx = 0; ++ for (var = data; + var < data + data_len && *var; +- var = value + strlen(value) + 1, idx++) { ++ var = value + strlen(value) + 1) { ++ struct nvmem_cell_info info = {}; ++ + eq = strchr(var, '='); + if (!eq) + break; + *eq = '\0'; + value = eq + 1; + +- priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL); +- if (!priv->cells[idx].name) ++ info.name = devm_kstrdup(dev, var, GFP_KERNEL); ++ if (!info.name) + return -ENOMEM; +- priv->cells[idx].offset = data_offset + value - data; +- priv->cells[idx].bytes = strlen(value); +- priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name); ++ info.offset = data_offset + value - data; ++ info.bytes = strlen(value); ++ info.np = of_get_child_by_name(dev->of_node, info.name); + if (!strcmp(var, "ethaddr")) { +- priv->cells[idx].raw_len = strlen(value); +- priv->cells[idx].bytes = ETH_ALEN; +- priv->cells[idx].read_post_process = u_boot_env_read_post_process_ethaddr; ++ info.raw_len = strlen(value); ++ info.bytes = ETH_ALEN; ++ info.read_post_process = u_boot_env_read_post_process_ethaddr; + } +- } + +- if (WARN_ON(idx != priv->ncells)) +- priv->ncells = idx; ++ nvmem_add_one_cell(nvmem, &info); ++ } + + return 0; + } +@@ -209,7 +199,6 @@ static int u_boot_env_probe(struct platf + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct u_boot_env *priv; +- int err; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -224,17 +213,15 @@ static int u_boot_env_probe(struct platf + return PTR_ERR(priv->mtd); + } + +- err = u_boot_env_parse(priv); +- if (err) +- return err; +- + config.dev = dev; +- config.cells = priv->cells; +- config.ncells = priv->ncells; + config.priv = priv; + config.size = priv->mtd->size; + +- return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++ priv->nvmem = devm_nvmem_register(dev, &config); ++ if (IS_ERR(priv->nvmem)) ++ return PTR_ERR(priv->nvmem); ++ ++ return u_boot_env_parse(priv); + } + + static const struct of_device_id u_boot_env_of_match_table[] = { diff --git a/target/linux/generic/backport-6.1/819-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch b/target/linux/generic/backport-6.1/819-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch new file mode 100644 index 0000000000..70abc7cf14 --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0012-nvmem-u-boot-env-use-nvmem-device-helpers.patch @@ -0,0 +1,81 @@ +From a832556d23c5a11115f300011a5874d6107a0d62 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:19 +0100 +Subject: [PATCH] nvmem: u-boot-env: use nvmem device helpers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use nvmem_dev_size() and nvmem_device_read() to make this driver less +mtd dependent. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-4-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -127,27 +127,34 @@ static int u_boot_env_add_cells(struct u + + static int u_boot_env_parse(struct u_boot_env *priv) + { ++ struct nvmem_device *nvmem = priv->nvmem; + struct device *dev = priv->dev; + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; + size_t data_offset; + size_t data_len; ++ size_t dev_size; + uint32_t crc32; + uint32_t calc; +- size_t bytes; + uint8_t *buf; ++ int bytes; + int err; + +- buf = kcalloc(1, priv->mtd->size, GFP_KERNEL); ++ dev_size = nvmem_dev_size(nvmem); ++ ++ buf = kcalloc(1, dev_size, GFP_KERNEL); + if (!buf) { + err = -ENOMEM; + goto err_out; + } + +- err = mtd_read(priv->mtd, 0, priv->mtd->size, &bytes, buf); +- if ((err && !mtd_is_bitflip(err)) || bytes != priv->mtd->size) { +- dev_err(dev, "Failed to read from mtd: %d\n", err); ++ bytes = nvmem_device_read(nvmem, 0, dev_size, buf); ++ if (bytes < 0) { ++ err = bytes; ++ goto err_kfree; ++ } else if (bytes != dev_size) { ++ err = -EIO; + goto err_kfree; + } + +@@ -169,8 +176,8 @@ static int u_boot_env_parse(struct u_boo + break; + } + crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); +- crc32_data_len = priv->mtd->size - crc32_data_offset; +- data_len = priv->mtd->size - data_offset; ++ crc32_data_len = dev_size - crc32_data_offset; ++ data_len = dev_size - data_offset; + + calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; + if (calc != crc32) { +@@ -179,7 +186,7 @@ static int u_boot_env_parse(struct u_boo + goto err_kfree; + } + +- buf[priv->mtd->size - 1] = '\0'; ++ buf[dev_size - 1] = '\0'; + err = u_boot_env_add_cells(priv, buf, data_offset, data_len); + if (err) + dev_err(dev, "Failed to add cells: %d\n", err); diff --git a/target/linux/generic/backport-6.1/819-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch b/target/linux/generic/backport-6.1/819-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch new file mode 100644 index 0000000000..273cfed874 --- /dev/null +++ b/target/linux/generic/backport-6.1/819-v6.8-0013-nvmem-u-boot-env-improve-coding-style.patch @@ -0,0 +1,62 @@ +From 6bafe07c930676d6430be471310958070816a595 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Dec 2023 18:34:20 +0100 +Subject: [PATCH] nvmem: u-boot-env: improve coding style +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Prefer kzalloc() over kcalloc() + See memory-allocation.rst which says: "to be on the safe side it's + best to use routines that set memory to zero, like kzalloc()" +2. Drop dev_err() for u_boot_env_add_cells() fail + It can fail only on -ENOMEM. We don't want to print error then. +3. Add extra "crc32_addr" variable + It makes code reading header's crc32 easier to understand / review. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Link: https://lore.kernel.org/r/20231221173421.13737-5-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/u-boot-env.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -132,6 +132,7 @@ static int u_boot_env_parse(struct u_boo + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; ++ __le32 *crc32_addr; + size_t data_offset; + size_t data_len; + size_t dev_size; +@@ -143,7 +144,7 @@ static int u_boot_env_parse(struct u_boo + + dev_size = nvmem_dev_size(nvmem); + +- buf = kcalloc(1, dev_size, GFP_KERNEL); ++ buf = kzalloc(dev_size, GFP_KERNEL); + if (!buf) { + err = -ENOMEM; + goto err_out; +@@ -175,7 +176,8 @@ static int u_boot_env_parse(struct u_boo + data_offset = offsetof(struct u_boot_env_image_broadcom, data); + break; + } +- crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); ++ crc32_addr = (__le32 *)(buf + crc32_offset); ++ crc32 = le32_to_cpu(*crc32_addr); + crc32_data_len = dev_size - crc32_data_offset; + data_len = dev_size - data_offset; + +@@ -188,8 +190,6 @@ static int u_boot_env_parse(struct u_boo + + buf[dev_size - 1] = '\0'; + err = u_boot_env_add_cells(priv, buf, data_offset, data_len); +- if (err) +- dev_err(dev, "Failed to add cells: %d\n", err); + + err_kfree: + kfree(buf); diff --git a/target/linux/generic/pending-5.15/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/pending-5.15/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 9b111050ee..d07447bcba 100644 --- a/target/linux/generic/pending-5.15/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/pending-5.15/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,9 +36,9 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -182,7 +182,7 @@ static int u_boot_env_parse(struct u_boo - crc32_data_len = priv->mtd->size - crc32_data_offset; - data_len = priv->mtd->size - data_offset; +@@ -181,7 +181,7 @@ static int u_boot_env_parse(struct u_boo + crc32_data_len = dev_size - crc32_data_offset; + data_len = dev_size - data_offset; - calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; + calc = le32_to_cpu((__le32)crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L); diff --git a/target/linux/generic/pending-6.1/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/pending-6.1/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 9b111050ee..d07447bcba 100644 --- a/target/linux/generic/pending-6.1/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/pending-6.1/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,9 +36,9 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -182,7 +182,7 @@ static int u_boot_env_parse(struct u_boo - crc32_data_len = priv->mtd->size - crc32_data_offset; - data_len = priv->mtd->size - data_offset; +@@ -181,7 +181,7 @@ static int u_boot_env_parse(struct u_boo + crc32_data_len = dev_size - crc32_data_offset; + data_len = dev_size - data_offset; - calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; + calc = le32_to_cpu((__le32)crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L); From 751791d545087ceee10c680ec8b5590b3554d082 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 6 Jan 2024 18:48:46 +0100 Subject: [PATCH 44/52] packages: store URL in Manifest The manifest should provide as much information as possible about the package, including the project URL. With this commit the URL is stored as it's own attribute instead of at the end of the description. Signed-off-by: Paul Spooren --- include/package-dumpinfo.mk | 4 ++-- include/package-ipkg.mk | 1 + scripts/metadata.pm | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 6baf10225d..fc25099ad3 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -37,14 +37,14 @@ $(if $(USERID),Require-User: $(USERID) $(if $(LICENSE),License: $(LICENSE) )$(if $(LICENSE_FILES),LicenseFiles: $(LICENSE_FILES) )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) +)$(if $(URL),URL: $(URL) )$(if $(ABI_VERSION),ABI-Version: $(ABI_VERSION) )Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg)) $(if $(KCONFIG),Kernel-Config: $(KCONFIG) )$(if $(BUILDONLY),Build-Only: $(BUILDONLY) )$(if $(HIDDEN),Hidden: $(HIDDEN) )Description: $(if $(Package/$(1)/description),$(Package/$(1)/description),$(TITLE)) -$(if $(URL),$(URL) -)$(MAINTAINER) +$(MAINTAINER) @@ $(if $(Package/$(1)/config),Config: $(Package/$(1)/config) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index afa2b81eb9..5f5f7e1317 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -185,6 +185,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,Section,$(SECTION) )$$(call addfield,Require-User,$(USERID) )$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH) +)$$(call addfield,URL,$(URL) )$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1)) )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) )$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 587ce7207d..ecfe42c0bc 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -257,6 +257,7 @@ sub parse_package_metadata($) { /^License: \s*(.+)\s*$/ and $pkg->{license} = $1; /^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1; /^CPE-ID: \s*(.+)\s*$/ and $pkg->{cpe_id} = $1; + /^URL: \s*(.+)\s*$/ and $pkg->{url} = $1; /^ABI-Version: \s*(.+)\s*$/ and $pkg->{abi_version} = $1; /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; /^Provides: \s*(.+)\s*$/ and do { @@ -344,6 +345,7 @@ sub parse_package_manifest_metadata($) { /^Section:\s*(.+)\s*$/ and $pkg->{section} = $1; /^SourceDateEpoch: \s*(.+)\s*$/ and $pkg->{sourcedateepoch} = $1; /^CPE-ID:\s*(.+)\s*$/ and $pkg->{cpe_id} = $1; + /^URL:\s*(.+)\s*$/ and $pkg->{url} = $1; /^Architecture:\s*(.+)\s*$/ and $pkg->{architecture} = $1; /^Installed-Size:\s*(.+)\s*$/ and $pkg->{installedsize} = $1; /^Filename:\s*(.+)\s*$/ and $pkg->{filename} = $1; From e32edf712b7c43e25b4bec40fedfd948a0ed5bd6 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 6 Jan 2024 18:50:00 +0100 Subject: [PATCH 45/52] packages: add PKG_URL variable Using PKG_URL one may set the URL for all sub packages, which is usually shared anyway. Future packages should only use PKG_URL instead of adding it per sub-package. Signed-off-by: Paul Spooren --- include/package-defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/package-defaults.mk b/include/package-defaults.mk index 2cff26b531..30b112c7d8 100644 --- a/include/package-defaults.mk +++ b/include/package-defaults.mk @@ -49,7 +49,7 @@ define Package/Default KCONFIG:= BUILDONLY:= HIDDEN:= - URL:= + URL:=$(PKG_URL) VARIANT:= DEFAULT_VARIANT:= USERID:= From 49e8f532989c342fff44c1c558f8182585673833 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 6 Jan 2024 18:10:29 +0100 Subject: [PATCH 46/52] scripts: fix installed-size calculation Previously the script would calculate the size of the compressed archive which isn't the size installed in the overlayfs. This commit uses zcat in combination with wc to calculate the umcompressed size. Signed-off-by: Paul Spooren --- scripts/ipkg-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ipkg-build b/scripts/ipkg-build index 122cca2cb4..6abcc58832 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -181,7 +181,7 @@ for file_mode in $file_modes; do done $TAR -X "$tmp_dir"/tarX --format=gnu --numeric-owner --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/data.tar.gz -installed_size=$(stat -c "%s" "$tmp_dir"/data.tar.gz) +installed_size=$(zcat < "$tmp_dir"/data.tar.gz | wc -c) sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \ "$pkg_dir"/$CONTROL/control From c7c2257f8289ba278a6baffb6fea945b4ad47344 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Mon, 8 Jan 2024 01:49:58 +0000 Subject: [PATCH 47/52] ipq-wifi: fix PKG_MIRROR_HASH Incorrect PKG_MIRROR_HASH introduced on #14356 Fixes: 934873f4514b ("ipq-wifi: bump version to 2024-01-06-71f45cff") Signed-off-by: Manuel Fombuena --- package/firmware/ipq-wifi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 7b71c63d6f..fe249807d4 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -8,7 +8,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git PKG_SOURCE_DATE:=2024-01-06 PKG_SOURCE_VERSION:=71f45cff8944405b7cc2bf5c19df2bd8fe7f2421 -PKG_MIRROR_HASH:=799602d1519605bab3a952bc07d1a055617ab295e338121bf0e6cae2ebbb0dc9 +PKG_MIRROR_HASH:=90c3c1659c54cdb4685d0a71633746c1000230e459801eb8ce12c805a994cc37 PKG_FLAGS:=nonshared From 5a82bb909bf16786b85508d2e974ddf0a14bb10c Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 6 Jan 2024 19:59:13 +0200 Subject: [PATCH 48/52] mediatek: GL-MT6000: Add missing LED state definitions Adjust LED names and provide the OpenWrt status indicator aliases to actually use LEDs by the OpenWrt boot & sysupgrade processes. * Name both LEDs clearly by the color * Add the missing OpenWrt LED status indicator aliases and remove the now unnecessary default status from blue LED After this commit, the LEDs are used as: * bootloader, really early Linux boot: blue LED is on * preinit/failsafe: white LED blinks rapidly * late boot: white LED blinks slowly * boot completed, running normally: blue LED is on * sysupgrade: white LED blinks Signed-off-by: Hannu Nyman --- target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts index fded507039..9a7031df53 100644 --- a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -13,6 +13,10 @@ aliases { serial0 = &uart0; + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_white; }; chosen { @@ -51,13 +55,12 @@ leds { compatible = "gpio-leds"; - led_run: led@0 { + led_blue: led@0 { label = "blue:run"; gpios = <&pio 38 GPIO_ACTIVE_LOW>; - default-state = "on"; }; - led@1 { + led_white: led@1 { label = "white:system"; gpios = <&pio 37 GPIO_ACTIVE_LOW>; }; From b4086f44cd8a739458a0fd12cfaf684515507614 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Fri, 13 Oct 2023 12:44:11 +0200 Subject: [PATCH 49/52] mediatek: add support for YunCore AX835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: 16MB NOR RAM: 256MB Ethernet: 2x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset Power: DC 12V 1A, PoE 802.3af 48V Flash instructions: Option #1 - SSH I was able to SSH into the stock firmware of my device. 1. Attach the router to the network 2. Use scp (-O) to copy the sysupgrade image 3. Connect using SSH and run `sysupgrade -n` Option #2 - U-Boot One way to use the bootloader for flashing is using TFTP: 1. Connect to the router using an ethernet cable 2 Spin up a TFTP server serving the sysupgrade file 3. Open the case and attach a UART 4. Attach power to the router and interrupt the countdown by pressing any key 5. Select option #2 (Upgrade firmware) 6. Enter IP address information and image name 7. Wait patiently Co-Authored-By: Enrique Rodríguez Valencia Co-Authored-By: Hauke Mehrtens Signed-off-by: Leon M. Busch-George --- .../mediatek/dts/mt7981b-yuncore-ax835.dts | 259 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 6 +- .../base-files/lib/upgrade/platform.sh | 3 +- target/linux/mediatek/image/filogic.mk | 19 ++ 4 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts diff --git a/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts b/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts new file mode 100644 index 0000000000..b3ca5bfa2c --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + compatible = "yuncore,ax835", "mediatek,mt7981"; + model = "YunCore AX835"; + + aliases { + ethernet0 = &gmac0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + reg_led_vbus { + compatible = "regulator-fixed"; + regulator-name = "led_vbus"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + gpio = <&pio 5 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led_system: led_system { + label = "red:system"; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + + led_wifi24 { + label = "green:wifi2"; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wifi5 { + label = "blue:wifi5"; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_hwwatchdog { + // a gpio-wdt watchdog couldn't be made to work. + // the device rebooted after 5 minutes. + label = "hwwatchdog"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + led-pattern = <1000>, <1000>; + }; + + // there's another "syswatchdog" on gpio2 + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "disabled"; +}; + +&spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + + compatible = "jedec,spi-nor"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000 { + label = "BL2"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_24: macaddr@24 { + reg = <0x24 0x6>; + }; + + macaddr_factory_2a: macaddr@2a { + reg = <0x2a 0x6>; + }; + }; + + partition@100000 { + label = "FIP"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@180000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x180000 0xe00000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + lan: port@3 { + reg = <3>; + label = "lan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_2a 0>; + }; + + port@4 { + reg = <4>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_2a 0>; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory 0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index dd3464b72c..2a6a97919d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -66,7 +66,8 @@ mediatek_setup_interfaces() ucidef_set_interface_lan "eth0" ;; smartrg,sdg-8622|\ - smartrg,sdg-8632) + smartrg,sdg-8632|\ + yuncore,ax835) ucidef_set_interfaces_lan_wan lan wan ;; tplink,tl-xdr6086) @@ -170,6 +171,9 @@ mediatek_setup_macs() wan_mac=$(mtd_get_mac_ascii Bdata ethaddr_wan) label_mac=$wan_mac ;; + yuncore,ax835) + label_mac=$(mtd_get_mac_binary "Factory" 0x4) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 65ec5d8271..517f4520e1 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -111,7 +111,8 @@ platform_do_upgrade() { ;; esac ;; - cudy,wr3000-v1) + cudy,wr3000-v1|\ + yuncore,ax835) default_do_upgrade "$1" ;; glinet,gl-mt2500|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index c079fae0b0..d0c9907635 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -880,6 +880,25 @@ endif endef TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod +define Device/yuncore_ax835 + DEVICE_VENDOR := YunCore + DEVICE_MODEL := AX835 + DEVICE_DTS := mt7981b-yuncore-ax835 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + IMAGES := sysupgrade.bin + IMAGE_SIZE := 14336k + SUPPORTED_DEVICES += mediatek,mt7981-spim-nor-rfb + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += yuncore_ax835 + + define Device/zbtlink_zbt-z8102ax DEVICE_VENDOR := Zbtlink DEVICE_MODEL := ZBT-Z8102AX From 50416c18dd309fec75b6911221905cd0c0139b25 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 21 Dec 2023 21:20:17 +0100 Subject: [PATCH 50/52] mediatek: disable btif for mt7622 devices It breaks built-in SoC WLAN. Can be re-enabled after we've figured out the cause Signed-off-by: Felix Fietkau --- .../mt7622-dlink-eagle-pro-ai-ax3200-a1.dtsi | 4 --- .../mediatek/dts/mt7622-linksys-e8450.dtsi | 4 --- .../mediatek/dts/mt7622-netgear-wax206.dts | 4 --- .../106-dts-mt7622-disable_btif.patch | 26 +++++++++++++++++++ .../112-dts-fix-bpi64-lan-names.patch | 2 +- .../114-dts-bpi64-disable-rtc.patch | 2 +- .../115-dts-bpi64-add-snand-support.patch | 2 +- .../131-dts-mt7622-add-snand-support.patch | 2 +- ...dts-fix-wmac-support-for-mt7622-rfb1.patch | 4 +-- ...80-dts-mt7622-bpi-r64-add-mt7531-irq.patch | 2 +- .../331-mt7622-rfb1-enable-bmt.patch | 2 +- ...mt7622-bpi-r64-aliases-for-dtoverlay.patch | 2 +- .../910-dts-mt7622-bpi-r64-wifi-eeprom.patch | 2 +- 13 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 target/linux/mediatek/patches-6.1/106-dts-mt7622-disable_btif.patch diff --git a/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-ax3200-a1.dtsi b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-ax3200-a1.dtsi index 6d87454370..10cee7bcef 100644 --- a/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-ax3200-a1.dtsi +++ b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-ax3200-a1.dtsi @@ -54,10 +54,6 @@ status = "okay"; }; -&btif { - status = "okay"; -}; - ð { pinctrl-names = "default"; pinctrl-0 = <ð_pins>; diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi index abac02a72d..be216d972c 100644 --- a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi @@ -110,10 +110,6 @@ }; }; -&btif { - status = "okay"; -}; - &cir { pinctrl-names = "default"; pinctrl-0 = <&irrx_pins>; diff --git a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts index 737ac35f3d..ce1cd46d2d 100644 --- a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts +++ b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts @@ -114,10 +114,6 @@ status = "okay"; }; -&btif { - status = "okay"; -}; - &cir { pinctrl-names = "default"; pinctrl-0 = <&irrx_pins>; diff --git a/target/linux/mediatek/patches-6.1/106-dts-mt7622-disable_btif.patch b/target/linux/mediatek/patches-6.1/106-dts-mt7622-disable_btif.patch new file mode 100644 index 0000000000..fc6a8f35bc --- /dev/null +++ b/target/linux/mediatek/patches-6.1/106-dts-mt7622-disable_btif.patch @@ -0,0 +1,26 @@ +--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +@@ -108,10 +108,6 @@ + status = "disabled"; + }; + +-&btif { +- status = "okay"; +-}; +- + &cir { + pinctrl-names = "default"; + pinctrl-0 = <&irrx_pins>; +--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +@@ -89,10 +89,6 @@ + status = "disabled"; + }; + +-&btif { +- status = "okay"; +-}; +- + &cir { + pinctrl-names = "default"; + pinctrl-0 = <&irrx_pins>; diff --git a/target/linux/mediatek/patches-6.1/112-dts-fix-bpi64-lan-names.patch b/target/linux/mediatek/patches-6.1/112-dts-fix-bpi64-lan-names.patch index 816683e626..b012a48d75 100644 --- a/target/linux/mediatek/patches-6.1/112-dts-fix-bpi64-lan-names.patch +++ b/target/linux/mediatek/patches-6.1/112-dts-fix-bpi64-lan-names.patch @@ -8,7 +8,7 @@ }; chosen { -@@ -164,22 +165,22 @@ +@@ -160,22 +161,22 @@ port@1 { reg = <1>; diff --git a/target/linux/mediatek/patches-6.1/114-dts-bpi64-disable-rtc.patch b/target/linux/mediatek/patches-6.1/114-dts-bpi64-disable-rtc.patch index 3d1b90217f..e30d9e5e12 100644 --- a/target/linux/mediatek/patches-6.1/114-dts-bpi64-disable-rtc.patch +++ b/target/linux/mediatek/patches-6.1/114-dts-bpi64-disable-rtc.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -@@ -558,12 +558,16 @@ +@@ -554,12 +554,16 @@ status = "okay"; }; diff --git a/target/linux/mediatek/patches-6.1/115-dts-bpi64-add-snand-support.patch b/target/linux/mediatek/patches-6.1/115-dts-bpi64-add-snand-support.patch index b159a17c4a..93f87fe697 100644 --- a/target/linux/mediatek/patches-6.1/115-dts-bpi64-add-snand-support.patch +++ b/target/linux/mediatek/patches-6.1/115-dts-bpi64-add-snand-support.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -@@ -255,14 +255,42 @@ +@@ -251,14 +251,42 @@ status = "disabled"; }; diff --git a/target/linux/mediatek/patches-6.1/131-dts-mt7622-add-snand-support.patch b/target/linux/mediatek/patches-6.1/131-dts-mt7622-add-snand-support.patch index 9cfe69ebb6..d6e0ab1d41 100644 --- a/target/linux/mediatek/patches-6.1/131-dts-mt7622-add-snand-support.patch +++ b/target/linux/mediatek/patches-6.1/131-dts-mt7622-add-snand-support.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -538,6 +538,65 @@ +@@ -534,6 +534,65 @@ status = "disabled"; }; diff --git a/target/linux/mediatek/patches-6.1/140-dts-fix-wmac-support-for-mt7622-rfb1.patch b/target/linux/mediatek/patches-6.1/140-dts-fix-wmac-support-for-mt7622-rfb1.patch index b01ce97cf0..117d5abde6 100644 --- a/target/linux/mediatek/patches-6.1/140-dts-fix-wmac-support-for-mt7622-rfb1.patch +++ b/target/linux/mediatek/patches-6.1/140-dts-fix-wmac-support-for-mt7622-rfb1.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -579,7 +579,7 @@ +@@ -575,7 +575,7 @@ reg = <0x140000 0x0080000>; }; @@ -9,7 +9,7 @@ label = "Factory"; reg = <0x1c0000 0x0100000>; }; -@@ -640,5 +640,6 @@ +@@ -636,5 +636,6 @@ &wmac { pinctrl-names = "default"; pinctrl-0 = <&wmac_pins>; diff --git a/target/linux/mediatek/patches-6.1/180-dts-mt7622-bpi-r64-add-mt7531-irq.patch b/target/linux/mediatek/patches-6.1/180-dts-mt7622-bpi-r64-add-mt7531-irq.patch index 5a834ac34f..676c09f656 100644 --- a/target/linux/mediatek/patches-6.1/180-dts-mt7622-bpi-r64-add-mt7531-irq.patch +++ b/target/linux/mediatek/patches-6.1/180-dts-mt7622-bpi-r64-add-mt7531-irq.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -@@ -156,6 +156,10 @@ +@@ -152,6 +152,10 @@ switch@0 { compatible = "mediatek,mt7531"; reg = <0>; diff --git a/target/linux/mediatek/patches-6.1/331-mt7622-rfb1-enable-bmt.patch b/target/linux/mediatek/patches-6.1/331-mt7622-rfb1-enable-bmt.patch index 662515f2c5..3e956701cd 100644 --- a/target/linux/mediatek/patches-6.1/331-mt7622-rfb1-enable-bmt.patch +++ b/target/linux/mediatek/patches-6.1/331-mt7622-rfb1-enable-bmt.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -552,6 +552,7 @@ +@@ -548,6 +548,7 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; nand-ecc-engine = <&snfi>; diff --git a/target/linux/mediatek/patches-6.1/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch b/target/linux/mediatek/patches-6.1/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch index 600b94d7bb..8e56be9ff4 100644 --- a/target/linux/mediatek/patches-6.1/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch +++ b/target/linux/mediatek/patches-6.1/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -@@ -314,7 +314,7 @@ +@@ -310,7 +310,7 @@ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and * SATA functions. i.e. output-high: PCIe, output-low: SATA */ diff --git a/target/linux/mediatek/patches-6.1/910-dts-mt7622-bpi-r64-wifi-eeprom.patch b/target/linux/mediatek/patches-6.1/910-dts-mt7622-bpi-r64-wifi-eeprom.patch index a45d51dd9f..b6762e29ac 100644 --- a/target/linux/mediatek/patches-6.1/910-dts-mt7622-bpi-r64-wifi-eeprom.patch +++ b/target/linux/mediatek/patches-6.1/910-dts-mt7622-bpi-r64-wifi-eeprom.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -@@ -641,5 +641,28 @@ +@@ -637,5 +637,28 @@ }; &wmac { From 32d2443476188f880395e52e0216c84dce9670f8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 21 Dec 2023 17:29:45 +0100 Subject: [PATCH 51/52] libubox: work around recent macOS linker change rpath handling seems to be more restrictive now. To deal with this, link the libubox library from STAGING_DIR_HOST to STAGING_DIR_HOSTPKG, so that packages installed to STAGING_DIR_HOSTPKG can pick it up. This mainly affects ucode, but possibly other host builds as well Signed-off-by: Felix Fietkau --- package/libs/libubox/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 549e604679..1ea886e6ac 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -105,6 +105,14 @@ CMAKE_HOST_OPTIONS += \ -DCMAKE_MACOSX_RPATH=1 \ -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ +ifeq ($(HOST_OS),Darwin) + define Host/Install + $(Host/Install/Default) + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib + cd "$(STAGING_DIR_HOSTPKG)/lib" && ln -sf ../../host/lib/libubox.* . + endef +endif + $(eval $(call BuildPackage,libubox)) $(eval $(call BuildPackage,libblobmsg-json)) $(eval $(call BuildPackage,jshn)) From d864f68232e910f2c8ab06a66347fc08c257dfcc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 11:05:45 +0100 Subject: [PATCH 52/52] hostapd: add missing NULL pointer check on radar notification Fixes a race condition that can lead to a hostapd crash Signed-off-by: Felix Fietkau --- package/network/services/hostapd/src/src/ap/ubus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 6ff2257c32..66eba99901 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1907,6 +1907,9 @@ void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequen struct hostapd_data *hapd; int i; + if (!ctx) + return; + blob_buf_init(&b, 0); blobmsg_add_u16(&b, "frequency", frequency); blobmsg_add_u16(&b, "width", chan_width);