diff options
-rw-r--r-- | arch/x86/kernel/early-quirks.c | 64 | ||||
-rw-r--r-- | drivers/bcma/bcma_private.h | 2 | ||||
-rw-r--r-- | include/linux/bcma/bcma.h | 1 |
3 files changed, 65 insertions, 2 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index ea60c05c2487..57b71373bae3 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -11,7 +11,11 @@ | |||
11 | 11 | ||
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/acpi.h> | 13 | #include <linux/acpi.h> |
14 | #include <linux/delay.h> | ||
15 | #include <linux/dmi.h> | ||
14 | #include <linux/pci_ids.h> | 16 | #include <linux/pci_ids.h> |
17 | #include <linux/bcma/bcma.h> | ||
18 | #include <linux/bcma/bcma_regs.h> | ||
15 | #include <drm/i915_drm.h> | 19 | #include <drm/i915_drm.h> |
16 | #include <asm/pci-direct.h> | 20 | #include <asm/pci-direct.h> |
17 | #include <asm/dma.h> | 21 | #include <asm/dma.h> |
@@ -21,6 +25,9 @@ | |||
21 | #include <asm/iommu.h> | 25 | #include <asm/iommu.h> |
22 | #include <asm/gart.h> | 26 | #include <asm/gart.h> |
23 | #include <asm/irq_remapping.h> | 27 | #include <asm/irq_remapping.h> |
28 | #include <asm/early_ioremap.h> | ||
29 | |||
30 | #define dev_err(msg) pr_err("pci 0000:%02x:%02x.%d: %s", bus, slot, func, msg) | ||
24 | 31 | ||
25 | static void __init fix_hypertransport_config(int num, int slot, int func) | 32 | static void __init fix_hypertransport_config(int num, int slot, int func) |
26 | { | 33 | { |
@@ -597,6 +604,61 @@ static void __init force_disable_hpet(int num, int slot, int func) | |||
597 | #endif | 604 | #endif |
598 | } | 605 | } |
599 | 606 | ||
607 | #define BCM4331_MMIO_SIZE 16384 | ||
608 | #define BCM4331_PM_CAP 0x40 | ||
609 | #define bcma_aread32(reg) ioread32(mmio + 1 * BCMA_CORE_SIZE + reg) | ||
610 | #define bcma_awrite32(reg, val) iowrite32(val, mmio + 1 * BCMA_CORE_SIZE + reg) | ||
611 | |||
612 | static void __init apple_airport_reset(int bus, int slot, int func) | ||
613 | { | ||
614 | void __iomem *mmio; | ||
615 | u16 pmcsr; | ||
616 | u64 addr; | ||
617 | int i; | ||
618 | |||
619 | if (!dmi_match(DMI_SYS_VENDOR, "Apple Inc.")) | ||
620 | return; | ||
621 | |||
622 | /* Card may have been put into PCI_D3hot by grub quirk */ | ||
623 | pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL); | ||
624 | |||
625 | if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) { | ||
626 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | ||
627 | write_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr); | ||
628 | mdelay(10); | ||
629 | |||
630 | pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL); | ||
631 | if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) { | ||
632 | dev_err("Cannot power up Apple AirPort card\n"); | ||
633 | return; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | addr = read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0); | ||
638 | addr |= (u64)read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_1) << 32; | ||
639 | addr &= PCI_BASE_ADDRESS_MEM_MASK; | ||
640 | |||
641 | mmio = early_ioremap(addr, BCM4331_MMIO_SIZE); | ||
642 | if (!mmio) { | ||
643 | dev_err("Cannot iomap Apple AirPort card\n"); | ||
644 | return; | ||
645 | } | ||
646 | |||
647 | pr_info("Resetting Apple AirPort card (left enabled by EFI)\n"); | ||
648 | |||
649 | for (i = 0; bcma_aread32(BCMA_RESET_ST) && i < 30; i++) | ||
650 | udelay(10); | ||
651 | |||
652 | bcma_awrite32(BCMA_RESET_CTL, BCMA_RESET_CTL_RESET); | ||
653 | bcma_aread32(BCMA_RESET_CTL); | ||
654 | udelay(1); | ||
655 | |||
656 | bcma_awrite32(BCMA_RESET_CTL, 0); | ||
657 | bcma_aread32(BCMA_RESET_CTL); | ||
658 | udelay(10); | ||
659 | |||
660 | early_iounmap(mmio, BCM4331_MMIO_SIZE); | ||
661 | } | ||
600 | 662 | ||
601 | #define QFLAG_APPLY_ONCE 0x1 | 663 | #define QFLAG_APPLY_ONCE 0x1 |
602 | #define QFLAG_APPLIED 0x2 | 664 | #define QFLAG_APPLIED 0x2 |
@@ -639,6 +701,8 @@ static struct chipset early_qrk[] __initdata = { | |||
639 | */ | 701 | */ |
640 | { PCI_VENDOR_ID_INTEL, 0x0f00, | 702 | { PCI_VENDOR_ID_INTEL, 0x0f00, |
641 | PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, | 703 | PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
704 | { PCI_VENDOR_ID_BROADCOM, 0x4331, | ||
705 | PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset}, | ||
642 | {} | 706 | {} |
643 | }; | 707 | }; |
644 | 708 | ||
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index eda09090cb52..f642c4264c27 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #include <linux/bcma/bcma.h> | 8 | #include <linux/bcma/bcma.h> |
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | 10 | ||
11 | #define BCMA_CORE_SIZE 0x1000 | ||
12 | |||
13 | #define bcma_err(bus, fmt, ...) \ | 11 | #define bcma_err(bus, fmt, ...) \ |
14 | pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) | 12 | pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) |
15 | #define bcma_warn(bus, fmt, ...) \ | 13 | #define bcma_warn(bus, fmt, ...) \ |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index e6b41f42602b..3db25df396cb 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -159,6 +159,7 @@ struct bcma_host_ops { | |||
159 | #define BCMA_CORE_DEFAULT 0xFFF | 159 | #define BCMA_CORE_DEFAULT 0xFFF |
160 | 160 | ||
161 | #define BCMA_MAX_NR_CORES 16 | 161 | #define BCMA_MAX_NR_CORES 16 |
162 | #define BCMA_CORE_SIZE 0x1000 | ||
162 | 163 | ||
163 | /* Chip IDs of PCIe devices */ | 164 | /* Chip IDs of PCIe devices */ |
164 | #define BCMA_CHIP_ID_BCM4313 0x4313 | 165 | #define BCMA_CHIP_ID_BCM4313 0x4313 |