irq-crossbar.c (8b09a45dc12f83f2312a47f0f0087ec4004ebacc) | irq-crossbar.c (2f7d2fb71dd0c14f9c0fe66f2ed7b4685fa745e2) |
---|---|
1/* 2 * drivers/irqchip/irq-crossbar.c 3 * 4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com 5 * Author: Sricharan R <r.sricharan@ti.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 12 unchanged lines hidden (view full) --- 21#define IRQ_RESERVED -2 22#define IRQ_SKIP -3 23#define GIC_IRQ_START 32 24 25/** 26 * struct crossbar_device - crossbar device description 27 * @int_max: maximum number of supported interrupts 28 * @safe_map: safe default value to initialize the crossbar | 1/* 2 * drivers/irqchip/irq-crossbar.c 3 * 4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com 5 * Author: Sricharan R <r.sricharan@ti.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 12 unchanged lines hidden (view full) --- 21#define IRQ_RESERVED -2 22#define IRQ_SKIP -3 23#define GIC_IRQ_START 32 24 25/** 26 * struct crossbar_device - crossbar device description 27 * @int_max: maximum number of supported interrupts 28 * @safe_map: safe default value to initialize the crossbar |
29 * @max_crossbar_sources: Maximum number of crossbar sources |
|
29 * @irq_map: array of interrupts to crossbar number mapping 30 * @crossbar_base: crossbar base address 31 * @register_offsets: offsets for each irq number 32 * @write: register write function pointer 33 */ 34struct crossbar_device { 35 uint int_max; 36 uint safe_map; | 30 * @irq_map: array of interrupts to crossbar number mapping 31 * @crossbar_base: crossbar base address 32 * @register_offsets: offsets for each irq number 33 * @write: register write function pointer 34 */ 35struct crossbar_device { 36 uint int_max; 37 uint safe_map; |
38 uint max_crossbar_sources; |
|
37 uint *irq_map; 38 void __iomem *crossbar_base; 39 int *register_offsets; 40 void (*write)(int, int); 41}; 42 43static struct crossbar_device *cb; 44 --- 67 unchanged lines hidden (view full) --- 112 113static int crossbar_domain_xlate(struct irq_domain *d, 114 struct device_node *controller, 115 const u32 *intspec, unsigned int intsize, 116 unsigned long *out_hwirq, 117 unsigned int *out_type) 118{ 119 int ret; | 39 uint *irq_map; 40 void __iomem *crossbar_base; 41 int *register_offsets; 42 void (*write)(int, int); 43}; 44 45static struct crossbar_device *cb; 46 --- 67 unchanged lines hidden (view full) --- 114 115static int crossbar_domain_xlate(struct irq_domain *d, 116 struct device_node *controller, 117 const u32 *intspec, unsigned int intsize, 118 unsigned long *out_hwirq, 119 unsigned int *out_type) 120{ 121 int ret; |
122 int req_num = intspec[1]; |
|
120 | 123 |
121 ret = get_prev_map_irq(intspec[1]); | 124 if (req_num >= cb->max_crossbar_sources) { 125 pr_err("%s: requested crossbar number %d > max %d\n", 126 __func__, req_num, cb->max_crossbar_sources); 127 return -EINVAL; 128 } 129 130 ret = get_prev_map_irq(req_num); |
122 if (ret >= 0) 123 goto found; 124 | 131 if (ret >= 0) 132 goto found; 133 |
125 ret = allocate_free_irq(intspec[1]); | 134 ret = allocate_free_irq(req_num); |
126 127 if (ret < 0) 128 return ret; 129 130found: 131 *out_hwirq = ret + GIC_IRQ_START; 132 return 0; 133} --- 14 unchanged lines hidden (view full) --- 148 149 if (!cb) 150 return ret; 151 152 cb->crossbar_base = of_iomap(node, 0); 153 if (!cb->crossbar_base) 154 goto err_cb; 155 | 135 136 if (ret < 0) 137 return ret; 138 139found: 140 *out_hwirq = ret + GIC_IRQ_START; 141 return 0; 142} --- 14 unchanged lines hidden (view full) --- 157 158 if (!cb) 159 return ret; 160 161 cb->crossbar_base = of_iomap(node, 0); 162 if (!cb->crossbar_base) 163 goto err_cb; 164 |
165 of_property_read_u32(node, "ti,max-crossbar-sources", 166 &cb->max_crossbar_sources); 167 if (!cb->max_crossbar_sources) { 168 pr_err("missing 'ti,max-crossbar-sources' property\n"); 169 ret = -EINVAL; 170 goto err_base; 171 } 172 |
|
156 of_property_read_u32(node, "ti,max-irqs", &max); 157 if (!max) { 158 pr_err("missing 'ti,max-irqs' property\n"); 159 ret = -EINVAL; 160 goto err_base; 161 } 162 cb->irq_map = kcalloc(max, sizeof(int), GFP_KERNEL); 163 if (!cb->irq_map) --- 120 unchanged lines hidden --- | 173 of_property_read_u32(node, "ti,max-irqs", &max); 174 if (!max) { 175 pr_err("missing 'ti,max-irqs' property\n"); 176 ret = -EINVAL; 177 goto err_base; 178 } 179 cb->irq_map = kcalloc(max, sizeof(int), GFP_KERNEL); 180 if (!cb->irq_map) --- 120 unchanged lines hidden --- |