Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-09-16 15:32:20 +08:00
commit 165b0899d4
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
327 changed files with 14204 additions and 425 deletions

View File

@ -14,7 +14,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir
world:
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' | head -n 1)
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' -m 1)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
ifneq ($(OPENWRT_BUILD),1)

View File

@ -58,6 +58,10 @@ menu "Global build settings"
bool "Enable signature checking in opkg"
default SIGNED_PACKAGES
config DOWNLOAD_CHECK_CERTIFICATE
bool "Enable TLS certificate verification during package download"
default y
comment "General build options"
config TESTING_KERNEL
@ -156,7 +160,6 @@ menu "Global build settings"
choice
prompt "Binary stripping method"
default USE_STRIP if EXTERNAL_TOOLCHAIN
default USE_STRIP if USE_GLIBC
default USE_SSTRIP
help

View File

@ -27,7 +27,7 @@ ifneq ($(wildcard $(2)),)
{ [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
) \
{ \
[ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
[ -f "$(2)_check.1" ] && mv "$(2)_check.1" "$(2)_check"; \
$(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
touch -r "$(2)" "$(2)_check"; \

View File

@ -198,8 +198,8 @@ ifndef DUMP
ifneq ($(CONFIG_AUTOREMOVE),)
host-compile:
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
$(XARGS) rm -rf
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \
$(XARGS) -0 rm -rf
endif
endef
endif

View File

@ -756,6 +756,7 @@ define BuildImage
else
image_prepare:
rm -rf $(KDIR)/tmp
mkdir -p $(BIN_DIR) $(KDIR)/tmp
endif

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .139
LINUX_KERNEL_HASH-5.10.139 = 1c002ac275a44934a280a158a136735bf6665b26a42d344023b4648a7898bef1
LINUX_VERSION-5.10 = .142
LINUX_KERNEL_HASH-5.10.142 = 3f47ebdb9afe152a0c32c1157336ef13fa5cc08ac6d884dfc1f6ddc2b7dba268

View File

@ -259,8 +259,8 @@ define Build/CoreTargets
ifneq ($(CONFIG_AUTOREMOVE),)
compile:
-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
$(XARGS) rm -rf
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \
$(XARGS) -0 rm -rf
endif
endef

View File

@ -188,7 +188,11 @@ $(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \
$(eval $(call TestHostCommand,python3-distutils, \
Please install the Python3 distutils module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
$(STAGING_DIR_HOST)/bin/python3 -c 'from distutils import util'))
$(eval $(call TestHostCommand,python3-stdlib, \
Please install the Python3 stdlib module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'import ntpath'))
$(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file))

View File

@ -96,7 +96,7 @@ generate_network() {
json_select network
json_select "$1"
json_get_vars device macaddr protocol ipaddr netmask vlan
json_get_vars device macaddr metric protocol ipaddr netmask vlan
json_get_values ports ports
json_select ..
json_select ..
@ -154,6 +154,7 @@ generate_network() {
set network.$1='interface'
set network.$1.type='$type'
set network.$1.device='$device'
set network.$1.metric='$metric'
set network.$1.proto='none'
EOF

View File

@ -110,6 +110,25 @@ mtd_get_mac_encrypted_arcadyan() {
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
}
mtd_get_mac_encrypted_deco() {
local mtdname="$1"
if ! [ -e "$mtdname" ]; then
echo "mtd_get_mac_encrypted_deco: file $mtdname not found!" >&2
return
fi
tplink_key="3336303032384339"
key=$(dd if=$mtdname bs=1 skip=16 count=8 2>/dev/null | \
uencrypt -n -d -k $tplink_key -c des-ecb | hexdump -v -n 8 -e '1/1 "%02x"')
macaddr=$(dd if=$mtdname bs=1 skip=32 count=8 2>/dev/null | \
uencrypt -n -d -k $key -c des-ecb | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"')
echo $macaddr
}
mtd_get_mac_text() {
local mtdname=$1
local offset=$(($2))

View File

@ -114,6 +114,14 @@ ucidef_set_network_device_mac() {
json_select ..
}
ucidef_set_network_device_path() {
json_select_object "network_device"
json_select_object "$1"
json_add_string path "$2"
json_select ..
json_select ..
}
_ucidef_add_switch_port() {
# inherited: $num $device $need_tag $want_untag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5

View File

@ -63,6 +63,20 @@ preinit_config_switch() {
json_select ..
}
preinit_config_port() {
local original
local netdev="$1"
local path="$2"
[ -d "/sys/devices/$path/net" ] || return
original="$(ls "/sys/devices/$path/net" | head -1)"
[ "$netdev" = "$original" ] && return
ip link set "$original" name "$netdev"
}
preinit_config_board() {
/bin/board_detect /tmp/board.json
@ -73,6 +87,35 @@ preinit_config_board() {
json_init
json_load "$(cat /tmp/board.json)"
# Find the current highest eth*
max_eth=$(grep -o '^ *eth[0-9]*:' /proc/net/dev | tr -dc '[0-9]\n' | sort -n | tail -1)
# Find and move netdevs using eth*s we are configuring
json_get_keys keys "network_device"
for netdev in $keys; do
json_select "network_device"
json_select "$netdev"
json_get_vars path path
next_eth="$(echo "$netdev" | grep 'eth[0-9]*' | tr -dc '[0-9]')"
[ "$next_eth" -gt "$max_eth" ] && max_eth=$next_eth
if [ -n "$path" -a -h "/sys/class/net/$netdev" ]; then
ip link set "$netdev" down
ip link set "$netdev" name eth$((++max_eth))
fi
json_select ..
json_select ..
done
# Move interfaces by path to their netdev name
json_get_keys keys "network_device"
for netdev in $keys; do
json_select "network_device"
json_select "$netdev"
json_get_vars path path
[ -n "$path" ] && preinit_config_port "$netdev" "$path"
json_select ..
json_select ..
done
json_select network
json_select "lan"
json_get_vars device

View File

@ -67,6 +67,9 @@ openmesh,om5p-ac-v1|\
openmesh,om5p-ac-v2|\
samsung,wam250|\
ubnt,nanostation-m|\
watchguard,ap100|\
watchguard,ap200|\
watchguard,ap300|\
yuncore,a770|\
yuncore,a782|\
yuncore,a930|\
@ -126,6 +129,10 @@ plasmacloud,pa300e)
qihoo,c301)
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
;;
ruckus,zf7321|\
ruckus,zf7372)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000"
;;
sophos,ap15|\
sophos,ap55|\
sophos,ap55c|\

View File

@ -0,0 +1,23 @@
#
# Copyright (C) 2021 OpenWrt.org
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
iptime,a6004mx)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv
exit 0

View File

@ -37,6 +37,8 @@ beeline,smartbox-turbo)
;;
buffalo,wsr-1166dhp|\
buffalo,wsr-600dhp|\
kroks,kndrt31r16|\
kroks,kndrt31r19|\
mediatek,linkit-smart-7688|\
samknows,whitebox-v8|\
xiaomi,mi-router-4c|\
@ -45,10 +47,12 @@ zbtlink,zbt-wg2626|\
zte,mf283plus)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;;
belkin,rt1800|\
h3c,tx1800-plus|\
h3c,tx1801-plus|\
h3c,tx1806|\
jcg,q20|\
linksys,e7350|\
netgear,wax202)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;

View File

@ -29,7 +29,9 @@ zyxel,gs1900-24hp-v2)
[ -n "$idx2" ] && \
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000"
;;
tplink,sg2008p-v1)
tplink,sg2008p-v1|\
tplink,sg2210p-v3|\
tplink,sg2452p-v4)
idx="$(find_mtd_index u-boot-env)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x10000"

View File

@ -291,7 +291,7 @@ endef
define Build/Compile
$(call Build/Compile/U-Boot)
ifeq ($(UBOOT_IMAGE),u-boot.fip))
ifeq ($(UBOOT_IMAGE),u-boot.fip)
$(call Build/fip-image)
endif
endef

View File

@ -866,14 +866,14 @@
+
+ keys {
+ compatible = "gpio-keys";
+
+/*
+ factory {
+ label = "reset";
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+ };
+
+*/
+ wps {
+ label = "wps";
+ label = "reset";
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ };
+ };

View File

@ -239,6 +239,18 @@ endef
$(eval $(call KernelPackage,crypto-echainiv))
define KernelPackage/crypto-essiv
TITLE:=ESSIV support for block encryption
DEPENDS:=+kmod-crypto-authenc
KCONFIG:=CONFIG_CRYPTO_ESSIV
FILES:= $(LINUX_DIR)/crypto/essiv.ko
AUTOLOAD:=$(call AutoLoad,10,essiv)
$(call AddDepends/crypto)
endef
$(eval $(call KernelPackage,crypto-essiv))
define KernelPackage/crypto-fcrypt
TITLE:=FCRYPT cipher CryptoAPI module
KCONFIG:=CONFIG_CRYPTO_FCRYPT

View File

@ -1479,3 +1479,19 @@ define KernelPackage/mhi-wwan-mbim/description
endef
$(eval $(call KernelPackage,mhi-wwan-mbim))
define KernelPackage/atlantic
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Aquantia AQtion 10Gbps Ethernet NIC
DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-hwmon-core +kmod-macsec
KCONFIG:=CONFIG_AQTION
FILES:=$(LINUX_DIR)/drivers/net/ethernet/aquantia/atlantic/atlantic.ko
AUTOLOAD:=$(call AutoProbe,atlantic)
endef
define KernelPackage/atlantic/description
Kernel modules for Aquantia AQtion 10Gbps Ethernet NIC
endef
$(eval $(call KernelPackage,atlantic))

View File

@ -892,6 +892,22 @@ endef
$(eval $(call KernelPackage,sched-flower))
define KernelPackage/sched-fq-pie
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Flow Queue Proportional Integral Enhanced (FQ-PIE)
DEPENDS:=+kmod-sched-core +kmod-sched-pie
KCONFIG:=CONFIG_NET_SCH_FQ_PIE
FILES:=$(LINUX_DIR)/net/sched/sch_fq_pie.ko
AUTOLOAD:=$(call AutoProbe, sch_fq_pie)
endef
define KernelPackage/sched-fq-pie/description
A queuing discipline that combines Flow Queuing with the PIE AQM.
endef
$(eval $(call KernelPackage,sched-fq-pie))
define KernelPackage/sched-ipset
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Traffic shaper ipset support
@ -922,6 +938,22 @@ endef
$(eval $(call KernelPackage,sched-mqprio))
define KernelPackage/sched-pie
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Proportional Integral controller-Enhanced AQM (PIE)
DEPENDS:=+kmod-sched-core
KCONFIG:=CONFIG_NET_SCH_PIE
FILES:=$(LINUX_DIR)/net/sched/sch_pie.ko
AUTOLOAD:=$(call AutoProbe, sch_pie)
endef
define KernelPackage/sched-pie/description
A control theoretic active queue management scheme.
endef
$(eval $(call KernelPackage,sched-pie))
define KernelPackage/sched-prio
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Multi Band Priority Queueing (PRIO)
@ -964,7 +996,7 @@ endef
$(eval $(call KernelPackage,bpf-test))
SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq sch_pie act_pedit act_simple act_csum em_cmp em_nbyte em_meta em_text
SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_csum em_cmp em_nbyte em_meta em_text
SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko)
define KernelPackage/sched
@ -979,7 +1011,6 @@ define KernelPackage/sched
CONFIG_NET_SCH_SFQ \
CONFIG_NET_SCH_TEQL \
CONFIG_NET_SCH_FQ \
CONFIG_NET_SCH_PIE \
CONFIG_NET_ACT_PEDIT \
CONFIG_NET_ACT_SIMP \
CONFIG_NET_ACT_CSUM \

View File

@ -1747,6 +1747,7 @@ define KernelPackage/usb3
+TARGET_bcm53xx:kmod-usb-bcma \
+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \
+TARGET_ramips_mt7621:kmod-usb-xhci-mtk \
+TARGET_mediatek:kmod-usb-xhci-mtk \
+TARGET_apm821xx_nand:kmod-usb-xhci-pci-renesas \
+TARGET_mvebu_cortexa9:kmod-usb-xhci-pci-renesas
KCONFIG:= \

View File

@ -8,6 +8,9 @@ was limited to a single VAP.
Signed-off-by: David Bauer <mail@david-bauer.net>
Tested-by: Christoph Krapp <achterin@googlemail.com>
---
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c

View File

