x86: add support for 3.14
[oweals/openwrt.git] / target / linux / bcm53xx / patches-3.18 / 060-bcma-make-it-possible-to-specify-a-IRQ-num-in-bcma_c.patch
1 From f3bbc921543ad8098617a5a6a8054fab11878a25 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed, 1 Oct 2014 00:30:37 +0200
4 Subject: [PATCH 1/3] bcma: make it possible to specify a IRQ num in
5  bcma_core_irq()
6
7 This moves bcma_core_irq() to main.c and add a extra parameter with a
8 number so that we can return different irq number for devices with more
9 than one.
10
11 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 ---
13  drivers/bcma/driver_chipcommon.c      |  2 +-
14  drivers/bcma/driver_gpio.c            |  4 ++--
15  drivers/bcma/driver_mips.c            | 11 ++---------
16  drivers/bcma/driver_pci_host.c        |  4 ++--
17  drivers/bcma/main.c                   | 22 ++++++++++++++++++++++
18  include/linux/bcma/bcma.h             |  2 ++
19  include/linux/bcma/bcma_driver_mips.h |  4 ++--
20  7 files changed, 33 insertions(+), 16 deletions(-)
21
22 --- a/drivers/bcma/driver_chipcommon.c
23 +++ b/drivers/bcma/driver_chipcommon.c
24 @@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma
25                 return;
26         }
27  
28 -       irq = bcma_core_irq(cc->core);
29 +       irq = bcma_core_irq(cc->core, 0);
30  
31         /* Determine the registers of the UARTs */
32         cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART);
33 --- a/drivers/bcma/driver_gpio.c
34 +++ b/drivers/bcma/driver_gpio.c
35 @@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(str
36                                          handle_simple_irq);
37         }
38  
39 -       hwirq = bcma_core_irq(cc->core);
40 +       hwirq = bcma_core_irq(cc->core, 0);
41         err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio",
42                           cc);
43         if (err)
44 @@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(st
45                 return;
46  
47         bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO);
48 -       free_irq(bcma_core_irq(cc->core), cc);
49 +       free_irq(bcma_core_irq(cc->core, 0), cc);
50         for (gpio = 0; gpio < chip->ngpio; gpio++) {
51                 int irq = irq_find_mapping(cc->irq_domain, gpio);
52  
53 --- a/drivers/bcma/driver_mips.c
54 +++ b/drivers/bcma/driver_mips.c
55 @@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct
56   * If disabled, 5 is returned.
57   * If not supported, 6 is returned.
58   */
59 -static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
60 +unsigned int bcma_core_mips_irq(struct bcma_device *dev)
61  {
62         struct bcma_device *mdev = dev->bus->drv_mips.core;
63         u32 irqflag;
64 @@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(s
65         return 5;
66  }
67  
68 -unsigned int bcma_core_irq(struct bcma_device *dev)
69 -{
70 -       unsigned int mips_irq = bcma_core_mips_irq(dev);
71 -       return mips_irq <= 4 ? mips_irq + 2 : 0;
72 -}
73 -EXPORT_SYMBOL(bcma_core_irq);
74 -
75  static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
76  {
77         unsigned int oldirq = bcma_core_mips_irq(dev);
78 @@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv
79                 break;
80         default:
81                 list_for_each_entry(core, &bus->cores, list) {
82 -                       core->irq = bcma_core_irq(core);
83 +                       core->irq = bcma_core_irq(core, 0);
84                 }
85                 bcma_err(bus,
86                          "Unknown device (0x%x) found, can not configure IRQs\n",
87 --- a/drivers/bcma/driver_pci_host.c
88 +++ b/drivers/bcma/driver_pci_host.c
89 @@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct p
90         pr_info("PCI: Fixing up device %s\n", pci_name(dev));
91  
92         /* Fix up interrupt lines */
93 -       dev->irq = bcma_core_irq(pc_host->pdev->core);
94 +       dev->irq = bcma_core_irq(pc_host->pdev->core, 0);
95         pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
96  
97         readrq = pcie_get_readrq(dev);
98 @@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const
99  
100         pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host,
101                                pci_ops);
102 -       return bcma_core_irq(pc_host->pdev->core);
103 +       return bcma_core_irq(pc_host->pdev->core, 0);
104  }
105  EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq);
106 --- a/drivers/bcma/main.c
107 +++ b/drivers/bcma/main.c
108 @@ -169,6 +169,28 @@ static void bcma_of_fill_device(struct p
109  }
110  #endif /* CONFIG_OF */
111  
112 +unsigned int bcma_core_irq(struct bcma_device *core, int num)
113 +{
114 +       struct bcma_bus *bus = core->bus;
115 +       unsigned int mips_irq;
116 +
117 +       switch (bus->hosttype) {
118 +       case BCMA_HOSTTYPE_PCI:
119 +               return bus->host_pci->irq;
120 +       case BCMA_HOSTTYPE_SOC:
121 +               if (bus->drv_mips.core && num == 0) {
122 +                       mips_irq = bcma_core_mips_irq(core);
123 +                       return mips_irq <= 4 ? mips_irq + 2 : 0;
124 +               }
125 +               break;
126 +       case BCMA_HOSTTYPE_SDIO:
127 +               return 0;
128 +       }
129 +
130 +       return 0;
131 +}
132 +EXPORT_SYMBOL(bcma_core_irq);
133 +
134  void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
135  {
136         core->dev.release = bcma_release_core_dev;
137 --- a/include/linux/bcma/bcma.h
138 +++ b/include/linux/bcma/bcma.h
139 @@ -447,4 +447,6 @@ extern u32 bcma_chipco_pll_read(struct b
140  #define  BCMA_DMA_TRANSLATION_DMA64_CMT        0x80000000 /* Client Mode Translation for 64-bit DMA */
141  extern u32 bcma_core_dma_translation(struct bcma_device *core);
142  
143 +extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
144 +
145  #endif /* LINUX_BCMA_H_ */
146 --- a/include/linux/bcma/bcma_driver_mips.h
147 +++ b/include/linux/bcma/bcma_driver_mips.h
148 @@ -43,12 +43,12 @@ struct bcma_drv_mips {
149  extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
150  extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
151  
152 -extern unsigned int bcma_core_irq(struct bcma_device *core);
153 +extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
154  #else
155  static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
156  static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
157  
158 -static inline unsigned int bcma_core_irq(struct bcma_device *core)
159 +static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
160  {
161         return 0;
162  }