Skip to content

Commit 85eb92e

Browse files
haukelinvjw
authored andcommitted
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>
1 parent 6164c20 commit 85eb92e

7 files changed

Lines changed: 33 additions & 16 deletions

File tree

drivers/bcma/driver_chipcommon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
339339
return;
340340
}
341341

342-
irq = bcma_core_irq(cc->core);
342+
irq = bcma_core_irq(cc->core, 0);
343343

344344
/* Determine the registers of the UARTs */
345345
cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART);

drivers/bcma/driver_gpio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc)
152152
handle_simple_irq);
153153
}
154154

155-
hwirq = bcma_core_irq(cc->core);
155+
hwirq = bcma_core_irq(cc->core, 0);
156156
err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio",
157157
cc);
158158
if (err)
@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc)
183183
return;
184184

185185
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);
187187
for (gpio = 0; gpio < chip->ngpio; gpio++) {
188188
int irq = irq_find_mapping(cc->irq_domain, gpio);
189189

drivers/bcma/driver_mips.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct bcma_device *dev)
115115
* If disabled, 5 is returned.
116116
* If not supported, 6 is returned.
117117
*/
118-
static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
118+
unsigned int bcma_core_mips_irq(struct bcma_device *dev)
119119
{
120120
struct bcma_device *mdev = dev->bus->drv_mips.core;
121121
u32 irqflag;
@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
133133
return 5;
134134
}
135135

136-
unsigned 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-
}
141-
EXPORT_SYMBOL(bcma_core_irq);
142-
143136
static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
144137
{
145138
unsigned int oldirq = bcma_core_mips_irq(dev);
@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
423416
break;
424417
default:
425418
list_for_each_entry(core, &bus->cores, list) {
426-
core->irq = bcma_core_irq(core);
419+
core->irq = bcma_core_irq(core, 0);
427420
}
428421
bcma_err(bus,
429422
"Unknown device (0x%x) found, can not configure IRQs\n",

drivers/bcma/driver_pci_host.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct pci_dev *dev)
593593
pr_info("PCI: Fixing up device %s\n", pci_name(dev));
594594

595595
/* 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);
597597
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
598598

599599
readrq = pcie_get_readrq(dev);
@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev)
617617

618618
pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host,
619619
pci_ops);
620-
return bcma_core_irq(pc_host->pdev->core);
620+
return bcma_core_irq(pc_host->pdev->core, 0);
621621
}
622622
EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq);

drivers/bcma/main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,28 @@ static void bcma_of_fill_device(struct platform_device *parent,
169169
}
170170
#endif /* CONFIG_OF */
171171

172+
unsigned 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+
}
192+
EXPORT_SYMBOL(bcma_core_irq);
193+
172194
void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
173195
{
174196
core->dev.release = bcma_release_core_dev;

include/linux/bcma/bcma.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,6 @@ extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
447447
#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
448448
extern u32 bcma_core_dma_translation(struct bcma_device *core);
449449

450+
extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
451+
450452
#endif /* LINUX_BCMA_H_ */

include/linux/bcma/bcma_driver_mips.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ struct bcma_drv_mips {
4343
extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
4444
extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
4545

46-
extern unsigned int bcma_core_irq(struct bcma_device *core);
46+
extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
4747
#else
4848
static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
4949
static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
5050

51-
static inline unsigned int bcma_core_irq(struct bcma_device *core)
51+
static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
5252
{
5353
return 0;
5454
}

0 commit comments

Comments
 (0)