@ -1,3 +1,17 @@
From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
Date: Mon, 8 Jan 2018 13:42:27 +0100
Subject: [PATCH] rt2x00: add RF self TXDC calibration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add TX self calibration based on mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800lib.c | 51 +++++++++++++++++++
1 file changed, 51 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -8438,6 +8438,56 @@ static void rt2800_init_rfcsr_5592(struc

View File

@ -1,3 +1,17 @@
From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
Date: Mon, 8 Jan 2018 13:42:58 +0100
Subject: [PATCH] rt2x00: add r calibration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add r calibration code as found in mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800lib.c | 150 ++++++++++++++++++
1 file changed, 150 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -8488,6 +8488,155 @@ static void rt2800_rf_self_txdc_cal(stru

View File

@ -1,3 +1,17 @@
From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
Date: Mon, 8 Jan 2018 13:43:37 +0100
Subject: [PATCH] rt2x00: add RXDCOC calibration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add RXDCOC calibration code from mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800lib.c | 65 +++++++++++++++++++
1 file changed, 65 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -8637,6 +8637,70 @@ static void rt2800_r_calibration(struct

View File

@ -1,3 +1,18 @@
From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
Date: Mon, 8 Jan 2018 13:43:56 +0100
Subject: [PATCH] rt2x00: add RXIQ calibration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add RXIQ calibration found in mtk driver. With old openwrt builds this
gets us ~8Mbps more of RX bandwidth (test with iPA/eLNA layout).
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800lib.c | 379 ++++++++++++++++++
1 file changed, 379 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -8701,6 +8701,384 @@ static void rt2800_rxdcoc_calibration(st

View File

@ -1,3 +1,18 @@
From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
Date: Thu, 11 Jan 2018 19:53:49 +0100
Subject: [PATCH] rt2x00: add TX LOFT calibration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add TX LOFT calibration from mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800lib.c | 938 ++++++++++++++++++
.../net/wireless/ralink/rt2x00/rt2800lib.h | 10 +
2 files changed, 948 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -9079,6 +9079,943 @@ restore_value:
@ -630,7 +645,7 @@
+
+ if (vga_gain[ch_idx] < 0)
+ vga_gain[ch_idx] = 0;
+ }
+ }
+
+ rfvalue = rfvga_gain_table[vga_gain[ch_idx]];
+

View File

@ -0,0 +1,423 @@
From: Daniel Golle <daniel@makrotopia.org>
Date: Mon, 12 Sep 2022 21:33:13 +0100
Subject: [PATCH] rt2x00: various experimental fixes for MT7620
Serge Vasilugin reports:
To improve mt7620 built-in wifi performance some changes:
1. Correct BW20/BW40 switching (see comments with mark see commets with mark (1))
2. Correct TX_SW_CFG1 MAC reg from v3 of vendor driver see
https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531
3. Set bbp66 for all chains.
4. US_CYC_CNT init based on Programming guide, default value was 33 (pci),
set chipset bus clock with fallback to cpu clock/3.
5. Don't overwrite default values for mt7620.
6. Correct some typos.
7. Add support for external LNA:
a) RF and BBP regs never be corrected for this mode
b) eLNA is driven the same way as ePA with mt7620's pin PA
but vendor driver explicitly pin PA to gpio mode (for forrect calibration?)
so I'm not sure that request for pa_pin in dts-file will be enough
First 5 changes (really 2) improve performance for boards w/o eLNA/ePA.
Changes 7 add support for eLNA
Configuration w/o eLAN/ePA and with eLNA show results
tx/rx (from router point of view) for each stream:
35-40/30-35 Mbps for HT20
65-70/60-65 Mbps for HT40
Yes. Max results for 2T2R client is 140-145/135-140
with peaks 160/150, It correspond to mediatek driver results.
Boards with ePA untested.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -137,6 +137,26 @@ static u8 rt2800_bbp_read(struct rt2x00_
return value;
}
+//serge: move here for use in test
+static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev,
+ const u8 reg, const u8 value)
+{
+ rt2800_bbp_write(rt2x00dev, 195, reg);
+ rt2800_bbp_write(rt2x00dev, 196, value);
+}
+
+static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev,
+ const u8 reg, const u8 value)
+{
+ rt2800_bbp_write(rt2x00dev, 158, reg);
+ rt2800_bbp_write(rt2x00dev, 159, value);
+}
+
+static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg)
+{
+ rt2800_bbp_write(rt2x00dev, 158, reg);
+ return rt2800_bbp_read(rt2x00dev, 159);
+}
static void rt2800_rfcsr_write(struct rt2x00_dev *rt2x00dev,
const unsigned int word, const u8 value)
@@ -284,6 +304,28 @@ static void rt2800_rf_write(struct rt2x0
mutex_unlock(&rt2x00dev->csr_mutex);
}
+void rt6352_enable_pa_pin(struct rt2x00_dev *rt2x00dev, int enable)
+{
+ if (!rt2x00dev->pinctrl)
+ return;
+
+ if (enable) {
+ if (!rt2x00dev->pins_default) {
+ rt2x00_warn(rt2x00dev, "cannot enable PA pin! no default pinctrl\n");
+ return;
+ }
+
+ pinctrl_select_state(rt2x00dev->pinctrl, rt2x00dev->pins_default);
+ } else {
+ if (!rt2x00dev->pins_pa_gpio) {
+ rt2x00_warn(rt2x00dev, "cannot disable PA pin! no pa_gpio pinctrl\n");
+ return;
+ }
+
+ pinctrl_select_state(rt2x00dev->pinctrl, rt2x00dev->pins_pa_gpio);
+ }
+}
+
static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = {
[EEPROM_CHIP_ID] = 0x0000,
[EEPROM_VERSION] = 0x0001,
@@ -3801,6 +3843,20 @@ static void rt2800_config_channel_rf7620
rfcsr |= tx_agc_fc;
rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr);
}
+
+ if (conf_is_ht40(conf)) {//serge:skipped this step (1)
+ rt2800_bbp_write(rt2x00dev, 195, 141);
+ rt2800_bbp_write(rt2x00dev, 196, 0x10);
+ rt2800_bbp_write(rt2x00dev, 195, 157);
+ rt2800_bbp_write(rt2x00dev, 196, 0x2f);
+ //rt2800_bbp_write(rt2x00dev, 105, 0x3C);
+ } else {
+ rt2800_bbp_write(rt2x00dev, 195, 141);
+ rt2800_bbp_write(rt2x00dev, 196, 0x1a);
+ rt2800_bbp_write(rt2x00dev, 195, 157);
+ rt2800_bbp_write(rt2x00dev, 196, 0x40);
+ //rt2800_bbp_write(rt2x00dev, 105, 0x1C);
+ }
}
static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
@@ -4172,6 +4228,11 @@ static void rt2800_config_channel(struct
rt2800_bbp_write(rt2x00dev, 86, 0x46);
else
rt2800_bbp_write(rt2x00dev, 86, 0);
+ } else if (rt2x00_rt(rt2x00dev, RT6352)) {//serge: don't overwite bbp r86 (5)
+ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
+ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
+ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
+ rt2800_bbp_write(rt2x00dev, 86, 0x38);
} else {
rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
@@ -4377,7 +4438,8 @@ static void rt2800_config_channel(struct
reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain;
rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
- rt2800_iq_calibrate(rt2x00dev, rf->channel);
+ if (!rt2x00_rt(rt2x00dev, RT6352))//serge: this function for rt5592 only, for rt6352 it switch off compensations (5)
+ rt2800_iq_calibrate(rt2x00dev, rf->channel);
}
if (rt2x00_rt(rt2x00dev, RT6352)) {
@@ -4417,6 +4479,31 @@ static void rt2800_config_channel(struct
rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
0x6C6C6B6C);
}
+
+ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {//serge: for support eLNA (7a)
+ rt2x00_warn(rt2x00dev, "Correct RF/BBP for eLNA!\n");
+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
+ reg |= 0x00000101;
+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
+
+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
+ reg |= 0x00000101;
+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
+
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
+ rt2800_bbp_write(rt2x00dev, 75, 0x68);//serge: move bbp eLNA init here?
+ rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+ rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+ rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+ rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+ /* bank 0 RF reg 42 and glrt BBP reg 141
+ will be set in config channel function
+ in dependence of channel and HT20/HT40
+ so don't touch it
+ */
+ }
}
bbp = rt2800_bbp_read(rt2x00dev, 4);
@@ -4457,6 +4544,9 @@ static void rt2800_config_channel(struct
rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
rt2800_bbp_write(rt2x00dev, 49, bbp);
}
+//serge:just print results after config channel - don't forget to remove nahren (c) <- this is copyright, not ref to comments :)
+ bbp = rt2800_bbp_dcoc_read(rt2x00dev, 0x03);
+ pr_info("BBP tx/rx compensation control=0x%02x\n", bbp);
}
static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
@@ -5527,7 +5617,7 @@ void rt2800_vco_calibration(struct rt2x0
}
rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
- if (rt2x00_rt(rt2x00dev, RT6352)) {
+ if (rt2x00_rt(rt2x00dev, RT6352)) {//serge:remark - move all this code to rfcsr_6352 init?
if (rt2x00dev->default_ant.rx_chain_num == 1) {
rt2800_bbp_write(rt2x00dev, 91, 0x07);
rt2800_bbp_write(rt2x00dev, 95, 0x1A);
@@ -5695,7 +5785,8 @@ static inline void rt2800_set_vgc(struct
if (qual->vgc_level != vgc_level) {
if (rt2x00_rt(rt2x00dev, RT3572) ||
rt2x00_rt(rt2x00dev, RT3593) ||
- rt2x00_rt(rt2x00dev, RT3883)) {
+ rt2x00_rt(rt2x00dev, RT3883) ||
+ rt2x00_rt(rt2x00dev, RT6352)) {//serge: rt6352 too (3)
rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
vgc_level);
} else if (rt2x00_rt(rt2x00dev, RT5592)) {
@@ -5930,7 +6021,7 @@ static int rt2800_init_registers(struct
0x00550055);
} else {
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401);
- rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000);
+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001);//serge:was 0x000C0000 (2)
rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000);
rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
@@ -6195,6 +6286,29 @@ static int rt2800_init_registers(struct
reg = rt2800_register_read(rt2x00dev, US_CYC_CNT);
rt2x00_set_field32(&reg, US_CYC_CNT_CLOCK_CYCLE, 125);
rt2800_register_write(rt2x00dev, US_CYC_CNT, reg);
+ } else if (rt2x00_is_soc(rt2x00dev)) {//serge:which value correct? (4)
+ struct clk *clk = clk_get_sys("bus", NULL);
+ int rate;
+
+ if (IS_ERR(clk)) {
+ rt2x00_warn(rt2x00dev, "system bus clock undefined\n");
+ clk = clk_get_sys("cpu", NULL);
+
+ if (IS_ERR(clk))
+ rate = 125;
+ else {
+ rate = clk_get_rate(clk) / 3000000;
+ clk_put(clk);
+ }
+ } else {
+ rate = clk_get_rate(clk) / 1000000;
+ clk_put(clk);
+ }
+
+ rt2x00_info(rt2x00dev, "set US_CYC=%dMHz\n", rate);
+ reg = rt2800_register_read(rt2x00dev, US_CYC_CNT);
+ rt2x00_set_field32(&reg, US_CYC_CNT_CLOCK_CYCLE, rate);
+ rt2800_register_write(rt2x00dev, US_CYC_CNT, reg);
}
reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0);
@@ -6981,26 +7095,7 @@ static void rt2800_init_bbp_5592(struct
if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C))
rt2800_bbp_write(rt2x00dev, 103, 0xc0);
}
-
-static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev,
- const u8 reg, const u8 value)
-{
- rt2800_bbp_write(rt2x00dev, 195, reg);
- rt2800_bbp_write(rt2x00dev, 196, value);
-}
-
-static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev,
- const u8 reg, const u8 value)
-{
- rt2800_bbp_write(rt2x00dev, 158, reg);
- rt2800_bbp_write(rt2x00dev, 159, value);
-}
-
-static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg)
-{
- rt2800_bbp_write(rt2x00dev, 158, reg);
- return rt2800_bbp_read(rt2x00dev, 159);
-}
+//serge: move these function upper
static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev)
{
@@ -8635,7 +8730,7 @@ static void rt2800_r_calibration(struct
r_cal_code = (u8)rcalcode;
rt2800_rfcsr_write_bank(rt2x00dev, 0, 7, r_cal_code);
-
+ pr_info("RF bank 0 reg 5=0x%02x\n", r_cal_code);//serge: just for info to compare with vendor driver
rt2800_bbp_write(rt2x00dev, 22, 0x0);
bytevalue = rt2800_bbp_read(rt2x00dev, 21);
@@ -8693,7 +8788,7 @@ static void rt2800_rxdcoc_calibration(st
break;
}
- saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 0);
+ saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4);//serge: was 0 - typo? (6)
saverfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4);
saverfb5r4 = saverfb5r4 & (~0x40);
saverfb7r4 = saverfb7r4 & (~0x40);
@@ -9022,13 +9117,15 @@ static void rt2800_rxiq_calibration(stru
rt2x00_info(rt2x00dev, "RXIQ G_imb=%d, Ph_rx=%d\n", g_imb, ph_rx);
if ((ph_rx > 20) || (ph_rx < -20)) {
+ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL(ph_rx=%d out of [-20..20]", ph_rx);//serge:just to see value
ph_rx = 0;
- rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL");
+ //rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL");
}
if ((g_imb > 12) || (g_imb < -12)) {
+ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL(g_imb=%d out of (-12..12]", g_imb);//serge:just to see the reason
g_imb = 0;
- rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL");
+ //rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL");
}
}
else {
@@ -9039,11 +9136,21 @@ static void rt2800_rxiq_calibration(stru
}
if (ch_idx == 0) {
+ //serge: just to see values
+ pr_info("RXIQ RX0 g_imb (0x37, %2x) ph_rx (0x35, %2x)\n",
+ g_imb & 0x3f,
+ ph_rx & 0x3f
+ );
rt2800_bbp_write(rt2x00dev, 158, 0x37);
rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f);
rt2800_bbp_write(rt2x00dev, 158, 0x35);
rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f);
} else {
+ //serge: just to see values
+ pr_info("RXIQ RX1 g_imb (0x55, %2x) ph_rx (0x53, %2x)\n",
+ g_imb & 0x3f,
+ ph_rx & 0x3f
+ );
rt2800_bbp_write(rt2x00dev, 158, 0x55);
rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f);
rt2800_bbp_write(rt2x00dev, 158, 0x53);
@@ -9745,6 +9852,15 @@ void rt2800_loft_iq_calibration(struct r
}
for (rf_alc_idx = 0; rf_alc_idx < 3; rf_alc_idx++) {
+ //serge: just to see values
+ pr_info("LOFT ALC (0xb0, %2x) I0 (0xb1, %2x) Q0 (0xb2, %2x) I1 (0xb8, %2x) Q1 (0xb9, %2x)\n",
+ rf_alc_idx,
+ loft_dc_search_result[CHAIN_0][rf_alc_idx][0x00] & 0x3F,
+ loft_dc_search_result[CHAIN_0][rf_alc_idx][0x01] & 0x3F,
+ loft_dc_search_result[CHAIN_1][rf_alc_idx][0x00] & 0x3F,
+ loft_dc_search_result[CHAIN_1][rf_alc_idx][0x01] & 0x3F
+ );
+
for (idx = 0; idx < 4; idx++) {
rt2800_bbp_write(rt2x00dev, 158, 0xB0);
bbp = (idx<<2) + rf_alc_idx;
@@ -10669,6 +10785,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
}
+ rt6352_enable_pa_pin(rt2x00dev, 0);//serge: vendor driver do it before calibration (7b)
rt2800_r_calibration(rt2x00dev);
rt2800_rf_self_txdc_cal(rt2x00dev);
rt2800_rxdcoc_calibration(rt2x00dev);
@@ -10676,6 +10793,29 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_bw_filter_calibration(rt2x00dev, false);
rt2800_loft_iq_calibration(rt2x00dev);
rt2800_rxiq_calibration(rt2x00dev);
+ rt6352_enable_pa_pin(rt2x00dev, 1);//serge: vendor driver do it after calibration (7b)
+ /* Vendor driver restore iLNA/iPA before
+ recalibration and set correct values after.
+ Openwrt driver init iLNA and iPA but restore only
+ ePA values after recalibration.
+ So set eLNA values only
+ */
+ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {//serge: rf regs never corrected for eLNA (7a)
+ rt2x00_info(rt2x00dev, "Correct RF/BBP for eLNA!\n");
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
+ rt2800_bbp_write(rt2x00dev, 75, 0x68);//serge: move bbp eLNA init here?
+ rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+ rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+ rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+ rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+ /* bank 0 RF reg 42 and glrt BBP reg 141
+ will be set in config channel function
+ in dependence of channel and HT20/HT40
+ so don't touch it
+ */
+ }
}
static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
@@ -28,6 +28,7 @@
#include <linux/average.h>
#include <linux/usb.h>
#include <linux/clk.h>
+#include <linux/pinctrl/consumer.h>
#include <linux/rt2x00_platform.h>
#include <net/mac80211.h>
@@ -1029,6 +1030,11 @@ struct rt2x00_dev {
/* Clock for System On Chip devices. */
struct clk *clk;
+
+ /* pinctrl and states for System On Chip devices with PA/LNA. */
+ struct pinctrl *pinctrl;
+ struct pinctrl_state *pins_default;
+ struct pinctrl_state *pins_pa_gpio;
};
struct rt2x00_bar_list_entry {
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
@@ -97,6 +97,21 @@ int rt2x00soc_probe(struct platform_devi
if (retval)
goto exit_free_reg;
+ rt2x00dev->pinctrl = devm_pinctrl_get(&pdev->dev);
+ if (IS_ERR(rt2x00dev->pinctrl)) {
+ rt2x00dev->pinctrl = NULL;
+ rt2x00dev->pins_default = NULL;
+ rt2x00dev->pins_pa_gpio = NULL;
+ } else {
+ rt2x00dev->pins_default = pinctrl_lookup_state(rt2x00dev->pinctrl, "default");
+ if (IS_ERR(rt2x00dev->pins_default))
+ rt2x00dev->pins_default = NULL;
+
+ rt2x00dev->pins_pa_gpio = pinctrl_lookup_state(rt2x00dev->pinctrl, "pa_gpio");
+ if (IS_ERR(rt2x00dev->pins_pa_gpio))
+ rt2x00dev->pins_pa_gpio = NULL;
+ }
+
return 0;
exit_free_reg:

View File

@ -0,0 +1,40 @@
From: Alexander Wetzel <alexander@wetzel-home.de>
Date: Thu, 15 Sep 2022 14:41:20 +0200
Subject: [PATCH] mac80211: Fix deadlock: Don't start TX while holding
fq->lock
ieee80211_txq_purge() calls fq_tin_reset() and
ieee80211_purge_tx_queue(); Both are then calling
ieee80211_free_txskb(). Which can decide to TX the skb again.
There are at least two ways to get a deadlock:
1) When we have a TDLS teardown packet queued in either tin or frags
ieee80211_tdls_td_tx_handle() will call ieee80211_subif_start_xmit()
while we still hold fq->lock. ieee80211_txq_enqueue() will thus
deadlock.
2) A variant of the above happens if aggregation is up and running:
In that case ieee80211_iface_work() will deadlock with the original
task: The original tasks already holds fq->lock and tries to get
sta->lock after kicking off ieee80211_iface_work(). But the worker
can get sta->lock prior to the original task and will then spin for
fq->lock.
Avoid these deadlocks by not sending out any skbs when called via
ieee80211_free_txskb().
Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
---
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -698,7 +698,7 @@ static void ieee80211_report_used_skb(st
if (!sdata) {
skb->dev = NULL;
- } else {
+ } else if (!dropped) {
unsigned int hdr_size =
ieee80211_hdrlen(hdr->frame_control);

View File

@ -0,0 +1,47 @@
From: Alexander Wetzel <alexander@wetzel-home.de>
Date: Thu, 15 Sep 2022 15:09:46 +0200
Subject: [PATCH] mac80211: Ensure vif queues are operational after start
Make sure local->queue_stop_reasons and vif.txqs_stopped stay in sync.
When a new vif is created the queues may end up in an inconsistent state
and be inoperable:
Communication not using iTXQ will work, allowing to e.g. complete the
association. But the 4-way handshake will time out. The sta will not
send out any skbs queued in iTXQs.
All normal attempts to start the queues will fail when reaching this
state.
local->queue_stop_reasons will have marked all queues as operational but
vif.txqs_stopped will still be set, creating an inconsistent internal
state.
In reality this seems to be race between the mac80211 function
ieee80211_do_open() setting SDATA_STATE_RUNNING and the wake_txqs_tasklet:
Depending on the driver and the timing the queues may end up to be
operational or not.
Cc: stable@vger.kernel.org
Fixes: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped")
Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
---
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -301,14 +301,14 @@ static void __ieee80211_wake_txqs(struct
local_bh_disable();
spin_lock(&fq->lock);
+ sdata->vif.txqs_stopped[ac] = false;
+
if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
goto out;
if (sdata->vif.type == NL80211_IFTYPE_AP)
ps = &sdata->bss->ps;
- sdata->vif.txqs_stopped[ac] = false;
-
list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (sdata != sta->sdata)
continue;

View File

@ -0,0 +1,77 @@
From 4db561ae4a90c2d0e15996634567559e292dc9e5 Mon Sep 17 00:00:00 2001
From: Ahmed Zaki <anzaki@gmail.com>
Date: Sat, 2 Oct 2021 08:53:29 -0600
Subject: [PATCH] mac80211: fix a memory leak where sta_info is not freed
commit 8f9dcc29566626f683843ccac6113a12208315ca upstream.
The following is from a system that went OOM due to a memory leak:
wlan0: Allocated STA 74:83:c2:64:0b:87
wlan0: Allocated STA 74:83:c2:64:0b:87
wlan0: IBSS finish 74:83:c2:64:0b:87 (---from ieee80211_ibss_add_sta)
wlan0: Adding new IBSS station 74:83:c2:64:0b:87
wlan0: moving STA 74:83:c2:64:0b:87 to state 2
wlan0: moving STA 74:83:c2:64:0b:87 to state 3
wlan0: Inserted STA 74:83:c2:64:0b:87
wlan0: IBSS finish 74:83:c2:64:0b:87 (---from ieee80211_ibss_work)
wlan0: Adding new IBSS station 74:83:c2:64:0b:87
wlan0: moving STA 74:83:c2:64:0b:87 to state 2
wlan0: moving STA 74:83:c2:64:0b:87 to state 3
.
.
wlan0: expiring inactive not authorized STA 74:83:c2:64:0b:87
wlan0: moving STA 74:83:c2:64:0b:87 to state 2
wlan0: moving STA 74:83:c2:64:0b:87 to state 1
wlan0: Removed STA 74:83:c2:64:0b:87
wlan0: Destroyed STA 74:83:c2:64:0b:87
The ieee80211_ibss_finish_sta() is called twice on the same STA from 2
different locations. On the second attempt, the allocated STA is not
destroyed creating a kernel memory leak.
This is happening because sta_info_insert_finish() does not call
sta_info_free() the second time when the STA already exists (returns
-EEXIST). Note that the caller sta_info_insert_rcu() assumes STA is
destroyed upon errors.
Same fix is applied to -ENOMEM.
Signed-off-by: Ahmed Zaki <anzaki@gmail.com>
Link: https://lore.kernel.org/r/20211002145329.3125293-1-anzaki@gmail.com
[change the error path label to use the existing code]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Viacheslav Sablin <sablin@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/sta_info.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -646,13 +646,13 @@ static int sta_info_insert_finish(struct
/* check if STA exists already */
if (sta_info_get_bss(sdata, sta->sta.addr)) {
err = -EEXIST;
- goto out_err;
+ goto out_cleanup;
}
sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
if (!sinfo) {
err = -ENOMEM;
- goto out_err;
+ goto out_cleanup;
}
local->num_sta++;
@@ -708,8 +708,8 @@ static int sta_info_insert_finish(struct
out_drop_sta:
local->num_sta--;
synchronize_net();
+ out_cleanup:
cleanup_single_sta(sta);
- out_err:
mutex_unlock(&local->sta_mtx);
kfree(sinfo);
rcu_read_lock();

View File

@ -0,0 +1,47 @@
From 552ba102a6898630a7d16887f29e606d6fabe508 Mon Sep 17 00:00:00 2001
From: Siddh Raman Pant <code@siddh.me>
Date: Sun, 14 Aug 2022 20:45:12 +0530
Subject: [PATCH] wifi: mac80211: Don't finalize CSA in IBSS mode if state is
disconnected
commit 15bc8966b6d3a5b9bfe4c9facfa02f2b69b1e5f0 upstream.
When we are not connected to a channel, sending channel "switch"
announcement doesn't make any sense.
The BSS list is empty in that case. This causes the for loop in
cfg80211_get_bss() to be bypassed, so the function returns NULL
(check line 1424 of net/wireless/scan.c), causing the WARN_ON()
in ieee80211_ibss_csa_beacon() to get triggered (check line 500
of net/mac80211/ibss.c), which was consequently reported on the
syzkaller dashboard.
Thus, check if we have an existing connection before generating
the CSA beacon in ieee80211_ibss_finish_csa().
Cc: stable@vger.kernel.org
Fixes: cd7760e62c2a ("mac80211: add support for CSA in IBSS mode")
Link: https://syzkaller.appspot.com/bug?id=05603ef4ae8926761b678d2939a3b2ad28ab9ca6
Reported-by: syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Tested-by: syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20220814151512.9985-1-code@siddh.me
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ibss.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -534,6 +534,10 @@ int ieee80211_ibss_finish_csa(struct iee
sdata_assert_lock(sdata);
+ /* When not connected/joined, sending CSA doesn't make sense. */
+ if (ifibss->state != IEEE80211_IBSS_MLME_JOINED)
+ return -ENOLINK;
+
/* update cfg80211 bss information with the new channel */
if (!is_zero_ether_addr(ifibss->bssid)) {
cbss = cfg80211_get_bss(sdata->local->hw.wiphy,

View File

@ -0,0 +1,55 @@
From 5d20c6f932f2758078d0454729129c894fe353e7 Mon Sep 17 00:00:00 2001
From: Siddh Raman Pant <code@siddh.me>
Date: Sat, 20 Aug 2022 01:33:40 +0530
Subject: [PATCH] wifi: mac80211: Fix UAF in ieee80211_scan_rx()
commit 60deb9f10eec5c6a20252ed36238b55d8b614a2c upstream.
ieee80211_scan_rx() tries to access scan_req->flags after a
null check, but a UAF is observed when the scan is completed
and __ieee80211_scan_completed() executes, which then calls
cfg80211_scan_done() leading to the freeing of scan_req.
Since scan_req is rcu_dereference()'d, prevent the racing in
__ieee80211_scan_completed() by ensuring that from mac80211's
POV it is no longer accessed from an RCU read critical section
before we call cfg80211_scan_done().
Cc: stable@vger.kernel.org
Link: https://syzkaller.appspot.com/bug?extid=f9acff9bf08a845f225d
Reported-by: syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Link: https://lore.kernel.org/r/20220819200340.34826-1-code@siddh.me
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/scan.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -461,16 +461,19 @@ static void __ieee80211_scan_completed(s
scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx));
- if (scan_req != local->int_scan_req) {
- local->scan_info.aborted = aborted;
- cfg80211_scan_done(scan_req, &local->scan_info);
- }
RCU_INIT_POINTER(local->scan_req, NULL);
RCU_INIT_POINTER(local->scan_sdata, NULL);
local->scanning = 0;
local->scan_chandef.chan = NULL;
+ synchronize_rcu();
+
+ if (scan_req != local->int_scan_req) {
+ local->scan_info.aborted = aborted;
+ cfg80211_scan_done(scan_req, &local->scan_info);
+ }
+
/* Set power back to normal operating levels. */
ieee80211_hw_config(local, 0);

View File

@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-09-06
PKG_SOURCE_VERSION:=d70546462b7b51ebc2bcdd5c534fdf3465be62a4
PKG_MIRROR_HASH:=3d6b68d70a78c0072ed10ab2548344b6b3a70ad99e4edc258fafa16886f4abf9
PKG_SOURCE_DATE:=2022-09-15
PKG_SOURCE_VERSION:=763a1d90133bfd2efae1a533d6b571d9802bcaa3
PKG_MIRROR_HASH:=8adeab19ef8c7df146fa9568bc8aba9418840e543b49e1e79dee85ca70725fa4
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_USE_NINJA:=0

View File

@ -1,18 +1,19 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libbsd
PKG_VERSION:=0.10.0
PKG_VERSION:=0.11.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://libbsd.freedesktop.org/releases
PKG_HASH:=34b8adc726883d0e85b3118fa13605e179a62b31ba51f676136ecb2d0bc1a887
PKG_HASH:=19b38f3172eaf693e6e1c68714636190c7e48851e45224d720b3b5bc0499b5df
PKG_LICENSE:=BSD-4-Clause
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS := libmd
include $(INCLUDE_DIR)/package.mk
@ -42,4 +43,3 @@ define Package/libbsd/install
endef
$(eval $(call BuildPackage,libbsd))

View File

@ -0,0 +1,8 @@
--- a/progs/mkcapshdoc.sh
+++ b/progs/mkcapshdoc.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# This script generates some C code for inclusion in the capsh binary.
# The Makefile generally only generates the .c code and compares it
# with the checked in code in the progs directory.

View File

@ -0,0 +1,47 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libmd
PKG_VERSION:=1.0.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://archive.hadrons.org/software/libmd/
PKG_HASH:=f51c921042e34beddeded4b75557656559cf5b1f2448033b4c1eec11c07e530f
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-static
define Package/libmd
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Message Digest functions from BSD systems
ABI_VERSION:=0
endef
define Package/libmd/description
This library provides message digest functions found on BSD systems either
on their libc or libmd libraries and lacking on others like GNU systems,
thus making it easier to port projects with strong BSD origins, without
needing to embed the same code over and over again on each project.
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmd.a $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmd*.pc $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
endef
$(eval $(call BuildPackage,libmd))

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd
PKG_VERSION:=1.0.14
PKG_VERSION:=1.0.15
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/lldpd/lldpd/tar.gz/$(PKG_VERSION)?
PKG_HASH:=0cb77fd7634401347b8311db1bf64d4fc3890acba90915e2cc2c5f79045ddbf0
PKG_HASH:=bdb1f9e29f61c3be99e421e88a431536c53e62f1ab7189a6d5b8e1d2d55d8899
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=ISC

View File

@ -17,7 +17,7 @@ PKG_MIRROR_HASH:=a693c2b4b4bda5e1e44b493019e8e6e6d39c4048f417b581c801a9931e6b9b3
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_BUILD_DEPENDS:=bpf-headers
PKG_BUILD_DEPENDS:=HAS_BPF_TOOLCHAIN:bpf-headers
PKG_BUILD_PARALLEL:=1

View File

@ -82,7 +82,7 @@ define Package/tc-mod-iptables
$(call Package/iproute2/Default)
TITLE:=Traffic control module - iptables action
VARIANT:=tcfull
DEPENDS:=+libxtables
DEPENDS:=+libxtables +libbpf
endef
define Package/genl

View File

@ -85,7 +85,6 @@ CONFIGURE_VARS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
CLANG="$(CLANG)" \
BPF_CFLAGS="$(BPF_CFLAGS)" \
BPF_TARGET="$(BPF_TARGET)" \
LLC="$(LLVM_LLC)"
@ -93,6 +92,11 @@ MAKE_VARS += \
PREFIX=/usr \
RUNDIR=/tmp/run
define Build/Configure
$(call Build/Configure/Default)
echo "BPF_CFLAGS += -I$(BPF_HEADERS_DIR)/tools/lib" >> $(PKG_BUILD_DIR)/config.mk
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/xdp
$(CP) $(PKG_INSTALL_DIR)/usr/include/xdp/*.h $(1)/usr/include/xdp/

View File

@ -142,42 +142,42 @@ int selfsigned(WC_RNG *rng, char **arg) {
newCert.isCA = 0;
while (*arg && **arg == '-') {
if (!strncmp(*arg, "-der", 4)) {
if (!strcmp(*arg, "-der")) {
pem = false;
} else if (!strncmp(*arg, "-newkey", 6) && arg[1]) {
} else if (!strcmp(*arg, "-newkey") && arg[1]) {
if (!strncmp(arg[1], "rsa:", 4)) {
type = RSA_KEY_TYPE;
keySz = (unsigned int)atoi(arg[1] + 4);
} else if (!strncmp(arg[1], "ec", 2)) {
keySz = atoi(arg[1] + 4);
} else if (!strcmp(arg[1], "ec")) {
type = EC_KEY_TYPE;
} else {
fprintf(stderr, "error: invalid algorithm\n");
return 1;
}
arg++;
} else if (!strncmp(*arg, "-days", 5) && arg[1]) {
} else if (!strcmp(*arg, "-days") && arg[1]) {
days = (unsigned int)atoi(arg[1]);
arg++;
} else if (!strncmp(*arg, "-pkeyopt", 8) && arg[1]) {
} else if (!strcmp(*arg, "-pkeyopt") && arg[1]) {
if (strncmp(arg[1], "ec_paramgen_curve:", 18)) {
fprintf(stderr, "error: invalid pkey option: %s\n", arg[1]);
return 1;
}
if (!strncmp(arg[1] + 18, "P-256:", 5)) {
if (!strcmp(arg[1] + 18, "P-256")) {
curve = ECC_SECP256R1;
} else if (!strncmp(arg[1] + 18, "P-384:", 5)) {
} else if (!strcmp(arg[1] + 18, "P-384")) {
curve = ECC_SECP384R1;
} else if (!strncmp(arg[1] + 18, "P-521:", 5)) {
} else if (!strcmp(arg[1] + 18, "P-521")) {
curve = ECC_SECP521R1;
} else {
fprintf(stderr, "error: invalid curve name: %s\n", arg[1] + 18);
return 1;
}
arg++;
} else if (!strncmp(*arg, "-keyout", 7) && arg[1]) {
} else if (!strcmp(*arg, "-keyout") && arg[1]) {
keypath = arg[1];
arg++;
} else if (!strncmp(*arg, "-out", 4) && arg[1]) {
} else if (!strcmp(*arg, "-out") && arg[1]) {
certpath = arg[1];
arg++;
} else if (!strcmp(*arg, "-subj") && arg[1]) {
@ -306,25 +306,25 @@ int dokey(WC_RNG *rng, int type, char **arg) {
bool pem = true;
while (*arg && **arg == '-') {
if (!strncmp(*arg, "-out", 4) && arg[1]) {
if (!strcmp(*arg, "-out") && arg[1]) {
path = arg[1];
arg++;
} else if (!strncmp(*arg, "-3", 2)) {
} else if (!strcmp(*arg, "-3")) {
exp = 3;
} else if (!strncmp(*arg, "-der", 4)) {
} else if (!strcmp(*arg, "-der")) {
pem = false;
}
arg++;
}
if (*arg && type == RSA_KEY_TYPE) {
keySz = (unsigned int)atoi(*arg);
keySz = atoi(*arg);
} else if (*arg) {
if (!strncmp(*arg, "P-256", 5)) {
if (!strcmp(*arg, "P-256")) {
curve = ECC_SECP256R1;
} else if (!strncmp(*arg, "P-384", 5)) {
} else if (!strcmp(*arg, "P-384")) {
curve = ECC_SECP384R1;
} else if (!strncmp(*arg, "P-521", 5)) {
} else if (!strcmp(*arg, "P-521")) {
curve = ECC_SECP521R1;
} else {
fprintf(stderr, "Invalid Curve Name: %s\n", *arg);
@ -356,13 +356,13 @@ int main(int argc, char *argv[]) {
}
if (argv[1]) {
if (!strncmp(argv[1], "eckey", 5))
if (!strcmp(argv[1], "eckey"))
return dokey(&rng, EC_KEY_TYPE, argv + 2);
if (!strncmp(argv[1], "rsakey", 5))
if (!strcmp(argv[1], "rsakey"))
return dokey(&rng, RSA_KEY_TYPE, argv + 2);
if (!strncmp(argv[1], "selfsigned", 10))
if (!strcmp(argv[1], "selfsigned"))
return selfsigned(&rng, argv + 2);
}

View File

@ -257,6 +257,9 @@ ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash
# MKHASH is used in /scripts, so we export it here.
export MKHASH
# DOWNLOAD_CHECK_CERTIFICATE is used in /scripts, so we export it here.
DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
export DOWNLOAD_CHECK_CERTIFICATE
CP:=cp -fpR
LN:=ln -sf
XARGS:=xargs -r

View File

@ -13,6 +13,7 @@ import sys
import os
import re
import getopt
import shutil
# Commandline options
opt_dryrun = False
@ -119,8 +120,10 @@ versionRegex = (
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
(re.compile(r"(.+)[-_]v(\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-v1.2.3a
(re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3
(re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a
(re.compile(r"(.+)[-_]v(\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-v1.2a
(re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111
)
@ -138,15 +141,18 @@ class EntryParseError(Exception):
class Entry:
def __init__(self, directory, filename):
def __init__(self, directory, builddir, filename):
self.directory = directory
self.filename = filename
self.builddir = builddir
self.progname = ""
self.fileext = ""
self.filenoext = ""
for ext in extensions:
if filename.endswith(ext):
filename = filename[0 : 0 - len(ext)]
self.filenoext = filename
self.fileext = ext
break
else:
@ -166,12 +172,27 @@ class Entry:
def getPath(self):
return (self.directory + "/" + self.filename).replace("//", "/")
def getBuildPaths(self):
paths = []
for subdir in os.scandir(self.builddir):
package_build_dir = os.path.join(subdir.path, self.filenoext)
if os.path.exists(package_build_dir):
paths.append(package_build_dir)
return paths
def deleteFile(self):
path = self.getPath()
print("Deleting", path)
if not opt_dryrun:
os.unlink(path)
def deleteBuildDir(self):
paths = self.getBuildPaths()
for path in paths:
print("Deleting BuildDir", path)
if not opt_dryrun:
shutil.rmtree(path)
def __ge__(self, y):
return self.version >= y.version
@ -183,6 +204,12 @@ def usage():
print(" -d|--dry-run Do a dry-run. Don't delete any files")
print(" -B|--show-blacklist Show the blacklist and exit")
print(" -w|--whitelist ITEM Remove ITEM from blacklist")
print(
" -D|--download-dir Provide path to dl dir to clean also the build directory"
)
print(
" -b|--build-dir Provide path to build dir to clean also the build directory"
)
def main(argv):
@ -191,25 +218,22 @@ def main(argv):
try:
(opts, args) = getopt.getopt(
argv[1:],
"hdBw:",
"hdBwDb:",
[
"help",
"dry-run",
"show-blacklist",
"whitelist=",
"download-dir=",
"build-dir=",
],
)
if len(args) != 1:
usage()
return 1
except getopt.GetoptError as e:
usage()
return 1
directory = args[0]
if not os.path.exists(directory):
print("Can't find dl path", directory)
return 1
directory = "dl/"
builddir = "build_dir/"
for (o, v) in opts:
if o in ("-h", "--help"):
@ -233,6 +257,18 @@ def main(argv):
sep = "\t"
print("%s%s(%s)" % (name, sep, regex.pattern))
return 0
if o in ("-D", "--download-dir"):
directory = v
if o in ("-b", "--build-dir"):
builddir = v
if not os.path.exists(directory):
print("Can't find dl path", directory)
return 1
if not os.path.exists(builddir):
print("Can't find dl path", builddir)
return 1
# Create a directory listing and parse the file names.
entries = []
@ -246,7 +282,7 @@ def main(argv):
break
else:
try:
entries.append(Entry(directory, filename))
entries.append(Entry(directory, builddir, filename))
except EntryParseError as e:
pass
@ -271,6 +307,8 @@ def main(argv):
for version in versions:
if version is not lastVersion:
version.deleteFile()
if builddir:
version.deleteBuildDir()
if opt_dryrun:
print("Keeping", lastVersion.getPath())

View File

@ -24,6 +24,8 @@ my $scriptdir = dirname($0);
my @mirrors;
my $ok;
my $check_certificate = $ENV{DOWNLOAD_CHECK_CERTIFICATE} eq "y";
$url_filename or $url_filename = $filename;
sub localmirrors {
@ -72,7 +74,7 @@ sub download_cmd($) {
my $url = shift;
my $have_curl = 0;
if (open CURL, '-|', 'curl', '--version') {
if (open CURL, "curl --version 2>/dev/null |") {
if (defined(my $line = readline CURL)) {
$have_curl = 1 if $line =~ /^curl /;
}
@ -80,8 +82,14 @@ sub download_cmd($) {
}
return $have_curl
? (qw(curl -f --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url)
: (qw(wget --tries=5 --timeout=20 --no-check-certificate --output-document=-), shellwords($ENV{WGET_OPTIONS} || ''), $url)
? (qw(curl -f --connect-timeout 20 --retry 5 --location),
$check_certificate ? () : '--insecure',
shellwords($ENV{CURL_OPTIONS} || ''),
$url)
: (qw(wget --tries=5 --timeout=20 --output-document=-),
$check_certificate ? () : '--no-check-certificate',
shellwords($ENV{WGET_OPTIONS} || ''),
$url)
;
}

View File

@ -23,7 +23,7 @@ produce a noisy warning.
xhci->quirks |= XHCI_RESET_ON_RESUME;
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -425,10 +425,14 @@ static int xhci_try_enable_msi(struct us
@@ -427,10 +427,14 @@ static int xhci_try_enable_msi(struct us
free_irq(hcd->irq, hcd);
hcd->irq = 0;

View File

@ -9,8 +9,7 @@ BOARDNAME:=QEMU ARM Virtual Machine
FEATURES:=fpu pci rtc usb
FEATURES+=cpiogz ext4 ramdisk squashfs targz
KERNEL_PATCHVER:=5.10
KERNEL_TESTING_PATCHVER:=5.15
KERNEL_PATCHVER:=5.15
include $(INCLUDE_DIR)/target.mk

View File

@ -18,7 +18,7 @@ Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3106,7 +3106,10 @@ static int clk_rate_get(void *data, u64
@@ -3105,7 +3105,10 @@ static int clk_rate_get(void *data, u64
{
struct clk_core *core = data;

View File

@ -0,0 +1,103 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9341_tplink.dtsi"
/ {
model = "TP-Link TL-WR941ND v5";
compatible = "tplink,tl-wr941nd-v5", "qca,ar9341";
aliases {
label-mac-device = &wmac;
};
keys {
compatible = "gpio-keys";
rfkill {
label = "WiFi";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
reset {
label = "Reset/WPS";
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
};
&leds {
lan3 {
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
};
lan4 {
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
uboot: partition@0 {
label = "u-boot";
reg = <0x000000 0x020000>;
read-only;
};
partition@20000 {
compatible = "tplink,firmware";
label = "firmware";
reg = <0x020000 0x3d0000>;
};
art: partition@3f0000 {
label = "art";
reg = <0x3f0000 0x010000>;
read-only;
};
};
};
};
&eth0 { // WAN port, initialized last as eth1
nvmem-cells = <&macaddr_uboot_1fc00>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
};
&eth1 { // LAN ports, initialized first as eth0
nvmem-cells = <&macaddr_uboot_1fc00>;
nvmem-cell-names = "mac-address";
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_uboot_1fc00>;
nvmem-cell-names = "mac-address";
};
&uboot {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_uboot_1fc00: macaddr@1fc00 {
reg = <0x1fc00 0x6>;
};
};

View File

@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar934x_ruckus_zf73xx.dtsi"
/ {
model = "Ruckus ZoneFlex 7321[-U]";
compatible = "ruckus,zf7321", "qca,ar9342";
leds {
air-green {
label = "green:air";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
dir-green {
label = "green:dir";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
power_red: power-red {
label = "red:power";
gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
panic-indicator;
};
wlan2g-green {
label = "green:wlan2g";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0assoc";
};
wlan2g-yellow {
label = "yellow:wlan2g";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wlan5g-green {
label = "green:wlan5g";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0assoc";
};
wlan5g-yellow {
label = "yellow:wlan5g";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};
};
&eth0 {
nvmem-cells = <&macaddr_board_data_66>;
};

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344_engenius_exx600.dtsi"
#include "ar9344_senao_ap-dual.dtsi"
/ {
model = "EnGenius EAP600";

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344_engenius_exx600.dtsi"
#include "ar9344_senao_ap-dual.dtsi"
/ {
model = "EnGenius ECB600";

View File

@ -0,0 +1,133 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar934x_ruckus_zf73xx.dtsi"
/ {
model = "Ruckus ZoneFlex 7352/7372[-E/-U]";
compatible = "ruckus,zf7372", "qca,ar9344";
leds {
air-green {
label = "green:air";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
};
air-yellow {
label = "yellow:air";
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
};
dir-green {
label = "green:dir";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
eth1-green {
label = "green:eth1";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
power_red: power-red {
label = "red:power";
gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
panic-indicator;
};
wlan2g-green {
label = "green:wlan2g";
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0assoc";
};
wlan2g-yellow {
label = "yellow:wlan2g";
gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wlan5g-green {
label = "green:wlan5g";
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1assoc";
};
wlan5g-yellow {
label = "yellow:wlan5g";
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
};
beamforming-2g-spi {
compatible = "spi-gpio";
mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
sck-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
num-chipselects = <0>;
beamforming-2g-gpio@0 {
compatible = "fairchild,74hc595";
reg = <0>;
registers-number = <1>;
spi-max-frequency = <24000000>;
gpio-controller;
#gpio-cells = <2>;
};
};
beamforming-5g-spi {
compatible = "spi-gpio";
mosi-gpios = <&ath9k 15 GPIO_ACTIVE_HIGH>;
sck-gpios = <&ath9k 14 GPIO_ACTIVE_HIGH>;
num-chipselects = <0>;
beamforming-5g-gpio@0 {
compatible = "fairchild,74hc595";
reg = <0>;
registers-number = <1>;
spi-max-frequency = <24000000>;
gpio-controller;
#gpio-cells = <2>;
};
};
};
&eth0 {
nvmem-cells = <&macaddr_board_data_6c>;
};
&eth1 {
status = "okay";
nvmem-cells = <&macaddr_board_data_66>;
nvmem-cell-names = "mac-address";
gmac-config {
device = <&gmac>;
switch-phy-swap = <0>;
switch-only-mode = <1>;
};
};
&pcie {
status = "okay";
ath9k: wifi@0,0 {
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
gpio-controller;
#gpio-cells = <2>;
nvmem-cells = <&macaddr_board_data_76>;
nvmem-cell-names = "mac-address";
};
};
&board_data {
macaddr_board_data_6c: macaddr@6c {
reg = <0x6c 0x6>;
};
macaddr_board_data_76: macaddr@76 {
reg = <0x76 0x6>;
};
};

View File

@ -51,16 +51,9 @@
status = "okay";
phy-handle = <&phy0>;
phy-mode = "rgmii-id";
phy-mode = "rgmii-txid";
pll-data = <0x02000000 0x00000101 0x00001313>;
gmac-config {
device = <&gmac>;
rgmii-gmac0 = <1>;
rxdv-delay = <3>;
rxd-delay = <3>;
};
};
&pcie {

View File

@ -0,0 +1,84 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344_senao_ap-dual.dtsi"
/ {
compatible = "watchguard,ap100", "qca,ar9344";
model = "WatchGuard AP100";
aliases {
led-boot = &led_power_amber;
led-failsafe = &led_power_amber;
led-running = &led_power_green;
led-upgrade = &led_power_amber;
};
leds {
compatible = "gpio-leds";
led_power_amber: power_amber {
label = "amber:power";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
led_power_green: power_green {
label = "green:power";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
default-state = "on";
};
lan_data {
label = "orange:lan_data";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
lan_link {
label = "green:lan_link";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
wifi_amber {
label = "amber:wifi";
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
wifi_green {
label = "green:wifi";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};
};
&ref {
clock-frequency = <25000000>;
};
&eth0 {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-2)>;
};
&pcie {
status = "disabled";
};
&wmac {
/delete-property/ qca,disable-2ghz;
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-2)>;
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
};

View File

@ -0,0 +1,86 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344_senao_ap-dual.dtsi"
/ {
compatible = "watchguard,ap200", "qca,ar9344";
model = "WatchGuard AP200";
aliases {
led-boot = &led_power_amber;
led-failsafe = &led_power_amber;
led-running = &led_power_green;
led-upgrade = &led_power_amber;
};
leds {
compatible = "gpio-leds";
led_power_amber: power_amber {
label = "amber:power";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
led_power_green: power_green {
label = "green:power";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
default-state = "on";
};
lan_data {
label = "orange:lan_data";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
lan_link {
label = "green:lan_link";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
wifi_amber {
label = "amber:wifi";
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
wifi_green {
label = "green:wifi";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};
};
&ref {
clock-frequency = <25000000>;
};
&eth0 {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-2)>;
};
&pcie {
wifi@0,0,0 {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-1)>;
};
};
&wmac {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-2)>;
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
};

View File

@ -0,0 +1,198 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/mtd/partitions/uimage.h>
/ {
aliases {
led-boot = &power_green;
led-failsafe = &power_red;
led-running = &power_green;
led-upgrade = &power_red;
};
firmware-concat {
compatible = "mtd-concat";
devices = <&fwconcat0 &fwconcat1>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x1f00000>;
label = "firmware";
compatible = "openwrt,uimage", "denx,uimage";
};
};
};
keys {
compatible = "gpio-keys";
reset {
linux,code = <KEY_RESTART>;
label = "Reset button";
gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
debounce-interval = <50>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&enable_gpio_11>,
<&enable_gpio_16>,
<&enable_gpio_4>,
<&clks_disable_pins>;
power_green: power-green {
label = "green:power";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
ruckus-himem@7ff0000 {
/* Ruckus Himem area used to control
* redundant boot image selection
*/
compatible = "nvmem-rmem";
reg = <0x7ff0000 0x10000>;
no-map;
};
};
};
&ref {
clock-frequency = <40000000>;
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x040000>;
read-only;
};
fwconcat0: partition@40000 {
label = "fwconcat0";
reg = <0x040000 0xf00000>;
};
partition@f40000 {
compatible = "u-boot,env";
label = "u-boot-env";
reg = <0xf40000 0x040000>;
};
board_data: partition@f80000 {
label = "board-data";
reg = <0xf80000 0x080000>;
read-only;
};
fwconcat1: partition@1000000 {
label = "fwconcat1";
reg = <0x1000000 0x1000000>;
};
};
};
};
&mdio0 {
status = "okay";
phy: ethernet-phy@6 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <6>;
};
};
&eth0 {
status = "okay";
pll-data = <0x02000000 0x00000101 0x00001313>;
phy-mode = "rgmii-id";
phy-handle = <&phy>;
nvmem-cell-names = "mac-address";
gmac-config {
device = <&gmac>;
rgmii-gmac0 = <1>;
rxdv-delay = <3>;
rxd-delay = <3>;
};
};
&pinmux {
clks_disable_pins: pinmux_clks_disable_pins {
pinctrl-single,bits = <0x40 0x0 0x20>;
};
enable_gpio_4: pinctrl_enable_gpio_4 {
pinctrl-single,bits = <0x4 0x0 0xff>;
};
enable_gpio_11: pinctrl_enable_gpio_11 {
pinctrl-single,bits = <0x8 0x0 0xff000000>;
};
enable_gpio_16: pinctrl_enable_gpio_16 {
pinctrl-single,bits = <0x10 0x0 0xff>;
};
};
&wmac {
status = "okay";
nvmem-cells = <&macaddr_board_data_60>, <&cal_board_data_41000>;
nvmem-cell-names = "mac-address", "calibration";
};
&usb {
status = "okay";
};
&usb_phy {
status = "okay";
};
&board_data {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_board_data_60: macaddr@60 {
reg = <0x60 0x6>;
};
macaddr_board_data_66: macaddr@66 {
reg = <0x66 0x6>;
};
cal_board_data_41000: cal@41000 {
reg = <0x41000 0x440>;
};
};

View File

@ -0,0 +1,132 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca955x_senao_loader.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "watchguard,ap300", "qca,qca9558";
model = "WatchGuard AP300";
aliases {
label-mac-device = &eth0;
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
keys {
compatible = "gpio-keys";
reset {
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "green:power";
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
default-state = "on";
};
lan_data {
label = "orange:lan_data";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
lan_link {
label = "green:lan_link";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
wifi_amber {
label = "amber:wifi";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
wifi_green {
label = "green:wifi";
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};
virtual_flash {
devices = <&fwconcat0 &fwconcat1 &fwconcat2>;
};
watchdog {
compatible = "linux,wdt-gpio";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
hw_algo = "toggle";
hw_margin_ms = <20000>;
always-running;
};
};
&eth0 {
status = "okay";
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
phy-handle = <&phy5>;
phy-mode = "rgmii-id";
pll-data = <0x82000000 0x80000101 0x80001313>;
};
&mdio0 {
status = "okay";
phy5: ethernet-phy@5 {
reg = <5>;
eee-broken-100tx;
eee-broken-1000t;
};
};
&partitions {
fwconcat2: partition@ff0000 {
label = "fwconcat2";
reg = <0xff0000 0x1000000>;
};
art: partition@1ff0000 {
label = "art";
reg = <0x1ff0000 0x010000>;
read-only;
};
};
&wdt {
status = "disabled";
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
};

View File

@ -0,0 +1,131 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "qca956x.dtsi"
/ {
compatible = "tplink,deco-s4-v2", "qca,qca9563";
model = "TP-Link Deco S4 v2";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
leds {
compatible = "gpio-leds";
wlan2g {
label = "red:wlan2g";
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
led_power: power {
label = "green:power";
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
default-state = "on";
};
wlan5g {
label = "blue:wlan5g";
gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};
keys {
compatible = "gpio-keys";
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
};
&pcie {
status = "okay";
};
&mdio0 {
status = "okay";
phy0: ethernet-phy@0 {
reg = <0>;
phy-mode = "sgmii";
qca,mib-poll-interval = <500>;
qca,ar8327-initvals = <
0x04 0x00080080 /* PORT0 PAD MODE CTRL */
0x7c 0x0000007e /* PORT0_STATUS */
>;
};
};
&spi {
status = "okay";
num-cs = <1>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
uboot: partition@0 {
label = "u-boot";
reg = <0x000000 0x080000>;
read-only;
};
partition@80000 {
label = "product-info";
reg = <0x80000 0x05000>;
read-only;
};
config: partition@85000 {
label = "config";
reg = <0x85000 0x16b000>;
read-only;
};
art: partition@1f0000 {
label = "art";
reg = <0x1f0000 0x10000>;
read-only;
};
partition@200000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x200000 0xe00000>;
};
};
};
};
&eth0 {
status = "okay";
phy-mode = "sgmii";
phy-handle = <&phy0>;
};
&wmac {
status = "okay";
qca,no-eeprom;
};

View File

@ -40,7 +40,10 @@ alfa-network,n5q)
ucidef_set_led_rssi "signal3" "SIGNAL3" "green:signal3" "wlan0" "50" "100"
ucidef_set_led_rssi "signal4" "SIGNAL4" "green:signal4" "wlan0" "75" "100"
;;
alfa-network,pi-wifi4)
alfa-network,pi-wifi4|\
watchguard,ap100|\
watchguard,ap200|\
watchguard,ap300)
ucidef_set_led_netdev "lan_data" "LAN_DATA" "orange:lan_data" "eth0" "tx rx"
ucidef_set_led_netdev "lan_link" "LAN_LINK" "green:lan_link" "eth0" "link"
;;
@ -324,6 +327,9 @@ qca,ap143-16m)
qihoo,c301)
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
;;
ruckus,zf7372)
ucidef_set_led_switch "lan" "LAN" "green:eth1" "switch0" "0x02"
;;
samsung,wam250)
ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth0"
;;

