Lines Matching +full:num +full:- +full:vectors
1 // SPDX-License-Identifier: GPL-2.0-only
22 /* 64 irqs (Pin0-pin63) are reserved for each mbigen chip */
57 * struct mbigen_device - holds the information of mbigen device.
85 hwirq -= RESERVED_IRQ_PER_MBIGEN_CHIP; in get_mbigen_vec_reg()
97 hwirq -= RESERVED_IRQ_PER_MBIGEN_CHIP; in get_mbigen_type_reg()
118 void __iomem *base = data->chip_data; in mbigen_eoi_irq()
121 get_mbigen_clear_reg(data->hwirq, &mask, &addr); in mbigen_eoi_irq()
130 void __iomem *base = data->chip_data; in mbigen_set_type()
134 return -EINVAL; in mbigen_set_type()
136 get_mbigen_type_reg(data->hwirq, &mask, &addr); in mbigen_set_type()
152 void __iomem *base = d->chip_data; in mbigen_write_msi_msg()
155 if (!msg->address_lo && !msg->address_hi) in mbigen_write_msi_msg()
158 base += get_mbigen_vec_reg(d->hwirq); in mbigen_write_msi_msg()
162 val |= (msg->data << IRQ_EVENT_ID_SHIFT); in mbigen_write_msi_msg()
173 if (is_of_node(fwspec->fwnode) || is_acpi_device_node(fwspec->fwnode)) { in mbigen_domain_translate()
174 if (fwspec->param_count != 2) in mbigen_domain_translate()
175 return -EINVAL; in mbigen_domain_translate()
177 if ((fwspec->param[0] > MAXIMUM_IRQ_PIN_NUM) || in mbigen_domain_translate()
178 (fwspec->param[0] < RESERVED_IRQ_PER_MBIGEN_CHIP)) in mbigen_domain_translate()
179 return -EINVAL; in mbigen_domain_translate()
181 *hwirq = fwspec->param[0]; in mbigen_domain_translate()
184 if ((fwspec->param[1] == IRQ_TYPE_EDGE_RISING) || in mbigen_domain_translate()
185 (fwspec->param[1] == IRQ_TYPE_LEVEL_HIGH)) in mbigen_domain_translate()
186 *type = fwspec->param[1]; in mbigen_domain_translate()
188 return -EINVAL; in mbigen_domain_translate()
192 return -EINVAL; in mbigen_domain_translate()
197 arg->desc = desc; in mbigen_domain_set_desc()
198 arg->hwirq = (u32)desc->data.icookie.value; in mbigen_domain_set_desc()
203 .name = "mbigen-v2",
225 if (WARN_ON_ONCE(!dev->msi.domain)) in mbigen_create_device_domain()
230 NULL, mgn_chip->base); in mbigen_create_device_domain()
239 for_each_child_of_node_scoped(pdev->dev.of_node, np) { in mbigen_of_create_domain()
240 if (!of_property_read_bool(np, "interrupt-controller")) in mbigen_of_create_domain()
245 return -ENOMEM; in mbigen_of_create_domain()
247 if (of_property_read_u32(child->dev.of_node, "num-pins", in mbigen_of_create_domain()
249 dev_err(&pdev->dev, "No num-pins property\n"); in mbigen_of_create_domain()
250 return -EINVAL; in mbigen_of_create_domain()
253 if (!mbigen_create_device_domain(&child->dev, num_pins, mgn_chip)) in mbigen_of_create_domain()
254 return -ENOMEM; in mbigen_of_create_domain()
274 * "num-pins" is the total number of interrupt pins implemented in in mbigen_acpi_create_domain()
277 * use "num-pins" to alloc MSI vectors which are needed by client in mbigen_acpi_create_domain()
289 * ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), in mbigen_acpi_create_domain()
291 * Package () {"num-pins", 378} in mbigen_acpi_create_domain()
296 ret = device_property_read_u32(&pdev->dev, "num-pins", &num_pins); in mbigen_acpi_create_domain()
298 return -EINVAL; in mbigen_acpi_create_domain()
300 if (!mbigen_create_device_domain(&pdev->dev, num_pins, mgn_chip)) in mbigen_acpi_create_domain()
301 return -ENOMEM; in mbigen_acpi_create_domain()
309 return -ENODEV; in mbigen_acpi_create_domain()
319 mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); in mbigen_device_probe()
321 return -ENOMEM; in mbigen_device_probe()
323 mgn_chip->pdev = pdev; in mbigen_device_probe()
327 return -EINVAL; in mbigen_device_probe()
329 mgn_chip->base = devm_ioremap(&pdev->dev, res->start, in mbigen_device_probe()
331 if (!mgn_chip->base) { in mbigen_device_probe()
332 dev_err(&pdev->dev, "failed to ioremap %pR\n", res); in mbigen_device_probe()
333 return -ENOMEM; in mbigen_device_probe()
336 if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) in mbigen_device_probe()
338 else if (ACPI_COMPANION(&pdev->dev)) in mbigen_device_probe()
341 err = -EINVAL; in mbigen_device_probe()
344 dev_err(&pdev->dev, "Failed to create mbi-gen irqdomain\n"); in mbigen_device_probe()
353 { .compatible = "hisilicon,mbigen-v2" },
360 .name = "Hisilicon MBIGEN-V2",