|
17 | 17 | #include <linux/of_platform.h>
|
18 | 18 | #include <linux/platform_device.h>
|
19 | 19 |
|
| 20 | +#include "irq-msi-lib.h" |
| 21 | + |
20 | 22 | #include <dt-bindings/interrupt-controller/arm-gic.h>
|
21 | 23 |
|
22 | 24 | #define GICP_SETSPI_NSR_OFFSET 0x0
|
@@ -145,32 +147,32 @@ static void gicp_irq_domain_free(struct irq_domain *domain,
|
145 | 147 | }
|
146 | 148 |
|
147 | 149 | static const struct irq_domain_ops gicp_domain_ops = {
|
| 150 | + .select = msi_lib_irq_domain_select, |
148 | 151 | .alloc = gicp_irq_domain_alloc,
|
149 | 152 | .free = gicp_irq_domain_free,
|
150 | 153 | };
|
151 | 154 |
|
152 |
| -static struct irq_chip gicp_msi_irq_chip = { |
153 |
| - .name = "GICP", |
154 |
| - .irq_set_type = irq_chip_set_type_parent, |
155 |
| - .flags = IRQCHIP_SUPPORTS_LEVEL_MSI, |
156 |
| -}; |
| 155 | +#define GICP_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ |
| 156 | + MSI_FLAG_USE_DEF_CHIP_OPS) |
157 | 157 |
|
158 |
| -static struct msi_domain_ops gicp_msi_ops = { |
159 |
| -}; |
| 158 | +#define GICP_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ |
| 159 | + MSI_FLAG_LEVEL_CAPABLE) |
160 | 160 |
|
161 |
| -static struct msi_domain_info gicp_msi_domain_info = { |
162 |
| - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | |
163 |
| - MSI_FLAG_LEVEL_CAPABLE), |
164 |
| - .ops = &gicp_msi_ops, |
165 |
| - .chip = &gicp_msi_irq_chip, |
| 161 | +static const struct msi_parent_ops gicp_msi_parent_ops = { |
| 162 | + .supported_flags = GICP_MSI_FLAGS_SUPPORTED, |
| 163 | + .required_flags = GICP_MSI_FLAGS_REQUIRED, |
| 164 | + .bus_select_token = DOMAIN_BUS_GENERIC_MSI, |
| 165 | + .bus_select_mask = MATCH_PLATFORM_MSI, |
| 166 | + .prefix = "GICP-", |
| 167 | + .init_dev_msi_info = msi_lib_init_dev_msi_info, |
166 | 168 | };
|
167 | 169 |
|
168 | 170 | static int mvebu_gicp_probe(struct platform_device *pdev)
|
169 | 171 | {
|
170 |
| - struct mvebu_gicp *gicp; |
171 |
| - struct irq_domain *inner_domain, *plat_domain, *parent_domain; |
| 172 | + struct irq_domain *inner_domain, *parent_domain; |
172 | 173 | struct device_node *node = pdev->dev.of_node;
|
173 | 174 | struct device_node *irq_parent_dn;
|
| 175 | + struct mvebu_gicp *gicp; |
174 | 176 | int ret, i;
|
175 | 177 |
|
176 | 178 | gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL);
|
@@ -234,17 +236,9 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
|
234 | 236 | if (!inner_domain)
|
235 | 237 | return -ENOMEM;
|
236 | 238 |
|
237 |
| - |
238 |
| - plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(node), |
239 |
| - &gicp_msi_domain_info, |
240 |
| - inner_domain); |
241 |
| - if (!plat_domain) { |
242 |
| - irq_domain_remove(inner_domain); |
243 |
| - return -ENOMEM; |
244 |
| - } |
245 |
| - |
246 |
| - platform_set_drvdata(pdev, gicp); |
247 |
| - |
| 239 | + irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); |
| 240 | + inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; |
| 241 | + inner_domain->msi_parent_ops = &gicp_msi_parent_ops; |
248 | 242 | return 0;
|
249 | 243 | }
|
250 | 244 |
|
|
0 commit comments