View File

@ -65,6 +65,7 @@ ath79_setup_interfaces()
pisen,ts-d084|\
pisen,wmb001n|\
pisen,wmm003n|\
ruckus,zf7321|\
siemens,ws-ap3610|\
sophos,ap15|\
sophos,ap55|\
@ -109,6 +110,9 @@ ath79_setup_interfaces()
ubnt,unifiac-lr|\
ubnt,unifiac-mesh|\
ubnt,unifi|\
watchguard,ap100|\
watchguard,ap200|\
watchguard,ap300|\
wd,mynet-wifi-rangeextender|\
winchannel,wb2000|\
zyxel,nwa1100-nh|\
@ -131,6 +135,7 @@ ath79_setup_interfaces()
engenius,enstationac-v1|\
engenius,ews511ap|\
ocedo,ursus|\
ruckus,zf7372|\
ubnt,unifi-ap-outdoor-plus)
ucidef_set_interface_lan "eth0 eth1"
;;
@ -514,7 +519,8 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan"
;;
tplink,deco-m4r-v1)
tplink,deco-m4r-v1|\
tplink,deco-s4-v2)
ucidef_add_switch "switch0" \
"0@eth0" "3:lan:1" "5:lan:2"
;;
@ -672,6 +678,10 @@ ath79_setup_macs()
base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
wan_mac=$(macaddr_add "$base_mac" 1)
;;
tplink,deco-s4-v2)
lan_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
label_mac=$lan_mac
;;
nec,wf1200cr|\
nec,wg1200cr)
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
@ -698,6 +708,11 @@ ath79_setup_macs()
wan_mac=$(mtd_get_mac_binary factory 0x0)
lan_mac=$(macaddr_setbit_la "$wan_mac")
;;
ruckus,zf7321|\
ruckus,zf7372)
lan_mac=$(mtd_get_mac_binary board-data 0x807E)
label_mac=$lan_mac
;;
sitecom,wlr-7100|\
sitecom,wlr-8100)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)

