diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-04-07 11:54:18 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-04-07 11:54:18 +0000 |
commit | 3fa00eeda227f7e2f182718509a8a3b8cc163668 (patch) | |
tree | 1884133421c05d053073c5a8cf801e0f909db8db /target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch | |
parent | beca028bd6bb71898052faadff680d8e76f61eb3 (diff) | |
download | master-31e0f0ae-3fa00eeda227f7e2f182718509a8a3b8cc163668.tar.gz master-31e0f0ae-3fa00eeda227f7e2f182718509a8a3b8cc163668.tar.bz2 master-31e0f0ae-3fa00eeda227f7e2f182718509a8a3b8cc163668.zip |
brcm47xx: group MIPS BCM47XX backported patches by source kernel
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 45287
Diffstat (limited to 'target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch')
-rw-r--r-- | target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch b/target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch new file mode 100644 index 0000000000..095338f61d --- /dev/null +++ b/target/linux/brcm47xx/patches-3.18/031-01-MIPS-BCM47XX-Support-SPROM-prefixes-for-PCI-devices.patch @@ -0,0 +1,73 @@ +From 9a6a2b96dfd8b01336f8519a5be7fb353cfa62fb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Sat, 14 Mar 2015 17:55:54 +0100 +Subject: [PATCH] MIPS: BCM47XX: Support SPROM prefixes for PCI devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support parsing SPROMs with prefixes defined like devpath1=pci/1/1 + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +Cc: linux-mips@linux-mips.org +Cc: Hauke Mehrtens <hauke@hauke-m.de> +Patchwork: https://patchwork.linux-mips.org/patch/9552/ +Signed-off-by: Ralf Baechle <ralf@linux-mips.org> +--- + arch/mips/bcm47xx/sprom.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c +index 2eff7fe..eff9205 100644 +--- a/arch/mips/bcm47xx/sprom.c ++++ b/arch/mips/bcm47xx/sprom.c +@@ -836,6 +836,38 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) + #endif + + #if defined(CONFIG_BCM47XX_BCMA) ++/* ++ * Having many NVRAM entries for PCI devices led to repeating prefixes like ++ * pci/1/1/ all the time and wasting flash space. So at some point Broadcom ++ * decided to introduce prefixes like 0: 1: 2: etc. ++ * If we find e.g. devpath0=pci/2/1 or devpath0=pci/2/1/ we should use 0: ++ * instead of pci/2/1/. ++ */ ++static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size) ++{ ++ size_t prefix_len = strlen(prefix); ++ size_t short_len = prefix_len - 1; ++ char nvram_var[10]; ++ char buf[20]; ++ int i; ++ ++ /* Passed prefix has to end with a slash */ ++ if (prefix_len <= 0 || prefix[prefix_len - 1] != '/') ++ return; ++ ++ for (i = 0; i < 3; i++) { ++ if (snprintf(nvram_var, sizeof(nvram_var), "devpath%d", i) <= 0) ++ continue; ++ if (bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf)) < 0) ++ continue; ++ if (!strcmp(buf, prefix) || ++ (short_len && strlen(buf) == short_len && !strncmp(buf, prefix, short_len))) { ++ snprintf(prefix, prefix_size, "%d:", i); ++ return; ++ } ++ } ++} ++ + static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) + { + char prefix[10]; +@@ -847,6 +879,7 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) + snprintf(prefix, sizeof(prefix), "pci/%u/%u/", + bus->host_pci->bus->number + 1, + PCI_SLOT(bus->host_pci->devfn)); ++ bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix)); + bcm47xx_fill_sprom(out, prefix, false); + return 0; + case BCMA_HOSTTYPE_SOC: +-- +1.8.4.5 + |