bcma: support for PCIe Gen 2 as host platform
Rafał Miłecki
maintainerRFC PATCH 1/1 bcma: support for PCIe Gen 2 as host platform
I dumped LNKCAP on most of my devices and it seems we can use PCI_EXP_LNKCAP_SLS_5_0GB to determine if device is PCIe 2.0.
PCIe Gen 1:
14e4:4331 0x00176C11 (hint: PCI_EXP_LNKCAP_SLS_2_5GB)
14e4:4353 0x00176C11 (hint: PCI_EXP_LNKCAP_SLS_2_5GB)
14e4:4359 0x00176811 (hint: PCI_EXP_LNKCAP_SLS_2_5GB)
14e4:4365 0x00076C11 (hint: PCI_EXP_LNKCAP_SLS_2_5GB)
14e4:4727 0x00176C11 (hint: PCI_EXP_LNKCAP_SLS_2_5GB)
PCIe Gen 2:
14e4:4360 0x0046DC12 (hint: PCI_EXP_LNKCAP_SLS_5_0GB)
--- drivers/bcma/host_pci.c | 10 ++++++++-- include/linux/bcma/bcma.h | 1 + include/linux/bcma/bcma_regs.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/bcma/host_pci.c +8 -2
@@ -13,10 +13,12 @@static void bcma_host_pci_switch_core (struct bcma_device *core) { +int win2 = core->bus->host_is_pcie2 ? +BCMA_PCIE2_BAR0_WIN2 :BCMA_PCI_BAR0_WIN2 ; +pci_write_config_dword (core->bus->host_pci,BCMA_PCI_BAR0_WIN , core->addr); -pci_write_config_dword (core->bus->host_pci,BCMA_PCI_BAR0_WIN2 , - core->wrap); +pci_write_config_dword (core->bus->host_pci, win2, core->wrap); core->bus->mapped_core = core;bcma_debug (core->bus,"Switched to core: 0x%X\n" , core->id.id); }
@@ -194,6 +196,10 @@ static int bcma_host_pci_probe(struct pci_dev *dev, goto err_pci_release_regions; } +/* PCIe Gen 2 has some regs different */ +pcie_capability_read_dword (dev,PCI_EXP_LNKCAP , &val); + bus->host_is_pcie2 = !!(val &PCI_EXP_LNKCAP_SLS_5_0GB ); +/* Map MMIO */ err = -ENOMEM ; bus->mmio =pci_iomap (dev,0 , ~0UL );
include/linux/bcma/bcma.h +1 -0
@@ -315,6 +315,7 @@ struct bcma_bus {const struct bcma_host_ops *ops;enum bcma_hosttype hosttype; +bool host_is_pcie2;/* Valid for BCMA_HOSTTYPE_PCI only */ union {/* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ struct pci_dev *host_pci;
include/linux/bcma/bcma_regs.h +2 -0
@@ -59,6 +59,8 @@#define BCMA_PCI_GPIO_XTAL 0x40/* PCI config space GPIO 14 for Xtal powerup */ #define BCMA_PCI_GPIO_PLL 0x80/* PCI config space GPIO 15 for PLL powerdown */ +#define BCMA_PCIE2_BAR0_WIN2 0x70 +/* SiliconBackplane Address Map. * All regions may not exist on all chips. */
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerQuoted 2 lines · Rafał Miłecki
I dumped LNKCAP on most of my devices and it seems we can use
PCI_EXP_LNKCAP_SLS_5_0GBto determine if device is PCIe 2.0.
I accidentally dropped beginning of the message:
I couldn't find any nice way to check if device is PCIe 2.0 or not. I tried asking on linux-pci@, but without any answer so far:
http://marc.info/?t=140441806600004&r=1&w=2