From a3b55ae510e1af2fa401d0091fccb11af6bed799 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 2 Feb 2021 18:04:33 +0000 Subject: [PATCH 1/4] arm-trusted-firmware-mediatek: add ATF builds for MT7622 ATF bl2 comes in 4 variants for MT7622 depending on the boot media: * nor * snand * emmc * sdmmc Additional binary headers needed for emmc and sdmmc are downloaded as well and provided along with bl2*.bin and bl31.bin to allow building images including ATF for MT7622. Signed-off-by: Daniel Golle --- .../arm-trusted-firmware-mediatek/Makefile | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 package/boot/arm-trusted-firmware-mediatek/Makefile diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile new file mode 100644 index 0000000000..c886a4ccc7 --- /dev/null +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -0,0 +1,111 @@ +# +# Copyright (C) 2017 Hauke Mehrtens +# Copyright (C) 2020 Daniel Golle +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=arm-trusted-firmware-mediatek +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git +PKG_SOURCE_DATE:=2020-11-09 +PKG_SOURCE_VERSION:=03017334ccd8c0fac12e7db36749b95b9a7d745f +PKG_MIRROR_HASH:=b211b2f9143d4debc7ad8dc959cb606888af20af790855dd66c87e451b6a1bc7 + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=docs/license.rst + +PKG_MAINTAINER:=Daniel Golle + +include $(INCLUDE_DIR)/package.mk + +define Download/mt7622-header-emmc + URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0 + URL_FILE:=header_emmc.bin + FILE:=mt7622-header_emmc.bin + HASH:=0a09c55d90c5fc375c59468a4331555f77cbc3e1dd107ca83b5b8c9625f38d8c +endef + +define Download/mt7622-header-sdmmc + URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0 + URL_FILE:=header_sdmmc.bin + FILE:=mt7622-header_sdmmc.bin + HASH:=242908c04e25289d25ba9fab61a1930425af173051c43d275d1ac9877d6accb1 +endef + +define Package/arm-trusted-firmware-mt7622/Default + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=ARM Trusted Firmware for MT7622 + DEPENDS:=@TARGET_mediatek_mt7622 +endef + +define Package/arm-trusted-firmware-mt7622-nor + $(call Package/arm-trusted-firmware-mt7622/Default) + VARIANT:=nor +endef + +define Package/arm-trusted-firmware-mt7622-snand + $(call Package/arm-trusted-firmware-mt7622/Default) + VARIANT:=snand +endef + +define Package/arm-trusted-firmware-mt7622-emmc + $(call Package/arm-trusted-firmware-mt7622/Default) + VARIANT:=emmc +endef + +define Package/arm-trusted-firmware-mt7622-sdmmc + $(call Package/arm-trusted-firmware-mt7622/Default) + VARIANT:=sdmmc +endef + +export GCC_HONOUR_COPTS=s + +MAKE_VARS = \ + CROSS_COMPILE="$(TARGET_CROSS)" + +MAKE_FLAGS += \ + PLAT=mt7622 \ + BOOT_DEVICE=$(BUILD_VARIANT) \ + all + +define Build/Prepare + $(call Build/Prepare/Default) +ifeq ($(BUILD_VARIANT),emmc) + $(eval $(call Download,mt7622-header-emmc)) +endif +ifeq ($(BUILD_VARIANT),sdmmc) + $(eval $(call Download,mt7622-header-sdmmc)) +endif +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.bin $(STAGING_DIR_IMAGE)/bl2-$(BUILD_VARIANT).bin + $(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.img $(STAGING_DIR_IMAGE)/bl2-$(BUILD_VARIANT).img +# bl31.bin turns out to be identical for all build variants + $(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31.bin +ifeq ($(BUILD_VARIANT),emmc) + $(CP) $(DL_DIR)/mt7622-header_emmc.bin $(STAGING_DIR_IMAGE)/header-emmc.bin +endif +ifeq ($(BUILD_VARIANT),sdmmc) + $(CP) $(DL_DIR)/mt7622-header_sdmmc.bin $(STAGING_DIR_IMAGE)/header-sdmmc.bin +endif +endef + +define Package/arm-trusted-firmware-mt7622-nor/install +endef +Package/arm-trusted-firmware-mt7622-snand/install = $(Package/arm-trusted-firmware-mt7622-nor/install) +Package/arm-trusted-firmware-mt7622-emmc/install = $(Package/arm-trusted-firmware-mt7622-nor/install) +Package/arm-trusted-firmware-mt7622-sdmmc/install = $(Package/arm-trusted-firmware-mt7622-nor/install) + +$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-nor)) +$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-snand)) +$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-emmc)) +$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-sdmmc)) From e23a90674e1b52a6eaa3d66a621f7ff612641243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 2 Feb 2021 11:02:39 +0100 Subject: [PATCH 2/4] bcm63xx: backport upstream SSB SPROM extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New upstream changes extract more SPROM values and fix the antenna gain. These changes can be found in linux drivers/ssb/pci.c. Signed-off-by: Álvaro Fernández Rojas --- ...S-BCM63XX-add-support-for-raw-sproms.patch | 122 +++++++++++++----- ...-raw-fallback-sproms-for-most-common.patch | 2 +- ...o-register-a-fallback-sprom-for-bcma.patch | 6 +- ...M63XX-add-BCMA-based-sprom-templates.patch | 2 +- ...ow-board-files-to-provide-sprom-fixu.patch | 4 +- ...ow-setting-a-pci-bus-device-for-fall.patch | 4 +- 6 files changed, 102 insertions(+), 38 deletions(-) diff --git a/target/linux/bcm63xx/patches-5.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch b/target/linux/bcm63xx/patches-5.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch index 42502eb062..2063cda485 100644 --- a/target/linux/bcm63xx/patches-5.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch +++ b/target/linux/bcm63xx/patches-5.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch @@ -12,7 +12,7 @@ Signed-off-by: Jonas Gorski --- a/arch/mips/bcm63xx/sprom.c +++ b/arch/mips/bcm63xx/sprom.c -@@ -55,13 +55,492 @@ int bcm63xx_get_fallback_sprom(struct ss +@@ -55,13 +55,556 @@ int bcm63xx_get_fallback_sprom(struct ss return -EINVAL; } } @@ -43,13 +43,13 @@ Signed-off-by: Jonas Gorski + } while (0) + + -+static s8 r123_extract_antgain(u8 sprom_revision, const u16 *in, -+ u16 mask, u16 shift) ++static s8 sprom_extract_antgain(u8 sprom_revision, const u16 *in, u16 offset, ++ u16 mask, u16 shift) +{ + u16 v; + u8 gain; + -+ v = in[SPOFF(SSB_SPROM1_AGAIN)]; ++ v = in[SPOFF(offset)]; + gain = (v & mask) >> shift; + if (gain == 0xFF) + gain = 2; /* If unset use 2dBm */ @@ -129,12 +129,14 @@ Signed-off-by: Jonas Gorski + SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); + + /* Extract the antenna gain values. */ -+ out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN_BG, -+ SSB_SPROM1_AGAIN_BG_SHIFT); -+ out->antenna_gain.a1 = r123_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN_A, -+ SSB_SPROM1_AGAIN_A_SHIFT); ++ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM1_AGAIN, ++ SSB_SPROM1_AGAIN_BG, ++ SSB_SPROM1_AGAIN_BG_SHIFT); ++ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM1_AGAIN, ++ SSB_SPROM1_AGAIN_A, ++ SSB_SPROM1_AGAIN_A_SHIFT); + if (out->revision >= 2) + sprom_extract_r23(out, in); +} @@ -181,7 +183,15 @@ Signed-off-by: Jonas Gorski + +static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) +{ ++ static const u16 pwr_info_offset[] = { ++ SSB_SPROM4_PWR_INFO_CORE0, SSB_SPROM4_PWR_INFO_CORE1, ++ SSB_SPROM4_PWR_INFO_CORE2, SSB_SPROM4_PWR_INFO_CORE3 ++ }; + u16 il0mac_offset; ++ int i; ++ ++ BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != ++ ARRAY_SIZE(out->core_pwr_info)); + + if (out->revision == 4) + il0mac_offset = SSB_SPROM4_IL0MAC; @@ -235,14 +245,59 @@ Signed-off-by: Jonas Gorski + } + + /* Extract the antenna gain values. */ -+ SPEX(antenna_gain.a0, SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN0, SSB_SPROM4_AGAIN0_SHIFT); -+ SPEX(antenna_gain.a1, SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN1, SSB_SPROM4_AGAIN1_SHIFT); -+ SPEX(antenna_gain.a2, SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN2, SSB_SPROM4_AGAIN2_SHIFT); -+ SPEX(antenna_gain.a3, SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN3, SSB_SPROM4_AGAIN3_SHIFT); ++ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM4_AGAIN01, ++ SSB_SPROM4_AGAIN0, ++ SSB_SPROM4_AGAIN0_SHIFT); ++ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM4_AGAIN01, ++ SSB_SPROM4_AGAIN1, ++ SSB_SPROM4_AGAIN1_SHIFT); ++ out->antenna_gain.a2 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM4_AGAIN23, ++ SSB_SPROM4_AGAIN2, ++ SSB_SPROM4_AGAIN2_SHIFT); ++ out->antenna_gain.a3 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM4_AGAIN23, ++ SSB_SPROM4_AGAIN3, ++ SSB_SPROM4_AGAIN3_SHIFT); ++ ++ /* Extract cores power info info */ ++ for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { ++ u16 o = pwr_info_offset[i]; ++ ++ SPEX(core_pwr_info[i].itssi_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, ++ SSB_SPROM4_2G_ITSSI, SSB_SPROM4_2G_ITSSI_SHIFT); ++ SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, ++ SSB_SPROM4_2G_MAXP, 0); ++ ++ SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SPROM4_2G_PA_0, ~0, 0); ++ SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SPROM4_2G_PA_1, ~0, 0); ++ SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SPROM4_2G_PA_2, ~0, 0); ++ SPEX(core_pwr_info[i].pa_2g[3], o + SSB_SPROM4_2G_PA_3, ~0, 0); ++ ++ SPEX(core_pwr_info[i].itssi_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, ++ SSB_SPROM4_5G_ITSSI, SSB_SPROM4_5G_ITSSI_SHIFT); ++ SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, ++ SSB_SPROM4_5G_MAXP, 0); ++ SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM4_5GHL_MAXP, ++ SSB_SPROM4_5GH_MAXP, 0); ++ SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM4_5GHL_MAXP, ++ SSB_SPROM4_5GL_MAXP, SSB_SPROM4_5GL_MAXP_SHIFT); ++ ++ SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SPROM4_5GL_PA_0, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SPROM4_5GL_PA_1, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SPROM4_5GL_PA_2, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gl[3], o + SSB_SPROM4_5GL_PA_3, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SPROM4_5G_PA_0, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SPROM4_5G_PA_1, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SPROM4_5G_PA_2, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5g[3], o + SSB_SPROM4_5G_PA_3, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SPROM4_5GH_PA_0, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SPROM4_5GH_PA_1, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SPROM4_5GH_PA_2, ~0, 0); ++ SPEX(core_pwr_info[i].pa_5gh[3], o + SSB_SPROM4_5GH_PA_3, ~0, 0); ++ } + + sprom_extract_r458(out, in); + @@ -253,7 +308,7 @@ Signed-off-by: Jonas Gorski +{ + int i; + u16 o; -+ u16 pwr_info_offset[] = { ++ static const u16 pwr_info_offset[] = { + SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1, + SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3 + }; @@ -329,14 +384,22 @@ Signed-off-by: Jonas Gorski + SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0); + + /* Extract the antenna gain values. */ -+ SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); -+ SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); -+ SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); -+ SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); ++ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM8_AGAIN01, ++ SSB_SPROM8_AGAIN0, ++ SSB_SPROM8_AGAIN0_SHIFT); ++ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM8_AGAIN01, ++ SSB_SPROM8_AGAIN1, ++ SSB_SPROM8_AGAIN1_SHIFT); ++ out->antenna_gain.a2 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM8_AGAIN23, ++ SSB_SPROM8_AGAIN2, ++ SSB_SPROM8_AGAIN2_SHIFT); ++ out->antenna_gain.a3 = sprom_extract_antgain(out->revision, in, ++ SSB_SPROM8_AGAIN23, ++ SSB_SPROM8_AGAIN3, ++ SSB_SPROM8_AGAIN3_SHIFT); + + /* Extract cores power info info */ + for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { @@ -460,6 +523,7 @@ Signed-off-by: Jonas Gorski + memset(out, 0, sizeof(*out)); + + out->revision = in[size - 1] & 0x00FF; ++ + memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */ + memset(out->et1mac, 0xFF, 6); + @@ -478,7 +542,7 @@ Signed-off-by: Jonas Gorski + break; + default: + pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n", -+ out->revision); ++ out->revision); + out->revision = 1; + sprom_extract_r123(out, in); + } @@ -505,7 +569,7 @@ Signed-off-by: Jonas Gorski switch (data->type) { case SPROM_DEFAULT: memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -@@ -71,6 +550,9 @@ int __init bcm63xx_register_fallback_spr +@@ -71,6 +614,9 @@ int __init bcm63xx_register_fallback_spr return -EINVAL; } diff --git a/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch b/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch index 65c00b5197..0017cc2f6a 100644 --- a/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch +++ b/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch @@ -137,7 +137,7 @@ Signed-off-by: Jonas Gorski static struct ssb_sprom bcm63xx_sprom; int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -@@ -542,6 +658,26 @@ int __init bcm63xx_register_fallback_spr +@@ -606,6 +722,26 @@ int __init bcm63xx_register_fallback_spr u16 size = 0; switch (data->type) { diff --git a/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch b/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch index 24ae8c35c7..eaabbeb432 100644 --- a/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch +++ b/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch @@ -84,7 +84,7 @@ Signed-off-by: Jonas Gorski /* FIXME: use lib_sprom after submission upstream */ -@@ -654,10 +671,11 @@ int __init bcm63xx_register_fallback_spr +@@ -718,10 +735,11 @@ int __init bcm63xx_register_fallback_spr { int ret = 0; @@ -97,7 +97,7 @@ Signed-off-by: Jonas Gorski case SPROM_BCM4306: memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom)); size = ARRAY_SIZE(bcm4306_sprom); -@@ -678,6 +696,7 @@ int __init bcm63xx_register_fallback_spr +@@ -742,6 +760,7 @@ int __init bcm63xx_register_fallback_spr memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom)); size = ARRAY_SIZE(bcm43222_sprom); break; @@ -105,7 +105,7 @@ Signed-off-by: Jonas Gorski case SPROM_DEFAULT: memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, sizeof(bcm63xx_sprom)); -@@ -692,8 +711,19 @@ int __init bcm63xx_register_fallback_spr +@@ -756,8 +775,19 @@ int __init bcm63xx_register_fallback_spr memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); diff --git a/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch b/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch index 5c0abb90e3..d3c40fff43 100644 --- a/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch +++ b/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch @@ -241,7 +241,7 @@ Signed-off-by: Jonas Gorski static struct ssb_sprom bcm63xx_sprom; #if defined(CONFIG_SSB_PCIHOST) -@@ -697,6 +917,42 @@ int __init bcm63xx_register_fallback_spr +@@ -761,6 +981,42 @@ int __init bcm63xx_register_fallback_spr size = ARRAY_SIZE(bcm43222_sprom); break; #endif diff --git a/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch b/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch index 74c2846d5f..ad5ccbab0c 100644 --- a/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch +++ b/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonas Gorski --- a/arch/mips/bcm63xx/sprom.c +++ b/arch/mips/bcm63xx/sprom.c -@@ -883,6 +883,14 @@ static int sprom_extract(struct ssb_spro +@@ -947,6 +947,14 @@ static int sprom_extract(struct ssb_spro return 0; } @@ -31,7 +31,7 @@ Signed-off-by: Jonas Gorski static __initdata u16 template_sprom[220]; #endif -@@ -961,8 +969,12 @@ int __init bcm63xx_register_fallback_spr +@@ -1025,8 +1033,12 @@ int __init bcm63xx_register_fallback_spr return -EINVAL; } diff --git a/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch b/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch index 40591e5f2e..4b994a22c6 100644 --- a/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch +++ b/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch @@ -57,7 +57,7 @@ Signed-off-by: Jonas Gorski return 0; } else { printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -@@ -962,8 +980,8 @@ int __init bcm63xx_register_fallback_spr +@@ -1026,8 +1044,8 @@ int __init bcm63xx_register_fallback_spr break; #endif case SPROM_DEFAULT: @@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski break; default: return -EINVAL; -@@ -973,12 +991,15 @@ int __init bcm63xx_register_fallback_spr +@@ -1037,12 +1055,15 @@ int __init bcm63xx_register_fallback_spr sprom_apply_fixups(template_sprom, data->board_fixups, data->num_board_fixups); From a0e0e621cadbec02fddc1311d4a10b189b3c70f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Tue, 2 Feb 2021 12:11:09 +0100 Subject: [PATCH 3/4] bcm63xx: sprom: override the PCI device ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PCI device ID detected by the wifi drivers on devices using a fallback SPROM is wrong. Currently the chipnum is used for this parameter. Most SSB based Broadcom wifi chips are 2.4 and 5GHz capable. But on devices without a physical SPROM, the only one way to detect if the device suports both bands or only the 5GHz band, is by reading the device ID from the fallback SPROM. In some devices, this may lead to a non working wifi on a 5GHz-only card, or in the best case a working 2.4GHz-only in a dual band wifi card. The offset for the deviceid in SSB SPROMs is 0x0008, whereas in BCMA is 0x0060. This is true for any SPROM version. Override the PCI device ID with the one defined at the fallback SPROM, to detect the correct wifi card model and allow using the 5GHz band if supported. The patch has been tested with the following wifi radios: BCM43222: b43: both 2.4/5GHz working brcm-wl: both 2.4/5GHz working BCM43225: b43: 2.4GHz, working brcmsmac: working brcm-wl: it lacks support BCM43217: b43: 2.4GHz, working brcmsmac: it lacks support brcm-wl: it lacks support Signed-off-by: Daniel González Cabanelas [amend commit description, rework patch to avoid using a new global variable and keep ssb sprom extraction code as close to ssb/pci.c as possible] Signed-off-by: Álvaro Fernández Rojas --- ...CM63XX-fallback-sprom-override-devid.patch | 78 +++++++++++++++++++ .../801-ssb_export_fallback_sprom.patch | 2 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 target/linux/bcm63xx/patches-5.4/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch diff --git a/target/linux/bcm63xx/patches-5.4/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch b/target/linux/bcm63xx/patches-5.4/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch new file mode 100644 index 0000000000..31641aeff2 --- /dev/null +++ b/target/linux/bcm63xx/patches-5.4/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch @@ -0,0 +1,78 @@ +--- a/arch/mips/bcm63xx/sprom.c ++++ b/arch/mips/bcm63xx/sprom.c +@@ -384,6 +384,7 @@ static __initconst u16 bcm4331_sprom[] = + struct fallback_sprom_match { + u8 pci_bus; + u8 pci_dev; ++ int override_devid; + struct ssb_sprom sprom; + }; + +@@ -399,6 +400,8 @@ int bcm63xx_get_fallback_ssb_sprom(struc + fallback_sprom.pci_bus, fallback_sprom.pci_dev, + bus->host_pci->bus->number, + PCI_SLOT(bus->host_pci->devfn)); ++ if (fallback_sprom.override_devid) ++ bus->host_pci->device = fallback_sprom.sprom.dev_id; + memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); + return 0; + } else { +@@ -418,6 +421,8 @@ int bcm63xx_get_fallback_bcma_sprom(stru + fallback_sprom.pci_bus, fallback_sprom.pci_dev, + bus->host_pci->bus->number, + PCI_SLOT(bus->host_pci->devfn)); ++ if (fallback_sprom.override_devid) ++ bus->host_pci->device = fallback_sprom.sprom.dev_id; + memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); + return 0; + } else { +@@ -965,6 +970,37 @@ static int sprom_extract(struct ssb_spro + return 0; + } + ++int sprom_override_devid(struct fallback_sprom_data *data, ++ struct ssb_sprom *out, const u16 *in) ++{ ++ switch (data->type) { ++#if defined(CONFIG_SSB_PCIHOST) ++ case SPROM_BCM4306: ++ case SPROM_BCM4318: ++ case SPROM_BCM4321: ++ case SPROM_BCM4322: ++ case SPROM_BCM43222: ++ SPEX(dev_id, SSB_SPROM1_PID, 0xFFFF, 0); ++ return !!out->dev_id; ++#endif /* CONFIG_SSB_PCIHOST */ ++#if defined(CONFIG_BCMA_HOST_PCI) ++ case SPROM_BCM4313: ++ case SPROM_BCM43131: ++ case SPROM_BCM43217: ++ case SPROM_BCM43225: ++ case SPROM_BCM43227: ++ case SPROM_BCM43228: ++ case SPROM_BCM4331: ++ SPEX(dev_id, 0x0060, 0xFFFF, 0); ++ return !!out->dev_id; ++#endif /* CONFIG_BCMA_HOST_PCI */ ++ case SPROM_DEFAULT: ++ return 0; ++ } ++ ++ return 0; ++} ++ + void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n) + { + unsigned int i; +@@ -1056,6 +1092,11 @@ int __init bcm63xx_register_fallback_spr + data->num_board_fixups); + + sprom_extract(&fallback_sprom.sprom, template_sprom, size); ++ ++ fallback_sprom.override_devid = ++ sprom_override_devid(data, &fallback_sprom.sprom, template_sprom); ++ } else { ++ fallback_sprom.override_devid = 0; + } + + memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN); diff --git a/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch b/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch index 11a83536b7..6e4e05a63b 100644 --- a/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch +++ b/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -387,7 +388,19 @@ struct fallback_sprom_match { +@@ -388,7 +389,19 @@ struct fallback_sprom_match { struct ssb_sprom sprom; }; From abe348168b282786208a1959d2a80794fdd82f2b Mon Sep 17 00:00:00 2001 From: Curtis Deptuck Date: Mon, 1 Feb 2021 14:03:47 -0700 Subject: [PATCH 4/4] iptables: update to 1.8.7 ChangeLog: https://netfilter.org/projects/iptables/files/changes-iptables-1.8.7.txt Refresh patch: None required Signed-off-by: Curtis Deptuck --- package/network/utils/iptables/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index c4b87f0df6..9f033de72f 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables -PKG_VERSION:=1.8.6 +PKG_VERSION:=1.8.7 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_HASH:=a0f4fe0c3eb8faa5bd9c8376d132f340b9558e750c91deb2d5028aa3d0047767 +PKG_HASH:=c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0 PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared