|
17 | 17 | #include <linux/msi.h>
|
18 | 18 | #include <linux/of_address.h>
|
19 | 19 | #include <linux/slab.h>
|
| 20 | + |
| 21 | +#include "irq-msi-lib.h" |
| 22 | + |
20 | 23 | #include <dt-bindings/interrupt-controller/arm-gic.h>
|
21 | 24 |
|
22 | 25 | #define GICP_ODMIN_SET 0x40
|
@@ -141,27 +144,29 @@ static void odmi_irq_domain_free(struct irq_domain *domain,
|
141 | 144 | }
|
142 | 145 |
|
143 | 146 | static const struct irq_domain_ops odmi_domain_ops = {
|
| 147 | + .select = msi_lib_irq_domain_select, |
144 | 148 | .alloc = odmi_irq_domain_alloc,
|
145 | 149 | .free = odmi_irq_domain_free,
|
146 | 150 | };
|
147 | 151 |
|
148 |
| -static struct irq_chip odmi_msi_irq_chip = { |
149 |
| - .name = "ODMI", |
150 |
| -}; |
| 152 | +#define ODMI_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ |
| 153 | + MSI_FLAG_USE_DEF_CHIP_OPS) |
151 | 154 |
|
152 |
| -static struct msi_domain_ops odmi_msi_ops = { |
153 |
| -}; |
| 155 | +#define ODMI_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK) |
154 | 156 |
|
155 |
| -static struct msi_domain_info odmi_msi_domain_info = { |
156 |
| - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS), |
157 |
| - .ops = &odmi_msi_ops, |
158 |
| - .chip = &odmi_msi_irq_chip, |
| 157 | +static const struct msi_parent_ops odmi_msi_parent_ops = { |
| 158 | + .supported_flags = ODMI_MSI_FLAGS_SUPPORTED, |
| 159 | + .required_flags = ODMI_MSI_FLAGS_REQUIRED, |
| 160 | + .bus_select_token = DOMAIN_BUS_GENERIC_MSI, |
| 161 | + .bus_select_mask = MATCH_PLATFORM_MSI, |
| 162 | + .prefix = "ODMI-", |
| 163 | + .init_dev_msi_info = msi_lib_init_dev_msi_info, |
159 | 164 | };
|
160 | 165 |
|
161 | 166 | static int __init mvebu_odmi_init(struct device_node *node,
|
162 | 167 | struct device_node *parent)
|
163 | 168 | {
|
164 |
| - struct irq_domain *parent_domain, *inner_domain, *plat_domain; |
| 169 | + struct irq_domain *parent_domain, *inner_domain; |
165 | 170 | int ret, i;
|
166 | 171 |
|
167 | 172 | if (of_property_read_u32(node, "marvell,odmi-frames", &odmis_count))
|
@@ -208,18 +213,12 @@ static int __init mvebu_odmi_init(struct device_node *node,
|
208 | 213 | goto err_unmap;
|
209 | 214 | }
|
210 | 215 |
|
211 |
| - plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(node), |
212 |
| - &odmi_msi_domain_info, |
213 |
| - inner_domain); |
214 |
| - if (!plat_domain) { |
215 |
| - ret = -ENOMEM; |
216 |
| - goto err_remove_inner; |
217 |
| - } |
| 216 | + irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); |
| 217 | + inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; |
| 218 | + inner_domain->msi_parent_ops = &odmi_msi_parent_ops; |
218 | 219 |
|
219 | 220 | return 0;
|
220 | 221 |
|
221 |
| -err_remove_inner: |
222 |
| - irq_domain_remove(inner_domain); |
223 | 222 | err_unmap:
|
224 | 223 | for (i = 0; i < odmis_count; i++) {
|
225 | 224 | struct odmi_data *odmi = &odmis[i];
|
|
0 commit comments