View File

@ -71,6 +71,11 @@ case "$FIRMWARE" in
caldata_extract "radiocfg" 0x1000 0x440
ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac")
;;
tplink,deco-s4-v2)
caldata_extract "art" 0x1000 0x440
base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
ath9k_patch_mac $(macaddr_add $base_mac 1)
;;
*)
caldata_die "board $board is not supported yet"
;;
@ -91,6 +96,8 @@ case "$FIRMWARE" in
tplink,tl-wdr4310-v1|\
tplink,tl-wdr4900-v2|\
ubnt,unifi-ap-pro|\
watchguard,ap100|\
watchguard,ap200|\
winchannel,wb2000)
caldata_extract "art" 0x5000 0x440
;;

View File

@ -15,7 +15,8 @@ case "$FIRMWARE" in
araknis,an-700-ap-i-ac|\
engenius,eap1200h|\
engenius,enstationac-v1|\
glinet,gl-x750)
glinet,gl-x750|\
watchguard,ap300)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 2)
;;
@ -262,6 +263,13 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
tplink,deco-s4-v2)
caldata_extract "art" 0x5000 0x2f20
base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
ath10k_patch_mac $(macaddr_add $base_mac 2)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
esac
;;
*)

View File

@ -1,4 +1,4 @@
. /lib/functions.sh
. /lib/functions/system.sh
preinit_set_mac_address() {
case $(board_name) in
@ -19,6 +19,10 @@ preinit_set_mac_address() {
siemens,ws-ap3610)
ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
;;
tplink,deco-s4-v2)
base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
ip link set dev eth0 address $base_mac
;;
zyxel,nbg6616)
ethaddr=$(mtd_get_mac_ascii u-boot-env ethaddr)
ip link set dev eth0 address $(macaddr_add $ethaddr 2)

