aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/driver_pci_host.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c
index 4a4152389515..c0cb0620ab62 100644
--- a/drivers/bcma/driver_pci_host.c
+++ b/drivers/bcma/driver_pci_host.c
@@ -149,7 +149,7 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
149 const void *buf, int len) 149 const void *buf, int len)
150{ 150{
151 int err = -EINVAL; 151 int err = -EINVAL;
152 u32 addr = 0, val = 0; 152 u32 addr, val;
153 void __iomem *mmio = 0; 153 void __iomem *mmio = 0;
154 u16 chipid = pc->core->bus->chipinfo.id; 154 u16 chipid = pc->core->bus->chipinfo.id;
155 155
@@ -165,12 +165,10 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
165 * requires indirect access. 165 * requires indirect access.
166 */ 166 */
167 if (off < PCI_CONFIG_SPACE_SIZE) { 167 if (off < PCI_CONFIG_SPACE_SIZE) {
168 addr = pc->core->addr + BCMA_CORE_PCI_PCICFG0; 168 addr = BCMA_CORE_PCI_PCICFG0;
169 addr |= (func << 8); 169 addr |= (func << 8);
170 addr |= (off & 0xfc); 170 addr |= (off & 0xfc);
171 mmio = ioremap_nocache(addr, sizeof(val)); 171 val = pcicore_read32(pc, addr);
172 if (!mmio)
173 goto out;
174 } 172 }
175 } else { 173 } else {
176 addr = bcma_get_cfgspace_addr(pc, dev, func, off); 174 addr = bcma_get_cfgspace_addr(pc, dev, func, off);
@@ -189,12 +187,10 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
189 187
190 switch (len) { 188 switch (len) {
191 case 1: 189 case 1:
192 val = readl(mmio);
193 val &= ~(0xFF << (8 * (off & 3))); 190 val &= ~(0xFF << (8 * (off & 3)));
194 val |= *((const u8 *)buf) << (8 * (off & 3)); 191 val |= *((const u8 *)buf) << (8 * (off & 3));
195 break; 192 break;
196 case 2: 193 case 2:
197 val = readl(mmio);
198 val &= ~(0xFFFF << (8 * (off & 3))); 194 val &= ~(0xFFFF << (8 * (off & 3)));
199 val |= *((const u16 *)buf) << (8 * (off & 3)); 195 val |= *((const u16 *)buf) << (8 * (off & 3));
200 break; 196 break;
@@ -202,13 +198,17 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
202 val = *((const u32 *)buf); 198 val = *((const u32 *)buf);
203 break; 199 break;
204 } 200 }
205 if (dev == 0 && !addr) { 201 if (dev == 0) {
206 /* accesses to config registers with offsets >= 256 202 /* accesses to config registers with offsets >= 256
207 * requires indirect access. 203 * requires indirect access.
208 */ 204 */
209 addr = (func << 12); 205 if (off >= PCI_CONFIG_SPACE_SIZE) {
210 addr |= (off & 0x0FFF); 206 addr = (func << 12);
211 bcma_pcie_write_config(pc, addr, val); 207 addr |= (off & 0x0FFF);
208 bcma_pcie_write_config(pc, addr, val);
209 } else {
210 pcicore_write32(pc, addr, val);
211 }
212 } else { 212 } else {
213 writel(val, mmio); 213 writel(val, mmio);
214 214