]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
bcma: make it possible to specify a IRQ num in bcma_core_irq()
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 1 Nov 2014 15:54:55 +0000 (16:54 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 11 Nov 2014 21:31:11 +0000 (16:31 -0500)
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>
drivers/bcma/driver_chipcommon.c
drivers/bcma/driver_gpio.c
drivers/bcma/driver_mips.c
drivers/bcma/driver_pci_host.c
drivers/bcma/main.c
include/linux/bcma/bcma.h
include/linux/bcma/bcma_driver_mips.h

index b068f98920a8385446f03ee3e6fe32d369aedc3c..19f679667ca48d46626b04c9a2f43db4000554f2 100644 (file)
@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
                return;
        }
 
-       irq = bcma_core_irq(cc->core);
+       irq = bcma_core_irq(cc->core, 0);
 
        /* Determine the registers of the UARTs */
        cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART);
index 706b9ae0dcfbdb82cf73ae41139d2e4b82ab4693..598a6cd9028a70a239f283101d8f65a33e9fdf77 100644 (file)
@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc)
                                         handle_simple_irq);
        }
 
-       hwirq = bcma_core_irq(cc->core);
+       hwirq = bcma_core_irq(cc->core, 0);
        err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio",
                          cc);
        if (err)
@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc)
                return;
 
        bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO);
-       free_irq(bcma_core_irq(cc->core), cc);
+       free_irq(bcma_core_irq(cc->core, 0), cc);
        for (gpio = 0; gpio < chip->ngpio; gpio++) {
                int irq = irq_find_mapping(cc->irq_domain, gpio);
 
index 004d6aa671cecbf82f0df9da6078f868683de361..5ec69c3d409dd31801f928230dc55109186626f0 100644 (file)
@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct bcma_device *dev)
  * If disabled, 5 is returned.
  * If not supported, 6 is returned.
  */
-static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
+unsigned int bcma_core_mips_irq(struct bcma_device *dev)
 {
        struct bcma_device *mdev = dev->bus->drv_mips.core;
        u32 irqflag;
@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
        return 5;
 }
 
-unsigned int bcma_core_irq(struct bcma_device *dev)
-{
-       unsigned int mips_irq = bcma_core_mips_irq(dev);
-       return mips_irq <= 4 ? mips_irq + 2 : 0;
-}
-EXPORT_SYMBOL(bcma_core_irq);
-
 static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
 {
        unsigned int oldirq = bcma_core_mips_irq(dev);
@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
                break;
        default:
                list_for_each_entry(core, &bus->cores, list) {
-                       core->irq = bcma_core_irq(core);
+                       core->irq = bcma_core_irq(core, 0);
                }
                bcma_err(bus,
                         "Unknown device (0x%x) found, can not configure IRQs\n",
index c3d7b03c2fdc71474b954326a96f8ae183c1e3a8..c8a6b741967b390e20470f15d55d493fa9bc8ce8 100644 (file)
@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct pci_dev *dev)
        pr_info("PCI: Fixing up device %s\n", pci_name(dev));
 
        /* Fix up interrupt lines */
-       dev->irq = bcma_core_irq(pc_host->pdev->core);
+       dev->irq = bcma_core_irq(pc_host->pdev->core, 0);
        pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
 
        readrq = pcie_get_readrq(dev);
@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev)
 
        pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host,
                               pci_ops);
-       return bcma_core_irq(pc_host->pdev->core);
+       return bcma_core_irq(pc_host->pdev->core, 0);
 }
 EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq);
index 9b229c9c35e5086b36b82035b2ed52962673b946..6d1cf57014521d73c3d66657d8aeb30a2c504b95 100644 (file)
@@ -169,6 +169,28 @@ static void bcma_of_fill_device(struct platform_device *parent,
 }
 #endif /* CONFIG_OF */
 
+unsigned int bcma_core_irq(struct bcma_device *core, int num)
+{
+       struct bcma_bus *bus = core->bus;
+       unsigned int mips_irq;
+
+       switch (bus->hosttype) {
+       case BCMA_HOSTTYPE_PCI:
+               return bus->host_pci->irq;
+       case BCMA_HOSTTYPE_SOC:
+               if (bus->drv_mips.core && num == 0) {
+                       mips_irq = bcma_core_mips_irq(core);
+                       return mips_irq <= 4 ? mips_irq + 2 : 0;
+               }
+               break;
+       case BCMA_HOSTTYPE_SDIO:
+               return 0;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(bcma_core_irq);
+
 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
 {
        core->dev.release = bcma_release_core_dev;
index 729f48e6b20b21564bfdbc4d958fd0bc327f740d..eb1c6a47b67f2acf99df011962da81c76398b2d7 100644 (file)
@@ -447,4 +447,6 @@ extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
 #define  BCMA_DMA_TRANSLATION_DMA64_CMT        0x80000000 /* Client Mode Translation for 64-bit DMA */
 extern u32 bcma_core_dma_translation(struct bcma_device *core);
 
+extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
+
 #endif /* LINUX_BCMA_H_ */
index fb61f3fb4ddbb1c208b2557f7aace2c692c6632e..0b3b32aeeb8af8c76b9ed23ff0017ef79e92e635 100644 (file)
@@ -43,12 +43,12 @@ struct bcma_drv_mips {
 extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
 extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
 
-extern unsigned int bcma_core_irq(struct bcma_device *core);
+extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
 #else
 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
 static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
 
-static inline unsigned int bcma_core_irq(struct bcma_device *core)
+static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
 {
        return 0;
 }