Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 1 | #define pr_fmt(fmt) "irq: " fmt |
| 2 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 3 | #include <linux/debugfs.h> |
| 4 | #include <linux/hardirq.h> |
| 5 | #include <linux/interrupt.h> |
Grant Likely | 08a543a | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 6 | #include <linux/irq.h> |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 7 | #include <linux/irqdesc.h> |
Grant Likely | 08a543a | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 8 | #include <linux/irqdomain.h> |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/mutex.h> |
| 11 | #include <linux/of.h> |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 12 | #include <linux/of_address.h> |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 13 | #include <linux/topology.h> |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 14 | #include <linux/seq_file.h> |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 15 | #include <linux/slab.h> |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 16 | #include <linux/smp.h> |
| 17 | #include <linux/fs.h> |
Grant Likely | 08a543a | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 18 | |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 19 | #define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs. |
| 20 | * ie. legacy 8259, gets irqs 1..15 */ |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 21 | #define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */ |
| 22 | #define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */ |
| 23 | #define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */ |
| 24 | |
Grant Likely | 08a543a | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 25 | static LIST_HEAD(irq_domain_list); |
| 26 | static DEFINE_MUTEX(irq_domain_mutex); |
| 27 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 28 | static DEFINE_MUTEX(revmap_trees_mutex); |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 29 | static struct irq_domain *irq_default_domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 30 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 31 | /** |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 32 | * irq_domain_alloc() - Allocate a new irq_domain data structure |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 33 | * @of_node: optional device-tree node of the interrupt controller |
| 34 | * @revmap_type: type of reverse mapping to use |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 35 | * @ops: map/unmap domain callbacks |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 36 | * @host_data: Controller private data pointer |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 37 | * |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 38 | * Allocates and initialize and irq_domain structure. Caller is expected to |
| 39 | * register allocated irq_domain with irq_domain_register(). Returns pointer |
| 40 | * to IRQ domain, or NULL on failure. |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 41 | */ |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 42 | static struct irq_domain *irq_domain_alloc(struct device_node *of_node, |
| 43 | unsigned int revmap_type, |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 44 | const struct irq_domain_ops *ops, |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 45 | void *host_data) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 46 | { |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 47 | struct irq_domain *domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 48 | |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 49 | domain = kzalloc_node(sizeof(*domain), GFP_KERNEL, |
| 50 | of_node_to_nid(of_node)); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 51 | if (WARN_ON(!domain)) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 52 | return NULL; |
| 53 | |
| 54 | /* Fill structure */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 55 | domain->revmap_type = revmap_type; |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 56 | domain->ops = ops; |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 57 | domain->host_data = host_data; |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 58 | domain->of_node = of_node_get(of_node); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 59 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 60 | return domain; |
| 61 | } |
| 62 | |
Paul Mundt | 58ee99a | 2012-05-19 15:11:41 +0900 | [diff] [blame] | 63 | static void irq_domain_free(struct irq_domain *domain) |
| 64 | { |
| 65 | of_node_put(domain->of_node); |
| 66 | kfree(domain); |
| 67 | } |
| 68 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 69 | static void irq_domain_add(struct irq_domain *domain) |
| 70 | { |
| 71 | mutex_lock(&irq_domain_mutex); |
| 72 | list_add(&domain->link, &irq_domain_list); |
| 73 | mutex_unlock(&irq_domain_mutex); |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 74 | pr_debug("Allocated domain of type %d @0x%p\n", |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 75 | domain->revmap_type, domain); |
| 76 | } |
| 77 | |
Paul Mundt | 58ee99a | 2012-05-19 15:11:41 +0900 | [diff] [blame] | 78 | /** |
| 79 | * irq_domain_remove() - Remove an irq domain. |
| 80 | * @domain: domain to remove |
| 81 | * |
| 82 | * This routine is used to remove an irq domain. The caller must ensure |
| 83 | * that all mappings within the domain have been disposed of prior to |
| 84 | * use, depending on the revmap type. |
| 85 | */ |
| 86 | void irq_domain_remove(struct irq_domain *domain) |
| 87 | { |
| 88 | mutex_lock(&irq_domain_mutex); |
| 89 | |
| 90 | switch (domain->revmap_type) { |
| 91 | case IRQ_DOMAIN_MAP_LEGACY: |
| 92 | /* |
| 93 | * Legacy domains don't manage their own irq_desc |
| 94 | * allocations, we expect the caller to handle irq_desc |
| 95 | * freeing on their own. |
| 96 | */ |
| 97 | break; |
| 98 | case IRQ_DOMAIN_MAP_TREE: |
| 99 | /* |
| 100 | * radix_tree_delete() takes care of destroying the root |
| 101 | * node when all entries are removed. Shout if there are |
| 102 | * any mappings left. |
| 103 | */ |
| 104 | WARN_ON(domain->revmap_data.tree.height); |
| 105 | break; |
| 106 | case IRQ_DOMAIN_MAP_LINEAR: |
| 107 | kfree(domain->revmap_data.linear.revmap); |
| 108 | domain->revmap_data.linear.size = 0; |
| 109 | break; |
| 110 | case IRQ_DOMAIN_MAP_NOMAP: |
| 111 | break; |
| 112 | } |
| 113 | |
| 114 | list_del(&domain->link); |
| 115 | |
| 116 | /* |
| 117 | * If the going away domain is the default one, reset it. |
| 118 | */ |
| 119 | if (unlikely(irq_default_domain == domain)) |
| 120 | irq_set_default_host(NULL); |
| 121 | |
| 122 | mutex_unlock(&irq_domain_mutex); |
| 123 | |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 124 | pr_debug("Removed domain of type %d @0x%p\n", |
Paul Mundt | 58ee99a | 2012-05-19 15:11:41 +0900 | [diff] [blame] | 125 | domain->revmap_type, domain); |
| 126 | |
| 127 | irq_domain_free(domain); |
| 128 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 129 | EXPORT_SYMBOL_GPL(irq_domain_remove); |
Paul Mundt | 58ee99a | 2012-05-19 15:11:41 +0900 | [diff] [blame] | 130 | |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 131 | static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain, |
| 132 | irq_hw_number_t hwirq) |
| 133 | { |
| 134 | irq_hw_number_t first_hwirq = domain->revmap_data.legacy.first_hwirq; |
| 135 | int size = domain->revmap_data.legacy.size; |
| 136 | |
| 137 | if (WARN_ON(hwirq < first_hwirq || hwirq >= first_hwirq + size)) |
| 138 | return 0; |
| 139 | return hwirq - first_hwirq + domain->revmap_data.legacy.first_irq; |
| 140 | } |
| 141 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 142 | /** |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 143 | * irq_domain_add_simple() - Allocate and register a simple irq_domain. |
| 144 | * @of_node: pointer to interrupt controller's device tree node. |
| 145 | * @size: total number of irqs in mapping |
Linus Walleij | 94a63da | 2013-06-06 12:10:23 +0100 | [diff] [blame^] | 146 | * @first_irq: first number of irq block assigned to the domain, |
| 147 | * pass zero to assign irqs on-the-fly. This will result in a |
| 148 | * linear IRQ domain so it is important to use irq_create_mapping() |
| 149 | * for each used IRQ, especially when SPARSE_IRQ is enabled. |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 150 | * @ops: map/unmap domain callbacks |
| 151 | * @host_data: Controller private data pointer |
| 152 | * |
| 153 | * Allocates a legacy irq_domain if irq_base is positive or a linear |
Linus Walleij | 2854d16 | 2012-09-27 14:59:39 +0200 | [diff] [blame] | 154 | * domain otherwise. For the legacy domain, IRQ descriptors will also |
| 155 | * be allocated. |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 156 | * |
| 157 | * This is intended to implement the expected behaviour for most |
| 158 | * interrupt controllers which is that a linear mapping should |
| 159 | * normally be used unless the system requires a legacy mapping in |
| 160 | * order to support supplying interrupt numbers during non-DT |
| 161 | * registration of devices. |
| 162 | */ |
| 163 | struct irq_domain *irq_domain_add_simple(struct device_node *of_node, |
| 164 | unsigned int size, |
| 165 | unsigned int first_irq, |
| 166 | const struct irq_domain_ops *ops, |
| 167 | void *host_data) |
| 168 | { |
Linus Walleij | 2854d16 | 2012-09-27 14:59:39 +0200 | [diff] [blame] | 169 | if (first_irq > 0) { |
| 170 | int irq_base; |
| 171 | |
| 172 | if (IS_ENABLED(CONFIG_SPARSE_IRQ)) { |
| 173 | /* |
| 174 | * Set the descriptor allocator to search for a |
| 175 | * 1-to-1 mapping, such as irq_alloc_desc_at(). |
| 176 | * Use of_node_to_nid() which is defined to |
| 177 | * numa_node_id() on platforms that have no custom |
| 178 | * implementation. |
| 179 | */ |
| 180 | irq_base = irq_alloc_descs(first_irq, first_irq, size, |
| 181 | of_node_to_nid(of_node)); |
| 182 | if (irq_base < 0) { |
Linus Walleij | d202b7b | 2012-11-27 01:20:32 +0100 | [diff] [blame] | 183 | pr_info("Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", |
| 184 | first_irq); |
Linus Walleij | 2854d16 | 2012-09-27 14:59:39 +0200 | [diff] [blame] | 185 | irq_base = first_irq; |
| 186 | } |
| 187 | } else |
| 188 | irq_base = first_irq; |
| 189 | |
| 190 | return irq_domain_add_legacy(of_node, size, irq_base, 0, |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 191 | ops, host_data); |
Linus Walleij | 2854d16 | 2012-09-27 14:59:39 +0200 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | /* A linear domain is the default */ |
| 195 | return irq_domain_add_linear(of_node, size, ops, host_data); |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 196 | } |
Arnd Bergmann | 346dbb7 | 2013-04-25 19:28:54 +0200 | [diff] [blame] | 197 | EXPORT_SYMBOL_GPL(irq_domain_add_simple); |
Mark Brown | 781d0f4 | 2012-07-05 12:19:19 +0100 | [diff] [blame] | 198 | |
| 199 | /** |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 200 | * irq_domain_add_legacy() - Allocate and register a legacy revmap irq_domain. |
| 201 | * @of_node: pointer to interrupt controller's device tree node. |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 202 | * @size: total number of irqs in legacy mapping |
| 203 | * @first_irq: first number of irq block assigned to the domain |
| 204 | * @first_hwirq: first hwirq number to use for the translation. Should normally |
| 205 | * be '0', but a positive integer can be used if the effective |
| 206 | * hwirqs numbering does not begin at zero. |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 207 | * @ops: map/unmap domain callbacks |
| 208 | * @host_data: Controller private data pointer |
| 209 | * |
| 210 | * Note: the map() callback will be called before this function returns |
| 211 | * for all legacy interrupts except 0 (which is always the invalid irq for |
| 212 | * a legacy controller). |
| 213 | */ |
| 214 | struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 215 | unsigned int size, |
| 216 | unsigned int first_irq, |
| 217 | irq_hw_number_t first_hwirq, |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 218 | const struct irq_domain_ops *ops, |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 219 | void *host_data) |
| 220 | { |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 221 | struct irq_domain *domain; |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 222 | unsigned int i; |
| 223 | |
| 224 | domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LEGACY, ops, host_data); |
| 225 | if (!domain) |
| 226 | return NULL; |
| 227 | |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 228 | domain->revmap_data.legacy.first_irq = first_irq; |
| 229 | domain->revmap_data.legacy.first_hwirq = first_hwirq; |
| 230 | domain->revmap_data.legacy.size = size; |
| 231 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 232 | mutex_lock(&irq_domain_mutex); |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 233 | /* Verify that all the irqs are available */ |
| 234 | for (i = 0; i < size; i++) { |
| 235 | int irq = first_irq + i; |
| 236 | struct irq_data *irq_data = irq_get_irq_data(irq); |
| 237 | |
| 238 | if (WARN_ON(!irq_data || irq_data->domain)) { |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 239 | mutex_unlock(&irq_domain_mutex); |
Paul Mundt | 58ee99a | 2012-05-19 15:11:41 +0900 | [diff] [blame] | 240 | irq_domain_free(domain); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 241 | return NULL; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 242 | } |
| 243 | } |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 244 | |
| 245 | /* Claim all of the irqs before registering a legacy domain */ |
| 246 | for (i = 0; i < size; i++) { |
| 247 | struct irq_data *irq_data = irq_get_irq_data(first_irq + i); |
| 248 | irq_data->hwirq = first_hwirq + i; |
| 249 | irq_data->domain = domain; |
| 250 | } |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 251 | mutex_unlock(&irq_domain_mutex); |
| 252 | |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 253 | for (i = 0; i < size; i++) { |
| 254 | int irq = first_irq + i; |
| 255 | int hwirq = first_hwirq + i; |
| 256 | |
| 257 | /* IRQ0 gets ignored */ |
| 258 | if (!irq) |
| 259 | continue; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 260 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 261 | /* Legacy flags are left to default at this point, |
| 262 | * one can then use irq_create_mapping() to |
| 263 | * explicitly change them |
| 264 | */ |
Grant Likely | aed9804 | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 265 | if (ops->map) |
| 266 | ops->map(domain, irq, hwirq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 267 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 268 | /* Clear norequest flags */ |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 269 | irq_clear_status_flags(irq, IRQ_NOREQUEST); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 270 | } |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 271 | |
| 272 | irq_domain_add(domain); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 273 | return domain; |
| 274 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 275 | EXPORT_SYMBOL_GPL(irq_domain_add_legacy); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 276 | |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 277 | /** |
Dong Aisheng | 22076c7 | 2012-06-20 17:00:30 +0800 | [diff] [blame] | 278 | * irq_domain_add_linear() - Allocate and register a linear revmap irq_domain. |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 279 | * @of_node: pointer to interrupt controller's device tree node. |
Mark Brown | a87487e | 2012-05-19 12:15:35 +0100 | [diff] [blame] | 280 | * @size: Number of interrupts in the domain. |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 281 | * @ops: map/unmap domain callbacks |
| 282 | * @host_data: Controller private data pointer |
| 283 | */ |
| 284 | struct irq_domain *irq_domain_add_linear(struct device_node *of_node, |
| 285 | unsigned int size, |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 286 | const struct irq_domain_ops *ops, |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 287 | void *host_data) |
| 288 | { |
| 289 | struct irq_domain *domain; |
| 290 | unsigned int *revmap; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 291 | |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 292 | revmap = kzalloc_node(sizeof(*revmap) * size, GFP_KERNEL, |
| 293 | of_node_to_nid(of_node)); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 294 | if (WARN_ON(!revmap)) |
| 295 | return NULL; |
| 296 | |
| 297 | domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LINEAR, ops, host_data); |
| 298 | if (!domain) { |
| 299 | kfree(revmap); |
| 300 | return NULL; |
| 301 | } |
| 302 | domain->revmap_data.linear.size = size; |
| 303 | domain->revmap_data.linear.revmap = revmap; |
| 304 | irq_domain_add(domain); |
| 305 | return domain; |
| 306 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 307 | EXPORT_SYMBOL_GPL(irq_domain_add_linear); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 308 | |
| 309 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 310 | unsigned int max_irq, |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 311 | const struct irq_domain_ops *ops, |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 312 | void *host_data) |
| 313 | { |
| 314 | struct irq_domain *domain = irq_domain_alloc(of_node, |
| 315 | IRQ_DOMAIN_MAP_NOMAP, ops, host_data); |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 316 | if (domain) { |
| 317 | domain->revmap_data.nomap.max_irq = max_irq ? max_irq : ~0; |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 318 | irq_domain_add(domain); |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 319 | } |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 320 | return domain; |
| 321 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 322 | EXPORT_SYMBOL_GPL(irq_domain_add_nomap); |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 323 | |
| 324 | /** |
| 325 | * irq_domain_add_tree() |
| 326 | * @of_node: pointer to interrupt controller's device tree node. |
| 327 | * @ops: map/unmap domain callbacks |
| 328 | * |
| 329 | * Note: The radix tree will be allocated later during boot automatically |
| 330 | * (the reverse mapping will use the slow path until that happens). |
| 331 | */ |
| 332 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 333 | const struct irq_domain_ops *ops, |
Grant Likely | a8db8cf | 2012-02-14 14:06:54 -0700 | [diff] [blame] | 334 | void *host_data) |
| 335 | { |
| 336 | struct irq_domain *domain = irq_domain_alloc(of_node, |
| 337 | IRQ_DOMAIN_MAP_TREE, ops, host_data); |
| 338 | if (domain) { |
| 339 | INIT_RADIX_TREE(&domain->revmap_data.tree, GFP_KERNEL); |
| 340 | irq_domain_add(domain); |
| 341 | } |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 342 | return domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 343 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 344 | EXPORT_SYMBOL_GPL(irq_domain_add_tree); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 345 | |
| 346 | /** |
| 347 | * irq_find_host() - Locates a domain for a given device node |
| 348 | * @node: device-tree node of the interrupt controller |
| 349 | */ |
| 350 | struct irq_domain *irq_find_host(struct device_node *node) |
| 351 | { |
| 352 | struct irq_domain *h, *found = NULL; |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 353 | int rc; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 354 | |
| 355 | /* We might want to match the legacy controller last since |
| 356 | * it might potentially be set to match all interrupts in |
| 357 | * the absence of a device node. This isn't a problem so far |
| 358 | * yet though... |
| 359 | */ |
| 360 | mutex_lock(&irq_domain_mutex); |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 361 | list_for_each_entry(h, &irq_domain_list, link) { |
| 362 | if (h->ops->match) |
| 363 | rc = h->ops->match(h, node); |
| 364 | else |
| 365 | rc = (h->of_node != NULL) && (h->of_node == node); |
| 366 | |
| 367 | if (rc) { |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 368 | found = h; |
| 369 | break; |
| 370 | } |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 371 | } |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 372 | mutex_unlock(&irq_domain_mutex); |
| 373 | return found; |
| 374 | } |
| 375 | EXPORT_SYMBOL_GPL(irq_find_host); |
| 376 | |
| 377 | /** |
| 378 | * irq_set_default_host() - Set a "default" irq domain |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 379 | * @domain: default domain pointer |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 380 | * |
| 381 | * For convenience, it's possible to set a "default" domain that will be used |
| 382 | * whenever NULL is passed to irq_create_mapping(). It makes life easier for |
| 383 | * platforms that want to manipulate a few hard coded interrupt numbers that |
| 384 | * aren't properly represented in the device-tree. |
| 385 | */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 386 | void irq_set_default_host(struct irq_domain *domain) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 387 | { |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 388 | pr_debug("Default domain set to @0x%p\n", domain); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 389 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 390 | irq_default_domain = domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 391 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 392 | EXPORT_SYMBOL_GPL(irq_set_default_host); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 393 | |
Grant Likely | 913af20 | 2012-06-03 22:04:35 -0700 | [diff] [blame] | 394 | static void irq_domain_disassociate_many(struct irq_domain *domain, |
| 395 | unsigned int irq_base, int count) |
| 396 | { |
| 397 | /* |
| 398 | * disassociate in reverse order; |
| 399 | * not strictly necessary, but nice for unwinding |
| 400 | */ |
| 401 | while (count--) { |
| 402 | int irq = irq_base + count; |
| 403 | struct irq_data *irq_data = irq_get_irq_data(irq); |
Chen Gang | 275e31b | 2013-05-14 19:02:45 +0800 | [diff] [blame] | 404 | irq_hw_number_t hwirq; |
Grant Likely | 913af20 | 2012-06-03 22:04:35 -0700 | [diff] [blame] | 405 | |
| 406 | if (WARN_ON(!irq_data || irq_data->domain != domain)) |
| 407 | continue; |
| 408 | |
Chen Gang | 275e31b | 2013-05-14 19:02:45 +0800 | [diff] [blame] | 409 | hwirq = irq_data->hwirq; |
Grant Likely | 913af20 | 2012-06-03 22:04:35 -0700 | [diff] [blame] | 410 | irq_set_status_flags(irq, IRQ_NOREQUEST); |
| 411 | |
| 412 | /* remove chip and handler */ |
| 413 | irq_set_chip_and_handler(irq, NULL, NULL); |
| 414 | |
| 415 | /* Make sure it's completed */ |
| 416 | synchronize_irq(irq); |
| 417 | |
| 418 | /* Tell the PIC about it */ |
| 419 | if (domain->ops->unmap) |
| 420 | domain->ops->unmap(domain, irq); |
| 421 | smp_mb(); |
| 422 | |
| 423 | irq_data->domain = NULL; |
| 424 | irq_data->hwirq = 0; |
| 425 | |
| 426 | /* Clear reverse map */ |
| 427 | switch(domain->revmap_type) { |
| 428 | case IRQ_DOMAIN_MAP_LINEAR: |
| 429 | if (hwirq < domain->revmap_data.linear.size) |
| 430 | domain->revmap_data.linear.revmap[hwirq] = 0; |
| 431 | break; |
| 432 | case IRQ_DOMAIN_MAP_TREE: |
| 433 | mutex_lock(&revmap_trees_mutex); |
| 434 | radix_tree_delete(&domain->revmap_data.tree, hwirq); |
| 435 | mutex_unlock(&revmap_trees_mutex); |
| 436 | break; |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 441 | int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base, |
| 442 | irq_hw_number_t hwirq_base, int count) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 443 | { |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 444 | unsigned int virq = irq_base; |
| 445 | irq_hw_number_t hwirq = hwirq_base; |
Mark Brown | f5a1ad0 | 2012-07-20 10:33:19 +0100 | [diff] [blame] | 446 | int i, ret; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 447 | |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 448 | pr_debug("%s(%s, irqbase=%i, hwbase=%i, count=%i)\n", __func__, |
| 449 | of_node_full_name(domain->of_node), irq_base, (int)hwirq_base, count); |
| 450 | |
| 451 | for (i = 0; i < count; i++) { |
| 452 | struct irq_data *irq_data = irq_get_irq_data(virq + i); |
| 453 | |
| 454 | if (WARN(!irq_data, "error: irq_desc not allocated; " |
| 455 | "irq=%i hwirq=0x%x\n", virq + i, (int)hwirq + i)) |
| 456 | return -EINVAL; |
| 457 | if (WARN(irq_data->domain, "error: irq_desc already associated; " |
| 458 | "irq=%i hwirq=0x%x\n", virq + i, (int)hwirq + i)) |
| 459 | return -EINVAL; |
| 460 | }; |
| 461 | |
| 462 | for (i = 0; i < count; i++, virq++, hwirq++) { |
| 463 | struct irq_data *irq_data = irq_get_irq_data(virq); |
| 464 | |
| 465 | irq_data->hwirq = hwirq; |
| 466 | irq_data->domain = domain; |
Mark Brown | f5a1ad0 | 2012-07-20 10:33:19 +0100 | [diff] [blame] | 467 | if (domain->ops->map) { |
| 468 | ret = domain->ops->map(domain, virq, hwirq); |
| 469 | if (ret != 0) { |
Benjamin Herrenschmidt | 5fe0c1f | 2013-05-06 11:37:43 +1000 | [diff] [blame] | 470 | /* |
| 471 | * If map() returns -EPERM, this interrupt is protected |
| 472 | * by the firmware or some other service and shall not |
| 473 | * be mapped. |
| 474 | * |
| 475 | * Since on some platforms we blindly try to map everything |
| 476 | * we end up with a log full of backtraces. |
| 477 | * |
| 478 | * So instead, we silently fail on -EPERM, it is the |
| 479 | * responsibility of the PIC driver to display a relevant |
| 480 | * message if needed. |
| 481 | */ |
| 482 | if (ret != -EPERM) { |
| 483 | pr_err("irq-%i==>hwirq-0x%lx mapping failed: %d\n", |
| 484 | virq, hwirq, ret); |
| 485 | WARN_ON(1); |
| 486 | } |
Mark Brown | f5a1ad0 | 2012-07-20 10:33:19 +0100 | [diff] [blame] | 487 | irq_data->domain = NULL; |
| 488 | irq_data->hwirq = 0; |
| 489 | goto err_unmap; |
| 490 | } |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 491 | } |
| 492 | |
| 493 | switch (domain->revmap_type) { |
| 494 | case IRQ_DOMAIN_MAP_LINEAR: |
| 495 | if (hwirq < domain->revmap_data.linear.size) |
| 496 | domain->revmap_data.linear.revmap[hwirq] = virq; |
| 497 | break; |
| 498 | case IRQ_DOMAIN_MAP_TREE: |
| 499 | mutex_lock(&revmap_trees_mutex); |
Grant Likely | d6b0d1f | 2012-06-03 22:04:37 -0700 | [diff] [blame] | 500 | radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data); |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 501 | mutex_unlock(&revmap_trees_mutex); |
| 502 | break; |
| 503 | } |
| 504 | |
| 505 | irq_clear_status_flags(virq, IRQ_NOREQUEST); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 506 | } |
| 507 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 508 | return 0; |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 509 | |
| 510 | err_unmap: |
| 511 | irq_domain_disassociate_many(domain, irq_base, i); |
| 512 | return -EINVAL; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 513 | } |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 514 | EXPORT_SYMBOL_GPL(irq_domain_associate_many); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 515 | |
| 516 | /** |
| 517 | * irq_create_direct_mapping() - Allocate an irq for direct mapping |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 518 | * @domain: domain to allocate the irq for or NULL for default domain |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 519 | * |
| 520 | * This routine is used for irq controllers which can choose the hardware |
| 521 | * interrupt numbers they generate. In such a case it's simplest to use |
| 522 | * the linux irq as the hardware interrupt number. |
| 523 | */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 524 | unsigned int irq_create_direct_mapping(struct irq_domain *domain) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 525 | { |
| 526 | unsigned int virq; |
| 527 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 528 | if (domain == NULL) |
| 529 | domain = irq_default_domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 530 | |
Grant Likely | 9844a55 | 2012-06-03 22:04:38 -0700 | [diff] [blame] | 531 | if (WARN_ON(!domain || domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP)) |
| 532 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 533 | |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 534 | virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node)); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 535 | if (!virq) { |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 536 | pr_debug("create_direct virq allocation failed\n"); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 537 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 538 | } |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 539 | if (virq >= domain->revmap_data.nomap.max_irq) { |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 540 | pr_err("ERROR: no free irqs available below %i maximum\n", |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 541 | domain->revmap_data.nomap.max_irq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 542 | irq_free_desc(virq); |
| 543 | return 0; |
| 544 | } |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 545 | pr_debug("create_direct obtained virq %d\n", virq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 546 | |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 547 | if (irq_domain_associate(domain, virq, virq)) { |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 548 | irq_free_desc(virq); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 549 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | return virq; |
| 553 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 554 | EXPORT_SYMBOL_GPL(irq_create_direct_mapping); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 555 | |
| 556 | /** |
| 557 | * irq_create_mapping() - Map a hardware interrupt into linux irq space |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 558 | * @domain: domain owning this hardware interrupt or NULL for default domain |
| 559 | * @hwirq: hardware irq number in that domain space |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 560 | * |
| 561 | * Only one mapping per hardware interrupt is permitted. Returns a linux |
| 562 | * irq number. |
| 563 | * If the sense/trigger is to be specified, set_irq_type() should be called |
| 564 | * on the number returned from that call. |
| 565 | */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 566 | unsigned int irq_create_mapping(struct irq_domain *domain, |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 567 | irq_hw_number_t hwirq) |
| 568 | { |
David Daney | 5b7526e | 2012-04-05 16:52:13 -0700 | [diff] [blame] | 569 | unsigned int hint; |
| 570 | int virq; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 571 | |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 572 | pr_debug("irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 573 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 574 | /* Look for default domain if nececssary */ |
| 575 | if (domain == NULL) |
| 576 | domain = irq_default_domain; |
| 577 | if (domain == NULL) { |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 578 | pr_warning("irq_create_mapping called for" |
| 579 | " NULL domain, hwirq=%lx\n", hwirq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 580 | WARN_ON(1); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 581 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 582 | } |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 583 | pr_debug("-> using domain @%p\n", domain); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 584 | |
| 585 | /* Check if mapping already exists */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 586 | virq = irq_find_mapping(domain, hwirq); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 587 | if (virq) { |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 588 | pr_debug("-> existing mapping on virq %d\n", virq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 589 | return virq; |
| 590 | } |
| 591 | |
| 592 | /* Get a virtual interrupt number */ |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 593 | if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) |
| 594 | return irq_domain_legacy_revmap(domain, hwirq); |
| 595 | |
| 596 | /* Allocate a virtual interrupt number */ |
Grant Likely | 6fa6c8e2 | 2012-02-15 15:06:08 -0700 | [diff] [blame] | 597 | hint = hwirq % nr_irqs; |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 598 | if (hint == 0) |
| 599 | hint++; |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 600 | virq = irq_alloc_desc_from(hint, of_node_to_nid(domain->of_node)); |
David Daney | 5b7526e | 2012-04-05 16:52:13 -0700 | [diff] [blame] | 601 | if (virq <= 0) |
Paul Mundt | 5ca4db6 | 2012-06-03 22:04:34 -0700 | [diff] [blame] | 602 | virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node)); |
David Daney | 5b7526e | 2012-04-05 16:52:13 -0700 | [diff] [blame] | 603 | if (virq <= 0) { |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 604 | pr_debug("-> virq allocation failed\n"); |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 605 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 606 | } |
| 607 | |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 608 | if (irq_domain_associate(domain, virq, hwirq)) { |
Grant Likely | 7325570 | 2012-06-03 22:04:35 -0700 | [diff] [blame] | 609 | irq_free_desc(virq); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 610 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 611 | } |
| 612 | |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 613 | pr_debug("irq %lu on domain %s mapped to virtual irq %u\n", |
Grant Likely | efd68e7 | 2012-06-03 22:04:33 -0700 | [diff] [blame] | 614 | hwirq, of_node_full_name(domain->of_node), virq); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 615 | |
| 616 | return virq; |
| 617 | } |
| 618 | EXPORT_SYMBOL_GPL(irq_create_mapping); |
| 619 | |
Grant Likely | 98aa468 | 2012-06-17 16:17:04 -0600 | [diff] [blame] | 620 | /** |
| 621 | * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs |
| 622 | * @domain: domain owning the interrupt range |
| 623 | * @irq_base: beginning of linux IRQ range |
| 624 | * @hwirq_base: beginning of hardware IRQ range |
| 625 | * @count: Number of interrupts to map |
| 626 | * |
| 627 | * This routine is used for allocating and mapping a range of hardware |
| 628 | * irqs to linux irqs where the linux irq numbers are at pre-defined |
| 629 | * locations. For use by controllers that already have static mappings |
| 630 | * to insert in to the domain. |
| 631 | * |
| 632 | * Non-linear users can use irq_create_identity_mapping() for IRQ-at-a-time |
| 633 | * domain insertion. |
| 634 | * |
| 635 | * 0 is returned upon success, while any failure to establish a static |
| 636 | * mapping is treated as an error. |
| 637 | */ |
| 638 | int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base, |
| 639 | irq_hw_number_t hwirq_base, int count) |
| 640 | { |
| 641 | int ret; |
| 642 | |
| 643 | ret = irq_alloc_descs(irq_base, irq_base, count, |
| 644 | of_node_to_nid(domain->of_node)); |
| 645 | if (unlikely(ret < 0)) |
| 646 | return ret; |
| 647 | |
| 648 | ret = irq_domain_associate_many(domain, irq_base, hwirq_base, count); |
| 649 | if (unlikely(ret < 0)) { |
| 650 | irq_free_descs(irq_base, count); |
| 651 | return ret; |
| 652 | } |
| 653 | |
| 654 | return 0; |
| 655 | } |
| 656 | EXPORT_SYMBOL_GPL(irq_create_strict_mappings); |
| 657 | |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 658 | unsigned int irq_create_of_mapping(struct device_node *controller, |
| 659 | const u32 *intspec, unsigned int intsize) |
| 660 | { |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 661 | struct irq_domain *domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 662 | irq_hw_number_t hwirq; |
| 663 | unsigned int type = IRQ_TYPE_NONE; |
| 664 | unsigned int virq; |
| 665 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 666 | domain = controller ? irq_find_host(controller) : irq_default_domain; |
| 667 | if (!domain) { |
Grant Likely | abd2363 | 2012-02-24 08:07:06 -0700 | [diff] [blame] | 668 | #ifdef CONFIG_MIPS |
| 669 | /* |
| 670 | * Workaround to avoid breaking interrupt controller drivers |
| 671 | * that don't yet register an irq_domain. This is temporary |
| 672 | * code. ~~~gcl, Feb 24, 2012 |
| 673 | * |
| 674 | * Scheduled for removal in Linux v3.6. That should be enough |
| 675 | * time. |
| 676 | */ |
| 677 | if (intsize > 0) |
| 678 | return intspec[0]; |
| 679 | #endif |
Paul Mundt | 54a9058 | 2012-05-19 15:11:47 +0900 | [diff] [blame] | 680 | pr_warning("no irq domain found for %s !\n", |
Grant Likely | efd68e7 | 2012-06-03 22:04:33 -0700 | [diff] [blame] | 681 | of_node_full_name(controller)); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 682 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 683 | } |
| 684 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 685 | /* If domain has no translation, then we assume interrupt line */ |
| 686 | if (domain->ops->xlate == NULL) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 687 | hwirq = intspec[0]; |
| 688 | else { |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 689 | if (domain->ops->xlate(domain, controller, intspec, intsize, |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 690 | &hwirq, &type)) |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 691 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | /* Create mapping */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 695 | virq = irq_create_mapping(domain, hwirq); |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 696 | if (!virq) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 697 | return virq; |
| 698 | |
| 699 | /* Set type if specified and different than the current one */ |
| 700 | if (type != IRQ_TYPE_NONE && |
| 701 | type != (irqd_get_trigger_type(irq_get_irq_data(virq)))) |
| 702 | irq_set_irq_type(virq, type); |
| 703 | return virq; |
| 704 | } |
| 705 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); |
| 706 | |
| 707 | /** |
| 708 | * irq_dispose_mapping() - Unmap an interrupt |
| 709 | * @virq: linux irq number of the interrupt to unmap |
| 710 | */ |
| 711 | void irq_dispose_mapping(unsigned int virq) |
| 712 | { |
| 713 | struct irq_data *irq_data = irq_get_irq_data(virq); |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 714 | struct irq_domain *domain; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 715 | |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 716 | if (!virq || !irq_data) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 717 | return; |
| 718 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 719 | domain = irq_data->domain; |
| 720 | if (WARN_ON(domain == NULL)) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 721 | return; |
| 722 | |
| 723 | /* Never unmap legacy interrupts */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 724 | if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 725 | return; |
| 726 | |
Grant Likely | 913af20 | 2012-06-03 22:04:35 -0700 | [diff] [blame] | 727 | irq_domain_disassociate_many(domain, virq, 1); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 728 | irq_free_desc(virq); |
| 729 | } |
| 730 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); |
| 731 | |
| 732 | /** |
| 733 | * irq_find_mapping() - Find a linux irq from an hw irq number. |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 734 | * @domain: domain owning this hardware interrupt |
| 735 | * @hwirq: hardware irq number in that domain space |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 736 | */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 737 | unsigned int irq_find_mapping(struct irq_domain *domain, |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 738 | irq_hw_number_t hwirq) |
| 739 | { |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 740 | struct irq_data *data; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 741 | |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 742 | /* Look for default domain if nececssary */ |
| 743 | if (domain == NULL) |
| 744 | domain = irq_default_domain; |
| 745 | if (domain == NULL) |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 746 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 747 | |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 748 | switch (domain->revmap_type) { |
| 749 | case IRQ_DOMAIN_MAP_LEGACY: |
Grant Likely | 1bc04f2 | 2012-02-14 14:06:55 -0700 | [diff] [blame] | 750 | return irq_domain_legacy_revmap(domain, hwirq); |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 751 | case IRQ_DOMAIN_MAP_LINEAR: |
| 752 | return irq_linear_revmap(domain, hwirq); |
| 753 | case IRQ_DOMAIN_MAP_TREE: |
| 754 | rcu_read_lock(); |
| 755 | data = radix_tree_lookup(&domain->revmap_data.tree, hwirq); |
| 756 | rcu_read_unlock(); |
| 757 | if (data) |
| 758 | return data->irq; |
| 759 | break; |
| 760 | case IRQ_DOMAIN_MAP_NOMAP: |
| 761 | data = irq_get_irq_data(hwirq); |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 762 | if (data && (data->domain == domain) && (data->hwirq == hwirq)) |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 763 | return hwirq; |
| 764 | break; |
| 765 | } |
| 766 | |
Grant Likely | 0384837 | 2012-02-14 14:06:52 -0700 | [diff] [blame] | 767 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 768 | } |
| 769 | EXPORT_SYMBOL_GPL(irq_find_mapping); |
| 770 | |
| 771 | /** |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 772 | * irq_linear_revmap() - Find a linux irq from a hw irq number. |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 773 | * @domain: domain owning this hardware interrupt |
| 774 | * @hwirq: hardware irq number in that domain space |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 775 | * |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 776 | * This is a fast path that can be called directly by irq controller code to |
| 777 | * save a handful of instructions. |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 778 | */ |
Grant Likely | 6870065 | 2012-02-14 14:06:53 -0700 | [diff] [blame] | 779 | unsigned int irq_linear_revmap(struct irq_domain *domain, |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 780 | irq_hw_number_t hwirq) |
| 781 | { |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 782 | BUG_ON(domain->revmap_type != IRQ_DOMAIN_MAP_LINEAR); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 783 | |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 784 | /* Check revmap bounds; complain if exceeded */ |
| 785 | if (WARN_ON(hwirq >= domain->revmap_data.linear.size)) |
| 786 | return 0; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 787 | |
Grant Likely | 4c0946c | 2012-06-03 22:04:39 -0700 | [diff] [blame] | 788 | return domain->revmap_data.linear.revmap[hwirq]; |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 789 | } |
Paul Mundt | ecd84eb | 2012-05-19 15:11:42 +0900 | [diff] [blame] | 790 | EXPORT_SYMBOL_GPL(irq_linear_revmap); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 791 | |
Grant Likely | 092b2fb | 2012-03-29 14:10:30 -0600 | [diff] [blame] | 792 | #ifdef CONFIG_IRQ_DOMAIN_DEBUG |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 793 | static int virq_debug_show(struct seq_file *m, void *private) |
| 794 | { |
| 795 | unsigned long flags; |
| 796 | struct irq_desc *desc; |
| 797 | const char *p; |
| 798 | static const char none[] = "none"; |
| 799 | void *data; |
| 800 | int i; |
| 801 | |
Grant Likely | 15e06bf | 2012-04-11 00:26:25 -0600 | [diff] [blame] | 802 | seq_printf(m, "%-5s %-7s %-15s %-*s %s\n", "irq", "hwirq", |
Grant Likely | 5269a9a | 2012-04-12 14:42:15 -0600 | [diff] [blame] | 803 | "chip name", (int)(2 * sizeof(void *) + 2), "chip data", |
| 804 | "domain name"); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 805 | |
| 806 | for (i = 1; i < nr_irqs; i++) { |
| 807 | desc = irq_to_desc(i); |
| 808 | if (!desc) |
| 809 | continue; |
| 810 | |
| 811 | raw_spin_lock_irqsave(&desc->lock, flags); |
| 812 | |
| 813 | if (desc->action && desc->action->handler) { |
| 814 | struct irq_chip *chip; |
| 815 | |
| 816 | seq_printf(m, "%5d ", i); |
| 817 | seq_printf(m, "0x%05lx ", desc->irq_data.hwirq); |
| 818 | |
| 819 | chip = irq_desc_get_chip(desc); |
| 820 | if (chip && chip->name) |
| 821 | p = chip->name; |
| 822 | else |
| 823 | p = none; |
| 824 | seq_printf(m, "%-15s ", p); |
| 825 | |
| 826 | data = irq_desc_get_chip_data(desc); |
Grant Likely | 15e06bf | 2012-04-11 00:26:25 -0600 | [diff] [blame] | 827 | seq_printf(m, data ? "0x%p " : " %p ", data); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 828 | |
Grant Likely | efd68e7 | 2012-06-03 22:04:33 -0700 | [diff] [blame] | 829 | if (desc->irq_data.domain) |
| 830 | p = of_node_full_name(desc->irq_data.domain->of_node); |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 831 | else |
| 832 | p = none; |
| 833 | seq_printf(m, "%s\n", p); |
| 834 | } |
| 835 | |
| 836 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
| 837 | } |
| 838 | |
| 839 | return 0; |
| 840 | } |
| 841 | |
| 842 | static int virq_debug_open(struct inode *inode, struct file *file) |
| 843 | { |
| 844 | return single_open(file, virq_debug_show, inode->i_private); |
| 845 | } |
| 846 | |
| 847 | static const struct file_operations virq_debug_fops = { |
| 848 | .open = virq_debug_open, |
| 849 | .read = seq_read, |
| 850 | .llseek = seq_lseek, |
| 851 | .release = single_release, |
| 852 | }; |
| 853 | |
| 854 | static int __init irq_debugfs_init(void) |
| 855 | { |
Grant Likely | 092b2fb | 2012-03-29 14:10:30 -0600 | [diff] [blame] | 856 | if (debugfs_create_file("irq_domain_mapping", S_IRUGO, NULL, |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 857 | NULL, &virq_debug_fops) == NULL) |
| 858 | return -ENOMEM; |
| 859 | |
| 860 | return 0; |
| 861 | } |
| 862 | __initcall(irq_debugfs_init); |
Grant Likely | 092b2fb | 2012-03-29 14:10:30 -0600 | [diff] [blame] | 863 | #endif /* CONFIG_IRQ_DOMAIN_DEBUG */ |
Grant Likely | cc79ca6 | 2012-02-16 01:37:49 -0700 | [diff] [blame] | 864 | |
Grant Likely | 16b2e6e | 2012-01-26 11:26:52 -0700 | [diff] [blame] | 865 | /** |
| 866 | * irq_domain_xlate_onecell() - Generic xlate for direct one cell bindings |
| 867 | * |
| 868 | * Device Tree IRQ specifier translation function which works with one cell |
| 869 | * bindings where the cell value maps directly to the hwirq number. |
| 870 | */ |
| 871 | int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, |
| 872 | const u32 *intspec, unsigned int intsize, |
| 873 | unsigned long *out_hwirq, unsigned int *out_type) |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 874 | { |
Grant Likely | 16b2e6e | 2012-01-26 11:26:52 -0700 | [diff] [blame] | 875 | if (WARN_ON(intsize < 1)) |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 876 | return -EINVAL; |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 877 | *out_hwirq = intspec[0]; |
| 878 | *out_type = IRQ_TYPE_NONE; |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 879 | return 0; |
| 880 | } |
Grant Likely | 16b2e6e | 2012-01-26 11:26:52 -0700 | [diff] [blame] | 881 | EXPORT_SYMBOL_GPL(irq_domain_xlate_onecell); |
| 882 | |
| 883 | /** |
| 884 | * irq_domain_xlate_twocell() - Generic xlate for direct two cell bindings |
| 885 | * |
| 886 | * Device Tree IRQ specifier translation function which works with two cell |
| 887 | * bindings where the cell values map directly to the hwirq number |
| 888 | * and linux irq flags. |
| 889 | */ |
| 890 | int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, |
| 891 | const u32 *intspec, unsigned int intsize, |
| 892 | irq_hw_number_t *out_hwirq, unsigned int *out_type) |
| 893 | { |
| 894 | if (WARN_ON(intsize < 2)) |
| 895 | return -EINVAL; |
| 896 | *out_hwirq = intspec[0]; |
| 897 | *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; |
| 898 | return 0; |
| 899 | } |
| 900 | EXPORT_SYMBOL_GPL(irq_domain_xlate_twocell); |
| 901 | |
| 902 | /** |
| 903 | * irq_domain_xlate_onetwocell() - Generic xlate for one or two cell bindings |
| 904 | * |
| 905 | * Device Tree IRQ specifier translation function which works with either one |
| 906 | * or two cell bindings where the cell values map directly to the hwirq number |
| 907 | * and linux irq flags. |
| 908 | * |
| 909 | * Note: don't use this function unless your interrupt controller explicitly |
| 910 | * supports both one and two cell bindings. For the majority of controllers |
| 911 | * the _onecell() or _twocell() variants above should be used. |
| 912 | */ |
| 913 | int irq_domain_xlate_onetwocell(struct irq_domain *d, |
| 914 | struct device_node *ctrlr, |
| 915 | const u32 *intspec, unsigned int intsize, |
| 916 | unsigned long *out_hwirq, unsigned int *out_type) |
| 917 | { |
| 918 | if (WARN_ON(intsize < 1)) |
| 919 | return -EINVAL; |
| 920 | *out_hwirq = intspec[0]; |
| 921 | *out_type = (intsize > 1) ? intspec[1] : IRQ_TYPE_NONE; |
| 922 | return 0; |
| 923 | } |
| 924 | EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell); |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 925 | |
Grant Likely | a18dc81 | 2012-01-26 12:12:14 -0700 | [diff] [blame] | 926 | const struct irq_domain_ops irq_domain_simple_ops = { |
Grant Likely | 16b2e6e | 2012-01-26 11:26:52 -0700 | [diff] [blame] | 927 | .xlate = irq_domain_xlate_onetwocell, |
Grant Likely | 7529495 | 2012-02-14 14:06:57 -0700 | [diff] [blame] | 928 | }; |
| 929 | EXPORT_SYMBOL_GPL(irq_domain_simple_ops); |
| 930 | |
| 931 | #ifdef CONFIG_OF_IRQ |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 932 | void irq_domain_generate_simple(const struct of_device_id *match, |
| 933 | u64 phys_base, unsigned int irq_start) |
| 934 | { |
| 935 | struct device_node *node; |
Grant Likely | e1964c5 | 2012-02-14 14:06:48 -0700 | [diff] [blame] | 936 | pr_debug("looking for phys_base=%llx, irq_start=%i\n", |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 937 | (unsigned long long) phys_base, (int) irq_start); |
| 938 | node = of_find_matching_node_by_address(NULL, match, phys_base); |
| 939 | if (node) |
Grant Likely | 6b783f7 | 2012-01-10 17:09:30 -0700 | [diff] [blame] | 940 | irq_domain_add_legacy(node, 32, irq_start, 0, |
| 941 | &irq_domain_simple_ops, NULL); |
Grant Likely | 7e71330 | 2011-07-26 03:19:06 -0600 | [diff] [blame] | 942 | } |
| 943 | EXPORT_SYMBOL_GPL(irq_domain_generate_simple); |
Grant Likely | 7529495 | 2012-02-14 14:06:57 -0700 | [diff] [blame] | 944 | #endif |