View File

@ -40,7 +40,10 @@ platform_do_upgrade() {
engenius,eap600|\
engenius,ecb600|\
engenius,ens202ext-v1|\
engenius,enstationac-v1)
engenius,enstationac-v1|\
watchguard,ap100|\
watchguard,ap200|\
watchguard,ap300)
IMAGE_LIST="tar tzf $1"
IMAGE_CMD="tar xzOf $1"
KERNEL_PART="loader"

View File

@ -1,8 +1,10 @@
define Device/mikrotik
DEVICE_VENDOR := MikroTik
LOADER_TYPE := elf
KERNEL_NAME := vmlinuz
KERNEL := kernel-bin | append-dtb-elf
KERNEL_INITRAMFS := kernel-bin | append-dtb-elf
KERNEL_INITRAMFS_NAME := vmlinux-initramfs
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel
endef
define Device/mikrotik_nor

View File

@ -1,4 +1,4 @@
DEVICE_VARS += SENAO_IMGNAME
DEVICE_VARS += SENAO_IMGNAME WATCHGUARD_MAGIC
# This needs to make OEM config archive 'sysupgrade.tgz' an empty file prior to OEM
# sysupgrade, as otherwise it will implant the old configuration from
@ -27,6 +27,13 @@ define Build/senao-tar-gz
rm -rf $@.tmp $@.len $@.md5
endef
define Build/watchguard-cksum
-echo -n $(word 1,$(1)) | cat $@ - | md5sum | \
cut -d ' ' -f1 | tr -d '\n' > $@.md5 && \
cat $@.md5 >> $@ && \
rm -rf $@.md5
endef
define Device/senao_loader_okli
$(Device/loader-okli-uimage)
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x73714f4b

