diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-03-05 18:25:10 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-13 16:25:50 +0200 |
commit | 702131e2a393b45174be326f1dbe20b658b4f157 (patch) | |
tree | 56f75cea704366fd23018a050e5f943f98715937 /drivers/bcma/host_pci.c | |
parent | 708c964c5df8536f555bb86a8acb837835808e38 (diff) | |
download | linux-702131e2a393b45174be326f1dbe20b658b4f157.tar.bz2 |
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/host_pci.c')
-rw-r--r-- | drivers/bcma/host_pci.c | 34 |
1 files changed, 34 insertions, 0 deletions
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) bcma_core_pci_down(&bus->drv_pci[0]); } EXPORT_SYMBOL_GPL(bcma_host_pci_down); + +/* See also si_pci_setup */ +int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, + bool enable) +{ + struct pci_dev *pdev; + u32 coremask, tmp; + int err = 0; + + if (bus->hosttype != BCMA_HOSTTYPE_PCI) { + /* This bcma device is not on a PCI host-bus. So the IRQs are + * not routed through the PCI core. + * So we must not enable routing through the PCI core. */ + goto out; + } + + pdev = bus->host_pci; + + err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); + if (err) + goto out; + + coremask = BIT(core->core_index) << 8; + if (enable) + tmp |= coremask; + else + tmp &= ~coremask; + + err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); + +out: + return err; +} +EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl); |