Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * S3C24XX IRQ handling |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 3 | * |
Ben Dooks | e02f866 | 2009-11-13 22:54:13 +0000 | [diff] [blame] | 4 | * Copyright (c) 2003-2004 Simtec Electronics |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 5 | * Ben Dooks <ben@simtec.co.uk> |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 6 | * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #include <linux/init.h> |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 20 | #include <linux/slab.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 21 | #include <linux/module.h> |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 22 | #include <linux/io.h> |
| 23 | #include <linux/err.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 24 | #include <linux/interrupt.h> |
| 25 | #include <linux/ioport.h> |
Kay Sievers | edbaa60 | 2011-12-21 16:26:03 -0800 | [diff] [blame] | 26 | #include <linux/device.h> |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 27 | #include <linux/irqdomain.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 28 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 29 | #include <asm/mach/irq.h> |
| 30 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 31 | #include <mach/regs-irq.h> |
| 32 | #include <mach/regs-gpio.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 33 | |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 34 | #include <plat/cpu.h> |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 35 | #include <plat/regs-irqtype.h> |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 36 | #include <plat/pm.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 37 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 38 | #define S3C_IRQTYPE_NONE 0 |
| 39 | #define S3C_IRQTYPE_EINT 1 |
| 40 | #define S3C_IRQTYPE_EDGE 2 |
| 41 | #define S3C_IRQTYPE_LEVEL 3 |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 42 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 43 | struct s3c_irq_data { |
| 44 | unsigned int type; |
| 45 | unsigned long parent_irq; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 46 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 47 | /* data gets filled during init */ |
| 48 | struct s3c_irq_intc *intc; |
| 49 | unsigned long sub_bits; |
| 50 | struct s3c_irq_intc *sub_intc; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 53 | /* |
| 54 | * Sructure holding the controller data |
| 55 | * @reg_pending register holding pending irqs |
| 56 | * @reg_intpnd special register intpnd in main intc |
| 57 | * @reg_mask mask register |
| 58 | * @domain irq_domain of the controller |
| 59 | * @parent parent controller for ext and sub irqs |
| 60 | * @irqs irq-data, always s3c_irq_data[32] |
| 61 | */ |
| 62 | struct s3c_irq_intc { |
| 63 | void __iomem *reg_pending; |
| 64 | void __iomem *reg_intpnd; |
| 65 | void __iomem *reg_mask; |
| 66 | struct irq_domain *domain; |
| 67 | struct s3c_irq_intc *parent; |
| 68 | struct s3c_irq_data *irqs; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 69 | }; |
| 70 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 71 | static void s3c_irq_mask(struct irq_data *data) |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 72 | { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 73 | struct s3c_irq_intc *intc = data->domain->host_data; |
| 74 | struct s3c_irq_intc *parent_intc = intc->parent; |
| 75 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; |
| 76 | struct s3c_irq_data *parent_data; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 77 | unsigned long mask; |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 78 | unsigned int irqno; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 79 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 80 | mask = __raw_readl(intc->reg_mask); |
| 81 | mask |= (1UL << data->hwirq); |
| 82 | __raw_writel(mask, intc->reg_mask); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 83 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 84 | if (parent_intc && irq_data->parent_irq) { |
| 85 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 86 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 87 | /* check to see if we need to mask the parent IRQ */ |
| 88 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { |
| 89 | irqno = irq_find_mapping(parent_intc->domain, |
| 90 | irq_data->parent_irq); |
| 91 | s3c_irq_mask(irq_get_irq_data(irqno)); |
| 92 | } |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 93 | } |
| 94 | } |
| 95 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 96 | static void s3c_irq_unmask(struct irq_data *data) |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 97 | { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 98 | struct s3c_irq_intc *intc = data->domain->host_data; |
| 99 | struct s3c_irq_intc *parent_intc = intc->parent; |
| 100 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 101 | unsigned long mask; |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 102 | unsigned int irqno; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 103 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 104 | mask = __raw_readl(intc->reg_mask); |
| 105 | mask &= ~(1UL << data->hwirq); |
| 106 | __raw_writel(mask, intc->reg_mask); |
| 107 | |
| 108 | if (parent_intc && irq_data->parent_irq) { |
| 109 | irqno = irq_find_mapping(parent_intc->domain, |
| 110 | irq_data->parent_irq); |
| 111 | s3c_irq_unmask(irq_get_irq_data(irqno)); |
| 112 | } |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 113 | } |
| 114 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 115 | static inline void s3c_irq_ack(struct irq_data *data) |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 116 | { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 117 | struct s3c_irq_intc *intc = data->domain->host_data; |
| 118 | unsigned long bitval = 1UL << data->hwirq; |
| 119 | |
| 120 | __raw_writel(bitval, intc->reg_pending); |
| 121 | if (intc->reg_intpnd) |
| 122 | __raw_writel(bitval, intc->reg_intpnd); |
| 123 | } |
| 124 | |
| 125 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, |
| 126 | void __iomem *extint_reg, |
| 127 | unsigned long gpcon_offset, |
| 128 | unsigned long extint_offset, |
| 129 | unsigned int type) |
| 130 | { |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 131 | unsigned long newvalue = 0, value; |
| 132 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 133 | /* Set the GPIO to external interrupt mode */ |
| 134 | value = __raw_readl(gpcon_reg); |
| 135 | value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset); |
| 136 | __raw_writel(value, gpcon_reg); |
| 137 | |
| 138 | /* Set the external interrupt to pointed trigger type */ |
| 139 | switch (type) |
| 140 | { |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 141 | case IRQ_TYPE_NONE: |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 142 | pr_warn("No edge setting!\n"); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 143 | break; |
| 144 | |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 145 | case IRQ_TYPE_EDGE_RISING: |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 146 | newvalue = S3C2410_EXTINT_RISEEDGE; |
| 147 | break; |
| 148 | |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 149 | case IRQ_TYPE_EDGE_FALLING: |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 150 | newvalue = S3C2410_EXTINT_FALLEDGE; |
| 151 | break; |
| 152 | |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 153 | case IRQ_TYPE_EDGE_BOTH: |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 154 | newvalue = S3C2410_EXTINT_BOTHEDGE; |
| 155 | break; |
| 156 | |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 157 | case IRQ_TYPE_LEVEL_LOW: |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 158 | newvalue = S3C2410_EXTINT_LOWLEV; |
| 159 | break; |
| 160 | |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 161 | case IRQ_TYPE_LEVEL_HIGH: |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 162 | newvalue = S3C2410_EXTINT_HILEV; |
| 163 | break; |
| 164 | |
| 165 | default: |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 166 | pr_err("No such irq type %d", type); |
| 167 | return -EINVAL; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | value = __raw_readl(extint_reg); |
| 171 | value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset); |
| 172 | __raw_writel(value, extint_reg); |
| 173 | |
| 174 | return 0; |
| 175 | } |
| 176 | |
Heiko Stuebner | dc1a353 | 2013-02-12 14:23:01 -0800 | [diff] [blame] | 177 | static int s3c_irqext_type(struct irq_data *data, unsigned int type) |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 178 | { |
| 179 | void __iomem *extint_reg; |
| 180 | void __iomem *gpcon_reg; |
| 181 | unsigned long gpcon_offset, extint_offset; |
| 182 | |
| 183 | if ((data->hwirq >= 4) && (data->hwirq <= 7)) { |
| 184 | gpcon_reg = S3C2410_GPFCON; |
| 185 | extint_reg = S3C24XX_EXTINT0; |
| 186 | gpcon_offset = (data->hwirq) * 2; |
| 187 | extint_offset = (data->hwirq) * 4; |
| 188 | } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) { |
| 189 | gpcon_reg = S3C2410_GPGCON; |
| 190 | extint_reg = S3C24XX_EXTINT1; |
| 191 | gpcon_offset = (data->hwirq - 8) * 2; |
| 192 | extint_offset = (data->hwirq - 8) * 4; |
| 193 | } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) { |
| 194 | gpcon_reg = S3C2410_GPGCON; |
| 195 | extint_reg = S3C24XX_EXTINT2; |
| 196 | gpcon_offset = (data->hwirq - 8) * 2; |
| 197 | extint_offset = (data->hwirq - 16) * 4; |
| 198 | } else { |
| 199 | return -EINVAL; |
| 200 | } |
| 201 | |
| 202 | return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset, |
| 203 | extint_offset, type); |
| 204 | } |
| 205 | |
| 206 | static int s3c_irqext0_type(struct irq_data *data, unsigned int type) |
| 207 | { |
| 208 | void __iomem *extint_reg; |
| 209 | void __iomem *gpcon_reg; |
| 210 | unsigned long gpcon_offset, extint_offset; |
| 211 | |
| 212 | if ((data->hwirq >= 0) && (data->hwirq <= 3)) { |
| 213 | gpcon_reg = S3C2410_GPFCON; |
| 214 | extint_reg = S3C24XX_EXTINT0; |
| 215 | gpcon_offset = (data->hwirq) * 2; |
| 216 | extint_offset = (data->hwirq) * 4; |
| 217 | } else { |
| 218 | return -EINVAL; |
| 219 | } |
| 220 | |
| 221 | return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset, |
| 222 | extint_offset, type); |
| 223 | } |
| 224 | |
Heiko Stuebner | dc1a353 | 2013-02-12 14:23:01 -0800 | [diff] [blame] | 225 | static struct irq_chip s3c_irq_chip = { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 226 | .name = "s3c", |
| 227 | .irq_ack = s3c_irq_ack, |
| 228 | .irq_mask = s3c_irq_mask, |
| 229 | .irq_unmask = s3c_irq_unmask, |
| 230 | .irq_set_wake = s3c_irq_wake |
| 231 | }; |
| 232 | |
Heiko Stuebner | dc1a353 | 2013-02-12 14:23:01 -0800 | [diff] [blame] | 233 | static struct irq_chip s3c_irq_level_chip = { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 234 | .name = "s3c-level", |
| 235 | .irq_mask = s3c_irq_mask, |
| 236 | .irq_unmask = s3c_irq_unmask, |
| 237 | .irq_ack = s3c_irq_ack, |
| 238 | }; |
| 239 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 240 | static struct irq_chip s3c_irqext_chip = { |
| 241 | .name = "s3c-ext", |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 242 | .irq_mask = s3c_irq_mask, |
| 243 | .irq_unmask = s3c_irq_unmask, |
| 244 | .irq_ack = s3c_irq_ack, |
Lennert Buytenhek | 57436c2d | 2011-01-03 19:15:54 +0900 | [diff] [blame] | 245 | .irq_set_type = s3c_irqext_type, |
Mark Brown | f5aeffb | 2010-12-02 14:35:38 +0900 | [diff] [blame] | 246 | .irq_set_wake = s3c_irqext_wake |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 247 | }; |
| 248 | |
| 249 | static struct irq_chip s3c_irq_eint0t4 = { |
| 250 | .name = "s3c-ext0", |
Lennert Buytenhek | 57436c2d | 2011-01-03 19:15:54 +0900 | [diff] [blame] | 251 | .irq_ack = s3c_irq_ack, |
| 252 | .irq_mask = s3c_irq_mask, |
| 253 | .irq_unmask = s3c_irq_unmask, |
| 254 | .irq_set_wake = s3c_irq_wake, |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 255 | .irq_set_type = s3c_irqext0_type, |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 256 | }; |
| 257 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 258 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 259 | { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 260 | struct irq_chip *chip = irq_desc_get_chip(desc); |
| 261 | struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; |
| 262 | struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; |
| 263 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; |
| 264 | unsigned long src; |
| 265 | unsigned long msk; |
| 266 | unsigned int n; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 267 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 268 | chained_irq_enter(chip, desc); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 269 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 270 | src = __raw_readl(sub_intc->reg_pending); |
| 271 | msk = __raw_readl(sub_intc->reg_mask); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 272 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 273 | src &= ~msk; |
| 274 | src &= irq_data->sub_bits; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 275 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 276 | while (src) { |
| 277 | n = __ffs(src); |
| 278 | src &= ~(1 << n); |
| 279 | generic_handle_irq(irq_find_mapping(sub_intc->domain, n)); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 280 | } |
| 281 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 282 | chained_irq_exit(chip, desc); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 283 | } |
| 284 | |
Ben Dooks | 229fd8f | 2009-08-03 17:26:57 +0100 | [diff] [blame] | 285 | #ifdef CONFIG_FIQ |
| 286 | /** |
| 287 | * s3c24xx_set_fiq - set the FIQ routing |
| 288 | * @irq: IRQ number to route to FIQ on processor. |
| 289 | * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing. |
| 290 | * |
| 291 | * Change the state of the IRQ to FIQ routing depending on @irq and @on. If |
| 292 | * @on is true, the @irq is checked to see if it can be routed and the |
| 293 | * interrupt controller updated to route the IRQ. If @on is false, the FIQ |
| 294 | * routing is cleared, regardless of which @irq is specified. |
| 295 | */ |
| 296 | int s3c24xx_set_fiq(unsigned int irq, bool on) |
| 297 | { |
| 298 | u32 intmod; |
| 299 | unsigned offs; |
| 300 | |
| 301 | if (on) { |
| 302 | offs = irq - FIQ_START; |
| 303 | if (offs > 31) |
| 304 | return -EINVAL; |
| 305 | |
| 306 | intmod = 1 << offs; |
| 307 | } else { |
| 308 | intmod = 0; |
| 309 | } |
| 310 | |
| 311 | __raw_writel(intmod, S3C2410_INTMOD); |
| 312 | return 0; |
| 313 | } |
Ben Dooks | 0f13c82 | 2009-12-07 14:51:38 +0000 | [diff] [blame] | 314 | |
| 315 | EXPORT_SYMBOL_GPL(s3c24xx_set_fiq); |
Ben Dooks | 229fd8f | 2009-08-03 17:26:57 +0100 | [diff] [blame] | 316 | #endif |
| 317 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 318 | static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, |
| 319 | irq_hw_number_t hw) |
| 320 | { |
| 321 | struct s3c_irq_intc *intc = h->host_data; |
| 322 | struct s3c_irq_data *irq_data = &intc->irqs[hw]; |
| 323 | struct s3c_irq_intc *parent_intc; |
| 324 | struct s3c_irq_data *parent_irq_data; |
| 325 | unsigned int irqno; |
| 326 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 327 | /* attach controller pointer to irq_data */ |
| 328 | irq_data->intc = intc; |
| 329 | |
| 330 | /* set handler and flags */ |
| 331 | switch (irq_data->type) { |
| 332 | case S3C_IRQTYPE_NONE: |
| 333 | return 0; |
| 334 | case S3C_IRQTYPE_EINT: |
Heiko Stuebner | 1c8408e | 2013-02-12 10:12:09 -0800 | [diff] [blame] | 335 | /* On the S3C2412, the EINT0to3 have a parent irq |
| 336 | * but need the s3c_irq_eint0t4 chip |
| 337 | */ |
| 338 | if (irq_data->parent_irq && (!soc_is_s3c2412() || hw >= 4)) |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 339 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, |
| 340 | handle_edge_irq); |
| 341 | else |
| 342 | irq_set_chip_and_handler(virq, &s3c_irq_eint0t4, |
| 343 | handle_edge_irq); |
| 344 | break; |
| 345 | case S3C_IRQTYPE_EDGE: |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 346 | if (irq_data->parent_irq || |
| 347 | intc->reg_pending == S3C2416_SRCPND2) |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 348 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
| 349 | handle_edge_irq); |
| 350 | else |
| 351 | irq_set_chip_and_handler(virq, &s3c_irq_chip, |
| 352 | handle_edge_irq); |
| 353 | break; |
| 354 | case S3C_IRQTYPE_LEVEL: |
| 355 | if (irq_data->parent_irq) |
| 356 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
| 357 | handle_level_irq); |
| 358 | else |
| 359 | irq_set_chip_and_handler(virq, &s3c_irq_chip, |
| 360 | handle_level_irq); |
| 361 | break; |
| 362 | default: |
| 363 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); |
| 364 | return -EINVAL; |
| 365 | } |
| 366 | set_irq_flags(virq, IRQF_VALID); |
| 367 | |
| 368 | if (irq_data->parent_irq) { |
| 369 | parent_intc = intc->parent; |
| 370 | if (!parent_intc) { |
| 371 | pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", |
| 372 | hw); |
| 373 | goto err; |
| 374 | } |
| 375 | |
Heiko Stuebner | 502a298 | 2013-03-07 12:38:13 +0900 | [diff] [blame^] | 376 | if (irq_data->parent_irq > 31) { |
| 377 | pr_err("irq-s3c24xx: parent irq %lu is out of range\n", |
| 378 | irq_data->parent_irq); |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 379 | goto err; |
| 380 | } |
| 381 | |
Heiko Stuebner | 502a298 | 2013-03-07 12:38:13 +0900 | [diff] [blame^] | 382 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 383 | parent_irq_data->sub_intc = intc; |
| 384 | parent_irq_data->sub_bits |= (1UL << hw); |
| 385 | |
| 386 | /* attach the demuxer to the parent irq */ |
| 387 | irqno = irq_find_mapping(parent_intc->domain, |
| 388 | irq_data->parent_irq); |
| 389 | if (!irqno) { |
| 390 | pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n", |
| 391 | irq_data->parent_irq); |
| 392 | goto err; |
| 393 | } |
| 394 | irq_set_chained_handler(irqno, s3c_irq_demux); |
| 395 | } |
| 396 | |
| 397 | return 0; |
| 398 | |
| 399 | err: |
| 400 | set_irq_flags(virq, 0); |
| 401 | |
| 402 | /* the only error can result from bad mapping data*/ |
| 403 | return -EINVAL; |
| 404 | } |
| 405 | |
| 406 | static struct irq_domain_ops s3c24xx_irq_ops = { |
| 407 | .map = s3c24xx_irq_map, |
| 408 | .xlate = irq_domain_xlate_twocell, |
| 409 | }; |
| 410 | |
| 411 | static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) |
| 412 | { |
| 413 | void __iomem *reg_source; |
| 414 | unsigned long pend; |
| 415 | unsigned long last; |
| 416 | int i; |
| 417 | |
| 418 | /* if intpnd is set, read the next pending irq from there */ |
| 419 | reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending; |
| 420 | |
| 421 | last = 0; |
| 422 | for (i = 0; i < 4; i++) { |
| 423 | pend = __raw_readl(reg_source); |
| 424 | |
| 425 | if (pend == 0 || pend == last) |
| 426 | break; |
| 427 | |
| 428 | __raw_writel(pend, intc->reg_pending); |
| 429 | if (intc->reg_intpnd) |
| 430 | __raw_writel(pend, intc->reg_intpnd); |
| 431 | |
| 432 | pr_info("irq: clearing pending status %08x\n", (int)pend); |
| 433 | last = pend; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, |
| 438 | struct s3c_irq_data *irq_data, |
| 439 | struct s3c_irq_intc *parent, |
| 440 | unsigned long address) |
| 441 | { |
| 442 | struct s3c_irq_intc *intc; |
| 443 | void __iomem *base = (void *)0xf6000000; /* static mapping */ |
| 444 | int irq_num; |
| 445 | int irq_start; |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 446 | int ret; |
| 447 | |
| 448 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); |
| 449 | if (!intc) |
| 450 | return ERR_PTR(-ENOMEM); |
| 451 | |
| 452 | intc->irqs = irq_data; |
| 453 | |
| 454 | if (parent) |
| 455 | intc->parent = parent; |
| 456 | |
| 457 | /* select the correct data for the controller. |
| 458 | * Need to hard code the irq num start and offset |
| 459 | * to preserve the static mapping for now |
| 460 | */ |
| 461 | switch (address) { |
| 462 | case 0x4a000000: |
| 463 | pr_debug("irq: found main intc\n"); |
| 464 | intc->reg_pending = base; |
| 465 | intc->reg_mask = base + 0x08; |
| 466 | intc->reg_intpnd = base + 0x10; |
| 467 | irq_num = 32; |
| 468 | irq_start = S3C2410_IRQ(0); |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 469 | break; |
| 470 | case 0x4a000018: |
| 471 | pr_debug("irq: found subintc\n"); |
| 472 | intc->reg_pending = base + 0x18; |
| 473 | intc->reg_mask = base + 0x1c; |
| 474 | irq_num = 29; |
| 475 | irq_start = S3C2410_IRQSUB(0); |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 476 | break; |
| 477 | case 0x4a000040: |
| 478 | pr_debug("irq: found intc2\n"); |
| 479 | intc->reg_pending = base + 0x40; |
| 480 | intc->reg_mask = base + 0x48; |
| 481 | intc->reg_intpnd = base + 0x50; |
| 482 | irq_num = 8; |
| 483 | irq_start = S3C2416_IRQ(0); |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 484 | break; |
| 485 | case 0x560000a4: |
| 486 | pr_debug("irq: found eintc\n"); |
| 487 | base = (void *)0xfd000000; |
| 488 | |
| 489 | intc->reg_mask = base + 0xa4; |
| 490 | intc->reg_pending = base + 0x08; |
Heiko Stuebner | 5424f21 | 2013-02-12 10:12:04 -0800 | [diff] [blame] | 491 | irq_num = 24; |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 492 | irq_start = S3C2410_IRQ(32); |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 493 | break; |
| 494 | default: |
| 495 | pr_err("irq: unsupported controller address\n"); |
| 496 | ret = -EINVAL; |
| 497 | goto err; |
| 498 | } |
| 499 | |
| 500 | /* now that all the data is complete, init the irq-domain */ |
| 501 | s3c24xx_clear_intc(intc); |
| 502 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, |
Heiko Stuebner | 5424f21 | 2013-02-12 10:12:04 -0800 | [diff] [blame] | 503 | 0, &s3c24xx_irq_ops, |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 504 | intc); |
| 505 | if (!intc->domain) { |
| 506 | pr_err("irq: could not create irq-domain\n"); |
| 507 | ret = -EINVAL; |
| 508 | goto err; |
| 509 | } |
| 510 | |
| 511 | return intc; |
| 512 | |
| 513 | err: |
| 514 | kfree(intc); |
| 515 | return ERR_PTR(ret); |
| 516 | } |
Ben Dooks | 229fd8f | 2009-08-03 17:26:57 +0100 | [diff] [blame] | 517 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 518 | /* s3c24xx_init_irq |
| 519 | * |
| 520 | * Initialise S3C2410 IRQ system |
| 521 | */ |
| 522 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 523 | static struct s3c_irq_data init_base[32] = { |
| 524 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
| 525 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
| 526 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
| 527 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ |
| 528 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 529 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 530 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 531 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 532 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 533 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ |
| 534 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 535 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 536 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 537 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 538 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 539 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 540 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ |
| 541 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ |
| 542 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ |
| 543 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ |
| 544 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ |
| 545 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ |
| 546 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 547 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 548 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 549 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 550 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 551 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 552 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 553 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ |
| 554 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 555 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
| 556 | }; |
| 557 | |
| 558 | static struct s3c_irq_data init_eint[32] = { |
| 559 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 560 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 561 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 562 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 563 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ |
| 564 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ |
| 565 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ |
| 566 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ |
| 567 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ |
| 568 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ |
| 569 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ |
| 570 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ |
| 571 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ |
| 572 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ |
| 573 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ |
| 574 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ |
| 575 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ |
| 576 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ |
| 577 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ |
| 578 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ |
| 579 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ |
| 580 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ |
| 581 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ |
| 582 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ |
| 583 | }; |
| 584 | |
| 585 | static struct s3c_irq_data init_subint[32] = { |
| 586 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 587 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 588 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 589 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 590 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 591 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 592 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 593 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 594 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 595 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 596 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 597 | }; |
| 598 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 599 | void __init s3c24xx_init_irq(void) |
| 600 | { |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 601 | struct s3c_irq_intc *main_intc; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 602 | |
Ben Dooks | 229fd8f | 2009-08-03 17:26:57 +0100 | [diff] [blame] | 603 | #ifdef CONFIG_FIQ |
Shawn Guo | bc89663 | 2012-06-28 14:42:08 +0800 | [diff] [blame] | 604 | init_FIQ(FIQ_START); |
Ben Dooks | 229fd8f | 2009-08-03 17:26:57 +0100 | [diff] [blame] | 605 | #endif |
| 606 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 607 | main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); |
| 608 | if (IS_ERR(main_intc)) { |
| 609 | pr_err("irq: could not create main interrupt controller\n"); |
| 610 | return; |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 611 | } |
| 612 | |
Heiko Stuebner | 1f629b7 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 613 | s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); |
| 614 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 615 | } |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 616 | |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 617 | #ifdef CONFIG_CPU_S3C2412 |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 618 | static struct s3c_irq_data init_s3c2412base[32] = { |
Heiko Stuebner | 1c8408e | 2013-02-12 10:12:09 -0800 | [diff] [blame] | 619 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */ |
| 620 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */ |
| 621 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */ |
| 622 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */ |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 623 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 624 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 625 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 626 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 627 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 628 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ |
| 629 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 630 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 631 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 632 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 633 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 634 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 635 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ |
| 636 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ |
| 637 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ |
| 638 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ |
| 639 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ |
| 640 | { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */ |
| 641 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 642 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 643 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 644 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 645 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 646 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 647 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 648 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ |
| 649 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 650 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
| 651 | }; |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 652 | |
Heiko Stuebner | 1c8408e | 2013-02-12 10:12:09 -0800 | [diff] [blame] | 653 | static struct s3c_irq_data init_s3c2412eint[32] = { |
| 654 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */ |
| 655 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */ |
| 656 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */ |
| 657 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */ |
| 658 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ |
| 659 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ |
| 660 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ |
| 661 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ |
| 662 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ |
| 663 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ |
| 664 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ |
| 665 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ |
| 666 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ |
| 667 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ |
| 668 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ |
| 669 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ |
| 670 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ |
| 671 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ |
| 672 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ |
| 673 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ |
| 674 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ |
| 675 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ |
| 676 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ |
| 677 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ |
| 678 | }; |
| 679 | |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 680 | static struct s3c_irq_data init_s3c2412subint[32] = { |
| 681 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 682 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 683 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 684 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 685 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 686 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 687 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 688 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 689 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 690 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 691 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 692 | { .type = S3C_IRQTYPE_NONE, }, |
| 693 | { .type = S3C_IRQTYPE_NONE, }, |
| 694 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */ |
| 695 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */ |
| 696 | }; |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 697 | |
Heiko Stuebner | 0da0993 | 2013-02-12 10:09:18 -0800 | [diff] [blame] | 698 | void s3c2412_init_irq(void) |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 699 | { |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 700 | struct s3c_irq_intc *main_intc; |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 701 | |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 702 | pr_info("S3C2412: IRQ Support\n"); |
| 703 | |
| 704 | #ifdef CONFIG_FIQ |
| 705 | init_FIQ(FIQ_START); |
| 706 | #endif |
| 707 | |
| 708 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, 0x4a000000); |
| 709 | if (IS_ERR(main_intc)) { |
| 710 | pr_err("irq: could not create main interrupt controller\n"); |
| 711 | return; |
| 712 | } |
| 713 | |
Heiko Stuebner | 1c8408e | 2013-02-12 10:12:09 -0800 | [diff] [blame] | 714 | s3c24xx_init_intc(NULL, &init_s3c2412eint[0], main_intc, 0x560000a4); |
Heiko Stuebner | 4245944 | 2013-02-12 10:09:21 -0800 | [diff] [blame] | 715 | s3c24xx_init_intc(NULL, &init_s3c2412subint[0], main_intc, 0x4a000018); |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 716 | } |
Heiko Stuebner | d3d5a2c | 2013-02-12 10:09:13 -0800 | [diff] [blame] | 717 | #endif |
| 718 | |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 719 | #ifdef CONFIG_CPU_S3C2416 |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 720 | static struct s3c_irq_data init_s3c2416base[32] = { |
| 721 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
| 722 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
| 723 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
| 724 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ |
| 725 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 726 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 727 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 728 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 729 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 730 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ |
| 731 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 732 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 733 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 734 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 735 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 736 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 737 | { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */ |
| 738 | { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */ |
| 739 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */ |
| 740 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
| 741 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */ |
| 742 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */ |
| 743 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 744 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 745 | { .type = S3C_IRQTYPE_EDGE, }, /* NAND */ |
| 746 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 747 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 748 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 749 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 750 | { .type = S3C_IRQTYPE_NONE, }, |
| 751 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 752 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 753 | }; |
| 754 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 755 | static struct s3c_irq_data init_s3c2416subint[32] = { |
| 756 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 757 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 758 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 759 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 760 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 761 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 762 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 763 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 764 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 765 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 766 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 767 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 768 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 769 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 770 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 771 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */ |
| 772 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */ |
| 773 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */ |
| 774 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */ |
| 775 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */ |
| 776 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */ |
| 777 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */ |
| 778 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */ |
| 779 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */ |
| 780 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */ |
| 781 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */ |
| 782 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */ |
| 783 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ |
| 784 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 785 | }; |
| 786 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 787 | static struct s3c_irq_data init_s3c2416_second[32] = { |
| 788 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ |
| 789 | { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ |
| 790 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 791 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 792 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ |
| 793 | { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ |
| 794 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ |
| 795 | { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 796 | }; |
| 797 | |
Heiko Stuebner | 4a282dd | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 798 | void __init s3c2416_init_irq(void) |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 799 | { |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 800 | struct s3c_irq_intc *main_intc; |
| 801 | |
Heiko Stuebner | 4a282dd | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 802 | pr_info("S3C2416: IRQ Support\n"); |
| 803 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 804 | #ifdef CONFIG_FIQ |
| 805 | init_FIQ(FIQ_START); |
| 806 | #endif |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 807 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 808 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); |
| 809 | if (IS_ERR(main_intc)) { |
| 810 | pr_err("irq: could not create main interrupt controller\n"); |
| 811 | return; |
| 812 | } |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 813 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 814 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
| 815 | s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018); |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 816 | |
Heiko Stuebner | 20f6c78 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 817 | s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 818 | } |
| 819 | |
Heiko Stuebner | ef602eb | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 820 | #endif |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 821 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 822 | #ifdef CONFIG_CPU_S3C2440 |
| 823 | static struct s3c_irq_data init_s3c2440base[32] = { |
| 824 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
| 825 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
| 826 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
| 827 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ |
| 828 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 829 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 830 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ |
| 831 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 832 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 833 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ |
| 834 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 835 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 836 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 837 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 838 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 839 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 840 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ |
| 841 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ |
| 842 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ |
| 843 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ |
| 844 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ |
| 845 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ |
| 846 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 847 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 848 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ |
| 849 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 850 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 851 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 852 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 853 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ |
| 854 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 855 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 856 | }; |
| 857 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 858 | static struct s3c_irq_data init_s3c2440subint[32] = { |
| 859 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 860 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 861 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 862 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 863 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 864 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 865 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 866 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 867 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 868 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 869 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 870 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */ |
| 871 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */ |
| 872 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ |
| 873 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ |
Heiko Stuebner | 2286cf4 | 2013-02-12 09:59:24 -0800 | [diff] [blame] | 874 | }; |
| 875 | |
Heiko Stuebner | 7cefed5 | 2013-02-12 09:59:27 -0800 | [diff] [blame] | 876 | void __init s3c2440_init_irq(void) |
Heiko Stuebner | 2286cf4 | 2013-02-12 09:59:24 -0800 | [diff] [blame] | 877 | { |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 878 | struct s3c_irq_intc *main_intc; |
Heiko Stuebner | 2286cf4 | 2013-02-12 09:59:24 -0800 | [diff] [blame] | 879 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 880 | pr_info("S3C2440: IRQ Support\n"); |
Heiko Stuebner | 2286cf4 | 2013-02-12 09:59:24 -0800 | [diff] [blame] | 881 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 882 | #ifdef CONFIG_FIQ |
| 883 | init_FIQ(FIQ_START); |
| 884 | #endif |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 885 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 886 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, 0x4a000000); |
| 887 | if (IS_ERR(main_intc)) { |
| 888 | pr_err("irq: could not create main interrupt controller\n"); |
| 889 | return; |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 890 | } |
Heiko Stuebner | 7cefed5 | 2013-02-12 09:59:27 -0800 | [diff] [blame] | 891 | |
Heiko Stuebner | f030167 | 2013-02-12 09:59:35 -0800 | [diff] [blame] | 892 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
| 893 | s3c24xx_init_intc(NULL, &init_s3c2440subint[0], main_intc, 0x4a000018); |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 894 | } |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 895 | #endif |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 896 | |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 897 | #ifdef CONFIG_CPU_S3C2442 |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 898 | static struct s3c_irq_data init_s3c2442base[32] = { |
| 899 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
| 900 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
| 901 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
| 902 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ |
| 903 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 904 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 905 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ |
| 906 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 907 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 908 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ |
| 909 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 910 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 911 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 912 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 913 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 914 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 915 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ |
| 916 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ |
| 917 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ |
| 918 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ |
| 919 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ |
| 920 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ |
| 921 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 922 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 923 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ |
| 924 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 925 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 926 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 927 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 928 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ |
| 929 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 930 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
| 931 | }; |
| 932 | |
| 933 | static struct s3c_irq_data init_s3c2442subint[32] = { |
| 934 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 935 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 936 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 937 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 938 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 939 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 940 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 941 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 942 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 943 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 944 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 945 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */ |
| 946 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */ |
| 947 | }; |
| 948 | |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 949 | void __init s3c2442_init_irq(void) |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 950 | { |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 951 | struct s3c_irq_intc *main_intc; |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 952 | |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 953 | pr_info("S3C2442: IRQ Support\n"); |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 954 | |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 955 | #ifdef CONFIG_FIQ |
| 956 | init_FIQ(FIQ_START); |
| 957 | #endif |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 958 | |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 959 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, 0x4a000000); |
| 960 | if (IS_ERR(main_intc)) { |
| 961 | pr_err("irq: could not create main interrupt controller\n"); |
| 962 | return; |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 963 | } |
Heiko Stuebner | 70644ad | 2013-02-12 09:59:31 -0800 | [diff] [blame] | 964 | |
| 965 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
| 966 | s3c24xx_init_intc(NULL, &init_s3c2442subint[0], main_intc, 0x4a000018); |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 967 | } |
Heiko Stuebner | ce6c164 | 2013-02-12 09:59:20 -0800 | [diff] [blame] | 968 | #endif |
Heiko Stuebner | 6f8d7ea | 2013-02-12 09:59:17 -0800 | [diff] [blame] | 969 | |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 970 | #ifdef CONFIG_CPU_S3C2443 |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 971 | static struct s3c_irq_data init_s3c2443base[32] = { |
| 972 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
| 973 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
| 974 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
| 975 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ |
| 976 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ |
| 977 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ |
| 978 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ |
| 979 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ |
| 980 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ |
| 981 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ |
| 982 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ |
| 983 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ |
| 984 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ |
| 985 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ |
| 986 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ |
| 987 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ |
| 988 | { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */ |
| 989 | { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */ |
| 990 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */ |
| 991 | { .type = S3C_IRQTYPE_EDGE, }, /* CFON */ |
| 992 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */ |
| 993 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */ |
| 994 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ |
| 995 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ |
| 996 | { .type = S3C_IRQTYPE_EDGE, }, /* NAND */ |
| 997 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ |
| 998 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ |
| 999 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ |
| 1000 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ |
| 1001 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ |
| 1002 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ |
| 1003 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1004 | }; |
| 1005 | |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1006 | |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1007 | static struct s3c_irq_data init_s3c2443subint[32] = { |
| 1008 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
| 1009 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
| 1010 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
| 1011 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ |
| 1012 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ |
| 1013 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ |
| 1014 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ |
| 1015 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ |
| 1016 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
| 1017 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
| 1018 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
| 1019 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ |
| 1020 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ |
| 1021 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
| 1022 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */ |
| 1023 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */ |
| 1024 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */ |
| 1025 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */ |
| 1026 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */ |
| 1027 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */ |
| 1028 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */ |
| 1029 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */ |
| 1030 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */ |
| 1031 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */ |
| 1032 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */ |
| 1033 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */ |
| 1034 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */ |
| 1035 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ |
| 1036 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1037 | }; |
| 1038 | |
Heiko Stuebner | b499b7a | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1039 | void __init s3c2443_init_irq(void) |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1040 | { |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1041 | struct s3c_irq_intc *main_intc; |
| 1042 | |
Heiko Stuebner | b499b7a | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1043 | pr_info("S3C2443: IRQ Support\n"); |
| 1044 | |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1045 | #ifdef CONFIG_FIQ |
| 1046 | init_FIQ(FIQ_START); |
| 1047 | #endif |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1048 | |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1049 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); |
| 1050 | if (IS_ERR(main_intc)) { |
| 1051 | pr_err("irq: could not create main interrupt controller\n"); |
| 1052 | return; |
| 1053 | } |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1054 | |
Heiko Stuebner | f44ddba | 2013-01-29 10:25:23 -0800 | [diff] [blame] | 1055 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
| 1056 | s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018); |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1057 | } |
Heiko Stuebner | 6b62891 | 2013-01-29 10:25:22 -0800 | [diff] [blame] | 1058 | #endif |