mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 21:58:04 +00:00
387fd3ca26
Add 3.18 support based on 3.18-rc6. Only netboot tested. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 43461
103 lines
3.8 KiB
Diff
103 lines
3.8 KiB
Diff
From f393eaacf178e7e8a61eb11a96edd7dfb35cb49d Mon Sep 17 00:00:00 2001
|
|
From: Jonas Gorski <jogo@openwrt.org>
|
|
Date: Thu, 31 Jul 2014 20:39:44 +0200
|
|
Subject: [PATCH 10/10] MIPS: BCM63XX: allow setting a pci bus/device for
|
|
fallback sprom
|
|
|
|
Warn if the set pci bus/slot does not match the actual request.
|
|
|
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|
---
|
|
arch/mips/bcm63xx/sprom.c | 31 ++++++++++++++++++----
|
|
.../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 3 +++
|
|
2 files changed, 29 insertions(+), 5 deletions(-)
|
|
|
|
--- a/arch/mips/bcm63xx/sprom.c
|
|
+++ b/arch/mips/bcm63xx/sprom.c
|
|
@@ -381,13 +381,25 @@ static __initconst u16 bcm4331_sprom[] =
|
|
|
|
#endif /* CONFIG_BCMA_HOST_PCI */
|
|
|
|
-static struct ssb_sprom bcm63xx_sprom;
|
|
+struct fallback_sprom_match {
|
|
+ u8 pci_bus;
|
|
+ u8 pci_dev;
|
|
+ struct ssb_sprom sprom;
|
|
+};
|
|
+
|
|
+static struct fallback_sprom_match fallback_sprom;
|
|
|
|
#if defined(CONFIG_SSB_PCIHOST)
|
|
int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
|
|
{
|
|
if (bus->bustype == SSB_BUSTYPE_PCI) {
|
|
- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
|
|
+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus ||
|
|
+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev)
|
|
+ pr_warn("ssb_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n",
|
|
+ fallback_sprom.pci_bus, fallback_sprom.pci_dev,
|
|
+ bus->host_pci->bus->number,
|
|
+ PCI_SLOT(bus->host_pci->devfn));
|
|
+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
|
|
return 0;
|
|
} else {
|
|
printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
|
|
@@ -400,7 +412,13 @@ int bcm63xx_get_fallback_ssb_sprom(struc
|
|
int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out)
|
|
{
|
|
if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
|
|
- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
|
|
+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus ||
|
|
+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev)
|
|
+ pr_warn("bcma_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n",
|
|
+ fallback_sprom.pci_bus, fallback_sprom.pci_dev,
|
|
+ bus->host_pci->bus->number,
|
|
+ PCI_SLOT(bus->host_pci->devfn));
|
|
+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
|
|
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
|
|
break;
|
|
#endif
|
|
case SPROM_DEFAULT:
|
|
- memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
|
|
- sizeof(bcm63xx_sprom));
|
|
+ memcpy(&fallback_sprom.sprom, &bcm63xx_default_sprom,
|
|
+ sizeof(bcm63xx_default_sprom));
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
@@ -973,12 +991,15 @@ int __init bcm63xx_register_fallback_spr
|
|
sprom_apply_fixups(template_sprom, data->board_fixups,
|
|
data->num_board_fixups);
|
|
|
|
- sprom_extract(&bcm63xx_sprom, template_sprom, size);
|
|
+ sprom_extract(&fallback_sprom.sprom, template_sprom, size);
|
|
}
|
|
|
|
- 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);
|
|
+ memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN);
|
|
+ memcpy(fallback_sprom.sprom.et0mac, data->mac_addr, ETH_ALEN);
|
|
+ memcpy(fallback_sprom.sprom.et1mac, data->mac_addr, ETH_ALEN);
|
|
+
|
|
+ fallback_sprom.pci_bus = data->pci_bus;
|
|
+ fallback_sprom.pci_dev = data->pci_dev;
|
|
#endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */
|
|
|
|
#if defined(CONFIG_SSB_PCIHOST)
|
|
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
|
|
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
|
|
@@ -30,6 +30,9 @@ struct fallback_sprom_data {
|
|
u8 mac_addr[ETH_ALEN];
|
|
enum sprom_type type;
|
|
|
|
+ u8 pci_bus;
|
|
+ u8 pci_dev;
|
|
+
|
|
struct sprom_fixup *board_fixups;
|
|
unsigned int num_board_fixups;
|
|
};
|