View File

@ -493,6 +493,18 @@ define Device/tplink_deco-m4r-v1
endef
TARGET_DEVICES += tplink_deco-m4r-v1
define Device/tplink_deco-s4-v2
$(Device/tplink-safeloader-uimage)
SOC := qca9563
IMAGE_SIZE := 13824k
DEVICE_MODEL := Deco S4
DEVICE_VARIANT := v2
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct uencrypt
SUPPORTED_DEVICES += deco-s4-v2
TPLINK_BOARD_ID := DECO-S4-V2
endef
TARGET_DEVICES += tplink_deco-s4-v2
define Device/tplink_re350k-v1
$(Device/tplink-safeloader)
SOC := qca9558

View File

@ -2381,6 +2381,29 @@ define Device/rosinson_wr818
endef
TARGET_DEVICES += rosinson_wr818
define Device/ruckus_zf73xx_common
DEVICE_VENDOR := Ruckus
DEVICE_PACKAGES := -swconfig kmod-usb2 kmod-usb-chipidea2
IMAGE_SIZE := 31744k
LOADER_TYPE := bin
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
endef
define Device/ruckus_zf7321
$(Device/ruckus_zf73xx_common)
SOC := ar9342
DEVICE_MODEL := ZoneFlex 7321[-U]
endef
TARGET_DEVICES += ruckus_zf7321
define Device/ruckus_zf7372
$(Device/ruckus_zf73xx_common)
SOC := ar9344
DEVICE_MODEL := ZoneFlex 7352/7372[-E/-U]
endef
TARGET_DEVICES += ruckus_zf7372
define Device/samsung_wam250
SOC := ar9344
DEVICE_VENDOR := Samsung
@ -2568,6 +2591,49 @@ define Device/wallys_dr531
endef
TARGET_DEVICES += wallys_dr531
define Device/watchguard_ap100
$(Device/senao_loader_okli)
SOC := ar9344
DEVICE_VENDOR := WatchGuard
DEVICE_MODEL := AP100
IMAGE_SIZE := 12096k
LOADER_FLASH_OFFS := 0x220000
SENAO_IMGNAME := senao-ap100
WATCHGUARD_MAGIC := 82kdlzk2
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
check-size | senao-tar-gz $$$$(SENAO_IMGNAME) | watchguard-cksum $$$$(WATCHGUARD_MAGIC)
endef
TARGET_DEVICES += watchguard_ap100
define Device/watchguard_ap200
$(Device/senao_loader_okli)
SOC := ar9344
DEVICE_VENDOR := WatchGuard
DEVICE_MODEL := AP200
IMAGE_SIZE := 12096k
LOADER_FLASH_OFFS := 0x220000
SENAO_IMGNAME := senao-ap200
WATCHGUARD_MAGIC := 82kdlzk2
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
check-size | senao-tar-gz $$$$(SENAO_IMGNAME) | watchguard-cksum $$$$(WATCHGUARD_MAGIC)
endef
TARGET_DEVICES += watchguard_ap200
define Device/watchguard_ap300
$(Device/senao_loader_okli)
SOC := qca9558
DEVICE_VENDOR := WatchGuard
DEVICE_MODEL := AP300
DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct
IMAGE_SIZE := 11584k
LOADER_FLASH_OFFS := 0x220000
SENAO_IMGNAME := senao-ap300
WATCHGUARD_MAGIC := 82kdlzk2
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
check-size | senao-tar-gz $$$$(SENAO_IMGNAME) | watchguard-cksum $$$$(WATCHGUARD_MAGIC)
endef
TARGET_DEVICES += watchguard_ap300
define Device/wd_mynet-n600
$(Device/seama)
SOC := ar9344

View File

@ -503,6 +503,16 @@ define Device/tplink_tl-wr941-v4
endef
TARGET_DEVICES += tplink_tl-wr941-v4
define Device/tplink_tl-wr941nd-v5
$(Device/tplink-4mlzma)
SOC := ar9341
DEVICE_MODEL := TL-WR941ND
DEVICE_VARIANT := v5
TPLINK_HWID := 0x09410005
SUPPORTED_DEVICES += tl-wr941nd-v5
endef
TARGET_DEVICES += tplink_tl-wr941nd-v5
define Device/tplink_tl-wr941nd-v6
$(Device/tplink-4mlzma)
SOC := tp9343

View File

