1 --- a/drivers/bcma/driver_pci_host.c
2 +++ b/drivers/bcma/driver_pci_host.c
3 @@ -99,19 +99,19 @@ static int bcma_extpci_read_config(struc
5 /* we support only two functions on device 0 */
10 /* accesses to config registers with offsets >= 256
11 * requires indirect access.
13 if (off >= PCI_CONFIG_SPACE_SIZE) {
15 - addr |= (off & 0x0FFF);
16 + addr |= (off & 0x0FFC);
17 val = bcma_pcie_read_config(pc, addr);
19 addr = BCMA_CORE_PCI_PCICFG0;
21 - addr |= (off & 0xfc);
22 + addr |= (off & 0xFC);
23 val = pcicore_read32(pc, addr);
26 @@ -127,8 +127,6 @@ static int bcma_extpci_read_config(struc
33 val >>= (8 * (off & 3));
35 @@ -156,7 +154,7 @@ static int bcma_extpci_write_config(stru
36 const void *buf, int len)
39 - u32 addr = 0, val = 0;
41 void __iomem *mmio = 0;
42 u16 chipid = pc->core->bus->chipinfo.id;
44 @@ -164,16 +162,22 @@ static int bcma_extpci_write_config(stru
45 if (unlikely(len != 1 && len != 2 && len != 4))
48 + /* we support only two functions on device 0 */
52 /* accesses to config registers with offsets >= 256
53 * requires indirect access.
55 - if (off < PCI_CONFIG_SPACE_SIZE) {
56 - addr = pc->core->addr + BCMA_CORE_PCI_PCICFG0;
57 + if (off >= PCI_CONFIG_SPACE_SIZE) {
58 + addr = (func << 12);
59 + addr |= (off & 0x0FFC);
60 + val = bcma_pcie_read_config(pc, addr);
62 + addr = BCMA_CORE_PCI_PCICFG0;
64 - addr |= (off & 0xfc);
65 - mmio = ioremap_nocache(addr, sizeof(val));
68 + addr |= (off & 0xFC);
69 + val = pcicore_read32(pc, addr);
72 addr = bcma_get_cfgspace_addr(pc, dev, func, off);
73 @@ -192,12 +196,10 @@ static int bcma_extpci_write_config(stru
78 val &= ~(0xFF << (8 * (off & 3)));
79 val |= *((const u8 *)buf) << (8 * (off & 3));
83 val &= ~(0xFFFF << (8 * (off & 3)));
84 val |= *((const u16 *)buf) << (8 * (off & 3));
86 @@ -205,13 +207,14 @@ static int bcma_extpci_write_config(stru
87 val = *((const u32 *)buf);
90 - if (dev == 0 && !addr) {
92 /* accesses to config registers with offsets >= 256
93 * requires indirect access.
95 - addr = (func << 12);
96 - addr |= (off & 0x0FFF);
97 - bcma_pcie_write_config(pc, addr, val);
98 + if (off >= PCI_CONFIG_SPACE_SIZE)
99 + bcma_pcie_write_config(pc, addr, val);
101 + pcicore_write32(pc, addr, val);