2011-05-09 23:56:46 +07:00
|
|
|
#ifndef LINUX_BCMA_H_
|
|
|
|
#define LINUX_BCMA_H_
|
|
|
|
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
|
2016-04-14 16:37:43 +07:00
|
|
|
#include <linux/bcma/bcma_driver_arm_c9.h>
|
2011-05-09 23:56:46 +07:00
|
|
|
#include <linux/bcma/bcma_driver_chipcommon.h>
|
|
|
|
#include <linux/bcma/bcma_driver_pci.h>
|
2014-07-05 06:10:41 +07:00
|
|
|
#include <linux/bcma/bcma_driver_pcie2.h>
|
2011-07-23 06:20:09 +07:00
|
|
|
#include <linux/bcma/bcma_driver_mips.h>
|
2012-07-11 14:23:43 +07:00
|
|
|
#include <linux/bcma/bcma_driver_gmac_cmn.h>
|
2011-06-02 07:08:51 +07:00
|
|
|
#include <linux/ssb/ssb.h> /* SPROM sharing */
|
2011-05-09 23:56:46 +07:00
|
|
|
|
2012-10-03 00:01:25 +07:00
|
|
|
#include <linux/bcma/bcma_regs.h>
|
2011-05-09 23:56:46 +07:00
|
|
|
|
|
|
|
struct bcma_device;
|
|
|
|
struct bcma_bus;
|
|
|
|
|
|
|
|
enum bcma_hosttype {
|
|
|
|
BCMA_HOSTTYPE_PCI,
|
|
|
|
BCMA_HOSTTYPE_SDIO,
|
2011-07-23 06:20:08 +07:00
|
|
|
BCMA_HOSTTYPE_SOC,
|
2011-05-09 23:56:46 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bcma_chipinfo {
|
|
|
|
u16 id;
|
|
|
|
u8 rev;
|
|
|
|
u8 pkg;
|
|
|
|
};
|
|
|
|
|
2012-04-29 07:04:08 +07:00
|
|
|
struct bcma_boardinfo {
|
|
|
|
u16 vendor;
|
|
|
|
u16 type;
|
|
|
|
};
|
|
|
|
|
2011-07-17 06:06:04 +07:00
|
|
|
enum bcma_clkmode {
|
|
|
|
BCMA_CLKMODE_FAST,
|
|
|
|
BCMA_CLKMODE_DYNAMIC,
|
|
|
|
};
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
struct bcma_host_ops {
|
|
|
|
u8 (*read8)(struct bcma_device *core, u16 offset);
|
|
|
|
u16 (*read16)(struct bcma_device *core, u16 offset);
|
|
|
|
u32 (*read32)(struct bcma_device *core, u16 offset);
|
|
|
|
void (*write8)(struct bcma_device *core, u16 offset, u8 value);
|
|
|
|
void (*write16)(struct bcma_device *core, u16 offset, u16 value);
|
|
|
|
void (*write32)(struct bcma_device *core, u16 offset, u32 value);
|
2011-05-20 08:27:06 +07:00
|
|
|
#ifdef CONFIG_BCMA_BLOCKIO
|
|
|
|
void (*block_read)(struct bcma_device *core, void *buffer,
|
|
|
|
size_t count, u16 offset, u8 reg_width);
|
|
|
|
void (*block_write)(struct bcma_device *core, const void *buffer,
|
|
|
|
size_t count, u16 offset, u8 reg_width);
|
|
|
|
#endif
|
2011-05-09 23:56:46 +07:00
|
|
|
/* Agent ops */
|
|
|
|
u32 (*aread32)(struct bcma_device *core, u16 offset);
|
|
|
|
void (*awrite32)(struct bcma_device *core, u16 offset, u32 value);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Core manufacturers */
|
|
|
|
#define BCMA_MANUF_ARM 0x43B
|
|
|
|
#define BCMA_MANUF_MIPS 0x4A7
|
|
|
|
#define BCMA_MANUF_BCM 0x4BF
|
|
|
|
|
|
|
|
/* Core class values. */
|
|
|
|
#define BCMA_CL_SIM 0x0
|
|
|
|
#define BCMA_CL_EROM 0x1
|
|
|
|
#define BCMA_CL_CORESIGHT 0x9
|
|
|
|
#define BCMA_CL_VERIF 0xB
|
|
|
|
#define BCMA_CL_OPTIMO 0xD
|
|
|
|
#define BCMA_CL_GEN 0xE
|
|
|
|
#define BCMA_CL_PRIMECELL 0xF
|
|
|
|
|
|
|
|
/* Core-ID values. */
|
|
|
|
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
|
2012-06-26 03:12:20 +07:00
|
|
|
#define BCMA_CORE_4706_CHIPCOMMON 0x500
|
2014-07-31 04:21:06 +07:00
|
|
|
#define BCMA_CORE_NS_PCIEG2 0x501
|
|
|
|
#define BCMA_CORE_NS_DMA 0x502
|
|
|
|
#define BCMA_CORE_NS_SDIO3 0x503
|
|
|
|
#define BCMA_CORE_NS_USB20 0x504
|
|
|
|
#define BCMA_CORE_NS_USB30 0x505
|
|
|
|
#define BCMA_CORE_NS_A9JTAG 0x506
|
|
|
|
#define BCMA_CORE_NS_DDR23 0x507
|
|
|
|
#define BCMA_CORE_NS_ROM 0x508
|
|
|
|
#define BCMA_CORE_NS_NAND 0x509
|
|
|
|
#define BCMA_CORE_NS_QSPI 0x50A
|
|
|
|
#define BCMA_CORE_NS_CHIPCOMMON_B 0x50B
|
2012-06-26 03:12:20 +07:00
|
|
|
#define BCMA_CORE_4706_SOC_RAM 0x50E
|
bcma: add some more core names
These cores were found on a BCM4708 (chipid 53010), this is a ARM SoC
with two Cortex A9 cores.
bcma: bus0: Found chip with id 0xCF12, rev 0x00 and package 0x02
bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2A, class 0x0)
bcma: bus0: Core 1 found: DMA (manuf 0x4BF, id 0x502, rev 0x01, class 0x0)
bcma: bus0: Core 2 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 3 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 4 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 5 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 6 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
bcma: bus0: Core 7 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
bcma: bus0: Core 8 found: ARM Cortex A9 core (ihost) (manuf 0x4BF, id 0x510, rev 0x01, class 0x0)
bcma: bus0: Core 9 found: USB 2.0 (manuf 0x4BF, id 0x504, rev 0x01, class 0x0)
bcma: bus0: Core 10 found: USB 3.0 (manuf 0x4BF, id 0x505, rev 0x01, class 0x0)
bcma: bus0: Core 11 found: SDIO3 (manuf 0x4BF, id 0x503, rev 0x01, class 0x0)
bcma: bus0: Core 12 found: ARM Cortex A9 JTAG (manuf 0x4BF, id 0x506, rev 0x01, class 0x0)
bcma: bus0: Core 13 found: Denali DDR2/DDR3 memory controller (manuf 0x4BF, id 0x507, rev 0x01, class 0x0)
bcma: bus0: Core 14 found: ROM (manuf 0x4BF, id 0x508, rev 0x01, class 0x0)
bcma: bus0: Core 15 found: NAND flash controller (manuf 0x4BF, id 0x509, rev 0x01, class 0x0)
bcma: bus0: Core 16 found: SPI flash controller (manuf 0x4BF, id 0x50A, rev 0x01, class 0x0)
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-07-15 18:15:04 +07:00
|
|
|
#define BCMA_CORE_ARMCA9 0x510
|
2012-06-26 03:12:20 +07:00
|
|
|
#define BCMA_CORE_4706_MAC_GBIT 0x52D
|
|
|
|
#define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */
|
|
|
|
#define BCMA_CORE_ALTA 0x534 /* I2S core */
|
|
|
|
#define BCMA_CORE_4706_MAC_GBIT_COMMON 0x5DC
|
|
|
|
#define BCMA_CORE_DDR23_PHY 0x5DD
|
2011-05-09 23:56:46 +07:00
|
|
|
#define BCMA_CORE_INVALID 0x700
|
|
|
|
#define BCMA_CORE_CHIPCOMMON 0x800
|
|
|
|
#define BCMA_CORE_ILINE20 0x801
|
|
|
|
#define BCMA_CORE_SRAM 0x802
|
|
|
|
#define BCMA_CORE_SDRAM 0x803
|
|
|
|
#define BCMA_CORE_PCI 0x804
|
|
|
|
#define BCMA_CORE_MIPS 0x805
|
|
|
|
#define BCMA_CORE_ETHERNET 0x806
|
|
|
|
#define BCMA_CORE_V90 0x807
|
|
|
|
#define BCMA_CORE_USB11_HOSTDEV 0x808
|
|
|
|
#define BCMA_CORE_ADSL 0x809
|
|
|
|
#define BCMA_CORE_ILINE100 0x80A
|
|
|
|
#define BCMA_CORE_IPSEC 0x80B
|
|
|
|
#define BCMA_CORE_UTOPIA 0x80C
|
|
|
|
#define BCMA_CORE_PCMCIA 0x80D
|
|
|
|
#define BCMA_CORE_INTERNAL_MEM 0x80E
|
|
|
|
#define BCMA_CORE_MEMC_SDRAM 0x80F
|
|
|
|
#define BCMA_CORE_OFDM 0x810
|
|
|
|
#define BCMA_CORE_EXTIF 0x811
|
|
|
|
#define BCMA_CORE_80211 0x812
|
|
|
|
#define BCMA_CORE_PHY_A 0x813
|
|
|
|
#define BCMA_CORE_PHY_B 0x814
|
|
|
|
#define BCMA_CORE_PHY_G 0x815
|
|
|
|
#define BCMA_CORE_MIPS_3302 0x816
|
|
|
|
#define BCMA_CORE_USB11_HOST 0x817
|
|
|
|
#define BCMA_CORE_USB11_DEV 0x818
|
|
|
|
#define BCMA_CORE_USB20_HOST 0x819
|
|
|
|
#define BCMA_CORE_USB20_DEV 0x81A
|
|
|
|
#define BCMA_CORE_SDIO_HOST 0x81B
|
|
|
|
#define BCMA_CORE_ROBOSWITCH 0x81C
|
|
|
|
#define BCMA_CORE_PARA_ATA 0x81D
|
|
|
|
#define BCMA_CORE_SATA_XORDMA 0x81E
|
|
|
|
#define BCMA_CORE_ETHERNET_GBIT 0x81F
|
|
|
|
#define BCMA_CORE_PCIE 0x820
|
|
|
|
#define BCMA_CORE_PHY_N 0x821
|
|
|
|
#define BCMA_CORE_SRAM_CTL 0x822
|
|
|
|
#define BCMA_CORE_MINI_MACPHY 0x823
|
|
|
|
#define BCMA_CORE_ARM_1176 0x824
|
|
|
|
#define BCMA_CORE_ARM_7TDMI 0x825
|
|
|
|
#define BCMA_CORE_PHY_LP 0x826
|
|
|
|
#define BCMA_CORE_PMU 0x827
|
|
|
|
#define BCMA_CORE_PHY_SSN 0x828
|
|
|
|
#define BCMA_CORE_SDIO_DEV 0x829
|
|
|
|
#define BCMA_CORE_ARM_CM3 0x82A
|
|
|
|
#define BCMA_CORE_PHY_HT 0x82B
|
|
|
|
#define BCMA_CORE_MIPS_74K 0x82C
|
|
|
|
#define BCMA_CORE_MAC_GBIT 0x82D
|
|
|
|
#define BCMA_CORE_DDR12_MEM_CTL 0x82E
|
|
|
|
#define BCMA_CORE_PCIE_RC 0x82F /* PCIe Root Complex */
|
|
|
|
#define BCMA_CORE_OCP_OCP_BRIDGE 0x830
|
|
|
|
#define BCMA_CORE_SHARED_COMMON 0x831
|
|
|
|
#define BCMA_CORE_OCP_AHB_BRIDGE 0x832
|
|
|
|
#define BCMA_CORE_SPI_HOST 0x833
|
|
|
|
#define BCMA_CORE_I2S 0x834
|
|
|
|
#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */
|
|
|
|
#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */
|
2013-05-10 02:24:24 +07:00
|
|
|
#define BCMA_CORE_PHY_AC 0x83B
|
|
|
|
#define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */
|
|
|
|
#define BCMA_CORE_USB30_DEV 0x83D
|
|
|
|
#define BCMA_CORE_ARM_CR4 0x83E
|
2016-01-16 06:48:52 +07:00
|
|
|
#define BCMA_CORE_GCI 0x840
|
|
|
|
#define BCMA_CORE_CMEM 0x846 /* CNDS DDR2/3 memory controller */
|
2015-09-19 03:08:17 +07:00
|
|
|
#define BCMA_CORE_ARM_CA7 0x847
|
|
|
|
#define BCMA_CORE_SYS_MEM 0x849
|
2011-05-09 23:56:46 +07:00
|
|
|
#define BCMA_CORE_DEFAULT 0xFFF
|
|
|
|
|
|
|
|
#define BCMA_MAX_NR_CORES 16
|
x86/quirks: Add early quirk to reset Apple AirPort card
The EFI firmware on Macs contains a full-fledged network stack for
downloading OS X images from osrecovery.apple.com. Unfortunately
on Macs introduced 2011 and 2012, EFI brings up the Broadcom 4331
wireless card on every boot and leaves it enabled even after
ExitBootServices has been called. The card continues to assert its IRQ
line, causing spurious interrupts if the IRQ is shared. It also corrupts
memory by DMAing received packets, allowing for remote code execution
over the air. This only stops when a driver is loaded for the wireless
card, which may be never if the driver is not installed or blacklisted.
The issue seems to be constrained to the Broadcom 4331. Chris Milsted
has verified that the newer Broadcom 4360 built into the MacBookPro11,3
(2013/2014) does not exhibit this behaviour. The chances that Apple will
ever supply a firmware fix for the older machines appear to be zero.
The solution is to reset the card on boot by writing to a reset bit in
its mmio space. This must be done as an early quirk and not as a plain
vanilla PCI quirk to successfully combat memory corruption by DMAed
packets: Matthew Garrett found out in 2012 that the packets are written
to EfiBootServicesData memory (http://mjg59.dreamwidth.org/11235.html).
This type of memory is made available to the page allocator by
efi_free_boot_services(). Plain vanilla PCI quirks run much later, in
subsys initcall level. In-between a time window would be open for memory
corruption. Random crashes occurring in this time window and attributed
to DMAed packets have indeed been observed in the wild by Chris
Bainbridge.
When Matthew Garrett analyzed the memory corruption issue in 2012, he
sought to fix it with a grub quirk which transitions the card to D3hot:
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=9d34bb85da56
This approach does not help users with other bootloaders and while it
may prevent DMAed packets, it does not cure the spurious interrupts
emanating from the card. Unfortunately the card's mmio space is
inaccessible in D3hot, so to reset it, we have to undo the effect of
Matthew's grub patch and transition the card back to D0.
Note that the quirk takes a few shortcuts to reduce the amount of code:
The size of BAR 0 and the location of the PM capability is identical
on all affected machines and therefore hardcoded. Only the address of
BAR 0 differs between models. Also, it is assumed that the BCMA core
currently mapped is the 802.11 core. The EFI driver seems to always take
care of this.
Michael Büsch, Bjorn Helgaas and Matt Fleming contributed feedback
towards finding the best solution to this problem.
The following should be a comprehensive list of affected models:
iMac13,1 2012 21.5" [Root Port 00:1c.3 = 8086:1e16]
iMac13,2 2012 27" [Root Port 00:1c.3 = 8086:1e16]
Macmini5,1 2011 i5 2.3 GHz [Root Port 00:1c.1 = 8086:1c12]
Macmini5,2 2011 i5 2.5 GHz [Root Port 00:1c.1 = 8086:1c12]
Macmini5,3 2011 i7 2.0 GHz [Root Port 00:1c.1 = 8086:1c12]
Macmini6,1 2012 i5 2.5 GHz [Root Port 00:1c.1 = 8086:1e12]
Macmini6,2 2012 i7 2.3 GHz [Root Port 00:1c.1 = 8086:1e12]
MacBookPro8,1 2011 13" [Root Port 00:1c.1 = 8086:1c12]
MacBookPro8,2 2011 15" [Root Port 00:1c.1 = 8086:1c12]
MacBookPro8,3 2011 17" [Root Port 00:1c.1 = 8086:1c12]
MacBookPro9,1 2012 15" [Root Port 00:1c.1 = 8086:1e12]
MacBookPro9,2 2012 13" [Root Port 00:1c.1 = 8086:1e12]
MacBookPro10,1 2012 15" [Root Port 00:1c.1 = 8086:1e12]
MacBookPro10,2 2012 13" [Root Port 00:1c.1 = 8086:1e12]
For posterity, spurious interrupts caused by the Broadcom 4331 wireless
card resulted in splats like this (stacktrace omitted):
irq 17: nobody cared (try booting with the "irqpoll" option)
handlers:
[<ffffffff81374370>] pcie_isr
[<ffffffffc0704550>] sdhci_irq [sdhci] threaded [<ffffffffc07013c0>] sdhci_thread_irq [sdhci]
[<ffffffffc0a0b960>] azx_interrupt [snd_hda_codec]
Disabling IRQ #17
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79301
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111781
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=728916
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=895951#c16
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1009819
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1098621
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1149632#c5
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1279130
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1332732
Tested-by: Konstantin Simanov <k.simanov@stlk.ru> # [MacBookPro8,1]
Tested-by: Lukas Wunner <lukas@wunner.de> # [MacBookPro9,1]
Tested-by: Bryan Paradis <bryan.paradis@gmail.com> # [MacBookPro9,2]
Tested-by: Andrew Worsley <amworsley@gmail.com> # [MacBookPro10,1]
Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com> # [MacBookPro10,2]
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris Milsted <cmilsted@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Michael Buesch <m@bues.ch>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: b43-dev@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: stable@vger.kernel.org # 123456789abc: x86/quirks: Apply nvidia_bugs quirk only on root bus
Cc: stable@vger.kernel.org # 123456789abc: x86/quirks: Reintroduce scanning of secondary buses
Link: http://lkml.kernel.org/r/48d0972ac82a53d460e5fce77a07b2560db95203.1465690253.git.lukas@wunner.de
[ Did minor readability edits. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-06-12 17:31:53 +07:00
|
|
|
#define BCMA_CORE_SIZE 0x1000
|
2011-05-09 23:56:46 +07:00
|
|
|
|
2012-06-30 06:44:38 +07:00
|
|
|
/* Chip IDs of PCIe devices */
|
|
|
|
#define BCMA_CHIP_ID_BCM4313 0x4313
|
2013-06-26 15:02:11 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM43142 43142
|
2014-07-24 20:29:18 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM43131 43131
|
2014-07-16 00:44:28 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM43217 43217
|
2014-07-18 00:31:05 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM43222 43222
|
2012-06-30 06:44:38 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM43224 43224
|
|
|
|
#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
|
|
|
|
#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
|
|
|
|
#define BCMA_CHIP_ID_BCM43225 43225
|
|
|
|
#define BCMA_CHIP_ID_BCM43227 43227
|
|
|
|
#define BCMA_CHIP_ID_BCM43228 43228
|
|
|
|
#define BCMA_CHIP_ID_BCM43421 43421
|
|
|
|
#define BCMA_CHIP_ID_BCM43428 43428
|
|
|
|
#define BCMA_CHIP_ID_BCM43431 43431
|
|
|
|
#define BCMA_CHIP_ID_BCM43460 43460
|
|
|
|
#define BCMA_CHIP_ID_BCM4331 0x4331
|
|
|
|
#define BCMA_CHIP_ID_BCM6362 0x6362
|
|
|
|
#define BCMA_CHIP_ID_BCM4360 0x4360
|
|
|
|
#define BCMA_CHIP_ID_BCM4352 0x4352
|
|
|
|
|
|
|
|
/* Chip IDs of SoCs */
|
|
|
|
#define BCMA_CHIP_ID_BCM4706 0x5300
|
2012-11-25 01:34:17 +07:00
|
|
|
#define BCMA_PKG_ID_BCM4706L 1
|
2012-06-30 06:44:38 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM4716 0x4716
|
|
|
|
#define BCMA_PKG_ID_BCM4716 8
|
|
|
|
#define BCMA_PKG_ID_BCM4717 9
|
|
|
|
#define BCMA_PKG_ID_BCM4718 10
|
|
|
|
#define BCMA_CHIP_ID_BCM47162 47162
|
|
|
|
#define BCMA_CHIP_ID_BCM4748 0x4748
|
|
|
|
#define BCMA_CHIP_ID_BCM4749 0x4749
|
|
|
|
#define BCMA_CHIP_ID_BCM5356 0x5356
|
|
|
|
#define BCMA_CHIP_ID_BCM5357 0x5357
|
2012-11-25 01:34:17 +07:00
|
|
|
#define BCMA_PKG_ID_BCM5358 9
|
|
|
|
#define BCMA_PKG_ID_BCM47186 10
|
|
|
|
#define BCMA_PKG_ID_BCM5357 11
|
2012-06-30 06:44:38 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM53572 53572
|
2012-11-25 01:34:17 +07:00
|
|
|
#define BCMA_PKG_ID_BCM47188 9
|
2013-07-15 18:15:06 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM4707 53010
|
|
|
|
#define BCMA_PKG_ID_BCM4707 1
|
|
|
|
#define BCMA_PKG_ID_BCM4708 2
|
|
|
|
#define BCMA_PKG_ID_BCM4709 0
|
2016-01-24 22:37:33 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM47094 53030
|
2013-07-15 18:15:06 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM53018 53018
|
2016-08-18 04:00:30 +07:00
|
|
|
#define BCMA_CHIP_ID_BCM53573 53573
|
|
|
|
#define BCMA_PKG_ID_BCM53573 0
|
|
|
|
#define BCMA_PKG_ID_BCM47189 1
|
2012-06-30 06:44:38 +07:00
|
|
|
|
2013-03-19 22:58:59 +07:00
|
|
|
/* Board types (on PCI usually equals to the subsystem dev id) */
|
|
|
|
/* BCM4313 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94313BU 0X050F
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94313HM 0X0510
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94313EPA 0X0511
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94313HMG 0X051C
|
|
|
|
/* BCM4716 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94716NR2 0X04CD
|
|
|
|
/* BCM43224 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224X21 0X056E
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224X21_FCC 0X00D1
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224X21B 0X00E9
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224M93 0X008B
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224M93A 0X0090
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943224X16 0X0093
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94322X9 0X008D
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94322M35E 0X008E
|
|
|
|
/* BCM43228 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943228BU8 0X0540
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943228BU9 0X0541
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943228BU 0X0542
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943227HM4L 0X0543
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943227HMB 0X0544
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943228HM4L 0X0545
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943228SD 0X0573
|
|
|
|
/* BCM4331 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X19 0X00D6
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X28 0X00E4
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X28B 0X010E
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX 0X00E4
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X12_2G 0X00EC
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X12_5G 0X00ED
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X29B 0X00EF
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331CSAX 0X00EF
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X19C 0X00F5
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331X33 0X00F4
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331BU 0X0523
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331S9BU 0X0524
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331MC 0X0525
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331MCI 0X0526
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331PCIEBT4 0X0527
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331HM 0X0574
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331PCIEDUAL 0X059B
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331MCH5 0X05A9
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331CS 0X05C6
|
|
|
|
#define BCMA_BOARD_TYPE_BCM94331CD 0X05DA
|
|
|
|
/* BCM53572 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM953572BU 0X058D
|
|
|
|
#define BCMA_BOARD_TYPE_BCM953572NR2 0X058E
|
|
|
|
#define BCMA_BOARD_TYPE_BCM947188NR2 0X058F
|
|
|
|
#define BCMA_BOARD_TYPE_BCM953572SDRNR2 0X0590
|
|
|
|
/* BCM43142 */
|
|
|
|
#define BCMA_BOARD_TYPE_BCM943142HM 0X05E0
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
struct bcma_device {
|
|
|
|
struct bcma_bus *bus;
|
|
|
|
struct bcma_device_id id;
|
|
|
|
|
|
|
|
struct device dev;
|
2011-05-18 16:40:22 +07:00
|
|
|
struct device *dma_dev;
|
2011-07-23 06:20:09 +07:00
|
|
|
|
2011-05-18 16:40:22 +07:00
|
|
|
unsigned int irq;
|
2011-05-09 23:56:46 +07:00
|
|
|
bool dev_registered;
|
|
|
|
|
|
|
|
u8 core_index;
|
2012-01-31 06:03:31 +07:00
|
|
|
u8 core_unit;
|
2011-05-09 23:56:46 +07:00
|
|
|
|
|
|
|
u32 addr;
|
2014-09-09 03:53:35 +07:00
|
|
|
u32 addr_s[8];
|
2011-05-09 23:56:46 +07:00
|
|
|
u32 wrap;
|
|
|
|
|
2011-07-23 06:20:08 +07:00
|
|
|
void __iomem *io_addr;
|
|
|
|
void __iomem *io_wrap;
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
void *drvdata;
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void *bcma_get_drvdata(struct bcma_device *core)
|
|
|
|
{
|
|
|
|
return core->drvdata;
|
|
|
|
}
|
|
|
|
static inline void bcma_set_drvdata(struct bcma_device *core, void *drvdata)
|
|
|
|
{
|
|
|
|
core->drvdata = drvdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct bcma_driver {
|
|
|
|
const char *name;
|
|
|
|
const struct bcma_device_id *id_table;
|
|
|
|
|
|
|
|
int (*probe)(struct bcma_device *dev);
|
|
|
|
void (*remove)(struct bcma_device *dev);
|
2012-01-14 05:58:41 +07:00
|
|
|
int (*suspend)(struct bcma_device *dev);
|
2011-05-09 23:56:46 +07:00
|
|
|
int (*resume)(struct bcma_device *dev);
|
|
|
|
void (*shutdown)(struct bcma_device *dev);
|
|
|
|
|
|
|
|
struct device_driver drv;
|
|
|
|
};
|
|
|
|
extern
|
|
|
|
int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
|
2011-05-27 20:02:11 +07:00
|
|
|
#define bcma_driver_register(drv) \
|
|
|
|
__bcma_driver_register(drv, THIS_MODULE)
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
extern void bcma_driver_unregister(struct bcma_driver *drv);
|
|
|
|
|
2015-05-15 04:05:49 +07:00
|
|
|
/* module_bcma_driver() - Helper macro for drivers that don't do
|
|
|
|
* anything special in module init/exit. This eliminates a lot of
|
|
|
|
* boilerplate. Each module may only use this macro once, and
|
|
|
|
* calling it replaces module_init() and module_exit()
|
|
|
|
*/
|
|
|
|
#define module_bcma_driver(__bcma_driver) \
|
|
|
|
module_driver(__bcma_driver, bcma_driver_register, \
|
|
|
|
bcma_driver_unregister)
|
|
|
|
|
2012-02-28 06:56:10 +07:00
|
|
|
/* Set a fallback SPROM.
|
|
|
|
* See kdoc at the function definition for complete documentation. */
|
|
|
|
extern int bcma_arch_register_fallback_sprom(
|
|
|
|
int (*sprom_callback)(struct bcma_bus *bus,
|
|
|
|
struct ssb_sprom *out));
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
struct bcma_bus {
|
|
|
|
/* The MMIO area. */
|
|
|
|
void __iomem *mmio;
|
|
|
|
|
|
|
|
const struct bcma_host_ops *ops;
|
|
|
|
|
|
|
|
enum bcma_hosttype hosttype;
|
2015-01-25 19:41:19 +07:00
|
|
|
bool host_is_pcie2; /* Used for BCMA_HOSTTYPE_PCI only */
|
2011-05-09 23:56:46 +07:00
|
|
|
union {
|
|
|
|
/* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */
|
|
|
|
struct pci_dev *host_pci;
|
|
|
|
/* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
|
|
|
|
struct sdio_func *host_sdio;
|
2014-09-26 05:09:19 +07:00
|
|
|
/* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
|
|
|
|
struct platform_device *host_pdev;
|
2011-05-09 23:56:46 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bcma_chipinfo chipinfo;
|
|
|
|
|
2012-04-29 07:04:08 +07:00
|
|
|
struct bcma_boardinfo boardinfo;
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
struct bcma_device *mapped_core;
|
|
|
|
struct list_head cores;
|
|
|
|
u8 nr_cores;
|
2012-01-31 06:03:36 +07:00
|
|
|
u8 num;
|
2011-05-09 23:56:46 +07:00
|
|
|
|
|
|
|
struct bcma_drv_cc drv_cc;
|
2014-09-09 03:53:36 +07:00
|
|
|
struct bcma_drv_cc_b drv_cc_b;
|
2012-09-30 01:40:18 +07:00
|
|
|
struct bcma_drv_pci drv_pci[2];
|
2014-07-05 06:10:41 +07:00
|
|
|
struct bcma_drv_pcie2 drv_pcie2;
|
2011-07-23 06:20:09 +07:00
|
|
|
struct bcma_drv_mips drv_mips;
|
2012-07-11 14:23:43 +07:00
|
|
|
struct bcma_drv_gmac_cmn drv_gmac_cmn;
|
2011-06-02 07:08:51 +07:00
|
|
|
|
|
|
|
/* We decided to share SPROM struct with SSB as long as we do not need
|
|
|
|
* any hacks for BCMA. This simplifies drivers code. */
|
|
|
|
struct ssb_sprom sprom;
|
2011-05-09 23:56:46 +07:00
|
|
|
};
|
|
|
|
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
|
2011-05-09 23:56:46 +07:00
|
|
|
{
|
|
|
|
return core->bus->ops->read8(core, offset);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
|
2011-05-09 23:56:46 +07:00
|
|
|
{
|
|
|
|
return core->bus->ops->read16(core, offset);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
|
2011-05-09 23:56:46 +07:00
|
|
|
{
|
|
|
|
return core->bus->ops->read32(core, offset);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline
|
2011-05-09 23:56:46 +07:00
|
|
|
void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
|
|
|
|
{
|
|
|
|
core->bus->ops->write8(core, offset, value);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline
|
2011-05-09 23:56:46 +07:00
|
|
|
void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
|
|
|
|
{
|
|
|
|
core->bus->ops->write16(core, offset, value);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline
|
2011-05-09 23:56:46 +07:00
|
|
|
void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
|
|
|
|
{
|
|
|
|
core->bus->ops->write32(core, offset, value);
|
|
|
|
}
|
2011-05-20 08:27:06 +07:00
|
|
|
#ifdef CONFIG_BCMA_BLOCKIO
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline void bcma_block_read(struct bcma_device *core, void *buffer,
|
2011-05-20 08:27:06 +07:00
|
|
|
size_t count, u16 offset, u8 reg_width)
|
|
|
|
{
|
|
|
|
core->bus->ops->block_read(core, buffer, count, offset, reg_width);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline void bcma_block_write(struct bcma_device *core,
|
|
|
|
const void *buffer, size_t count,
|
|
|
|
u16 offset, u8 reg_width)
|
2011-05-20 08:27:06 +07:00
|
|
|
{
|
|
|
|
core->bus->ops->block_write(core, buffer, count, offset, reg_width);
|
|
|
|
}
|
|
|
|
#endif
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
|
2011-05-09 23:56:46 +07:00
|
|
|
{
|
|
|
|
return core->bus->ops->aread32(core, offset);
|
|
|
|
}
|
2011-12-09 06:06:42 +07:00
|
|
|
static inline
|
2011-05-09 23:56:46 +07:00
|
|
|
void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
|
|
|
|
{
|
|
|
|
core->bus->ops->awrite32(core, offset, value);
|
|
|
|
}
|
|
|
|
|
2011-12-09 06:06:41 +07:00
|
|
|
static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
|
|
|
|
{
|
|
|
|
bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
|
|
|
|
}
|
|
|
|
static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
|
|
|
|
{
|
|
|
|
bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
|
|
|
|
}
|
|
|
|
static inline void bcma_maskset32(struct bcma_device *cc,
|
|
|
|
u16 offset, u32 mask, u32 set)
|
|
|
|
{
|
|
|
|
bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
|
|
|
|
}
|
|
|
|
static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
|
|
|
|
{
|
|
|
|
bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
|
|
|
|
}
|
|
|
|
static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
|
|
|
|
{
|
|
|
|
bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
|
|
|
|
}
|
|
|
|
static inline void bcma_maskset16(struct bcma_device *cc,
|
|
|
|
u16 offset, u16 mask, u16 set)
|
|
|
|
{
|
|
|
|
bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
|
|
|
|
}
|
2011-07-17 06:06:03 +07:00
|
|
|
|
2014-01-05 07:10:43 +07:00
|
|
|
extern struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
|
|
|
|
u8 unit);
|
|
|
|
static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
|
|
|
|
u16 coreid)
|
|
|
|
{
|
|
|
|
return bcma_find_core_unit(bus, coreid, 0);
|
|
|
|
}
|
|
|
|
|
2015-03-04 18:14:41 +07:00
|
|
|
#ifdef CONFIG_BCMA_HOST_PCI
|
2015-02-08 23:11:47 +07:00
|
|
|
extern void bcma_host_pci_up(struct bcma_bus *bus);
|
|
|
|
extern void bcma_host_pci_down(struct bcma_bus *bus);
|
2015-03-06 00:25:10 +07:00
|
|
|
extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
|
|
|
|
struct bcma_device *core, bool enable);
|
2015-03-04 18:14:41 +07:00
|
|
|
#else
|
|
|
|
static inline void bcma_host_pci_up(struct bcma_bus *bus)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void bcma_host_pci_down(struct bcma_bus *bus)
|
|
|
|
{
|
|
|
|
}
|
2015-03-06 00:25:10 +07:00
|
|
|
static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
|
|
|
|
struct bcma_device *core, bool enable)
|
|
|
|
{
|
|
|
|
if (bus->hosttype == BCMA_HOSTTYPE_PCI)
|
|
|
|
return -ENOTSUPP;
|
|
|
|
return 0;
|
|
|
|
}
|
2015-03-04 18:14:41 +07:00
|
|
|
#endif
|
2015-02-08 23:11:47 +07:00
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
extern bool bcma_core_is_enabled(struct bcma_device *core);
|
2011-06-10 01:07:20 +07:00
|
|
|
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
|
2011-05-09 23:56:46 +07:00
|
|
|
extern int bcma_core_enable(struct bcma_device *core, u32 flags);
|
2011-07-17 06:06:04 +07:00
|
|
|
extern void bcma_core_set_clockmode(struct bcma_device *core,
|
|
|
|
enum bcma_clkmode clkmode);
|
2011-07-17 06:06:05 +07:00
|
|
|
extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
|
|
|
|
bool on);
|
2012-11-12 19:03:20 +07:00
|
|
|
extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
|
2011-07-21 00:52:15 +07:00
|
|
|
#define BCMA_DMA_TRANSLATION_MASK 0xC0000000
|
|
|
|
#define BCMA_DMA_TRANSLATION_NONE 0x00000000
|
|
|
|
#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
|
|
|
|
#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
|
|
|
|
extern u32 bcma_core_dma_translation(struct bcma_device *core);
|
2011-07-17 06:06:03 +07:00
|
|
|
|
2014-11-01 22:54:55 +07:00
|
|
|
extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
|
|
|
|
|
2011-05-09 23:56:46 +07:00
|
|
|
#endif /* LINUX_BCMA_H_ */
|