@ -13,9 +13,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -931,6 +931,17 @@ config LEDS_ACER_A500
source "drivers/leds/blink/Kconfig"
@@ -941,6 +941,17 @@ config LEDS_UBNT_LEDBAR
To compile this driver as a module, choose M here: the module
will be called leds-ubnt-ledbar.
+config LEDS_RESET
+ tristate "LED support for reset-controller API"
@ -176,10 +176,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
+MODULE_ALIAS("platform:leds-reset");
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -93,6 +93,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
@@ -94,6 +94,7 @@ obj-$(CONFIG_LEDS_WM831X_STATUS) += leds
obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
obj-$(CONFIG_LEDS_UBNT_LEDBAR) += leds-ubnt-ledbar.o
+obj-$(CONFIG_LEDS_RESET) += leds-reset.o
# LED SPI Drivers

View File

@ -706,7 +706,7 @@
EXPORT_SYMBOL(xfrm_parse_spi);
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4093,14 +4093,16 @@ static bool tcp_parse_aligned_timestamp(
@@ -4116,14 +4116,16 @@ static bool tcp_parse_aligned_timestamp(
{
const __be32 *ptr = (const __be32 *)(th + 1);

View File

@ -13,9 +13,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -876,6 +876,17 @@ source "drivers/leds/blink/Kconfig"
comment "Flash and Torch LED drivers"
source "drivers/leds/flash/Kconfig"
@@ -886,6 +886,17 @@ config LEDS_UBNT_LEDBAR
To compile this driver as a module, choose M here: the module
will be called leds-ubnt-ledbar.
+config LEDS_RESET
+ tristate "LED support for reset-controller API"
@ -176,10 +176,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
+MODULE_ALIAS("platform:leds-reset");
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -87,6 +87,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
@@ -88,6 +88,7 @@ obj-$(CONFIG_LEDS_WM831X_STATUS) += leds
obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
obj-$(CONFIG_LEDS_UBNT_LEDBAR) += leds-ubnt-ledbar.o
+obj-$(CONFIG_LEDS_RESET) += leds-reset.o
# LED SPI Drivers

View File

@ -65,7 +65,8 @@ tplink,tl-mr3420-v2|\
tplink,tl-wr740n-v4|\
tplink,tl-wr740n-v5|\
tplink,tl-wr741nd-v4|\
tplink,tl-wr841-v8)
tplink,tl-wr841-v8|\
tplink,tl-wr941nd-v5)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x04"
ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x08"

View File

@ -84,7 +84,8 @@ ath79_setup_interfaces()
tplink,tl-wr740n-v4|\
tplink,tl-wr740n-v5|\
tplink,tl-wr741nd-v4|\
tplink,tl-wr841-v8)
tplink,tl-wr841-v8|\
tplink,tl-wr941nd-v5)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"

View File

