aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-11-01 11:54:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-11-11 16:31:11 -0500
commit85eb92e81801d64686eb78928d500a4c83ee9623 (patch)
treeaab5da45bc8861ab3882658922a0aa974f39e0f8 /drivers/bcma
parent6164c202289f4718acf00c0dbe5f130b07330ab2 (diff)
bcma: make it possible to specify a IRQ num in bcma_core_irq()
This moves bcma_core_irq() to main.c and add a extra parameter with a number so that we can return different irq number for devices with more than one. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/driver_chipcommon.c2
-rw-r--r--drivers/bcma/driver_gpio.c4
-rw-r--r--drivers/bcma/driver_mips.c11
-rw-r--r--drivers/bcma/driver_pci_host.c4
-rw-r--r--drivers/bcma/main.c22
5 files changed, 29 insertions, 14 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index b068f98920a8..19f679667ca4 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
339 return; 339 return;
340 } 340 }
341 341
342 irq = bcma_core_irq(cc->core); 342 irq = bcma_core_irq(cc->core, 0);
343 343
344 /* Determine the registers of the UARTs */ 344 /* Determine the registers of the UARTs */
345 cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART); 345 cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART);
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c
index 706b9ae0dcfb..598a6cd9028a 100644
--- a/drivers/bcma/driver_gpio.c
+++ b/drivers/bcma/driver_gpio.c
@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc)
152 handle_simple_irq); 152 handle_simple_irq);
153 } 153 }
154 154
155 hwirq = bcma_core_irq(cc->core); 155 hwirq = bcma_core_irq(cc->core, 0);
156 err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio", 156 err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio",
157 cc); 157 cc);
158 if (err) 158 if (err)
@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc)
183 return; 183 return;
184 184
185 bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO); 185 bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO);
186 free_irq(bcma_core_irq(cc->core), cc); 186 free_irq(bcma_core_irq(cc->core, 0), cc);
187 for (gpio = 0; gpio < chip->ngpio; gpio++) { 187 for (gpio = 0; gpio < chip->ngpio; gpio++) {
188 int irq = irq_find_mapping(cc->irq_domain, gpio); 188 int irq = irq_find_mapping(cc->irq_domain, gpio);
189 189
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index 004d6aa671ce..5ec69c3d409d 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct bcma_device *dev)
115 * If disabled, 5 is returned. 115 * If disabled, 5 is returned.
116 * If not supported, 6 is returned. 116 * If not supported, 6 is returned.
117 */ 117 */
118static unsigned int bcma_core_mips_irq(struct bcma_device *dev) 118unsigned int bcma_core_mips_irq(struct bcma_device *dev)
119{ 119{
120 struct bcma_device *mdev = dev->bus->drv_mips.core; 120 struct bcma_device *mdev = dev->bus->drv_mips.core;
121 u32 irqflag; 121 u32 irqflag;
@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
133 return 5; 133 return 5;
134} 134}
135 135
136unsigned int bcma_core_irq(struct bcma_device *dev)
137{
138 unsigned int mips_irq = bcma_core_mips_irq(dev);
139 return mips_irq <= 4 ? mips_irq + 2 : 0;
140}
141EXPORT_SYMBOL(bcma_core_irq);
142
143static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) 136static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
144{ 137{
145 unsigned int oldirq = bcma_core_mips_irq(dev); 138 unsigned int oldirq = bcma_core_mips_irq(dev);
@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
423 break; 416 break;
424 default: 417 default:
425 list_for_each_entry(core, &bus->cores, list) { 418 list_for_each_entry(core, &bus->cores, list) {
426 core->irq = bcma_core_irq(core); 419 core->irq = bcma_core_irq(core, 0);
427 } 420 }
428 bcma_err(bus, 421 bcma_err(bus,
429 "Unknown device (0x%x) found, can not configure IRQs\n", 422 "Unknown device (0x%x) found, can not configure IRQs\n",
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c
index c3d7b03c2fdc..c8a6b741967b 100644
--- a/drivers/bcma/driver_pci_host.c
+++ b/drivers/bcma/driver_pci_host.c
@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct pci_dev *dev)
593 pr_info("PCI: Fixing up device %s\n", pci_name(dev)); 593 pr_info("PCI: Fixing up device %s\n", pci_name(dev));
594 594
595 /* Fix up interrupt lines */ 595 /* Fix up interrupt lines */
596 dev->irq = bcma_core_irq(pc_host->pdev->core); 596 dev->irq = bcma_core_irq(pc_host->pdev->core, 0);
597 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 597 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
598 598
599 readrq = pcie_get_readrq(dev); 599 readrq = pcie_get_readrq(dev);
@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev)
617 617
618 pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, 618 pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host,
619 pci_ops); 619 pci_ops);
620 return bcma_core_irq(pc_host->pdev->core); 620 return bcma_core_irq(pc_host->pdev->core, 0);
621} 621}
622EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq); 622EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq);
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 9b229c9c35e5..6d1cf5701452 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -169,6 +169,28 @@ static void bcma_of_fill_device(struct platform_device *parent,
169} 169}
170#endif /* CONFIG_OF */ 170#endif /* CONFIG_OF */
171 171
172unsigned int bcma_core_irq(struct bcma_device *core, int num)
173{
174 struct bcma_bus *bus = core->bus;
175 unsigned int mips_irq;
176
177 switch (bus->hosttype) {
178 case BCMA_HOSTTYPE_PCI:
179 return bus->host_pci->irq;
180 case BCMA_HOSTTYPE_SOC:
181 if (bus->drv_mips.core && num == 0) {
182 mips_irq = bcma_core_mips_irq(core);
183 return mips_irq <= 4 ? mips_irq + 2 : 0;
184 }
185 break;
186 case BCMA_HOSTTYPE_SDIO:
187 return 0;
188 }
189
190 return 0;
191}
192EXPORT_SYMBOL(bcma_core_irq);
193
172void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) 194void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
173{ 195{
174 core->dev.release = bcma_release_core_dev; 196 core->dev.release = bcma_release_core_dev;