Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Renesas INTC External IRQ Pin Driver |
| 3 | * |
| 4 | * Copyright (C) 2013 Magnus Damm |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 20 | #include <linux/clk.h> |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 21 | #include <linux/init.h> |
Guennadi Liakhovetski | 894db16 | 2013-06-13 11:23:38 +0200 | [diff] [blame] | 22 | #include <linux/of.h> |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/spinlock.h> |
| 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/ioport.h> |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/irq.h> |
| 29 | #include <linux/irqdomain.h> |
| 30 | #include <linux/err.h> |
| 31 | #include <linux/slab.h> |
| 32 | #include <linux/module.h> |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 33 | #include <linux/of_device.h> |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 34 | #include <linux/pm_runtime.h> |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 35 | |
| 36 | #define INTC_IRQPIN_MAX 8 /* maximum 8 interrupts per driver instance */ |
| 37 | |
| 38 | #define INTC_IRQPIN_REG_SENSE 0 /* ICRn */ |
| 39 | #define INTC_IRQPIN_REG_PRIO 1 /* INTPRInn */ |
| 40 | #define INTC_IRQPIN_REG_SOURCE 2 /* INTREQnn */ |
| 41 | #define INTC_IRQPIN_REG_MASK 3 /* INTMSKnn */ |
| 42 | #define INTC_IRQPIN_REG_CLEAR 4 /* INTMSKCLRnn */ |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 43 | #define INTC_IRQPIN_REG_NR_MANDATORY 5 |
| 44 | #define INTC_IRQPIN_REG_IRLM 5 /* ICR0 with IRLM bit (optional) */ |
| 45 | #define INTC_IRQPIN_REG_NR 6 |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 46 | |
| 47 | /* INTC external IRQ PIN hardware register access: |
| 48 | * |
| 49 | * SENSE is read-write 32-bit with 2-bits or 4-bits per IRQ (*) |
| 50 | * PRIO is read-write 32-bit with 4-bits per IRQ (**) |
| 51 | * SOURCE is read-only 32-bit or 8-bit with 1-bit per IRQ (***) |
| 52 | * MASK is write-only 32-bit or 8-bit with 1-bit per IRQ (***) |
| 53 | * CLEAR is write-only 32-bit or 8-bit with 1-bit per IRQ (***) |
| 54 | * |
| 55 | * (*) May be accessed by more than one driver instance - lock needed |
| 56 | * (**) Read-modify-write access by one driver instance - lock needed |
| 57 | * (***) Accessed by one driver instance only - no locking needed |
| 58 | */ |
| 59 | |
| 60 | struct intc_irqpin_iomem { |
| 61 | void __iomem *iomem; |
| 62 | unsigned long (*read)(void __iomem *iomem); |
| 63 | void (*write)(void __iomem *iomem, unsigned long data); |
| 64 | int width; |
Magnus Damm | 862d309 | 2013-02-26 20:58:44 +0900 | [diff] [blame] | 65 | }; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 66 | |
| 67 | struct intc_irqpin_irq { |
| 68 | int hw_irq; |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 69 | int requested_irq; |
| 70 | int domain_irq; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 71 | struct intc_irqpin_priv *p; |
Magnus Damm | 862d309 | 2013-02-26 20:58:44 +0900 | [diff] [blame] | 72 | }; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 73 | |
| 74 | struct intc_irqpin_priv { |
| 75 | struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; |
| 76 | struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; |
Geert Uytterhoeven | f9551a9 | 2015-11-24 15:49:40 +0100 | [diff] [blame] | 77 | unsigned int sense_bitfield_width; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 78 | struct platform_device *pdev; |
| 79 | struct irq_chip irq_chip; |
| 80 | struct irq_domain *irq_domain; |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 81 | struct clk *clk; |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 82 | unsigned shared_irqs:1; |
| 83 | unsigned needs_clk:1; |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 84 | u8 shared_irq_mask; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 85 | }; |
| 86 | |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 87 | struct intc_irqpin_config { |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 88 | unsigned int irlm_bit; |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 89 | unsigned needs_irlm:1; |
| 90 | unsigned needs_clk:1; |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 91 | }; |
| 92 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 93 | static unsigned long intc_irqpin_read32(void __iomem *iomem) |
| 94 | { |
| 95 | return ioread32(iomem); |
| 96 | } |
| 97 | |
| 98 | static unsigned long intc_irqpin_read8(void __iomem *iomem) |
| 99 | { |
| 100 | return ioread8(iomem); |
| 101 | } |
| 102 | |
| 103 | static void intc_irqpin_write32(void __iomem *iomem, unsigned long data) |
| 104 | { |
| 105 | iowrite32(data, iomem); |
| 106 | } |
| 107 | |
| 108 | static void intc_irqpin_write8(void __iomem *iomem, unsigned long data) |
| 109 | { |
| 110 | iowrite8(data, iomem); |
| 111 | } |
| 112 | |
| 113 | static inline unsigned long intc_irqpin_read(struct intc_irqpin_priv *p, |
| 114 | int reg) |
| 115 | { |
| 116 | struct intc_irqpin_iomem *i = &p->iomem[reg]; |
Magnus Damm | 862d309 | 2013-02-26 20:58:44 +0900 | [diff] [blame] | 117 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 118 | return i->read(i->iomem); |
| 119 | } |
| 120 | |
| 121 | static inline void intc_irqpin_write(struct intc_irqpin_priv *p, |
| 122 | int reg, unsigned long data) |
| 123 | { |
| 124 | struct intc_irqpin_iomem *i = &p->iomem[reg]; |
Magnus Damm | 862d309 | 2013-02-26 20:58:44 +0900 | [diff] [blame] | 125 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 126 | i->write(i->iomem, data); |
| 127 | } |
| 128 | |
| 129 | static inline unsigned long intc_irqpin_hwirq_mask(struct intc_irqpin_priv *p, |
| 130 | int reg, int hw_irq) |
| 131 | { |
| 132 | return BIT((p->iomem[reg].width - 1) - hw_irq); |
| 133 | } |
| 134 | |
| 135 | static inline void intc_irqpin_irq_write_hwirq(struct intc_irqpin_priv *p, |
| 136 | int reg, int hw_irq) |
| 137 | { |
| 138 | intc_irqpin_write(p, reg, intc_irqpin_hwirq_mask(p, reg, hw_irq)); |
| 139 | } |
| 140 | |
| 141 | static DEFINE_RAW_SPINLOCK(intc_irqpin_lock); /* only used by slow path */ |
| 142 | |
| 143 | static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, |
| 144 | int reg, int shift, |
| 145 | int width, int value) |
| 146 | { |
| 147 | unsigned long flags; |
| 148 | unsigned long tmp; |
| 149 | |
| 150 | raw_spin_lock_irqsave(&intc_irqpin_lock, flags); |
| 151 | |
| 152 | tmp = intc_irqpin_read(p, reg); |
| 153 | tmp &= ~(((1 << width) - 1) << shift); |
| 154 | tmp |= value << shift; |
| 155 | intc_irqpin_write(p, reg, tmp); |
| 156 | |
| 157 | raw_spin_unlock_irqrestore(&intc_irqpin_lock, flags); |
| 158 | } |
| 159 | |
| 160 | static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, |
| 161 | int irq, int do_mask) |
| 162 | { |
Laurent Pinchart | e55bc55 | 2013-11-09 13:18:01 +0100 | [diff] [blame] | 163 | /* The PRIO register is assumed to be 32-bit with fixed 4-bit fields. */ |
| 164 | int bitfield_width = 4; |
| 165 | int shift = 32 - (irq + 1) * bitfield_width; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 166 | |
| 167 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO, |
| 168 | shift, bitfield_width, |
| 169 | do_mask ? 0 : (1 << bitfield_width) - 1); |
| 170 | } |
| 171 | |
| 172 | static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) |
| 173 | { |
Laurent Pinchart | e55bc55 | 2013-11-09 13:18:01 +0100 | [diff] [blame] | 174 | /* The SENSE register is assumed to be 32-bit. */ |
Geert Uytterhoeven | f9551a9 | 2015-11-24 15:49:40 +0100 | [diff] [blame] | 175 | int bitfield_width = p->sense_bitfield_width; |
Laurent Pinchart | e55bc55 | 2013-11-09 13:18:01 +0100 | [diff] [blame] | 176 | int shift = 32 - (irq + 1) * bitfield_width; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 177 | |
| 178 | dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); |
| 179 | |
| 180 | if (value >= (1 << bitfield_width)) |
| 181 | return -EINVAL; |
| 182 | |
| 183 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_SENSE, shift, |
| 184 | bitfield_width, value); |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | static void intc_irqpin_dbg(struct intc_irqpin_irq *i, char *str) |
| 189 | { |
| 190 | dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 191 | str, i->requested_irq, i->hw_irq, i->domain_irq); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | static void intc_irqpin_irq_enable(struct irq_data *d) |
| 195 | { |
| 196 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
| 197 | int hw_irq = irqd_to_hwirq(d); |
| 198 | |
| 199 | intc_irqpin_dbg(&p->irq[hw_irq], "enable"); |
| 200 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); |
| 201 | } |
| 202 | |
| 203 | static void intc_irqpin_irq_disable(struct irq_data *d) |
| 204 | { |
| 205 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
| 206 | int hw_irq = irqd_to_hwirq(d); |
| 207 | |
| 208 | intc_irqpin_dbg(&p->irq[hw_irq], "disable"); |
| 209 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); |
| 210 | } |
| 211 | |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 212 | static void intc_irqpin_shared_irq_enable(struct irq_data *d) |
| 213 | { |
| 214 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
| 215 | int hw_irq = irqd_to_hwirq(d); |
| 216 | |
| 217 | intc_irqpin_dbg(&p->irq[hw_irq], "shared enable"); |
| 218 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); |
| 219 | |
| 220 | p->shared_irq_mask &= ~BIT(hw_irq); |
| 221 | } |
| 222 | |
| 223 | static void intc_irqpin_shared_irq_disable(struct irq_data *d) |
| 224 | { |
| 225 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
| 226 | int hw_irq = irqd_to_hwirq(d); |
| 227 | |
| 228 | intc_irqpin_dbg(&p->irq[hw_irq], "shared disable"); |
| 229 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); |
| 230 | |
| 231 | p->shared_irq_mask |= BIT(hw_irq); |
| 232 | } |
| 233 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 234 | static void intc_irqpin_irq_enable_force(struct irq_data *d) |
| 235 | { |
| 236 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 237 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 238 | |
| 239 | intc_irqpin_irq_enable(d); |
Magnus Damm | d1b6aec | 2013-02-26 20:59:04 +0900 | [diff] [blame] | 240 | |
| 241 | /* enable interrupt through parent interrupt controller, |
| 242 | * assumes non-shared interrupt with 1:1 mapping |
| 243 | * needed for busted IRQs on some SoCs like sh73a0 |
| 244 | */ |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 245 | irq_get_chip(irq)->irq_unmask(irq_get_irq_data(irq)); |
| 246 | } |
| 247 | |
| 248 | static void intc_irqpin_irq_disable_force(struct irq_data *d) |
| 249 | { |
| 250 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 251 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 252 | |
Magnus Damm | d1b6aec | 2013-02-26 20:59:04 +0900 | [diff] [blame] | 253 | /* disable interrupt through parent interrupt controller, |
| 254 | * assumes non-shared interrupt with 1:1 mapping |
| 255 | * needed for busted IRQs on some SoCs like sh73a0 |
| 256 | */ |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 257 | irq_get_chip(irq)->irq_mask(irq_get_irq_data(irq)); |
| 258 | intc_irqpin_irq_disable(d); |
| 259 | } |
| 260 | |
| 261 | #define INTC_IRQ_SENSE_VALID 0x10 |
| 262 | #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) |
| 263 | |
| 264 | static unsigned char intc_irqpin_sense[IRQ_TYPE_SENSE_MASK + 1] = { |
| 265 | [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x00), |
| 266 | [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x01), |
| 267 | [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x02), |
| 268 | [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x03), |
| 269 | [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x04), |
| 270 | }; |
| 271 | |
| 272 | static int intc_irqpin_irq_set_type(struct irq_data *d, unsigned int type) |
| 273 | { |
| 274 | unsigned char value = intc_irqpin_sense[type & IRQ_TYPE_SENSE_MASK]; |
| 275 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
| 276 | |
| 277 | if (!(value & INTC_IRQ_SENSE_VALID)) |
| 278 | return -EINVAL; |
| 279 | |
| 280 | return intc_irqpin_set_sense(p, irqd_to_hwirq(d), |
| 281 | value ^ INTC_IRQ_SENSE_VALID); |
| 282 | } |
| 283 | |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 284 | static int intc_irqpin_irq_set_wake(struct irq_data *d, unsigned int on) |
| 285 | { |
| 286 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); |
Geert Uytterhoeven | f4e209c | 2015-09-08 19:00:35 +0200 | [diff] [blame] | 287 | int hw_irq = irqd_to_hwirq(d); |
| 288 | |
| 289 | irq_set_irq_wake(p->irq[hw_irq].requested_irq, on); |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 290 | |
| 291 | if (!p->clk) |
| 292 | return 0; |
| 293 | |
| 294 | if (on) |
| 295 | clk_enable(p->clk); |
| 296 | else |
| 297 | clk_disable(p->clk); |
| 298 | |
| 299 | return 0; |
| 300 | } |
| 301 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 302 | static irqreturn_t intc_irqpin_irq_handler(int irq, void *dev_id) |
| 303 | { |
| 304 | struct intc_irqpin_irq *i = dev_id; |
| 305 | struct intc_irqpin_priv *p = i->p; |
| 306 | unsigned long bit; |
| 307 | |
| 308 | intc_irqpin_dbg(i, "demux1"); |
| 309 | bit = intc_irqpin_hwirq_mask(p, INTC_IRQPIN_REG_SOURCE, i->hw_irq); |
| 310 | |
| 311 | if (intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE) & bit) { |
| 312 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, ~bit); |
| 313 | intc_irqpin_dbg(i, "demux2"); |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 314 | generic_handle_irq(i->domain_irq); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 315 | return IRQ_HANDLED; |
| 316 | } |
| 317 | return IRQ_NONE; |
| 318 | } |
| 319 | |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 320 | static irqreturn_t intc_irqpin_shared_irq_handler(int irq, void *dev_id) |
| 321 | { |
| 322 | struct intc_irqpin_priv *p = dev_id; |
| 323 | unsigned int reg_source = intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE); |
| 324 | irqreturn_t status = IRQ_NONE; |
| 325 | int k; |
| 326 | |
| 327 | for (k = 0; k < 8; k++) { |
| 328 | if (reg_source & BIT(7 - k)) { |
| 329 | if (BIT(k) & p->shared_irq_mask) |
| 330 | continue; |
| 331 | |
| 332 | status |= intc_irqpin_irq_handler(irq, &p->irq[k]); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | return status; |
| 337 | } |
| 338 | |
Geert Uytterhoeven | 769b5cf | 2015-09-09 13:42:54 +0200 | [diff] [blame] | 339 | /* |
| 340 | * This lock class tells lockdep that INTC External IRQ Pin irqs are in a |
| 341 | * different category than their parents, so it won't report false recursion. |
| 342 | */ |
| 343 | static struct lock_class_key intc_irqpin_irq_lock_class; |
| 344 | |
Andrew Lunn | 39c3fd5 | 2017-12-02 18:11:04 +0100 | [diff] [blame] | 345 | /* And this is for the request mutex */ |
| 346 | static struct lock_class_key intc_irqpin_irq_request_class; |
| 347 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 348 | static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq, |
| 349 | irq_hw_number_t hw) |
| 350 | { |
| 351 | struct intc_irqpin_priv *p = h->host_data; |
| 352 | |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 353 | p->irq[hw].domain_irq = virq; |
| 354 | p->irq[hw].hw_irq = hw; |
| 355 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 356 | intc_irqpin_dbg(&p->irq[hw], "map"); |
| 357 | irq_set_chip_data(virq, h->host_data); |
Andrew Lunn | 39c3fd5 | 2017-12-02 18:11:04 +0100 | [diff] [blame] | 358 | irq_set_lockdep_class(virq, &intc_irqpin_irq_lock_class, |
| 359 | &intc_irqpin_irq_request_class); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 360 | irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 361 | return 0; |
| 362 | } |
| 363 | |
Krzysztof Kozlowski | 9600973 | 2015-04-27 21:54:24 +0900 | [diff] [blame] | 364 | static const struct irq_domain_ops intc_irqpin_irq_domain_ops = { |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 365 | .map = intc_irqpin_irq_domain_map, |
Magnus Damm | 9d833bbe | 2013-03-06 15:16:08 +0900 | [diff] [blame] | 366 | .xlate = irq_domain_xlate_twocell, |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 367 | }; |
| 368 | |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 369 | static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 370 | .irlm_bit = 23, /* ICR0.IRLM0 */ |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 371 | .needs_irlm = 1, |
| 372 | .needs_clk = 0, |
| 373 | }; |
| 374 | |
| 375 | static const struct intc_irqpin_config intc_irqpin_rmobile = { |
| 376 | .needs_irlm = 0, |
| 377 | .needs_clk = 1, |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 378 | }; |
| 379 | |
| 380 | static const struct of_device_id intc_irqpin_dt_ids[] = { |
| 381 | { .compatible = "renesas,intc-irqpin", }, |
Ulrich Hecht | 26c21dd | 2015-09-30 12:03:07 +0200 | [diff] [blame] | 382 | { .compatible = "renesas,intc-irqpin-r8a7778", |
| 383 | .data = &intc_irqpin_irlm_r8a777x }, |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 384 | { .compatible = "renesas,intc-irqpin-r8a7779", |
Ulrich Hecht | 26c21dd | 2015-09-30 12:03:07 +0200 | [diff] [blame] | 385 | .data = &intc_irqpin_irlm_r8a777x }, |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 386 | { .compatible = "renesas,intc-irqpin-r8a7740", |
| 387 | .data = &intc_irqpin_rmobile }, |
| 388 | { .compatible = "renesas,intc-irqpin-sh73a0", |
| 389 | .data = &intc_irqpin_rmobile }, |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 390 | {}, |
| 391 | }; |
| 392 | MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids); |
| 393 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 394 | static int intc_irqpin_probe(struct platform_device *pdev) |
| 395 | { |
Geert Uytterhoeven | 42a5968 | 2017-10-04 14:17:58 +0200 | [diff] [blame] | 396 | const struct intc_irqpin_config *config; |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 397 | struct device *dev = &pdev->dev; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 398 | struct intc_irqpin_priv *p; |
| 399 | struct intc_irqpin_iomem *i; |
| 400 | struct resource *io[INTC_IRQPIN_REG_NR]; |
| 401 | struct resource *irq; |
| 402 | struct irq_chip *irq_chip; |
| 403 | void (*enable_fn)(struct irq_data *d); |
| 404 | void (*disable_fn)(struct irq_data *d); |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 405 | const char *name = dev_name(dev); |
Geert Uytterhoeven | f9551a9 | 2015-11-24 15:49:40 +0100 | [diff] [blame] | 406 | bool control_parent; |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 407 | unsigned int nirqs; |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 408 | int ref_irq; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 409 | int ret; |
| 410 | int k; |
| 411 | |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 412 | p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 413 | if (!p) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 414 | dev_err(dev, "failed to allocate driver data\n"); |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 415 | return -ENOMEM; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | /* deal with driver instance configuration */ |
Geert Uytterhoeven | f9551a9 | 2015-11-24 15:49:40 +0100 | [diff] [blame] | 419 | of_property_read_u32(dev->of_node, "sense-bitfield-width", |
| 420 | &p->sense_bitfield_width); |
| 421 | control_parent = of_property_read_bool(dev->of_node, "control-parent"); |
| 422 | if (!p->sense_bitfield_width) |
| 423 | p->sense_bitfield_width = 4; /* default to 4 bits */ |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 424 | |
| 425 | p->pdev = pdev; |
| 426 | platform_set_drvdata(pdev, p); |
| 427 | |
Geert Uytterhoeven | 42a5968 | 2017-10-04 14:17:58 +0200 | [diff] [blame] | 428 | config = of_device_get_match_data(dev); |
| 429 | if (config) |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 430 | p->needs_clk = config->needs_clk; |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 431 | |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 432 | p->clk = devm_clk_get(dev, NULL); |
| 433 | if (IS_ERR(p->clk)) { |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 434 | if (p->needs_clk) { |
| 435 | dev_err(dev, "unable to get clock\n"); |
| 436 | ret = PTR_ERR(p->clk); |
| 437 | goto err0; |
| 438 | } |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 439 | p->clk = NULL; |
| 440 | } |
| 441 | |
| 442 | pm_runtime_enable(dev); |
| 443 | pm_runtime_get_sync(dev); |
| 444 | |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 445 | /* get hold of register banks */ |
| 446 | memset(io, 0, sizeof(io)); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 447 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { |
| 448 | io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 449 | if (!io[k] && k < INTC_IRQPIN_REG_NR_MANDATORY) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 450 | dev_err(dev, "not enough IOMEM resources\n"); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 451 | ret = -EINVAL; |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 452 | goto err0; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 453 | } |
| 454 | } |
| 455 | |
| 456 | /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */ |
| 457 | for (k = 0; k < INTC_IRQPIN_MAX; k++) { |
| 458 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); |
| 459 | if (!irq) |
| 460 | break; |
| 461 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 462 | p->irq[k].p = p; |
Magnus Damm | 33f958f | 2013-02-26 20:58:54 +0900 | [diff] [blame] | 463 | p->irq[k].requested_irq = irq->start; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 464 | } |
| 465 | |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 466 | nirqs = k; |
| 467 | if (nirqs < 1) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 468 | dev_err(dev, "not enough IRQ resources\n"); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 469 | ret = -EINVAL; |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 470 | goto err0; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | /* ioremap IOMEM and setup read/write callbacks */ |
| 474 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { |
| 475 | i = &p->iomem[k]; |
| 476 | |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 477 | /* handle optional registers */ |
| 478 | if (!io[k]) |
| 479 | continue; |
| 480 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 481 | switch (resource_size(io[k])) { |
| 482 | case 1: |
| 483 | i->width = 8; |
| 484 | i->read = intc_irqpin_read8; |
| 485 | i->write = intc_irqpin_write8; |
| 486 | break; |
| 487 | case 4: |
| 488 | i->width = 32; |
| 489 | i->read = intc_irqpin_read32; |
| 490 | i->write = intc_irqpin_write32; |
| 491 | break; |
| 492 | default: |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 493 | dev_err(dev, "IOMEM size mismatch\n"); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 494 | ret = -EINVAL; |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 495 | goto err0; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 496 | } |
| 497 | |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 498 | i->iomem = devm_ioremap_nocache(dev, io[k]->start, |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 499 | resource_size(io[k])); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 500 | if (!i->iomem) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 501 | dev_err(dev, "failed to remap IOMEM\n"); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 502 | ret = -ENXIO; |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 503 | goto err0; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 504 | } |
| 505 | } |
| 506 | |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 507 | /* configure "individual IRQ mode" where needed */ |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 508 | if (config && config->needs_irlm) { |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 509 | if (io[INTC_IRQPIN_REG_IRLM]) |
| 510 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 511 | config->irlm_bit, 1, 1); |
Magnus Damm | e03f908 | 2014-12-03 21:18:03 +0900 | [diff] [blame] | 512 | else |
| 513 | dev_warn(dev, "unable to select IRLM mode\n"); |
| 514 | } |
| 515 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 516 | /* mask all interrupts using priority */ |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 517 | for (k = 0; k < nirqs; k++) |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 518 | intc_irqpin_mask_unmask_prio(p, k, 1); |
| 519 | |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 520 | /* clear all pending interrupts */ |
| 521 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, 0x0); |
| 522 | |
| 523 | /* scan for shared interrupt lines */ |
| 524 | ref_irq = p->irq[0].requested_irq; |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 525 | p->shared_irqs = 1; |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 526 | for (k = 1; k < nirqs; k++) { |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 527 | if (ref_irq != p->irq[k].requested_irq) { |
Geert Uytterhoeven | 86e57ca | 2015-11-24 16:08:13 +0100 | [diff] [blame] | 528 | p->shared_irqs = 0; |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 529 | break; |
| 530 | } |
| 531 | } |
| 532 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 533 | /* use more severe masking method if requested */ |
Geert Uytterhoeven | f9551a9 | 2015-11-24 15:49:40 +0100 | [diff] [blame] | 534 | if (control_parent) { |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 535 | enable_fn = intc_irqpin_irq_enable_force; |
| 536 | disable_fn = intc_irqpin_irq_disable_force; |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 537 | } else if (!p->shared_irqs) { |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 538 | enable_fn = intc_irqpin_irq_enable; |
| 539 | disable_fn = intc_irqpin_irq_disable; |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 540 | } else { |
| 541 | enable_fn = intc_irqpin_shared_irq_enable; |
| 542 | disable_fn = intc_irqpin_shared_irq_disable; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | irq_chip = &p->irq_chip; |
| 546 | irq_chip->name = name; |
| 547 | irq_chip->irq_mask = disable_fn; |
| 548 | irq_chip->irq_unmask = enable_fn; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 549 | irq_chip->irq_set_type = intc_irqpin_irq_set_type; |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 550 | irq_chip->irq_set_wake = intc_irqpin_irq_set_wake; |
| 551 | irq_chip->flags = IRQCHIP_MASK_ON_SUSPEND; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 552 | |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 553 | p->irq_domain = irq_domain_add_simple(dev->of_node, nirqs, 0, |
| 554 | &intc_irqpin_irq_domain_ops, p); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 555 | if (!p->irq_domain) { |
| 556 | ret = -ENXIO; |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 557 | dev_err(dev, "cannot initialize irq domain\n"); |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 558 | goto err0; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 559 | } |
| 560 | |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 561 | if (p->shared_irqs) { |
| 562 | /* request one shared interrupt */ |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 563 | if (devm_request_irq(dev, p->irq[0].requested_irq, |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 564 | intc_irqpin_shared_irq_handler, |
| 565 | IRQF_SHARED, name, p)) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 566 | dev_err(dev, "failed to request low IRQ\n"); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 567 | ret = -ENOENT; |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 568 | goto err1; |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 569 | } |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 570 | } else { |
| 571 | /* request interrupts one by one */ |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 572 | for (k = 0; k < nirqs; k++) { |
Geert Uytterhoeven | 36845f1 | 2014-09-12 15:15:17 +0200 | [diff] [blame] | 573 | if (devm_request_irq(dev, p->irq[k].requested_irq, |
| 574 | intc_irqpin_irq_handler, 0, name, |
| 575 | &p->irq[k])) { |
| 576 | dev_err(dev, "failed to request low IRQ\n"); |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 577 | ret = -ENOENT; |
| 578 | goto err1; |
| 579 | } |
| 580 | } |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 581 | } |
| 582 | |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 583 | /* unmask all interrupts on prio level */ |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 584 | for (k = 0; k < nirqs; k++) |
Bastian Hecht | 427cc72 | 2013-03-27 14:54:03 +0100 | [diff] [blame] | 585 | intc_irqpin_mask_unmask_prio(p, k, 0); |
| 586 | |
Geert Uytterhoeven | 1affe59 | 2015-11-24 15:49:41 +0100 | [diff] [blame] | 587 | dev_info(dev, "driving %d irqs\n", nirqs); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 588 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 589 | return 0; |
| 590 | |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 591 | err1: |
Magnus Damm | 08eba5b | 2013-02-26 20:59:13 +0900 | [diff] [blame] | 592 | irq_domain_remove(p->irq_domain); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 593 | err0: |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 594 | pm_runtime_put(dev); |
| 595 | pm_runtime_disable(dev); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 596 | return ret; |
| 597 | } |
| 598 | |
| 599 | static int intc_irqpin_remove(struct platform_device *pdev) |
| 600 | { |
| 601 | struct intc_irqpin_priv *p = platform_get_drvdata(pdev); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 602 | |
| 603 | irq_domain_remove(p->irq_domain); |
Geert Uytterhoeven | 705bc96 | 2014-09-12 15:15:18 +0200 | [diff] [blame] | 604 | pm_runtime_put(&pdev->dev); |
| 605 | pm_runtime_disable(&pdev->dev); |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 606 | return 0; |
| 607 | } |
| 608 | |
| 609 | static struct platform_driver intc_irqpin_device_driver = { |
| 610 | .probe = intc_irqpin_probe, |
| 611 | .remove = intc_irqpin_remove, |
| 612 | .driver = { |
| 613 | .name = "renesas_intc_irqpin", |
Magnus Damm | 9d833bbe | 2013-03-06 15:16:08 +0900 | [diff] [blame] | 614 | .of_match_table = intc_irqpin_dt_ids, |
Magnus Damm | 4435804 | 2013-02-18 23:28:34 +0900 | [diff] [blame] | 615 | } |
| 616 | }; |
| 617 | |
| 618 | static int __init intc_irqpin_init(void) |
| 619 | { |
| 620 | return platform_driver_register(&intc_irqpin_device_driver); |
| 621 | } |
| 622 | postcore_initcall(intc_irqpin_init); |
| 623 | |
| 624 | static void __exit intc_irqpin_exit(void) |
| 625 | { |
| 626 | platform_driver_unregister(&intc_irqpin_device_driver); |
| 627 | } |
| 628 | module_exit(intc_irqpin_exit); |
| 629 | |
| 630 | MODULE_AUTHOR("Magnus Damm"); |
| 631 | MODULE_DESCRIPTION("Renesas INTC External IRQ Pin Driver"); |
| 632 | MODULE_LICENSE("GPL v2"); |