mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
Merge Official Source
Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
commit
055e9e6fe2
111
package/boot/arm-trusted-firmware-mediatek/Makefile
Normal file
111
package/boot/arm-trusted-firmware-mediatek/Makefile
Normal file
@ -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 <daniel@makrotopia.org>
|
||||
|
||||
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))
|
@ -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
|
||||
|
@ -12,7 +12,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
|
||||
--- 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 <jogo@openwrt.org>
|
||||
+ } 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 <jogo@openwrt.org>
|
||||
+ 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 <jogo@openwrt.org>
|
||||
+
|
||||
+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 <jogo@openwrt.org>
|
||||
+ }
|
||||
+
|
||||
+ /* 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 <jogo@openwrt.org>
|
||||
+{
|
||||
+ 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 <jogo@openwrt.org>
|
||||
+ 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 <jogo@openwrt.org>
|
||||
+ 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 <jogo@openwrt.org>
|
||||
+ 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 <jogo@openwrt.org>
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
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) {
|
||||
|
@ -84,7 +84,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
|
||||
/* 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 <jogo@openwrt.org>
|
||||
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 <jogo@openwrt.org>
|
||||
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);
|
||||
|
@ -241,7 +241,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
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
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
|
||||
--- 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 <jogo@openwrt.org>
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
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 <jogo@openwrt.org>
|
||||
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);
|
||||
|
||||
|
@ -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);
|
@ -8,7 +8,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/platform_device.h>
|
||||
@@ -387,7 +388,19 @@ struct fallback_sprom_match {
|
||||
@@ -388,7 +389,19 @@ struct fallback_sprom_match {
|
||||
struct ssb_sprom sprom;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user