@ -0,0 +1,146 @@
From 6e977eaa8280e957b87904b536661550f2a6b3e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 25 Feb 2022 17:58:20 +0000
Subject: [PATCH] nvmem: brcm_nvram: parse NVRAM content into NVMEM cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NVRAM consist of header and NUL separated key-value pairs. Parse it and
create NVMEM cell for every key-value entry.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220225175822.8293-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/brcm_nvram.c | 90 ++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -6,12 +6,26 @@
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
+#include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h>
#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define NVRAM_MAGIC "FLSH"
struct brcm_nvram {
struct device *dev;
void __iomem *base;
+ struct nvmem_cell_info *cells;
+ int ncells;
+};
+
+struct brcm_nvram_header {
+ char magic[4];
+ __le32 len;
+ __le32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */
+ __le32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */
+ __le32 config_ncdl; /* ncdl values for memc */
};
static int brcm_nvram_read(void *context, unsigned int offset, void *val,
@@ -26,6 +40,75 @@ static int brcm_nvram_read(void *context
return 0;
}
+static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
+ size_t len)
+{
+ struct device *dev = priv->dev;
+ char *var, *value, *eq;
+ int idx;
+
+ priv->ncells = 0;
+ for (var = data + sizeof(struct brcm_nvram_header);
+ var < (char *)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 + sizeof(struct brcm_nvram_header), idx = 0;
+ var < (char *)data + len && *var;
+ var = value + strlen(value) + 1, idx++) {
+ 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)
+ return -ENOMEM;
+ priv->cells[idx].offset = value - (char *)data;
+ priv->cells[idx].bytes = strlen(value);
+ }
+
+ return 0;
+}
+
+static int brcm_nvram_parse(struct brcm_nvram *priv)
+{
+ struct device *dev = priv->dev;
+ struct brcm_nvram_header header;
+ uint8_t *data;
+ size_t len;
+ int err;
+
+ memcpy_fromio(&header, priv->base, sizeof(header));
+
+ if (memcmp(header.magic, NVRAM_MAGIC, 4)) {
+ dev_err(dev, "Invalid NVRAM magic\n");
+ return -EINVAL;
+ }
+
+ len = le32_to_cpu(header.len);
+
+ data = kcalloc(1, len, GFP_KERNEL);
+ memcpy_fromio(data, priv->base, len);
+ data[len - 1] = '\0';
+
+ err = brcm_nvram_add_cells(priv, data, len);
+ if (err) {
+ dev_err(dev, "Failed to add cells: %d\n", err);
+ return err;
+ }
+
+ kfree(data);
+
+ return 0;
+}
+
static int brcm_nvram_probe(struct platform_device *pdev)
{
struct nvmem_config config = {
@@ -35,6 +118,7 @@ static int brcm_nvram_probe(struct platf
struct device *dev = &pdev->dev;
struct resource *res;
struct brcm_nvram *priv;
+ int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -46,7 +130,13 @@ static int brcm_nvram_probe(struct platf
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ err = brcm_nvram_parse(priv);
+ if (err)
+ return err;
+
config.dev = dev;
+ config.cells = priv->cells;
+ config.ncells = priv->ncells;
config.priv = priv;
config.size = resource_size(res);

View File

@ -0,0 +1,38 @@
From 207775f7e17b8fd0426a2ac4a5b81e4e1d71849e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 29 Apr 2022 17:26:47 +0100
Subject: [PATCH] nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
device (provider) subnodes. Look for such subnodes when collecing NVMEM
cells. This allows NVMEM consumers to use NVRAM variables.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/brcm_nvram.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct b
return -ENOMEM;
priv->cells[idx].offset = value - (char *)data;
priv->cells[idx].bytes = strlen(value);
+ priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
}
return 0;

View File

@ -40,7 +40,7 @@ it on BCM4708 family.
/* called during probe() after chip reset completes */
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -156,6 +156,49 @@ int xhci_start(struct xhci_hcd *xhci)
@@ -158,6 +158,49 @@ int xhci_start(struct xhci_hcd *xhci)
return ret;
}
@ -90,7 +90,7 @@ it on BCM4708 family.
/*
* Reset a halted HC.
*
@@ -606,10 +649,20 @@ static int xhci_init(struct usb_hcd *hcd
@@ -608,10 +651,20 @@ static int xhci_init(struct usb_hcd *hcd
static int xhci_run_finished(struct xhci_hcd *xhci)
{
@ -114,7 +114,7 @@ it on BCM4708 family.
xhci->shared_hcd->state = HC_STATE_RUNNING;
xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
@@ -619,6 +672,10 @@ static int xhci_run_finished(struct xhci
@@ -621,6 +674,10 @@ static int xhci_run_finished(struct xhci
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB3 roothub");
return 0;

View File

@ -20,12 +20,12 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
@@ -46,6 +47,8 @@ static int brcm_nvram_probe(struct platf
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
@@ -136,6 +137,8 @@ static int brcm_nvram_probe(struct platf
if (err)
return err;
+ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
+
config.dev = dev;
config.priv = priv;
config.size = resource_size(res);
config.cells = priv->cells;
config.ncells = priv->ncells;

View File

@ -0,0 +1,146 @@
From 6e977eaa8280e957b87904b536661550f2a6b3e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 25 Feb 2022 17:58:20 +0000
Subject: [PATCH] nvmem: brcm_nvram: parse NVRAM content into NVMEM cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NVRAM consist of header and NUL separated key-value pairs. Parse it and
create NVMEM cell for every key-value entry.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220225175822.8293-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/brcm_nvram.c | 90 ++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -6,12 +6,26 @@
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
+#include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h>
#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define NVRAM_MAGIC "FLSH"
struct brcm_nvram {
struct device *dev;
void __iomem *base;
+ struct nvmem_cell_info *cells;
+ int ncells;
+};
+
+struct brcm_nvram_header {
+ char magic[4];
+ __le32 len;
+ __le32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */
+ __le32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */
+ __le32 config_ncdl; /* ncdl values for memc */
};
static int brcm_nvram_read(void *context, unsigned int offset, void *val,
@@ -26,6 +40,75 @@ static int brcm_nvram_read(void *context
return 0;
}
+static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
+ size_t len)
+{
+ struct device *dev = priv->dev;
+ char *var, *value, *eq;
+ int idx;
+
+ priv->ncells = 0;
+ for (var = data + sizeof(struct brcm_nvram_header);
+ var < (char *)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 + sizeof(struct brcm_nvram_header), idx = 0;
+ var < (char *)data + len && *var;
+ var = value + strlen(value) + 1, idx++) {
+ 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)
+ return -ENOMEM;
+ priv->cells[idx].offset = value - (char *)data;
+ priv->cells[idx].bytes = strlen(value);
+ }
+
+ return 0;
+}
+
+static int brcm_nvram_parse(struct brcm_nvram *priv)
+{
+ struct device *dev = priv->dev;
+ struct brcm_nvram_header header;
+ uint8_t *data;
+ size_t len;
+ int err;
+
+ memcpy_fromio(&header, priv->base, sizeof(header));
+
+ if (memcmp(header.magic, NVRAM_MAGIC, 4)) {
+ dev_err(dev, "Invalid NVRAM magic\n");
+ return -EINVAL;
+ }
+
+ len = le32_to_cpu(header.len);
+
+ data = kcalloc(1, len, GFP_KERNEL);
+ memcpy_fromio(data, priv->base, len);
+ data[len - 1] = '\0';
+
+ err = brcm_nvram_add_cells(priv, data, len);
+ if (err) {
+ dev_err(dev, "Failed to add cells: %d\n", err);
+ return err;
+ }
+
+ kfree(data);
+
+ return 0;
+}
+
static int brcm_nvram_probe(struct platform_device *pdev)
{
struct nvmem_config config = {
@@ -35,6 +118,7 @@ static int brcm_nvram_probe(struct platf
struct device *dev = &pdev->dev;
struct resource *res;
struct brcm_nvram *priv;
+ int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -46,7 +130,13 @@ static int brcm_nvram_probe(struct platf
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ err = brcm_nvram_parse(priv);
+ if (err)
+ return err;
+
config.dev = dev;
+ config.cells = priv->cells;
+ config.ncells = priv->ncells;
config.priv = priv;
config.size = resource_size(res);

View File

@ -0,0 +1,38 @@
From 207775f7e17b8fd0426a2ac4a5b81e4e1d71849e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 29 Apr 2022 17:26:47 +0100
Subject: [PATCH] nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
device (provider) subnodes. Look for such subnodes when collecing NVMEM
cells. This allows NVMEM consumers to use NVRAM variables.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/brcm_nvram.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct b
return -ENOMEM;
priv->cells[idx].offset = value - (char *)data;
priv->cells[idx].bytes = strlen(value);
+ priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
}
return 0;

View File

@ -20,12 +20,12 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
@@ -46,6 +47,8 @@ static int brcm_nvram_probe(struct platf
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
@@ -136,6 +137,8 @@ static int brcm_nvram_probe(struct platf
if (err)
return err;
+ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
+
config.dev = dev;
config.priv = priv;
config.size = resource_size(res);
config.cells = priv->cells;
config.ncells = priv->ncells;

View File

@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6809,15 +6809,10 @@ void __netif_napi_del(struct napi_struct
@@ -6810,15 +6810,10 @@ void __netif_napi_del(struct napi_struct
}
EXPORT_SYMBOL(__netif_napi_del);
@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
weight = n->weight;
/* This NAPI_STATE_SCHED test is for avoiding a race
@@ -6837,7 +6832,7 @@ static int napi_poll(struct napi_struct
@@ -6838,7 +6833,7 @@ static int napi_poll(struct napi_struct
n->poll, work, weight);
if (likely(work < weight))
@ -44,7 +44,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Drivers must not modify the NAPI state if they
* consume the entire weight. In such cases this code
@@ -6846,7 +6841,7 @@ static int napi_poll(struct napi_struct
@@ -6847,7 +6842,7 @@ static int napi_poll(struct napi_struct
*/
if (unlikely(napi_disable_pending(n))) {
napi_complete(n);
@ -53,7 +53,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
if (n->gro_bitmask) {
@@ -6864,12 +6859,29 @@ static int napi_poll(struct napi_struct
@@ -6865,12 +6860,29 @@ static int napi_poll(struct napi_struct
if (unlikely(!list_empty(&n->poll_list))) {
pr_warn_once("%s: Budget exhausted after napi rescheduled\n",
n->dev ? n->dev->name : "backlog");

View File

@ -76,7 +76,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/**
* napi_synchronize - wait until NAPI is not running
@@ -1842,6 +1832,8 @@ enum netdev_ml_priv_type {
@@ -1856,6 +1846,8 @@ enum netdev_ml_priv_type {
*
* @wol_enabled: Wake-on-LAN is enabled
*
@ -85,7 +85,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
* @net_notifier_list: List of per-net netdev notifier block
* that follow this device when it is moved
* to another network namespace.
@@ -2161,6 +2153,7 @@ struct net_device {
@@ -2175,6 +2167,7 @@ struct net_device {
struct lock_class_key *qdisc_running_key;
bool proto_down;
unsigned wol_enabled:1;
@ -131,7 +131,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
{
const struct net_device_ops *ops = dev->netdev_ops;
@@ -4271,6 +4293,21 @@ int gro_normal_batch __read_mostly = 8;
@@ -4272,6 +4294,21 @@ int gro_normal_batch __read_mostly = 8;
static inline void ____napi_schedule(struct softnet_data *sd,
struct napi_struct *napi)
{
@ -153,7 +153,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
list_add_tail(&napi->poll_list, &sd->poll_list);
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
}
@@ -6762,6 +6799,12 @@ void netif_napi_add(struct net_device *d
@@ -6763,6 +6800,12 @@ void netif_napi_add(struct net_device *d
set_bit(NAPI_STATE_NPSVC, &napi->state);
list_add_rcu(&napi->dev_list, &dev->napi_list);
napi_hash_add(napi);
@ -166,7 +166,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
EXPORT_SYMBOL(netif_napi_add);
@@ -6778,9 +6821,28 @@ void napi_disable(struct napi_struct *n)
@@ -6779,9 +6822,28 @@ void napi_disable(struct napi_struct *n)
hrtimer_cancel(&n->timer);
clear_bit(NAPI_STATE_DISABLE, &n->state);
@ -195,7 +195,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
static void flush_gro_hash(struct napi_struct *napi)
{
int i;
@@ -6806,6 +6868,11 @@ void __netif_napi_del(struct napi_struct
@@ -6807,6 +6869,11 @@ void __netif_napi_del(struct napi_struct
flush_gro_hash(napi);
napi->gro_bitmask = 0;
@ -207,7 +207,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
EXPORT_SYMBOL(__netif_napi_del);
@@ -6887,6 +6954,51 @@ static int napi_poll(struct napi_struct
@@ -6888,6 +6955,51 @@ static int napi_poll(struct napi_struct
return work;
}

View File

@ -57,7 +57,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
* @n: NAPI context
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4297,8 +4297,9 @@ static inline void ____napi_schedule(str
@@ -4298,8 +4298,9 @@ static inline void ____napi_schedule(str
if (test_bit(NAPI_STATE_THREADED, &napi->state)) {
/* Paired with smp_mb__before_atomic() in
@ -69,7 +69,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
* wake_up_process() when it's not NULL.
*/
thread = READ_ONCE(napi->thread);
@@ -6772,6 +6773,49 @@ static void init_gro_hash(struct napi_st
@@ -6773,6 +6774,49 @@ static void init_gro_hash(struct napi_st
napi->gro_bitmask = 0;
}

View File

@ -45,7 +45,7 @@ Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
enum gro_result {
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4304,6 +4304,8 @@ static inline void ____napi_schedule(str
@@ -4305,6 +4305,8 @@ static inline void ____napi_schedule(str
*/
thread = READ_ONCE(napi->thread);
if (thread) {
@ -54,7 +54,7 @@ Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
wake_up_process(thread);
return;
}
@@ -6564,7 +6566,8 @@ bool napi_complete_done(struct napi_stru
@@ -6565,7 +6567,8 @@ bool napi_complete_done(struct napi_stru
WARN_ON_ONCE(!(val & NAPIF_STATE_SCHED));
@ -64,7 +64,7 @@ Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
/* If STATE_MISSED was set, leave STATE_SCHED set,
* because we will call napi->poll() one more time.
@@ -7000,16 +7003,25 @@ static int napi_poll(struct napi_struct
@@ -7001,16 +7004,25 @@ static int napi_poll(struct napi_struct
static int napi_thread_wait(struct napi_struct *napi)
{

View File

@ -34,7 +34,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7007,7 +7007,7 @@ static int napi_thread_wait(struct napi_
@@ -7008,7 +7008,7 @@ static int napi_thread_wait(struct napi_
set_current_state(TASK_INTERRUPTIBLE);
@ -43,7 +43,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
/* Testing SCHED_THREADED bit here to make sure the current
* kthread owns this napi and could poll on this napi.
* Testing SCHED bit is not enough because SCHED bit might be
@@ -7025,6 +7025,7 @@ static int napi_thread_wait(struct napi_
@@ -7026,6 +7026,7 @@ static int napi_thread_wait(struct napi_
set_current_state(TASK_INTERRUPTIBLE);
}
__set_current_state(TASK_RUNNING);

View File

@ -12,7 +12,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1469,13 +1469,16 @@ struct nft_trans_chain {
@@ -1474,13 +1474,16 @@ struct nft_trans_chain {
struct nft_trans_table {
bool update;
@ -70,7 +70,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
nft_trans_table_update(trans) = true;
list_add_tail(&trans->list, &ctx->net->nft.commit_list);
return 0;
@@ -7929,11 +7933,10 @@ static int nf_tables_commit(struct net *
@@ -7919,11 +7923,10 @@ static int nf_tables_commit(struct net *
switch (trans->msg_type) {
case NFT_MSG_NEWTABLE:
if (nft_trans_table_update(trans)) {
@ -86,7 +86,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
} else {
nft_clear(net, trans->ctx.table);
}
@@ -8147,11 +8150,9 @@ static int __nf_tables_abort(struct net
@@ -8137,11 +8140,9 @@ static int __nf_tables_abort(struct net
switch (trans->msg_type) {
case NFT_MSG_NEWTABLE:
if (nft_trans_table_update(trans)) {

View File

@ -58,7 +58,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -827,6 +827,27 @@ typedef u16 (*select_queue_fallback_t)(s
@@ -841,6 +841,27 @@ typedef u16 (*select_queue_fallback_t)(s
struct sk_buff *skb,
struct net_device *sb_dev);
@ -86,7 +86,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
enum tc_setup_type {
TC_SETUP_QDISC_MQPRIO,
TC_SETUP_CLSU32,
@@ -1273,6 +1294,8 @@ struct netdev_net_notifier {
@@ -1287,6 +1308,8 @@ struct netdev_net_notifier {
* struct net_device *(*ndo_get_peer_dev)(struct net_device *dev);
* If a device is paired with a peer device, return the peer instance.
* The caller must be under RCU read context.
@ -95,7 +95,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
*/
struct net_device_ops {
int (*ndo_init)(struct net_device *dev);
@@ -1481,6 +1504,8 @@ struct net_device_ops {
@@ -1495,6 +1518,8 @@ struct net_device_ops {
int (*ndo_tunnel_ctl)(struct net_device *dev,
struct ip_tunnel_parm *p, int cmd);
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
@ -104,7 +104,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
};
/**
@@ -2828,6 +2853,8 @@ void dev_remove_offload(struct packet_of
@@ -2842,6 +2867,8 @@ void dev_remove_offload(struct packet_of
int dev_get_iflink(const struct net_device *dev);
int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);

View File

@ -28,7 +28,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -829,11 +829,18 @@ typedef u16 (*select_queue_fallback_t)(s
@@ -843,11 +843,18 @@ typedef u16 (*select_queue_fallback_t)(s
enum net_device_path_type {
DEV_PATH_ETHERNET = 0,

View File

@ -9,7 +9,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -830,6 +830,7 @@ typedef u16 (*select_queue_fallback_t)(s
@@ -844,6 +844,7 @@ typedef u16 (*select_queue_fallback_t)(s
enum net_device_path_type {
DEV_PATH_ETHERNET = 0,
DEV_PATH_VLAN,

View File

@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -841,10 +841,20 @@ struct net_device_path {
@@ -855,10 +855,20 @@ struct net_device_path {
u16 id;
__be16 proto;
} encap;
@ -36,7 +36,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
struct net_device_path_stack {
int num_paths;
@@ -854,6 +864,12 @@ struct net_device_path_stack {
@@ -868,6 +878,12 @@ struct net_device_path_stack {
struct net_device_path_ctx {
const struct net_device *dev;
const u8 *daddr;

View File

@ -83,7 +83,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -831,6 +831,7 @@ enum net_device_path_type {
@@ -845,6 +845,7 @@ enum net_device_path_type {
DEV_PATH_ETHERNET = 0,
DEV_PATH_VLAN,
DEV_PATH_BRIDGE,
@ -91,7 +91,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
};
struct net_device_path {
@@ -840,6 +841,7 @@ struct net_device_path {
@@ -854,6 +855,7 @@ struct net_device_path {
struct {
u16 id;
__be16 proto;

View File

@ -10,7 +10,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -832,6 +832,7 @@ enum net_device_path_type {
@@ -846,6 +846,7 @@ enum net_device_path_type {
DEV_PATH_VLAN,
DEV_PATH_BRIDGE,
DEV_PATH_PPPOE,
@ -18,7 +18,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
};
struct net_device_path {
@@ -852,6 +853,10 @@ struct net_device_path {
@@ -866,6 +867,10 @@ struct net_device_path {
u16 vlan_id;
__be16 vlan_proto;
} bridge;

View File

@ -12,7 +12,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -849,6 +849,7 @@ struct net_device_path {
@@ -863,6 +863,7 @@ struct net_device_path {
DEV_PATH_BR_VLAN_KEEP,
DEV_PATH_BR_VLAN_TAG,
DEV_PATH_BR_VLAN_UNTAG,

View File

@ -0,0 +1,41 @@
From dbc2f62061c6bfba0aee93161ee3194dcee84bd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 29 Apr 2022 17:26:46 +0100
Subject: [PATCH] nvmem: core: support passing DT node in cell info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some hardware may have NVMEM cells described in Device Tree using
individual nodes. Let drivers pass such nodes to the NVMEM subsystem so
they can be later used by NVMEM consumers.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220429162701.2222-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/core.c | 1 +
include/linux/nvmem-consumer.h | 1 +
2 files changed, 2 insertions(+)
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -374,6 +374,7 @@ static int nvmem_cell_info_to_nvmem_cell
cell->bit_offset = info->bit_offset;
cell->nbits = info->nbits;
+ cell->np = info->np;
if (cell->nbits)
cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset,
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -25,6 +25,7 @@ struct nvmem_cell_info {
unsigned int bytes;
unsigned int bit_offset;
unsigned int nbits;
+ struct device_node *np;
};
/**

View File

@ -0,0 +1,37 @@
From f369e9ad52ec9361827e21a631b7198c9fca438e Mon Sep 17 00:00:00 2001
From: Koen Vandeputte <koen.vandeputte@citymesh.com>
Date: Wed, 31 Aug 2022 12:03:49 +0200
Subject: [PATCH] bus: mhi: host: always print detected modem name
This harmless print provides a very easy way of knowing
if the modem is detected properly during probing.
Promote it to an informational print so no hassle is required
enabling kernel debugging info to obtain it.
The rationale here is that:
On a lot of low-storage embedded devices, extensive kernel
debugging info is not always present as this would
increase it's size to much causing partition size issues.
Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Link: https://lore.kernel.org/r/20220831100349.1488762-1-koen.vandeputte@citymesh.com
[mani: added missing review tags]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/bus/mhi/pci_generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/bus/mhi/pci_generic.c
+++ b/drivers/bus/mhi/pci_generic.c
@@ -806,7 +806,7 @@ static int mhi_pci_probe(struct pci_dev
struct mhi_controller *mhi_cntrl;
int err;
- dev_dbg(&pdev->dev, "MHI PCI device found: %s\n", info->name);
+ dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
/* mhi_pdev.mhi_cntrl must be zero-initialized */
mhi_pdev = devm_kzalloc(&pdev->dev, sizeof(*mhi_pdev), GFP_KERNEL);

View File

@ -0,0 +1,41 @@
From dbc2f62061c6bfba0aee93161ee3194dcee84bd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 29 Apr 2022 17:26:46 +0100
Subject: [PATCH] nvmem: core: support passing DT node in cell info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some hardware may have NVMEM cells described in Device Tree using
individual nodes. Let drivers pass such nodes to the NVMEM subsystem so
they can be later used by NVMEM consumers.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220429162701.2222-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/core.c | 1 +
include/linux/nvmem-consumer.h | 1 +
2 files changed, 2 insertions(+)
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -462,6 +462,7 @@ static int nvmem_cell_info_to_nvmem_cell
cell->bit_offset = info->bit_offset;
cell->nbits = info->nbits;
+ cell->np = info->np;
if (cell->nbits)
cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset,
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -25,6 +25,7 @@ struct nvmem_cell_info {
unsigned int bytes;
unsigned int bit_offset;
unsigned int nbits;
+ struct device_node *np;
};
/**

View File

@ -3060,6 +3060,7 @@ CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_LEDS_TRIGGER_TIMER=y
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
# CONFIG_LEDS_TURRIS_OMNIA is not set
# CONFIG_LEDS_UBNT_LEDBAR is not set
# CONFIG_LEDS_USER is not set
# CONFIG_LED_TRIGGER_PHY is not set
# CONFIG_LEGACY_PTYS is not set

Some files were not shown because too many files have changed in this diff Show More