aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-03-05 12:25:10 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-03-13 10:25:50 -0400
commit702131e2a393b45174be326f1dbe20b658b4f157 (patch)
tree56f75cea704366fd23018a050e5f943f98715937 /drivers/bcma
parent708c964c5df8536f555bb86a8acb837835808e38 (diff)
bcma: move PCI IRQ control function to host specific code
This function isn't really related to any bus core. It touches PCI device config registers only, so move it to the (PCI) host file. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/driver_pci.c33
-rw-r--r--drivers/bcma/host_pci.c34
2 files changed, 34 insertions, 33 deletions
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index cfd35bc1c5a3..f499a469e66d 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
282} 282}
283EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); 283EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
284 284
285int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
286 bool enable)
287{
288 struct pci_dev *pdev;
289 u32 coremask, tmp;
290 int err = 0;
291
292 if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
293 /* This bcma device is not on a PCI host-bus. So the IRQs are
294 * not routed through the PCI core.
295 * So we must not enable routing through the PCI core. */
296 goto out;
297 }
298
299 pdev = bus->host_pci;
300
301 err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
302 if (err)
303 goto out;
304
305 coremask = BIT(core->core_index) << 8;
306 if (enable)
307 tmp |= coremask;
308 else
309 tmp &= ~coremask;
310
311 err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
312
313out:
314 return err;
315}
316EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
317
318static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) 285static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
319{ 286{
320 u32 w; 287 u32 w;
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index a62a2f9091f5..0856189c065f 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus *bus)
351 bcma_core_pci_down(&bus->drv_pci[0]); 351 bcma_core_pci_down(&bus->drv_pci[0]);
352} 352}
353EXPORT_SYMBOL_GPL(bcma_host_pci_down); 353EXPORT_SYMBOL_GPL(bcma_host_pci_down);
354
355/* See also si_pci_setup */
356int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
357 bool enable)
358{
359 struct pci_dev *pdev;
360 u32 coremask, tmp;
361 int err = 0;
362
363 if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
364 /* This bcma device is not on a PCI host-bus. So the IRQs are
365 * not routed through the PCI core.
366 * So we must not enable routing through the PCI core. */
367 goto out;
368 }
369
370 pdev = bus->host_pci;
371
372 err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
373 if (err)
374 goto out;
375
376 coremask = BIT(core->core_index) << 8;
377 if (enable)
378 tmp |= coremask;
379 else
380 tmp &= ~coremask;
381
382 err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
383
384out:
385 return err;
386}
387EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);