mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-08 10:23:47 +08:00
Merge Official Source
This commit is contained in:
commit
b3c118d5c4
@ -62,6 +62,12 @@ define patch_libtool
|
||||
);
|
||||
endef
|
||||
|
||||
define set_libtool_abiver
|
||||
sed -i \
|
||||
-e 's,^soname_spec=.*,soname_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION)",' \
|
||||
-e 's,^library_names_spec=.*,library_names_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION) \\$$$${libname}\\$$$${shared_ext}",' \
|
||||
$(PKG_BUILD_DIR)/libtool
|
||||
endef
|
||||
|
||||
PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
|
||||
PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
|
||||
@ -110,6 +116,10 @@ ifneq ($(filter libtool,$(PKG_FIXUP)),)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
|
||||
Hooks/Configure/Post += set_libtool_abiver
|
||||
endif
|
||||
|
||||
ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
|
||||
PKG_BUILD_DEPENDS += libtool gettext libiconv
|
||||
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
|
||||
|
@ -43,5 +43,5 @@ endef
|
||||
|
||||
# 1: package name
|
||||
define GetABISuffix
|
||||
$(if $(filter-out kmod-%,$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))
|
||||
$(if $(filter-out kmod-%,$(1)),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
|
||||
endef
|
||||
|
@ -152,17 +152,16 @@ ifeq ($(DUMP),)
|
||||
mkdir -p $(PKG_BUILD_DIR)/.pkgdir/$(1)
|
||||
$(call Package/$(1)/install,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
$(call Package/$(1)/install_lib,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
$(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" "$(PKG_BUILD_DIR)/.pkgdir/$(1)" "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)")
|
||||
touch $$@
|
||||
|
||||
$(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
mkdir -p $(STAGING_DIR_ROOT)/stamp
|
||||
$(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || \
|
||||
echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version \
|
||||
$(foreach pkg,$(filter-out $(1),$(PROVIDES)),; \
|
||||
cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version \
|
||||
$(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \
|
||||
echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \
|
||||
$(foreach pkg,$(filter-out $(1),$(PROVIDES)), \
|
||||
cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \
|
||||
) \
|
||||
)
|
||||
} )
|
||||
$(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy)
|
||||
touch $$@
|
||||
|
||||
@ -197,15 +196,11 @@ $(_endef)
|
||||
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
|
||||
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
ifdef Build/InstallDev
|
||||
$$(IPKG_$(1)): $(STAMP_INSTALLED)
|
||||
endif
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
|
||||
@rm -rf $$(IDIR_$(1)); \
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
|
||||
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
|
||||
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
||||
$(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" "$$(IDIR_$(1))" "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)")
|
||||
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
|
||||
$(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay)
|
||||
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf
|
||||
|
@ -58,7 +58,7 @@ include $(INCLUDE_DIR)/quilt.mk
|
||||
|
||||
find_library_dependencies = \
|
||||
$(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
|
||||
$(sort $(foreach dep4, \
|
||||
$(filter-out $(BUILD_PACKAGES), $(sort $(foreach dep4, \
|
||||
$(sort $(foreach dep3, \
|
||||
$(sort $(foreach dep2, \
|
||||
$(sort $(foreach dep1, \
|
||||
@ -73,7 +73,7 @@ find_library_dependencies = \
|
||||
$(Package/$(dep3)/depends) $(dep3) \
|
||||
)), \
|
||||
$(Package/$(dep4)/depends) $(dep4) \
|
||||
)) \
|
||||
))) \
|
||||
))
|
||||
|
||||
|
||||
@ -178,7 +178,6 @@ Build/Exports=$(Build/Exports/Default)
|
||||
define Build/CoreTargets
|
||||
STAMP_PREPARED:=$$(STAMP_PREPARED)
|
||||
STAMP_CONFIGURED:=$$(STAMP_CONFIGURED)
|
||||
PKG_ABI_VERSION:=$$(PKG_ABI_VERSION)
|
||||
|
||||
$(if $(QUILT),$(Build/Quilt))
|
||||
$(call Build/Autoclean)
|
||||
@ -237,7 +236,6 @@ define Build/CoreTargets
|
||||
"$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \
|
||||
"$(STAGING_DIR)"; \
|
||||
fi
|
||||
$(if $(PKG_ABI_VERSION),$(SET_ABI_VERSION) "$(PKG_ABI_VERSION)" $(TMP_DIR)/stage-$(PKG_DIR_NAME))
|
||||
if [ -d $(TMP_DIR)/stage-$(PKG_DIR_NAME) ]; then \
|
||||
(cd $(TMP_DIR)/stage-$(PKG_DIR_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_DIR_NAME).files); \
|
||||
$(call locked, \
|
||||
|
@ -11,8 +11,8 @@ PKG_NAME:=Build dependency
|
||||
|
||||
# Required for the toolchain
|
||||
$(eval $(call TestHostCommand,working-make, \
|
||||
Please install GNU make v3.82 or later. (This version has bugs), \
|
||||
$(MAKE) -v | grep -E 'Make (3\.8[2-9]|3\.9[0-9]|[4-9]\.)'))
|
||||
Please install GNU make v4.1 or later., \
|
||||
$(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)'))
|
||||
|
||||
$(eval $(call TestHostCommand,case-sensitive-fs, \
|
||||
OpenWrt can only be built on a case-sensitive filesystem, \
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
PREP_MK= OPENWRT_BUILD= QUIET=0
|
||||
|
||||
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
|
||||
export IS_TTY=$(if $(MAKE_TERMOUT),1,0)
|
||||
|
||||
include $(TOPDIR)/include/verbose.mk
|
||||
|
||||
|
@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mac80211
|
||||
|
||||
PKG_VERSION:=5.10-rc6-1
|
||||
PKG_VERSION:=5.10.16-1
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10-rc6/
|
||||
PKG_HASH:=24c1e84dc1e7bb52d4f67ce481c242f29212a4ceb7833af30e3c279a3f710832
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.16/
|
||||
PKG_HASH:=12856db780c5023edc47e2d18486eb3346bb7c82f1f2fc48deb3b163142f7d2d
|
||||
|
||||
PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
|
||||
|
@ -37,7 +37,7 @@
|
||||
void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
|
||||
--- a/local-symbols
|
||||
+++ b/local-symbols
|
||||
@@ -143,6 +143,7 @@ ATH10K_SNOC=
|
||||
@@ -142,6 +142,7 @@ ATH10K_SNOC=
|
||||
ATH10K_DEBUG=
|
||||
ATH10K_DEBUGFS=
|
||||
ATH10K_SPECTRAL=
|
||||
|
@ -29,6 +29,21 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
- npend = ath9k_hw_numtxpending(ah, i);
|
||||
- if (npend)
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if (ah->external_reset &&
|
||||
- (npend || type == ATH9K_RESET_COLD)) {
|
||||
- int reset_err = 0;
|
||||
-
|
||||
- ath_dbg(ath9k_hw_common(ah), RESET,
|
||||
- "reset MAC via external reset\n");
|
||||
-
|
||||
- reset_err = ah->external_reset();
|
||||
- if (reset_err) {
|
||||
- ath_err(ath9k_hw_common(ah),
|
||||
- "External reset failed, err=%d\n",
|
||||
- reset_err);
|
||||
- return false;
|
||||
+ if (type == ATH9K_RESET_COLD)
|
||||
+ return true;
|
||||
+
|
||||
@ -44,47 +59,35 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ for (i = 0; i < AR_NUM_QCU; i++) {
|
||||
+ if (ath9k_hw_numtxpending(ah, i))
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
- if (ah->external_reset &&
|
||||
- (npend || type == ATH9K_RESET_COLD)) {
|
||||
- int reset_err = 0;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
|
||||
- ath_dbg(ath9k_hw_common(ah), RESET,
|
||||
- "reset MAC via external reset\n");
|
||||
+
|
||||
+static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
|
||||
+{
|
||||
+ int err;
|
||||
|
||||
- reset_err = ah->external_reset();
|
||||
- if (reset_err) {
|
||||
- ath_err(ath9k_hw_common(ah),
|
||||
- "External reset failed, err=%d\n",
|
||||
- reset_err);
|
||||
- return false;
|
||||
- }
|
||||
+
|
||||
+ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
|
||||
+ return true;
|
||||
|
||||
- REG_WRITE(ah, AR_RTC_RESET, 1);
|
||||
+
|
||||
+ ath_dbg(ath9k_hw_common(ah), RESET,
|
||||
+ "reset MAC via external reset\n");
|
||||
+
|
||||
|
||||
- REG_WRITE(ah, AR_RTC_RESET, 1);
|
||||
+ err = ah->external_reset();
|
||||
+ if (err) {
|
||||
+ ath_err(ath9k_hw_common(ah),
|
||||
+ "External reset failed, err=%d\n", err);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ if (AR_SREV_9550(ah)) {
|
||||
+ REG_WRITE(ah, AR_RTC_RESET, 0);
|
||||
+ udelay(10);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ REG_WRITE(ah, AR_RTC_RESET, 1);
|
||||
+ udelay(10);
|
||||
+
|
||||
|
@ -82,7 +82,7 @@
|
||||
help
|
||||
--- a/local-symbols
|
||||
+++ b/local-symbols
|
||||
@@ -86,6 +86,7 @@ ADM8211=
|
||||
@@ -85,6 +85,7 @@ ADM8211=
|
||||
ATH_COMMON=
|
||||
WLAN_VENDOR_ATH=
|
||||
ATH_DEBUG=
|
||||
|
@ -103,8 +103,7 @@
|
||||
+ GFP_KERNEL);
|
||||
+ if (!led)
|
||||
+ return -ENOMEM;
|
||||
|
||||
- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
|
||||
+
|
||||
+ led->gpio = gpio = (struct gpio_led *) (led + 1);
|
||||
+ _name = (char *) (led->gpio + 1);
|
||||
+
|
||||
@ -117,7 +116,8 @@
|
||||
+ ret = ath_add_led(sc, led);
|
||||
+ if (unlikely(ret < 0))
|
||||
+ kfree(led);
|
||||
+
|
||||
|
||||
- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
@ -125,11 +125,11 @@
|
||||
{
|
||||
- if (!sc->led_registered)
|
||||
- return;
|
||||
-
|
||||
- ath_led_brightness(&sc->led_cdev, LED_OFF);
|
||||
- led_classdev_unregister(&sc->led_cdev);
|
||||
+ struct ath_led *led;
|
||||
|
||||
- ath_led_brightness(&sc->led_cdev, LED_OFF);
|
||||
- led_classdev_unregister(&sc->led_cdev);
|
||||
-
|
||||
- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
|
||||
+ while (!list_empty(&sc->leds)) {
|
||||
+ led = list_first_entry(&sc->leds, struct ath_led, list);
|
||||
|
@ -371,7 +371,7 @@
|
||||
|
||||
--- a/local-symbols
|
||||
+++ b/local-symbols
|
||||
@@ -113,6 +113,7 @@ ATH9K_WOW=
|
||||
@@ -112,6 +112,7 @@ ATH9K_WOW=
|
||||
ATH9K_RFKILL=
|
||||
ATH9K_CHANNEL_CONTEXT=
|
||||
ATH9K_PCOEM=
|
||||
|
@ -114,7 +114,7 @@ v13:
|
||||
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
|
||||
--- a/local-symbols
|
||||
+++ b/local-symbols
|
||||
@@ -146,6 +146,7 @@ ATH10K_DEBUG=
|
||||
@@ -145,6 +145,7 @@ ATH10K_DEBUG=
|
||||
ATH10K_DEBUGFS=
|
||||
ATH10K_SPECTRAL=
|
||||
ATH10K_THERMAL=
|
||||
@ -456,7 +456,7 @@ v13:
|
||||
{
|
||||
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
|
||||
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
|
||||
@@ -4583,6 +4583,8 @@ static const struct wmi_ops wmi_tlv_ops
|
||||
@@ -4585,6 +4585,8 @@ static const struct wmi_ops wmi_tlv_ops
|
||||
.gen_echo = ath10k_wmi_tlv_op_gen_echo,
|
||||
.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
|
||||
.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
|
||||
@ -467,7 +467,7 @@ v13:
|
||||
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
|
||||
--- a/drivers/net/wireless/ath/ath10k/wmi.c
|
||||
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
|
||||
@@ -7463,6 +7463,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
|
||||
@@ -7468,6 +7468,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
|
||||
return skb;
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ v13:
|
||||
static struct sk_buff *
|
||||
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
|
||||
enum wmi_sta_ps_mode psmode)
|
||||
@@ -9151,6 +9194,9 @@ static const struct wmi_ops wmi_ops = {
|
||||
@@ -9156,6 +9199,9 @@ static const struct wmi_ops wmi_ops = {
|
||||
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
@ -527,7 +527,7 @@ v13:
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -9221,6 +9267,8 @@ static const struct wmi_ops wmi_10_1_ops
|
||||
@@ -9226,6 +9272,8 @@ static const struct wmi_ops wmi_10_1_ops
|
||||
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
@ -536,7 +536,7 @@ v13:
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -9293,6 +9341,8 @@ static const struct wmi_ops wmi_10_2_ops
|
||||
@@ -9298,6 +9346,8 @@ static const struct wmi_ops wmi_10_2_ops
|
||||
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
|
||||
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
@ -545,7 +545,7 @@ v13:
|
||||
/* .gen_pdev_enable_adaptive_cca not implemented */
|
||||
};
|
||||
|
||||
@@ -9364,6 +9414,8 @@ static const struct wmi_ops wmi_10_2_4_o
|
||||
@@ -9369,6 +9419,8 @@ static const struct wmi_ops wmi_10_2_4_o
|
||||
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
|
||||
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
|
||||
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
|
||||
@ -554,7 +554,7 @@ v13:
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -9445,6 +9497,8 @@ static const struct wmi_ops wmi_10_4_ops
|
||||
@@ -9450,6 +9502,8 @@ static const struct wmi_ops wmi_10_4_ops
|
||||
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
|
||||
@@ -2957,6 +2957,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
|
||||
@@ -2958,6 +2958,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
|
||||
* preference in cfg struct to apply this to
|
||||
* FW later while initializing the dongle
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
|
||||
@@ -2909,6 +2909,63 @@ done:
|
||||
@@ -2910,6 +2910,63 @@ done:
|
||||
}
|
||||
|
||||
static int
|
||||
@ -64,7 +64,7 @@
|
||||
brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
|
||||
int idx, u8 *mac, struct station_info *sinfo)
|
||||
{
|
||||
@@ -3004,6 +3061,7 @@ static s32 brcmf_inform_single_bss(struc
|
||||
@@ -3005,6 +3062,7 @@ static s32 brcmf_inform_single_bss(struc
|
||||
struct brcmu_chan ch;
|
||||
u16 channel;
|
||||
u32 freq;
|
||||
@ -72,7 +72,7 @@
|
||||
u16 notify_capability;
|
||||
u16 notify_interval;
|
||||
u8 *notify_ie;
|
||||
@@ -3028,6 +3086,17 @@ static s32 brcmf_inform_single_bss(struc
|
||||
@@ -3029,6 +3087,17 @@ static s32 brcmf_inform_single_bss(struc
|
||||
band = NL80211_BAND_5GHZ;
|
||||
|
||||
freq = ieee80211_channel_to_frequency(channel, band);
|
||||
@ -90,7 +90,7 @@
|
||||
bss_data.chan = ieee80211_get_channel(wiphy, freq);
|
||||
bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
|
||||
bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
|
||||
@@ -5514,6 +5583,7 @@ static struct cfg80211_ops brcmf_cfg8021
|
||||
@@ -5515,6 +5584,7 @@ static struct cfg80211_ops brcmf_cfg8021
|
||||
.leave_ibss = brcmf_cfg80211_leave_ibss,
|
||||
.get_station = brcmf_cfg80211_get_station,
|
||||
.dump_station = brcmf_cfg80211_dump_station,
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/wireless/Kconfig
|
||||
+++ b/net/wireless/Kconfig
|
||||
@@ -187,7 +187,7 @@ config CFG80211_WEXT_EXPORT
|
||||
@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT
|
||||
endif # CFG80211
|
||||
|
||||
config LIB80211
|
||||
@ -9,7 +9,7 @@
|
||||
depends on m
|
||||
default n
|
||||
help
|
||||
@@ -197,19 +197,19 @@ config LIB80211
|
||||
@@ -198,19 +198,19 @@ config LIB80211
|
||||
Drivers should select this themselves if needed.
|
||||
|
||||
config LIB80211_CRYPT_WEP
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/local-symbols
|
||||
+++ b/local-symbols
|
||||
@@ -333,6 +333,7 @@ RT2X00_LIB_FIRMWARE=
|
||||
@@ -332,6 +332,7 @@ RT2X00_LIB_FIRMWARE=
|
||||
RT2X00_LIB_CRYPTO=
|
||||
RT2X00_LIB_LEDS=
|
||||
RT2X00_LIB_DEBUGFS=
|
||||
|
@ -22,15 +22,16 @@
|
||||
- rfcsr = rt2800_rfcsr_read(rt2x00dev, 16);
|
||||
- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
|
||||
-
|
||||
- rfcsr = rt2800_rfcsr_read(rt2x00dev, 21);
|
||||
- rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
|
||||
+ if (rt2800_hw_get_chipver(rt2x00dev) > 1) {
|
||||
+ /* Default: XO=20MHz , SDM mode */
|
||||
+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 16);
|
||||
+ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80);
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
|
||||
|
||||
- rfcsr = rt2800_rfcsr_read(rt2x00dev, 21);
|
||||
- rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
|
||||
+
|
||||
+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 21);
|
||||
+ rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1);
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
|
||||
@ -216,6 +217,10 @@
|
||||
- rt2800_rfcsr_write(rt2x00dev, 28, 0x61);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 29, 0xB5);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 43, 0x02);
|
||||
-
|
||||
- rt2800_rfcsr_write(rt2x00dev, 28, 0x62);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 29, 0xAD);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 39, 0x80);
|
||||
+ if (rt2800_hw_get_chipver(rt2x00dev) > 1) {
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
|
||||
+ if (rt2800_clk_is_20mhz(rt2x00dev))
|
||||
@ -239,10 +244,7 @@
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 29, 0xB5);
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 43, 0x02);
|
||||
+ }
|
||||
|
||||
- rt2800_rfcsr_write(rt2x00dev, 28, 0x62);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 29, 0xAD);
|
||||
- rt2800_rfcsr_write(rt2x00dev, 39, 0x80);
|
||||
+
|
||||
+ if (rt2800_hw_get_chipver(rt2x00dev) > 1 &&
|
||||
+ rt2800_hw_get_chipeco(rt2x00dev) >= 2) {
|
||||
+ rt2800_rfcsr_write(rt2x00dev, 28, 0x62);
|
||||
@ -286,6 +288,33 @@
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
|
||||
-
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
|
||||
-
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
|
||||
-
|
||||
- /* Initialize RF channel register for DRQFN */
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7);
|
||||
+ if (rt2800_hw_get_chipver(rt2x00dev) > 1) {
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71);
|
||||
@ -318,16 +347,7 @@
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
|
||||
+ }
|
||||
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
|
||||
+
|
||||
+ if (rt2800_hw_get_chipver(rt2x00dev) > 1 &&
|
||||
+ rt2800_hw_get_chipeco(rt2x00dev) >= 2) {
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51);
|
||||
@ -339,13 +359,7 @@
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
|
||||
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
|
||||
+
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
|
||||
@ -353,16 +367,7 @@
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
|
||||
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
|
||||
+ }
|
||||
|
||||
- /* Initialize RF channel register for DRQFN */
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02);
|
||||
- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7);
|
||||
+
|
||||
+ if (rt2800_hw_get_chippkg(rt2x00dev) == 0 &&
|
||||
+ rt2800_hw_get_chipver(rt2x00dev) == 1) {
|
||||
+ /* Initialize RF channel register for DRQFN */
|
||||
|
@ -53,20 +53,22 @@
|
||||
- idle = rt2800_register_read(rt2x00dev, CH_IDLE_STA);
|
||||
- busy = rt2800_register_read(rt2x00dev, CH_BUSY_STA);
|
||||
- busy_ext = rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC);
|
||||
+ survey->channel = &rt2x00dev->bands[band].channels[idx];
|
||||
|
||||
-
|
||||
- if (idle || busy) {
|
||||
- survey->filled = SURVEY_INFO_TIME |
|
||||
- SURVEY_INFO_TIME_BUSY |
|
||||
- SURVEY_INFO_TIME_EXT_BUSY;
|
||||
+ survey->filled = SURVEY_INFO_TIME |
|
||||
+ SURVEY_INFO_TIME_BUSY |
|
||||
+ SURVEY_INFO_TIME_EXT_BUSY;
|
||||
|
||||
-
|
||||
- survey->time = (idle + busy) / 1000;
|
||||
- survey->time_busy = busy / 1000;
|
||||
- survey->time_ext_busy = busy_ext / 1000;
|
||||
- }
|
||||
+ survey->channel = &rt2x00dev->bands[band].channels[idx];
|
||||
+
|
||||
+ survey->filled = SURVEY_INFO_TIME |
|
||||
+ SURVEY_INFO_TIME_BUSY |
|
||||
+ SURVEY_INFO_TIME_EXT_BUSY;
|
||||
+
|
||||
+ survey->time = div_u64(chan_survey->time_idle + chan_survey->time_busy, 1000);
|
||||
+ survey->time_busy = div_u64(chan_survey->time_busy, 1000);
|
||||
+ survey->time_ext_busy = div_u64(chan_survey->time_ext_busy, 1000);
|
||||
|
@ -166,7 +166,8 @@
|
||||
#define AES_CCM_H
|
||||
|
||||
-#include "aead_api.h"
|
||||
-
|
||||
+#include <linux/crypto.h>
|
||||
|
||||
-#define CCM_AAD_LEN 32
|
||||
-
|
||||
-static inline struct crypto_aead *
|
||||
@ -194,8 +195,7 @@
|
||||
- be16_to_cpup((__be16 *)aad),
|
||||
- data, data_len, mic);
|
||||
-}
|
||||
+#include <linux/crypto.h>
|
||||
|
||||
-
|
||||
-static inline void ieee80211_aes_key_free(struct crypto_aead *tfm)
|
||||
-{
|
||||
- return aead_key_free(tfm);
|
||||
@ -331,10 +331,10 @@
|
||||
#define AES_GCM_H
|
||||
|
||||
-#include "aead_api.h"
|
||||
-
|
||||
-#define GCM_AAD_LEN 32
|
||||
+#include <linux/crypto.h>
|
||||
|
||||
-#define GCM_AAD_LEN 32
|
||||
-
|
||||
-static inline int ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm,
|
||||
- u8 *j_0, u8 *aad, u8 *data,
|
||||
- size_t data_len, u8 *mic)
|
||||
|
@ -133,34 +133,37 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
-static void fq_recalc_backlog(struct fq *fq,
|
||||
- struct fq_tin *tin,
|
||||
- struct fq_flow *flow)
|
||||
+static struct fq_flow *fq_find_fattest_flow(struct fq *fq)
|
||||
{
|
||||
-{
|
||||
- struct fq_flow *i;
|
||||
+ struct fq_tin *tin;
|
||||
+ struct fq_flow *flow = NULL;
|
||||
+ u32 len = 0;
|
||||
+ int i;
|
||||
|
||||
-
|
||||
- if (list_empty(&flow->backlogchain))
|
||||
- list_add_tail(&flow->backlogchain, &fq->backlogs);
|
||||
+ for_each_set_bit(i, fq->flows_bitmap, fq->flows_cnt) {
|
||||
+ struct fq_flow *cur = &fq->flows[i];
|
||||
+ unsigned int cur_len;
|
||||
|
||||
-
|
||||
- i = flow;
|
||||
- list_for_each_entry_continue_reverse(i, &fq->backlogs,
|
||||
- backlogchain)
|
||||
- if (i->backlog > flow->backlog)
|
||||
- break;
|
||||
+static struct fq_flow *fq_find_fattest_flow(struct fq *fq)
|
||||
+{
|
||||
+ struct fq_tin *tin;
|
||||
+ struct fq_flow *flow = NULL;
|
||||
+ u32 len = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_set_bit(i, fq->flows_bitmap, fq->flows_cnt) {
|
||||
+ struct fq_flow *cur = &fq->flows[i];
|
||||
+ unsigned int cur_len;
|
||||
+
|
||||
+ cur_len = cur->backlog;
|
||||
+ if (cur_len <= len)
|
||||
+ continue;
|
||||
|
||||
- list_move(&flow->backlogchain, &i->backlogchain);
|
||||
+
|
||||
+ flow = cur;
|
||||
+ len = cur_len;
|
||||
+ }
|
||||
+
|
||||
|
||||
- list_move(&flow->backlogchain, &i->backlogchain);
|
||||
+ list_for_each_entry(tin, &fq->tin_backlog, tin_list) {
|
||||
+ unsigned int cur_len = tin->default_flow.backlog;
|
||||
+
|
||||
|
@ -1,53 +0,0 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Wed, 16 Dec 2020 21:23:24 +0100
|
||||
Subject: [PATCH] mac80211: fix encryption key selection for 802.3 xmit
|
||||
|
||||
When using WEP, the default unicast key needs to be selected, instead of
|
||||
the STA PTK.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/tx.c
|
||||
+++ b/net/mac80211/tx.c
|
||||
@@ -4262,7 +4262,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8
|
||||
struct ethhdr *ehdr = (struct ethhdr *)skb->data;
|
||||
struct ieee80211_key *key;
|
||||
struct sta_info *sta;
|
||||
- bool offload = true;
|
||||
|
||||
if (unlikely(skb->len < ETH_HLEN)) {
|
||||
kfree_skb(skb);
|
||||
@@ -4278,18 +4277,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8
|
||||
|
||||
if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
|
||||
!test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
|
||||
- sdata->control_port_protocol == ehdr->h_proto))
|
||||
- offload = false;
|
||||
- else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) &&
|
||||
- (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
|
||||
- key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
|
||||
- offload = false;
|
||||
+ sdata->control_port_protocol == ehdr->h_proto))
|
||||
+ goto skip_offload;
|
||||
|
||||
- if (offload)
|
||||
- ieee80211_8023_xmit(sdata, dev, sta, key, skb);
|
||||
- else
|
||||
- ieee80211_subif_start_xmit(skb, dev);
|
||||
+ key = rcu_dereference(sta->ptk[sta->ptk_idx]);
|
||||
+ if (!key)
|
||||
+ key = rcu_dereference(sdata->default_unicast_key);
|
||||
+
|
||||
+ if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
|
||||
+ key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
|
||||
+ goto skip_offload;
|
||||
+
|
||||
+ ieee80211_8023_xmit(sdata, dev, sta, key, skb);
|
||||
+ goto out;
|
||||
|
||||
+skip_offload:
|
||||
+ ieee80211_subif_start_xmit(skb, dev);
|
||||
out:
|
||||
rcu_read_unlock();
|
||||
|
@ -1,21 +0,0 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Wed, 16 Dec 2020 21:24:19 +0100
|
||||
Subject: [PATCH] mac80211: fix fast-rx encryption check
|
||||
|
||||
When using WEP, the default unicast key needs to be selected, instead of
|
||||
the STA PTK.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/rx.c
|
||||
+++ b/net/mac80211/rx.c
|
||||
@@ -4195,6 +4195,8 @@ void ieee80211_check_fast_rx(struct sta_
|
||||
|
||||
rcu_read_lock();
|
||||
key = rcu_dereference(sta->ptk[sta->ptk_idx]);
|
||||
+ if (!key)
|
||||
+ key = rcu_dereference(sdata->default_unicast_key);
|
||||
if (key) {
|
||||
switch (key->conf.cipher) {
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
@ -89,7 +89,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/**
|
||||
--- a/net/mac80211/debugfs.c
|
||||
+++ b/net/mac80211/debugfs.c
|
||||
@@ -409,6 +409,7 @@ static const char *hw_flag_names[] = {
|
||||
@@ -405,6 +405,7 @@ static const char *hw_flag_names[] = {
|
||||
FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
|
||||
FLAG(AMPDU_KEYBORDER_SUPPORT),
|
||||
FLAG(SUPPORTS_TX_ENCAP_OFFLOAD),
|
||||
|
@ -1,28 +0,0 @@
|
||||
From: Wen Gong <wgong@codeaurora.org>
|
||||
Date: Wed, 9 Dec 2020 11:06:29 +0800
|
||||
Subject: [PATCH] mac80211: fix a mistake check for rx_stats update
|
||||
|
||||
It should be !is_multicast_ether_addr() in ieee80211_rx_h_sta_process()
|
||||
for the rx_stats update, below commit remove the !, this patch is to
|
||||
change it back.
|
||||
|
||||
It lead the rx rate "iw wlan0 station dump" become invalid for some
|
||||
scenario when IEEE80211_HW_USES_RSS is set.
|
||||
|
||||
Fixes: 09a740ce352e ("mac80211: receive and process S1G beacons")
|
||||
Signed-off-by: Wen Gong <wgong@codeaurora.org>
|
||||
Link: https://lore.kernel.org/r/1607483189-3891-1-git-send-email-wgong@codeaurora.org
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/rx.c
|
||||
+++ b/net/mac80211/rx.c
|
||||
@@ -1758,7 +1758,7 @@ ieee80211_rx_h_sta_process(struct ieee80
|
||||
} else if (rx->sdata->vif.type == NL80211_IFTYPE_OCB) {
|
||||
sta->rx_stats.last_rx = jiffies;
|
||||
} else if (!ieee80211_is_s1g_beacon(hdr->frame_control) &&
|
||||
- is_multicast_ether_addr(hdr->addr1)) {
|
||||
+ !is_multicast_ether_addr(hdr->addr1)) {
|
||||
/*
|
||||
* Mesh beacons will update last_rx when if they are found to
|
||||
* match the current local configuration when processed.
|
@ -1,25 +0,0 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 18 Dec 2020 20:08:06 +0100
|
||||
Subject: [PATCH] mac80211: do not drop tx nulldata packets on encrypted links
|
||||
|
||||
ieee80211_tx_h_select_key drops any non-mgmt packets without a key when
|
||||
encryption is used. This is wrong for nulldata packets that can't be
|
||||
encrypted and are sent out for probing clients and indicating 4-address
|
||||
mode.
|
||||
|
||||
Reported-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
|
||||
Fixes: a0761a301746 ("mac80211: drop data frames without key on encrypted links")
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/tx.c
|
||||
+++ b/net/mac80211/tx.c
|
||||
@@ -662,7 +662,7 @@ ieee80211_tx_h_select_key(struct ieee802
|
||||
if (!skip_hw && tx->key &&
|
||||
tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
|
||||
info->control.hw_key = &tx->key->conf;
|
||||
- } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta &&
|
||||
+ } else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta &&
|
||||
test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
|
||||
return TX_DROP;
|
||||
}
|
@ -27,8 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
- if (!mi->avg_ampdu_len)
|
||||
- return AVG_AMPDU_SIZE;
|
||||
+ int duration;
|
||||
|
||||
- return MINSTREL_TRUNC(mi->avg_ampdu_len);
|
||||
+
|
||||
+ if (mi->avg_ampdu_len)
|
||||
+ return MINSTREL_TRUNC(mi->avg_ampdu_len);
|
||||
+
|
||||
@ -36,7 +35,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ return 1;
|
||||
+
|
||||
+ duration = minstrel_get_duration(mi->max_tp_rate[0]);
|
||||
+
|
||||
|
||||
- return MINSTREL_TRUNC(mi->avg_ampdu_len);
|
||||
+ if (duration > 400 * 1000)
|
||||
+ return 2;
|
||||
+
|
||||
|
@ -179,14 +179,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ if (!rate)
|
||||
return;
|
||||
- }
|
||||
|
||||
-
|
||||
- i = 0;
|
||||
- if (n_rates > 1) {
|
||||
- random = prandom_u32();
|
||||
- i = random % n_rates;
|
||||
- }
|
||||
- probe_rate = rates[i];
|
||||
-
|
||||
|
||||
-out:
|
||||
- mi->sample_rate = probe_rate;
|
||||
+ mi->sample_rate = rate;
|
||||
@ -584,13 +584,13 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
-
|
||||
- if (!(mi->supported[sample_group] & BIT(sample_idx)))
|
||||
- return -1;
|
||||
-
|
||||
+ u8 seq;
|
||||
|
||||
- mrs = &mg->rates[sample_idx];
|
||||
- sample_idx += MI_RATE(sample_group, 0);
|
||||
-
|
||||
- tp_rate1 = mi->max_tp_rate[0];
|
||||
+ u8 seq;
|
||||
|
||||
-
|
||||
- /* Set tp_rate2 to the second highest max_tp_rate */
|
||||
- if (minstrel_get_duration(mi->max_tp_rate[0]) >
|
||||
- minstrel_get_duration(mi->max_tp_rate[1])) {
|
||||
@ -673,8 +673,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
- else
|
||||
- sample_idx = minstrel_get_sample_rate(mp, mi);
|
||||
+ return;
|
||||
|
||||
- if (sample_idx < 0)
|
||||
+
|
||||
+ if (mp->hw->max_rates == 1 && mp->sample_switch &&
|
||||
+ (mi->total_packets_cur >= SAMPLE_SWITCH_THR ||
|
||||
+ mp->sample_switch == 1))
|
||||
@ -682,7 +681,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+
|
||||
+ if (time_is_before_jiffies(mi->sample_time))
|
||||
+ return;
|
||||
+
|
||||
|
||||
- if (sample_idx < 0)
|
||||
+ mi->sample_time = jiffies + MINSTREL_SAMPLE_INTERVAL;
|
||||
+ sample_idx = minstrel_ht_get_sample_rate(mp, mi);
|
||||
+ if (!sample_idx)
|
||||
|
@ -1,38 +0,0 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 1 Feb 2021 00:59:14 +0100
|
||||
Subject: [PATCH] mac80211: fix station rate table updates on assoc
|
||||
|
||||
If the driver uses .sta_add, station entries are only uploaded after the sta
|
||||
is in assoc state. Fix early station rate table updates by deferring them
|
||||
until the sta has been uploaded
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/driver-ops.c
|
||||
+++ b/net/mac80211/driver-ops.c
|
||||
@@ -125,8 +125,11 @@ int drv_sta_state(struct ieee80211_local
|
||||
} else if (old_state == IEEE80211_STA_AUTH &&
|
||||
new_state == IEEE80211_STA_ASSOC) {
|
||||
ret = drv_sta_add(local, sdata, &sta->sta);
|
||||
- if (ret == 0)
|
||||
+ if (ret == 0) {
|
||||
sta->uploaded = true;
|
||||
+ if (rcu_dereference(sta->sta.rates))
|
||||
+ drv_sta_rate_tbl_update(local, sdata, &sta->sta);
|
||||
+ }
|
||||
} else if (old_state == IEEE80211_STA_ASSOC &&
|
||||
new_state == IEEE80211_STA_AUTH) {
|
||||
drv_sta_remove(local, sdata, &sta->sta);
|
||||
--- a/net/mac80211/rate.c
|
||||
+++ b/net/mac80211/rate.c
|
||||
@@ -960,7 +960,8 @@ int rate_control_set_rates(struct ieee80
|
||||
if (old)
|
||||
kfree_rcu(old, rcu_head);
|
||||
|
||||
- drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta);
|
||||
+ if (sta->uploaded)
|
||||
+ drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta);
|
||||
|
||||
ieee80211_sta_set_expected_throughput(pubsta, sta_get_expected_throughput(sta));
|
||||
|
@ -87,7 +87,7 @@
|
||||
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
|
||||
--- a/net/mac80211/ieee80211_i.h
|
||||
+++ b/net/mac80211/ieee80211_i.h
|
||||
@@ -1400,6 +1400,7 @@ struct ieee80211_local {
|
||||
@@ -1401,6 +1401,7 @@ struct ieee80211_local {
|
||||
int dynamic_ps_forced_timeout;
|
||||
|
||||
int user_power_level; /* in dBm, for all interfaces */
|
||||
|
@ -8,6 +8,7 @@ PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
|
||||
PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
|
||||
PKG_SOURCE_DATE:=2020-12-12
|
||||
PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=ISC
|
||||
@ -27,7 +28,7 @@ define Package/libubox
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Basic utility library
|
||||
ABI_VERSION:=20201212
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
@ -35,6 +36,7 @@ define Package/libblobmsg-json
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=blobmsg <-> json conversion library
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
DEPENDS:=+libjson-c +libubox
|
||||
endef
|
||||
|
||||
@ -53,6 +55,7 @@ define Package/libjson-script
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libubox
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
TITLE:=Minimalistic JSON based scripting engine
|
||||
endef
|
||||
|
||||
@ -65,16 +68,17 @@ endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
CMAKE_OPTIONS = \
|
||||
-DLUAPATH=/usr/lib/lua
|
||||
-DLUAPATH=/usr/lib/lua \
|
||||
-DABIVERSION="$(PKG_ABI_VERSION)"
|
||||
|
||||
define Package/libubox/install
|
||||
$(INSTALL_DIR) $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so.* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/libblobmsg-json/install
|
||||
$(INSTALL_DIR) $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so.* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/jshn/install
|
||||
@ -85,7 +89,7 @@ endef
|
||||
|
||||
define Package/libjson-script/install
|
||||
$(INSTALL_DIR) $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so.* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/libubox-lua/install
|
||||
|
@ -15,7 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
|
||||
PKG_HASH:=053aefbb02d0b06b27c5e2df6875b4b587318755b7db9d6aa8d72206b310a848
|
||||
|
||||
PKG_FIXUP:=libtool
|
||||
PKG_FIXUP:=libtool libtool-abiver
|
||||
PKG_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
@ -33,6 +33,8 @@ PKG_CONFIG_DEPENDS:=\
|
||||
CONFIG_WOLFSSL_HAS_SESSION_TICKET CONFIG_WOLFSSL_HAS_TLSV10 \
|
||||
CONFIG_WOLFSSL_HAS_TLSV13 CONFIG_WOLFSSL_HAS_WPAS CONFIG_WOLFSSL_HAS_CERTGEN
|
||||
|
||||
PKG_ABI_VERSION=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS)))
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libwolfssl
|
||||
@ -44,7 +46,7 @@ define Package/libwolfssl
|
||||
MENU:=1
|
||||
PROVIDES:=libcyassl
|
||||
DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user
|
||||
ABI_VERSION:=24
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
endef
|
||||
|
||||
define Package/libwolfssl/description
|
||||
|
@ -5,9 +5,10 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
|
||||
PKG_SOURCE_DATE:=2020-12-04
|
||||
PKG_SOURCE_VERSION:=d1d9ddf98d39b0bdc055060fb962335439445690
|
||||
PKG_MIRROR_HASH:=6fbdda5144cfef14d314d421ce801e9c89a2266428346f531a57c28e731a059c
|
||||
PKG_SOURCE_DATE:=2021-02-15
|
||||
PKG_SOURCE_VERSION:=2537be01858710e714c329153760c64fe3f8a73e
|
||||
PKG_MIRROR_HASH:=da1f4959fbe3d51cbc6b7c08b24307f43a80911b395cac834b9f4161c195152f
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
@ -38,7 +39,7 @@ define Package/libubus
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libubox
|
||||
ABI_VERSION:=20191227
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
TITLE:=OpenWrt RPC client library
|
||||
endef
|
||||
|
||||
@ -53,7 +54,8 @@ TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto
|
||||
TARGET_LDFLAGS += -flto
|
||||
|
||||
CMAKE_OPTIONS = \
|
||||
-DLUAPATH=/usr/lib/lua
|
||||
-DLUAPATH=/usr/lib/lua \
|
||||
-DABIVERSION="$(PKG_ABI_VERSION)"
|
||||
|
||||
define Package/ubus/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
@ -67,7 +69,7 @@ endef
|
||||
|
||||
define Package/libubus/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libubus.so.* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/libubus-lua/install
|
||||
|
@ -791,11 +791,13 @@ define Package/wipefs/install
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/wipefs $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
# these lines need to be ordered by dependency because of ABI versioning
|
||||
$(eval $(call BuildPackage,libuuid))
|
||||
$(eval $(call BuildPackage,libblkid))
|
||||
$(eval $(call BuildPackage,libfdisk))
|
||||
|
||||
$(eval $(call BuildPackage,libmount))
|
||||
$(eval $(call BuildPackage,libsmartcols))
|
||||
$(eval $(call BuildPackage,libuuid))
|
||||
$(eval $(call BuildPackage,agetty))
|
||||
$(eval $(call BuildPackage,blkdiscard))
|
||||
$(eval $(call BuildPackage,blkid))
|
||||
|
4
rules.mk
4
rules.mk
@ -339,10 +339,6 @@ else
|
||||
$(SCRIPT_DIR)/rstrip.sh
|
||||
endif
|
||||
|
||||
SET_ABI_VERSION= \
|
||||
PATCHELF="$(STAGING_DIR_HOST)/bin/patchelf" \
|
||||
$(SCRIPT_DIR)/set-abi-version.sh
|
||||
|
||||
ifeq ($(CONFIG_IPV6),y)
|
||||
DISABLE_IPV6:=
|
||||
else
|
||||
|
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2020 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
SELF=${0##*/}
|
||||
|
||||
[ -n "$PATCHELF" ] || {
|
||||
echo "$SELF: patchelf command not defined (PATCHELF variable not set)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ABI_VER="$1"
|
||||
PATCH_DIR="$2"
|
||||
REF_LIST="$3"
|
||||
|
||||
[ -n "$ABI_VER" -a -n "$PATCH_DIR" ] || {
|
||||
echo "$SELF: no ABI version or files/directories specified"
|
||||
echo "usage: $SELF <VERSION> [<PATH>...]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cmd() {
|
||||
echo "$@" >&2
|
||||
"$@" || exit 1
|
||||
}
|
||||
|
||||
gen_lib_list() {
|
||||
while read F; do
|
||||
F="${F##*/}"
|
||||
case "$F" in
|
||||
lib*.so*);;
|
||||
*) continue;;
|
||||
esac
|
||||
echo -n "$F:"
|
||||
done < "$REF_LIST"
|
||||
}
|
||||
|
||||
find "$PATCH_DIR" -type f -a -name 'lib*.so*' | \
|
||||
(
|
||||
while read F; do
|
||||
NEW_F="${F%%.so*}.so.$ABI_VER"
|
||||
NEW_NAME="${NEW_F##*/}"
|
||||
[ "$NEW_F" != "$F" ] || continue
|
||||
cmd mv "$F" "$NEW_F"
|
||||
[ "$REF_LIST" ] || cmd ln -s "$NEW_NAME" "$F"
|
||||
cmd $PATCHELF --set-soname "$NEW_NAME" "$NEW_F"
|
||||
done
|
||||
)
|
||||
|
||||
[ -n "$REF_LIST" ] || exit 0
|
||||
|
||||
LIBS="$(gen_lib_list)"
|
||||
LIBS="${LIBS%%:}"
|
||||
find "$PATCH_DIR" -type f -a -exec file {} \; | \
|
||||
sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*,.*/\1:\2/p' | \
|
||||
(
|
||||
IFS=":"
|
||||
while read F S; do
|
||||
$PATCHELF --print-needed "$F" | while read L; do
|
||||
BASE_L="${L%%.so*}"
|
||||
for lib in $LIBS; do
|
||||
base_lib="${lib%%.so*}"
|
||||
[ "$BASE_L" = "$base_lib" ] || continue
|
||||
[ "$l" = "$lib" ] && continue
|
||||
cmd $PATCHELF --replace-needed "$L" "$lib" "$F"
|
||||
done
|
||||
done
|
||||
done
|
||||
true
|
||||
)
|
@ -20,4 +20,6 @@ include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
KERNELNAME:=Image dtbs
|
||||
|
||||
DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
@ -138,6 +138,7 @@ CONFIG_MODULES_USE_ELF_RELA=y
|
||||
CONFIG_MTD_NAND_BRCMNAND=y
|
||||
CONFIG_MTD_NAND_CORE=y
|
||||
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
|
||||
CONFIG_MTD_OF_PARTS_BCM4908=y
|
||||
CONFIG_MTD_RAW_NAND=y
|
||||
CONFIG_MTD_SPLIT_CFE_BOOTFS=y
|
||||
# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set
|
||||
|
@ -404,3 +404,11 @@ Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
source "drivers/soc/bcm/brcmstb/Kconfig"
|
||||
|
||||
endmenu
|
||||
--- a/drivers/soc/bcm/Makefile
|
||||
+++ b/drivers/soc/bcm/Makefile
|
||||
@@ -1,4 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
obj-$(CONFIG_BCM2835_POWER) += bcm2835-power.o
|
||||
obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o
|
||||
+obj-y += bcm63xx/
|
||||
obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
|
||||
|
@ -1,6 +1,5 @@
|
||||
From 28d11220a92e9fc4d7d1b8e52dc1c48980e336a1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Wed, 20 Jan 2021 20:34:00 +0100
|
||||
Date: Mon, 15 Feb 2021 19:46:54 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe USB PHY
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -12,9 +11,9 @@ and XHCI. It requires powering up using the PMB.
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../bcm4908/bcm4906-netgear-r8000p.dts | 17 +++++++++++++
|
||||
.../bcm4908/bcm4908-asus-gt-ac5300.dts | 16 ++++++++++++
|
||||
.../bcm4908/bcm4908-asus-gt-ac5300.dts | 17 +++++++++++++
|
||||
.../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 25 ++++++++++++++++---
|
||||
3 files changed, 54 insertions(+), 4 deletions(-)
|
||||
3 files changed, 55 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
@ -44,11 +43,12 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
nand-ecc-step-size = <512>;
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
@@ -44,6 +44,22 @@
|
||||
@@ -44,6 +44,23 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&usb_phy {
|
||||
+ brcm,ioc = <1>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
@ -1,5 +1,5 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Feb 2021 09:11:36 +0100
|
||||
Date: Mon, 15 Feb 2021 19:51:26 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Ethernet controller
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -9,6 +9,8 @@ BCM4908 SoCs have an integrated Ethernet controller.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 20 +++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
@ -35,8 +37,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
+ port@8 {
|
||||
+ reg = <8>;
|
||||
+ phy-mode = "internal";
|
||||
+ brcm,use-bcm-hdr;
|
||||
+ ethernet = <&enet>;
|
||||
+ brcm,use-bcm-hdr;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
@ -0,0 +1,48 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 15 Feb 2021 19:52:58 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Netgear R8000P switch
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
R8000P model has 4 LAN ports and 1 WAN port.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../bcm4908/bcm4906-netgear-r8000p.dts | 25 +++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
@@ -43,6 +43,31 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&ports {
|
||||
+ port@0 {
|
||||
+ label = "lan4";
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ label = "lan3";
|
||||
+ };
|
||||
+
|
||||
+ port@2 {
|
||||
+ label = "lan2";
|
||||
+ };
|
||||
+
|
||||
+ port@3 {
|
||||
+ label = "lan1";
|
||||
+ };
|
||||
+
|
||||
+ port@7 {
|
||||
+ reg = <7>;
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&phy12>;
|
||||
+ label = "wan";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&nandcs {
|
||||
nand-ecc-strength = <4>;
|
||||
nand-ecc-step-size = <512>;
|
@ -0,0 +1,78 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 15 Feb 2021 20:05:41 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: add remaining Netgear R8000P
|
||||
LEDs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There are a few more GPIO connected LEDs there didn't get described
|
||||
initially.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../bcm4908/bcm4906-netgear-r8000p.dts | 48 +++++++++++++++++++
|
||||
1 file changed, 48 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
@@ -18,11 +18,59 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
+ power-white {
|
||||
+ function = LED_FUNCTION_POWER;
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ power-amber {
|
||||
+ function = LED_FUNCTION_POWER;
|
||||
+ color = <LED_COLOR_ID_AMBER>;
|
||||
+ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
wps {
|
||||
function = LED_FUNCTION_WPS;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
+
|
||||
+ 2ghz {
|
||||
+ function = "2ghz";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ 5ghz-1 {
|
||||
+ function = "5ghz-1";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ 5ghz-2 {
|
||||
+ function = "5ghz-2";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ usb2 {
|
||||
+ function = "usb2";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ usb3 {
|
||||
+ function = "usb3";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wifi {
|
||||
+ function = "wifi";
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
+ gpios = <&gpio0 56 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
@ -1,23 +1,22 @@
|
||||
From e401e6fe9195eabfc6c81d8aed920a75b5d7987b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Wed, 20 Jan 2021 20:53:35 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: improve partitions description
|
||||
Date: Mon, 15 Feb 2021 20:30:09 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe firmware partitions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
1. Use proper bindings
|
||||
2. Add missing partitions
|
||||
BCM4908 bootloader supports multiple firmware partitions and has its own
|
||||
bindings defined for them.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../bcm4908/bcm4906-netgear-r8000p.dts | 1 +
|
||||
.../bcm4908/bcm4908-asus-gt-ac5300.dts | 27 ++++++++++++++++++-
|
||||
2 files changed, 27 insertions(+), 1 deletion(-)
|
||||
.../dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 1 +
|
||||
.../dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 12 +++++++++++-
|
||||
2 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
|
||||
@@ -62,6 +62,7 @@
|
||||
@@ -135,6 +135,7 @@
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
@ -27,7 +26,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
};
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
@@ -121,7 +121,7 @@
|
||||
@@ -122,7 +122,7 @@
|
||||
#size-cells = <0>;
|
||||
|
||||
partitions {
|
||||
@ -36,7 +35,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
@@ -129,5 +129,30 @@
|
||||
@@ -130,5 +130,15 @@
|
||||
label = "cferom";
|
||||
reg = <0x0 0x100000>;
|
||||
};
|
||||
@ -49,21 +48,6 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
+ partition@5800000 {
|
||||
+ compatible = "brcm,bcm4908-firmware";
|
||||
+ reg = <0x5800000 0x5700000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@af00000 {
|
||||
+ label = "misc1";
|
||||
+ reg = <0xaf00000 0x800000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@b700000 {
|
||||
+ label = "misc2";
|
||||
+ reg = <0xb700000 0x4000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@f700000 {
|
||||
+ label = "data";
|
||||
+ reg = <0xf700000 0x800000>;
|
||||
+ };
|
||||
};
|
||||
};
|
@ -1,191 +0,0 @@
|
||||
From db18357719613cc40234300b10e28e4dfa075375 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Fri, 15 Jan 2021 16:23:01 +0100
|
||||
Subject: [PATCH 3/3] mtd: parsers: ofpart: support BCM4908 fixed partitions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM4908 partitioning is based on fixed layout but allows specifying
|
||||
multiple firmware partitions. It requires detecting which firmware
|
||||
partition was used for booting current kernel.
|
||||
|
||||
To support such cases without duplicating a lot of code (without copying
|
||||
most of the ofpart.c code) support for post-parsing callback was added.
|
||||
|
||||
BCM4908 callback simply reads offset of currently used firmware
|
||||
partition from the DT. Bootloader specifies it using the "brcm_blparms"
|
||||
property.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/mtd/parsers/Makefile | 1 +
|
||||
drivers/mtd/parsers/bcm4908-partitions.c | 62 ++++++++++++++++++++++++
|
||||
drivers/mtd/parsers/bcm4908-partitions.h | 7 +++
|
||||
drivers/mtd/parsers/ofpart.c | 28 ++++++++++-
|
||||
4 files changed, 96 insertions(+), 2 deletions(-)
|
||||
create mode 100644 drivers/mtd/parsers/bcm4908-partitions.c
|
||||
create mode 100644 drivers/mtd/parsers/bcm4908-partitions.h
|
||||
|
||||
--- a/drivers/mtd/parsers/Makefile
|
||||
+++ b/drivers/mtd/parsers/Makefile
|
||||
@@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6
|
||||
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
|
||||
obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
|
||||
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
|
||||
+obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o
|
||||
obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o
|
||||
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
|
||||
obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/parsers/bcm4908-partitions.c
|
||||
@@ -0,0 +1,62 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
+
|
||||
+#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS"
|
||||
+
|
||||
+static long long bcm4908_partitions_fw_offset(void)
|
||||
+{
|
||||
+ struct device_node *root;
|
||||
+ struct property *prop;
|
||||
+ const char *s;
|
||||
+
|
||||
+ root = of_find_node_by_path("/");
|
||||
+ if (!root)
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ of_property_for_each_string(root, "brcm_blparms", prop, s) {
|
||||
+ size_t len = strlen(BLPARAMS_FW_OFFSET);
|
||||
+ unsigned long offset;
|
||||
+ int err;
|
||||
+
|
||||
+ if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=')
|
||||
+ continue;
|
||||
+
|
||||
+ err = kstrtoul(s + len + 1, 0, &offset);
|
||||
+ if (err) {
|
||||
+ pr_err("failed to parse %s\n", s + len + 1);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ return offset << 10;
|
||||
+ }
|
||||
+
|
||||
+ return -ENOENT;
|
||||
+}
|
||||
+
|
||||
+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts)
|
||||
+{
|
||||
+ long long fw_offset;
|
||||
+ int i;
|
||||
+
|
||||
+ fw_offset = bcm4908_partitions_fw_offset();
|
||||
+
|
||||
+ for (i = 0; i < nr_parts; i++) {
|
||||
+ if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) {
|
||||
+ if (fw_offset < 0 || parts[i].offset == fw_offset)
|
||||
+ parts[i].name = "firmware";
|
||||
+ else
|
||||
+ parts[i].name = "backup";
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/parsers/bcm4908-partitions.h
|
||||
@@ -0,0 +1,7 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+#ifndef __BCM4908_PARTITIONS_H
|
||||
+#define __BCM4908_PARTITIONS_H
|
||||
+
|
||||
+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts);
|
||||
+
|
||||
+#endif
|
||||
--- a/drivers/mtd/parsers/ofpart.c
|
||||
+++ b/drivers/mtd/parsers/ofpart.c
|
||||
@@ -16,6 +16,18 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
+#include "bcm4908-partitions.h"
|
||||
+
|
||||
+struct fixed_partitions_quirks {
|
||||
+ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts);
|
||||
+};
|
||||
+
|
||||
+struct fixed_partitions_quirks bcm4908_partitions_quirks = {
|
||||
+ .post_parse = bcm4908_partitions_post_parse,
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id parse_ofpart_match_table[];
|
||||
+
|
||||
static bool node_has_compatible(struct device_node *pp)
|
||||
{
|
||||
return of_get_property(pp, "compatible", NULL);
|
||||
@@ -25,6 +37,8 @@ static int parse_fixed_partitions(struct
|
||||
const struct mtd_partition **pparts,
|
||||
struct mtd_part_parser_data *data)
|
||||
{
|
||||
+ const struct fixed_partitions_quirks *quirks;
|
||||
+ const struct of_device_id *of_id;
|
||||
struct mtd_partition *parts;
|
||||
struct device_node *mtd_node;
|
||||
struct device_node *ofpart_node;
|
||||
@@ -33,7 +47,6 @@ static int parse_fixed_partitions(struct
|
||||
int nr_parts, i, ret = 0;
|
||||
bool dedicated = true;
|
||||
|
||||
-
|
||||
/* Pull of_node from the master device node */
|
||||
mtd_node = mtd_get_of_node(master);
|
||||
if (!mtd_node)
|
||||
@@ -50,11 +63,16 @@ static int parse_fixed_partitions(struct
|
||||
master->name, mtd_node);
|
||||
ofpart_node = mtd_node;
|
||||
dedicated = false;
|
||||
- } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) {
|
||||
+ }
|
||||
+
|
||||
+ of_id = of_match_node(parse_ofpart_match_table, ofpart_node);
|
||||
+ if (dedicated && !of_id) {
|
||||
/* The 'partitions' subnode might be used by another parser */
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ quirks = of_id ? of_id->data : NULL;
|
||||
+
|
||||
/* First count the subnodes */
|
||||
nr_parts = 0;
|
||||
for_each_child_of_node(ofpart_node, pp) {
|
||||
@@ -123,6 +141,9 @@ static int parse_fixed_partitions(struct
|
||||
if (!nr_parts)
|
||||
goto ofpart_none;
|
||||
|
||||
+ if (quirks && quirks->post_parse)
|
||||
+ quirks->post_parse(master, parts, nr_parts);
|
||||
+
|
||||
*pparts = parts;
|
||||
return nr_parts;
|
||||
|
||||
@@ -137,7 +158,10 @@ ofpart_none:
|
||||
}
|
||||
|
||||
static const struct of_device_id parse_ofpart_match_table[] = {
|
||||
+ /* Generic */
|
||||
{ .compatible = "fixed-partitions" },
|
||||
+ /* Customized */
|
||||
+ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
|
@ -0,0 +1,23 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 15 Feb 2021 22:01:03 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: limit amount of GPIOs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Linux driver can't handle more than 64 GPIOs
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
@@ -281,7 +281,7 @@
|
||||
gpio0: gpio-controller@500 {
|
||||
compatible = "brcm,bcm6345-gpio";
|
||||
reg-names = "dirout", "dat";
|
||||
- reg = <0x500 0x28>, <0x528 0x28>;
|
||||
+ reg = <0x500 0x8>, <0x528 0x8>;
|
||||
|
||||
#gpio-cells = <2>;
|
||||
gpio-controller;
|
@ -0,0 +1,650 @@
|
||||
From 3924b0384a0cd20245e2ffb55c45c2ace737a061 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 11 Feb 2021 23:04:27 +0100
|
||||
Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Some devices use fixed partitioning with some partitions requiring some
|
||||
extra logic. E.g. BCM4908 may have multiple firmware partitions but
|
||||
detecting currently used one requires checking bootloader parameters.
|
||||
|
||||
To support such cases without duplicating a lot of code (without copying
|
||||
most of the ofpart.c code) support for post-parsing callback was added.
|
||||
|
||||
BCM4908 support in ofpart can be enabled using config option and results
|
||||
in compiling & executing a specific callback. It simply reads offset of
|
||||
currently used firmware partition from the DT. Bootloader specifies it
|
||||
using the "brcm_blparms" property.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/mtd/parsers/Kconfig | 9 +++
|
||||
drivers/mtd/parsers/Makefile | 2 +
|
||||
drivers/mtd/parsers/ofpart_bcm4908.c | 66 +++++++++++++++++++
|
||||
drivers/mtd/parsers/ofpart_bcm4908.h | 15 +++++
|
||||
.../mtd/parsers/{ofpart.c => ofpart_core.c} | 28 +++++++-
|
||||
5 files changed, 118 insertions(+), 2 deletions(-)
|
||||
create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.c
|
||||
create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.h
|
||||
rename drivers/mtd/parsers/{ofpart.c => ofpart_core.c} (88%)
|
||||
|
||||
--- a/drivers/mtd/parsers/Kconfig
|
||||
+++ b/drivers/mtd/parsers/Kconfig
|
||||
@@ -83,6 +83,15 @@ config MTD_OF_PARTS
|
||||
flash memory node, as described in
|
||||
Documentation/devicetree/bindings/mtd/partition.txt.
|
||||
|
||||
+config MTD_OF_PARTS_BCM4908
|
||||
+ bool "BCM4908 partitioning support"
|
||||
+ depends on MTD_OF_PARTS && (ARCH_BCM4908 || COMPILE_TEST)
|
||||
+ default ARCH_BCM4908
|
||||
+ help
|
||||
+ This provides partitions parser for BCM4908 family devices
|
||||
+ that can have multiple "firmware" partitions. It takes care of
|
||||
+ finding currently used one and backup ones.
|
||||
+
|
||||
config MTD_PARSER_IMAGETAG
|
||||
tristate "Parser for BCM963XX Image Tag format partitions"
|
||||
depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST
|
||||
--- a/drivers/mtd/parsers/Makefile
|
||||
+++ b/drivers/mtd/parsers/Makefile
|
||||
@@ -5,6 +5,8 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm6
|
||||
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
|
||||
obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
|
||||
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
|
||||
+ofpart-y += ofpart_core.o
|
||||
+ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o
|
||||
obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o
|
||||
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
|
||||
obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/parsers/ofpart_bcm4908.c
|
||||
@@ -0,0 +1,66 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
+
|
||||
+#include "ofpart_bcm4908.h"
|
||||
+
|
||||
+#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS"
|
||||
+
|
||||
+static long long bcm4908_partitions_fw_offset(void)
|
||||
+{
|
||||
+ struct device_node *root;
|
||||
+ struct property *prop;
|
||||
+ const char *s;
|
||||
+
|
||||
+ root = of_find_node_by_path("/");
|
||||
+ if (!root)
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ of_property_for_each_string(root, "brcm_blparms", prop, s) {
|
||||
+ size_t len = strlen(BLPARAMS_FW_OFFSET);
|
||||
+ unsigned long offset;
|
||||
+ int err;
|
||||
+
|
||||
+ if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=')
|
||||
+ continue;
|
||||
+
|
||||
+ err = kstrtoul(s + len + 1, 0, &offset);
|
||||
+ if (err) {
|
||||
+ pr_err("failed to parse %s\n", s + len + 1);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ return offset << 10;
|
||||
+ }
|
||||
+
|
||||
+ return -ENOENT;
|
||||
+}
|
||||
+
|
||||
+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts)
|
||||
+{
|
||||
+ long long fw_offset;
|
||||
+ int i;
|
||||
+
|
||||
+ fw_offset = bcm4908_partitions_fw_offset();
|
||||
+
|
||||
+ for (i = 0; i < nr_parts; i++) {
|
||||
+ if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) {
|
||||
+ if (fw_offset < 0 || parts[i].offset == fw_offset)
|
||||
+ parts[i].name = "firmware";
|
||||
+ else
|
||||
+ parts[i].name = "backup";
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/parsers/ofpart_bcm4908.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+#ifndef __BCM4908_PARTITIONS_H
|
||||
+#define __BCM4908_PARTITIONS_H
|
||||
+
|
||||
+#ifdef CONFIG_MTD_OF_PARTS_BCM4908
|
||||
+int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts);
|
||||
+#else
|
||||
+static inline int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts,
|
||||
+ int nr_parts)
|
||||
+{
|
||||
+ return -EOPNOTSUPP;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
--- a/drivers/mtd/parsers/ofpart.c
|
||||
+++ /dev/null
|
||||
@@ -1,236 +0,0 @@
|
||||
-// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-/*
|
||||
- * Flash partitions described by the OF (or flattened) device tree
|
||||
- *
|
||||
- * Copyright © 2006 MontaVista Software Inc.
|
||||
- * Author: Vitaly Wool <vwool@ru.mvista.com>
|
||||
- *
|
||||
- * Revised to handle newer style flash binding by:
|
||||
- * Copyright © 2007 David Gibson, IBM Corporation.
|
||||
- */
|
||||
-
|
||||
-#include <linux/module.h>
|
||||
-#include <linux/init.h>
|
||||
-#include <linux/of.h>
|
||||
-#include <linux/mtd/mtd.h>
|
||||
-#include <linux/slab.h>
|
||||
-#include <linux/mtd/partitions.h>
|
||||
-
|
||||
-static bool node_has_compatible(struct device_node *pp)
|
||||
-{
|
||||
- return of_get_property(pp, "compatible", NULL);
|
||||
-}
|
||||
-
|
||||
-static int parse_fixed_partitions(struct mtd_info *master,
|
||||
- const struct mtd_partition **pparts,
|
||||
- struct mtd_part_parser_data *data)
|
||||
-{
|
||||
- struct mtd_partition *parts;
|
||||
- struct device_node *mtd_node;
|
||||
- struct device_node *ofpart_node;
|
||||
- const char *partname;
|
||||
- struct device_node *pp;
|
||||
- int nr_parts, i, ret = 0;
|
||||
- bool dedicated = true;
|
||||
-
|
||||
-
|
||||
- /* Pull of_node from the master device node */
|
||||
- mtd_node = mtd_get_of_node(master);
|
||||
- if (!mtd_node)
|
||||
- return 0;
|
||||
-
|
||||
- ofpart_node = of_get_child_by_name(mtd_node, "partitions");
|
||||
- if (!ofpart_node) {
|
||||
- /*
|
||||
- * We might get here even when ofpart isn't used at all (e.g.,
|
||||
- * when using another parser), so don't be louder than
|
||||
- * KERN_DEBUG
|
||||
- */
|
||||
- pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n",
|
||||
- master->name, mtd_node);
|
||||
- ofpart_node = mtd_node;
|
||||
- dedicated = false;
|
||||
- } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) {
|
||||
- /* The 'partitions' subnode might be used by another parser */
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /* First count the subnodes */
|
||||
- nr_parts = 0;
|
||||
- for_each_child_of_node(ofpart_node, pp) {
|
||||
- if (!dedicated && node_has_compatible(pp))
|
||||
- continue;
|
||||
-
|
||||
- nr_parts++;
|
||||
- }
|
||||
-
|
||||
- if (nr_parts == 0)
|
||||
- return 0;
|
||||
-
|
||||
- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
|
||||
- if (!parts)
|
||||
- return -ENOMEM;
|
||||
-
|
||||
- i = 0;
|
||||
- for_each_child_of_node(ofpart_node, pp) {
|
||||
- const __be32 *reg;
|
||||
- int len;
|
||||
- int a_cells, s_cells;
|
||||
-
|
||||
- if (!dedicated && node_has_compatible(pp))
|
||||
- continue;
|
||||
-
|
||||
- reg = of_get_property(pp, "reg", &len);
|
||||
- if (!reg) {
|
||||
- if (dedicated) {
|
||||
- pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n",
|
||||
- master->name, pp,
|
||||
- mtd_node);
|
||||
- goto ofpart_fail;
|
||||
- } else {
|
||||
- nr_parts--;
|
||||
- continue;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- a_cells = of_n_addr_cells(pp);
|
||||
- s_cells = of_n_size_cells(pp);
|
||||
- if (len / 4 != a_cells + s_cells) {
|
||||
- pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
|
||||
- master->name, pp,
|
||||
- mtd_node);
|
||||
- goto ofpart_fail;
|
||||
- }
|
||||
-
|
||||
- parts[i].offset = of_read_number(reg, a_cells);
|
||||
- parts[i].size = of_read_number(reg + a_cells, s_cells);
|
||||
- parts[i].of_node = pp;
|
||||
-
|
||||
- partname = of_get_property(pp, "label", &len);
|
||||
- if (!partname)
|
||||
- partname = of_get_property(pp, "name", &len);
|
||||
- parts[i].name = partname;
|
||||
-
|
||||
- if (of_get_property(pp, "read-only", &len))
|
||||
- parts[i].mask_flags |= MTD_WRITEABLE;
|
||||
-
|
||||
- if (of_get_property(pp, "lock", &len))
|
||||
- parts[i].mask_flags |= MTD_POWERUP_LOCK;
|
||||
-
|
||||
- i++;
|
||||
- }
|
||||
-
|
||||
- if (!nr_parts)
|
||||
- goto ofpart_none;
|
||||
-
|
||||
- *pparts = parts;
|
||||
- return nr_parts;
|
||||
-
|
||||
-ofpart_fail:
|
||||
- pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n",
|
||||
- master->name, pp, mtd_node);
|
||||
- ret = -EINVAL;
|
||||
-ofpart_none:
|
||||
- of_node_put(pp);
|
||||
- kfree(parts);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static const struct of_device_id parse_ofpart_match_table[] = {
|
||||
- { .compatible = "fixed-partitions" },
|
||||
- {},
|
||||
-};
|
||||
-MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
|
||||
-
|
||||
-static struct mtd_part_parser ofpart_parser = {
|
||||
- .parse_fn = parse_fixed_partitions,
|
||||
- .name = "fixed-partitions",
|
||||
- .of_match_table = parse_ofpart_match_table,
|
||||
-};
|
||||
-
|
||||
-static int parse_ofoldpart_partitions(struct mtd_info *master,
|
||||
- const struct mtd_partition **pparts,
|
||||
- struct mtd_part_parser_data *data)
|
||||
-{
|
||||
- struct mtd_partition *parts;
|
||||
- struct device_node *dp;
|
||||
- int i, plen, nr_parts;
|
||||
- const struct {
|
||||
- __be32 offset, len;
|
||||
- } *part;
|
||||
- const char *names;
|
||||
-
|
||||
- /* Pull of_node from the master device node */
|
||||
- dp = mtd_get_of_node(master);
|
||||
- if (!dp)
|
||||
- return 0;
|
||||
-
|
||||
- part = of_get_property(dp, "partitions", &plen);
|
||||
- if (!part)
|
||||
- return 0; /* No partitions found */
|
||||
-
|
||||
- pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp);
|
||||
-
|
||||
- nr_parts = plen / sizeof(part[0]);
|
||||
-
|
||||
- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
|
||||
- if (!parts)
|
||||
- return -ENOMEM;
|
||||
-
|
||||
- names = of_get_property(dp, "partition-names", &plen);
|
||||
-
|
||||
- for (i = 0; i < nr_parts; i++) {
|
||||
- parts[i].offset = be32_to_cpu(part->offset);
|
||||
- parts[i].size = be32_to_cpu(part->len) & ~1;
|
||||
- /* bit 0 set signifies read only partition */
|
||||
- if (be32_to_cpu(part->len) & 1)
|
||||
- parts[i].mask_flags = MTD_WRITEABLE;
|
||||
-
|
||||
- if (names && (plen > 0)) {
|
||||
- int len = strlen(names) + 1;
|
||||
-
|
||||
- parts[i].name = names;
|
||||
- plen -= len;
|
||||
- names += len;
|
||||
- } else {
|
||||
- parts[i].name = "unnamed";
|
||||
- }
|
||||
-
|
||||
- part++;
|
||||
- }
|
||||
-
|
||||
- *pparts = parts;
|
||||
- return nr_parts;
|
||||
-}
|
||||
-
|
||||
-static struct mtd_part_parser ofoldpart_parser = {
|
||||
- .parse_fn = parse_ofoldpart_partitions,
|
||||
- .name = "ofoldpart",
|
||||
-};
|
||||
-
|
||||
-static int __init ofpart_parser_init(void)
|
||||
-{
|
||||
- register_mtd_parser(&ofpart_parser);
|
||||
- register_mtd_parser(&ofoldpart_parser);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static void __exit ofpart_parser_exit(void)
|
||||
-{
|
||||
- deregister_mtd_parser(&ofpart_parser);
|
||||
- deregister_mtd_parser(&ofoldpart_parser);
|
||||
-}
|
||||
-
|
||||
-module_init(ofpart_parser_init);
|
||||
-module_exit(ofpart_parser_exit);
|
||||
-
|
||||
-MODULE_LICENSE("GPL");
|
||||
-MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree");
|
||||
-MODULE_AUTHOR("Vitaly Wool, David Gibson");
|
||||
-/*
|
||||
- * When MTD core cannot find the requested parser, it tries to load the module
|
||||
- * with the same name. Since we provide the ofoldpart parser, we should have
|
||||
- * the corresponding alias.
|
||||
- */
|
||||
-MODULE_ALIAS("fixed-partitions");
|
||||
-MODULE_ALIAS("ofoldpart");
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/parsers/ofpart_core.c
|
||||
@@ -0,0 +1,260 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+/*
|
||||
+ * Flash partitions described by the OF (or flattened) device tree
|
||||
+ *
|
||||
+ * Copyright © 2006 MontaVista Software Inc.
|
||||
+ * Author: Vitaly Wool <vwool@ru.mvista.com>
|
||||
+ *
|
||||
+ * Revised to handle newer style flash binding by:
|
||||
+ * Copyright © 2007 David Gibson, IBM Corporation.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
+
|
||||
+#include "ofpart_bcm4908.h"
|
||||
+
|
||||
+struct fixed_partitions_quirks {
|
||||
+ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts);
|
||||
+};
|
||||
+
|
||||
+struct fixed_partitions_quirks bcm4908_partitions_quirks = {
|
||||
+ .post_parse = bcm4908_partitions_post_parse,
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id parse_ofpart_match_table[];
|
||||
+
|
||||
+static bool node_has_compatible(struct device_node *pp)
|
||||
+{
|
||||
+ return of_get_property(pp, "compatible", NULL);
|
||||
+}
|
||||
+
|
||||
+static int parse_fixed_partitions(struct mtd_info *master,
|
||||
+ const struct mtd_partition **pparts,
|
||||
+ struct mtd_part_parser_data *data)
|
||||
+{
|
||||
+ const struct fixed_partitions_quirks *quirks;
|
||||
+ const struct of_device_id *of_id;
|
||||
+ struct mtd_partition *parts;
|
||||
+ struct device_node *mtd_node;
|
||||
+ struct device_node *ofpart_node;
|
||||
+ const char *partname;
|
||||
+ struct device_node *pp;
|
||||
+ int nr_parts, i, ret = 0;
|
||||
+ bool dedicated = true;
|
||||
+
|
||||
+ /* Pull of_node from the master device node */
|
||||
+ mtd_node = mtd_get_of_node(master);
|
||||
+ if (!mtd_node)
|
||||
+ return 0;
|
||||
+
|
||||
+ ofpart_node = of_get_child_by_name(mtd_node, "partitions");
|
||||
+ if (!ofpart_node) {
|
||||
+ /*
|
||||
+ * We might get here even when ofpart isn't used at all (e.g.,
|
||||
+ * when using another parser), so don't be louder than
|
||||
+ * KERN_DEBUG
|
||||
+ */
|
||||
+ pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n",
|
||||
+ master->name, mtd_node);
|
||||
+ ofpart_node = mtd_node;
|
||||
+ dedicated = false;
|
||||
+ }
|
||||
+
|
||||
+ of_id = of_match_node(parse_ofpart_match_table, ofpart_node);
|
||||
+ if (dedicated && !of_id) {
|
||||
+ /* The 'partitions' subnode might be used by another parser */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ quirks = of_id ? of_id->data : NULL;
|
||||
+
|
||||
+ /* First count the subnodes */
|
||||
+ nr_parts = 0;
|
||||
+ for_each_child_of_node(ofpart_node, pp) {
|
||||
+ if (!dedicated && node_has_compatible(pp))
|
||||
+ continue;
|
||||
+
|
||||
+ nr_parts++;
|
||||
+ }
|
||||
+
|
||||
+ if (nr_parts == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
|
||||
+ if (!parts)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ i = 0;
|
||||
+ for_each_child_of_node(ofpart_node, pp) {
|
||||
+ const __be32 *reg;
|
||||
+ int len;
|
||||
+ int a_cells, s_cells;
|
||||
+
|
||||
+ if (!dedicated && node_has_compatible(pp))
|
||||
+ continue;
|
||||
+
|
||||
+ reg = of_get_property(pp, "reg", &len);
|
||||
+ if (!reg) {
|
||||
+ if (dedicated) {
|
||||
+ pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n",
|
||||
+ master->name, pp,
|
||||
+ mtd_node);
|
||||
+ goto ofpart_fail;
|
||||
+ } else {
|
||||
+ nr_parts--;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ a_cells = of_n_addr_cells(pp);
|
||||
+ s_cells = of_n_size_cells(pp);
|
||||
+ if (len / 4 != a_cells + s_cells) {
|
||||
+ pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
|
||||
+ master->name, pp,
|
||||
+ mtd_node);
|
||||
+ goto ofpart_fail;
|
||||
+ }
|
||||
+
|
||||
+ parts[i].offset = of_read_number(reg, a_cells);
|
||||
+ parts[i].size = of_read_number(reg + a_cells, s_cells);
|
||||
+ parts[i].of_node = pp;
|
||||
+
|
||||
+ partname = of_get_property(pp, "label", &len);
|
||||
+ if (!partname)
|
||||
+ partname = of_get_property(pp, "name", &len);
|
||||
+ parts[i].name = partname;
|
||||
+
|
||||
+ if (of_get_property(pp, "read-only", &len))
|
||||
+ parts[i].mask_flags |= MTD_WRITEABLE;
|
||||
+
|
||||
+ if (of_get_property(pp, "lock", &len))
|
||||
+ parts[i].mask_flags |= MTD_POWERUP_LOCK;
|
||||
+
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
+ if (!nr_parts)
|
||||
+ goto ofpart_none;
|
||||
+
|
||||
+ if (quirks && quirks->post_parse)
|
||||
+ quirks->post_parse(master, parts, nr_parts);
|
||||
+
|
||||
+ *pparts = parts;
|
||||
+ return nr_parts;
|
||||
+
|
||||
+ofpart_fail:
|
||||
+ pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n",
|
||||
+ master->name, pp, mtd_node);
|
||||
+ ret = -EINVAL;
|
||||
+ofpart_none:
|
||||
+ of_node_put(pp);
|
||||
+ kfree(parts);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id parse_ofpart_match_table[] = {
|
||||
+ /* Generic */
|
||||
+ { .compatible = "fixed-partitions" },
|
||||
+ /* Customized */
|
||||
+ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
|
||||
+
|
||||
+static struct mtd_part_parser ofpart_parser = {
|
||||
+ .parse_fn = parse_fixed_partitions,
|
||||
+ .name = "fixed-partitions",
|
||||
+ .of_match_table = parse_ofpart_match_table,
|
||||
+};
|
||||
+
|
||||
+static int parse_ofoldpart_partitions(struct mtd_info *master,
|
||||
+ const struct mtd_partition **pparts,
|
||||
+ struct mtd_part_parser_data *data)
|
||||
+{
|
||||
+ struct mtd_partition *parts;
|
||||
+ struct device_node *dp;
|
||||
+ int i, plen, nr_parts;
|
||||
+ const struct {
|
||||
+ __be32 offset, len;
|
||||
+ } *part;
|
||||
+ const char *names;
|
||||
+
|
||||
+ /* Pull of_node from the master device node */
|
||||
+ dp = mtd_get_of_node(master);
|
||||
+ if (!dp)
|
||||
+ return 0;
|
||||
+
|
||||
+ part = of_get_property(dp, "partitions", &plen);
|
||||
+ if (!part)
|
||||
+ return 0; /* No partitions found */
|
||||
+
|
||||
+ pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp);
|
||||
+
|
||||
+ nr_parts = plen / sizeof(part[0]);
|
||||
+
|
||||
+ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
|
||||
+ if (!parts)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ names = of_get_property(dp, "partition-names", &plen);
|
||||
+
|
||||
+ for (i = 0; i < nr_parts; i++) {
|
||||
+ parts[i].offset = be32_to_cpu(part->offset);
|
||||
+ parts[i].size = be32_to_cpu(part->len) & ~1;
|
||||
+ /* bit 0 set signifies read only partition */
|
||||
+ if (be32_to_cpu(part->len) & 1)
|
||||
+ parts[i].mask_flags = MTD_WRITEABLE;
|
||||
+
|
||||
+ if (names && (plen > 0)) {
|
||||
+ int len = strlen(names) + 1;
|
||||
+
|
||||
+ parts[i].name = names;
|
||||
+ plen -= len;
|
||||
+ names += len;
|
||||
+ } else {
|
||||
+ parts[i].name = "unnamed";
|
||||
+ }
|
||||
+
|
||||
+ part++;
|
||||
+ }
|
||||
+
|
||||
+ *pparts = parts;
|
||||
+ return nr_parts;
|
||||
+}
|
||||
+
|
||||
+static struct mtd_part_parser ofoldpart_parser = {
|
||||
+ .parse_fn = parse_ofoldpart_partitions,
|
||||
+ .name = "ofoldpart",
|
||||
+};
|
||||
+
|
||||
+static int __init ofpart_parser_init(void)
|
||||
+{
|
||||
+ register_mtd_parser(&ofpart_parser);
|
||||
+ register_mtd_parser(&ofoldpart_parser);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit ofpart_parser_exit(void)
|
||||
+{
|
||||
+ deregister_mtd_parser(&ofpart_parser);
|
||||
+ deregister_mtd_parser(&ofoldpart_parser);
|
||||
+}
|
||||
+
|
||||
+module_init(ofpart_parser_init);
|
||||
+module_exit(ofpart_parser_exit);
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree");
|
||||
+MODULE_AUTHOR("Vitaly Wool, David Gibson");
|
||||
+/*
|
||||
+ * When MTD core cannot find the requested parser, it tries to load the module
|
||||
+ * with the same name. Since we provide the ofoldpart parser, we should have
|
||||
+ * the corresponding alias.
|
||||
+ */
|
||||
+MODULE_ALIAS("fixed-partitions");
|
||||
+MODULE_ALIAS("ofoldpart");
|
@ -1,7 +1,7 @@
|
||||
From 4fdbaa5a3dbe761b231c13feaa53242aae3306cc Mon Sep 17 00:00:00 2001
|
||||
From 6418522022c706fd867b00b2571edba48b8fa8c7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Fri, 15 Jan 2021 15:23:02 +0100
|
||||
Subject: [PATCH 1/3] dt-bindings: mtd: move partition binding to its own file
|
||||
Date: Thu, 11 Feb 2021 23:04:25 +0100
|
||||
Subject: [PATCH] dt-bindings: mtd: move partition binding to its own file
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -13,6 +13,8 @@ Single partition binding is quite common and may be:
|
||||
Move it to separated file to avoid code duplication.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
---
|
||||
.../mtd/partitions/fixed-partitions.yaml | 33 +------------
|
||||
.../bindings/mtd/partitions/partition.yaml | 47 +++++++++++++++++++
|
@ -1,24 +1,25 @@
|
||||
From 4f740351484e88bcea3776578288b6ec400829c8 Mon Sep 17 00:00:00 2001
|
||||
From 6e9dff6fe3fbc452f16566e4a7e293b0decefdba Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Fri, 15 Jan 2021 16:01:04 +0100
|
||||
Subject: [PATCH 2/3] dt-bindings: mtd: add binding from BCM4908 partitions
|
||||
Date: Thu, 11 Feb 2021 23:04:26 +0100
|
||||
Subject: [PATCH] dt-bindings: mtd: add binding for BCM4908 partitions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM4908 uses fixed partitions layout but function of some partitions may
|
||||
vary. Some devices use multiple firmware partitions and those should be
|
||||
marked to let system discover their purpose.
|
||||
vary. Some devices use multiple firmware partitions and those partitions
|
||||
should be marked to let system discover their purpose.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
---
|
||||
.../partitions/brcm,bcm4908-partitions.yaml | 68 +++++++++++++++++++
|
||||
1 file changed, 68 insertions(+)
|
||||
.../partitions/brcm,bcm4908-partitions.yaml | 70 +++++++++++++++++++
|
||||
1 file changed, 70 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
|
||||
@@ -0,0 +1,68 @@
|
||||
@@ -0,0 +1,70 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
+%YAML 1.2
|
||||
+---
|
||||
@ -42,17 +43,19 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908-partitions
|
||||
+
|
||||
+ "#address-cells": true
|
||||
+ "#address-cells":
|
||||
+ enum: [ 1, 2 ]
|
||||
+
|
||||
+ "#size-cells": true
|
||||
+ "#size-cells":
|
||||
+ enum: [ 1, 2 ]
|
||||
+
|
||||
+patternProperties:
|
||||
+ "@[0-9a-f]+$":
|
||||
+ allOf:
|
||||
+ - $ref: "partition.yaml#"
|
||||
+ - properties:
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908-firmware
|
||||
+ "^partition@[0-9a-f]+$":
|
||||
+ $ref: "partition.yaml#"
|
||||
+ properties:
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908-firmware
|
||||
+ unevaluatedProperties: false
|
||||
+
|
||||
+required:
|
||||
+ - "#address-cells"
|
@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+{
|
||||
+ unsigned long timeout = jiffies + HZ;
|
||||
+
|
||||
+ while (time_is_before_jiffies(timeout)) {
|
||||
+ while (time_is_after_jiffies(timeout)) {
|
||||
+ if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY))
|
||||
+ return 0;
|
||||
+
|
||||
|
145
tools/fakeroot/patches/300-glibc-2.33-compatibility.patch
Normal file
145
tools/fakeroot/patches/300-glibc-2.33-compatibility.patch
Normal file
@ -0,0 +1,145 @@
|
||||
--- a/libfakeroot.c
|
||||
+++ b/libfakeroot.c
|
||||
@@ -90,6 +90,16 @@
|
||||
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
|
||||
#endif
|
||||
|
||||
+#ifndef _STAT_VER
|
||||
+ #if defined (__aarch64__)
|
||||
+ #define _STAT_VER 0
|
||||
+ #elif defined (__x86_64__)
|
||||
+ #define _STAT_VER 1
|
||||
+ #else
|
||||
+ #define _STAT_VER 3
|
||||
+ #endif
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
These INT_* (which stands for internal) macros should always be used when
|
||||
the fakeroot library owns the storage of the stat variable.
|
||||
@@ -1358,6 +1368,54 @@ int renameat(int olddir_fd, const char *
|
||||
#endif /* HAVE_FSTATAT */
|
||||
|
||||
|
||||
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
|
||||
+/* Glibc 2.33 exports symbols for these functions in the shared lib */
|
||||
+ int lstat(const char *file_name, struct stat *statbuf) {
|
||||
+ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
|
||||
+ }
|
||||
+ int stat(const char *file_name, struct stat *st) {
|
||||
+ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st);
|
||||
+ }
|
||||
+ int fstat(int fd, struct stat *st) {
|
||||
+ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st);
|
||||
+ }
|
||||
+
|
||||
+ #ifdef HAVE_FSTATAT
|
||||
+ int fstatat(int dir_fd, const char *path, struct stat *st, int flags) {
|
||||
+ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags);
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
+ #ifdef STAT64_SUPPORT
|
||||
+ int lstat64(const char *file_name, struct stat64 *st) {
|
||||
+ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st);
|
||||
+ }
|
||||
+ int stat64(const char *file_name, struct stat64 *st) {
|
||||
+ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st);
|
||||
+ }
|
||||
+ int fstat64(int fd, struct stat64 *st) {
|
||||
+ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st);
|
||||
+ }
|
||||
+
|
||||
+ #ifdef HAVE_FSTATAT
|
||||
+ int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) {
|
||||
+ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags);
|
||||
+ }
|
||||
+ #endif
|
||||
+ #endif
|
||||
+
|
||||
+ int mknod(const char *pathname, mode_t mode, dev_t dev) {
|
||||
+ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev);
|
||||
+ }
|
||||
+
|
||||
+ #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT)
|
||||
+ int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) {
|
||||
+ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
|
||||
+ }
|
||||
+ #endif
|
||||
+#endif /* GLIBC_PREREQ */
|
||||
+
|
||||
+
|
||||
#ifdef FAKEROOT_FAKENET
|
||||
pid_t fork(void)
|
||||
{
|
||||
@@ -2024,11 +2082,7 @@ FTSENT *fts_read(FTS *ftsp) {
|
||||
|| r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
|
||||
r->fts_statp = NULL; /* Otherwise fts_statp may be a random pointer */
|
||||
if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
|
||||
-# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
|
||||
- SEND_GET_STAT64(r->fts_statp, _STAT_VER);
|
||||
-# else
|
||||
SEND_GET_STAT(r->fts_statp, _STAT_VER);
|
||||
-# endif
|
||||
}
|
||||
|
||||
return r;
|
||||
@@ -2047,11 +2101,7 @@ FTSENT *fts_children(FTS *ftsp, int opti
|
||||
first=next_fts_children(ftsp, options);
|
||||
for(r = first; r; r = r->fts_link) {
|
||||
if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
|
||||
-# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
|
||||
- SEND_GET_STAT64(r->fts_statp, _STAT_VER);
|
||||
-# else
|
||||
SEND_GET_STAT(r->fts_statp, _STAT_VER);
|
||||
-# endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2483,7 +2533,7 @@ int statx (int dirfd, const char *path,
|
||||
|
||||
#ifdef LIBFAKEROOT_DEBUGGING
|
||||
if (fakeroot_debug) {
|
||||
- fprintf(stderr, "statx fd %d\n", fd);
|
||||
+ fprintf(stderr, "statx fd %d\n", dirfd);
|
||||
}
|
||||
#endif /* LIBFAKEROOT_DEBUGGING */
|
||||
r=INT_NEXT_FSTATAT(dirfd, path, &st, flags);
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -184,13 +184,13 @@ AC_MSG_CHECKING([for type of arg of __xm
|
||||
]], [[
|
||||
int __xmknod ( int ver,
|
||||
const char *pathname ,
|
||||
- mode_t mode , dev_t dev);
|
||||
+ mode_t mode , dev_t *dev);
|
||||
]])],[
|
||||
- AC_DEFINE(XMKNOD_FRTH_ARG,)
|
||||
- AC_MSG_RESULT([no extra *])
|
||||
- ],[
|
||||
AC_DEFINE(XMKNOD_FRTH_ARG,[*])
|
||||
AC_MSG_RESULT([needs *])
|
||||
+ ],[
|
||||
+ AC_DEFINE(XMKNOD_FRTH_ARG,)
|
||||
+ AC_MSG_RESULT([no extra *])
|
||||
|
||||
])
|
||||
|
||||
@@ -211,13 +211,13 @@ AC_MSG_CHECKING([for type of arg of __xm
|
||||
int __xmknodat ( int ver,
|
||||
int dirfd,
|
||||
const char *pathname ,
|
||||
- mode_t mode , dev_t dev);
|
||||
+ mode_t mode , dev_t *dev);
|
||||
]])],[
|
||||
- AC_DEFINE(XMKNODAT_FIFTH_ARG,)
|
||||
- AC_MSG_RESULT([no extra *])
|
||||
- ],[
|
||||
AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
|
||||
AC_MSG_RESULT([needs *])
|
||||
+ ],[
|
||||
+ AC_DEFINE(XMKNODAT_FIFTH_ARG,)
|
||||
+ AC_MSG_RESULT([no extra *])
|
||||
|
||||
])
|
||||
|
42
tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch
Normal file
42
tools/fakeroot/patches/301-glibc-2.33-compat-fixes.patch
Normal file
@ -0,0 +1,42 @@
|
||||
--- a/libfakeroot.c
|
||||
+++ b/libfakeroot.c
|
||||
@@ -1368,7 +1368,8 @@ int renameat(int olddir_fd, const char *
|
||||
#endif /* HAVE_FSTATAT */
|
||||
|
||||
|
||||
-#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
|
||||
+#if defined(__GLIBC__)
|
||||
+#if __GLIBC_PREREQ(2,33)
|
||||
/* Glibc 2.33 exports symbols for these functions in the shared lib */
|
||||
int lstat(const char *file_name, struct stat *statbuf) {
|
||||
return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
|
||||
@@ -1413,6 +1414,7 @@ int renameat(int olddir_fd, const char *
|
||||
return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
|
||||
}
|
||||
#endif
|
||||
+#endif /* __GLIBC__ */
|
||||
#endif /* GLIBC_PREREQ */
|
||||
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -182,6 +182,9 @@ AC_MSG_CHECKING([for type of arg of __xm
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
]], [[
|
||||
+#ifndef __GLIBC__
|
||||
+#error no extra *
|
||||
+#endif
|
||||
int __xmknod ( int ver,
|
||||
const char *pathname ,
|
||||
mode_t mode , dev_t *dev);
|
||||
@@ -208,6 +211,9 @@ AC_MSG_CHECKING([for type of arg of __xm
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
]], [[
|
||||
+#ifndef __GLIBC__
|
||||
+#error no extra *
|
||||
+#endif
|
||||
int __xmknodat ( int ver,
|
||||
int dirfd,
|
||||
const char *pathname ,
|
@ -7,11 +7,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=patchelf
|
||||
PKG_VERSION:=0.10
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://nixos.org/releases/patchelf/patchelf-$(PKG_VERSION)
|
||||
PKG_HASH:=f670cd462ac7161588c28f45349bc20fb9bd842805e3f71387a320e7a9ddfcf3
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/NixOS/patchelf.git
|
||||
PKG_SOURCE_VERSION:=f34751b88bd07d7f44f5cd3200fb4122bf916c7e
|
||||
PKG_SOURCE_DATE:=2020-12-07
|
||||
PKG_MIRROR_HASH:=ac746930b919b97da40f259cfc9ab7bbd48a0c9cbf2eebd8cee5ae19a94356fd
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
HOST_FIXUP:=autoreconf
|
||||
|
Loading…
x
Reference in New Issue
Block a user