Lines Matching +full:ls2k0500 +full:- +full:eiointc
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
8 #define pr_fmt(fmt) "eiointc: " fmt
20 #include "irq-loongson.h"
85 /* EIO node 0 is in charge of inter-node interrupt dispatch */ in eiointc_set_irq_route()
99 struct eiointc_priv *priv = d->domain->host_data; in eiointc_set_irq_affinity()
103 cpu = cpumask_first_and_and(&priv->cpuspan_map, affinity, cpu_online_mask); in eiointc_set_irq_affinity()
106 return -EINVAL; in eiointc_set_irq_affinity()
109 vector = d->hwirq; in eiointc_set_irq_affinity()
114 0x0, priv->node * CORES_PER_EIO_NODE); in eiointc_set_irq_affinity()
117 eiointc_set_irq_route(vector, cpu, priv->node, &priv->node_map); in eiointc_set_irq_affinity()
121 0x0, priv->node * CORES_PER_EIO_NODE); in eiointc_set_irq_affinity()
136 if (node_isset(node, eiointc_priv[i]->node_map)) in eiointc_index()
140 return -1; in eiointc_index()
152 return -1; in eiointc_router_init()
158 for (i = 0; i < eiointc_priv[0]->vec_count / 32; i++) { in eiointc_router_init()
163 for (i = 0; i < eiointc_priv[0]->vec_count / 32 / 4; i++) { in eiointc_router_init()
169 for (i = 0; i < eiointc_priv[0]->vec_count / 4; i++) { in eiointc_router_init()
170 /* Route to Node-0 Core-0 */ in eiointc_router_init()
174 bit = (eiointc_priv[index]->node << 4) | 1; in eiointc_router_init()
180 for (i = 0; i < eiointc_priv[0]->vec_count / 32; i++) { in eiointc_router_init()
200 for (i = 0; i < eiointc_priv[0]->vec_count / VEC_COUNT_PER_REG; i++) { in eiointc_irq_dispatch()
213 generic_handle_domain_irq(priv->eiointc_domain, irq); in eiointc_irq_dispatch()
238 .name = "EIOINTC",
253 struct eiointc_priv *priv = domain->host_data; in eiointc_domain_alloc()
328 unsigned int node = (pchpic_entry->address >> 44) & 0xf; in pch_pic_parse_madt()
345 node = early_cpu_to_node(eiointc_priv[nr_pics - 1]->node * CORES_PER_EIO_NODE); in pch_msi_parse_madt()
347 node = eiointc_priv[nr_pics - 1]->node; in pch_msi_parse_madt()
380 node_map = node_map ? node_map : -1ULL; in eiointc_init()
383 node_set(cpu_to_eio_node(i), priv->node_map); in eiointc_init()
384 cpumask_or(&priv->cpuspan_map, &priv->cpuspan_map, in eiointc_init()
389 priv->eiointc_domain = irq_domain_create_linear(priv->domain_handle, in eiointc_init()
390 priv->vec_count, in eiointc_init()
393 if (!priv->eiointc_domain) { in eiointc_init()
394 pr_err("loongson-extioi: cannot add IRQ domain\n"); in eiointc_init()
395 return -ENOMEM; in eiointc_init()
405 "irqchip/loongarch/eiointc:starting", in eiointc_init()
421 return -ENOMEM; in eiointc_acpi_init()
423 priv->domain_handle = irq_domain_alloc_named_id_fwnode("EIOPIC", in eiointc_acpi_init()
424 acpi_eiointc->node); in eiointc_acpi_init()
425 if (!priv->domain_handle) { in eiointc_acpi_init()
430 priv->vec_count = VEC_COUNT; in eiointc_acpi_init()
431 priv->node = acpi_eiointc->node; in eiointc_acpi_init()
433 parent_irq = irq_create_mapping(parent, acpi_eiointc->cascade); in eiointc_acpi_init()
435 ret = eiointc_init(priv, parent_irq, acpi_eiointc->node_map); in eiointc_acpi_init()
440 node = early_cpu_to_node(acpi_eiointc->node * CORES_PER_EIO_NODE); in eiointc_acpi_init()
442 node = acpi_eiointc->node; in eiointc_acpi_init()
443 acpi_set_vec_parent(node, priv->eiointc_domain, pch_group); in eiointc_acpi_init()
444 acpi_set_vec_parent(node, priv->eiointc_domain, msi_group); in eiointc_acpi_init()
453 irq_domain_free_fwnode(priv->domain_handle); in eiointc_acpi_init()
454 priv->domain_handle = NULL; in eiointc_acpi_init()
458 return -ENOMEM; in eiointc_acpi_init()
469 return -ENOMEM; in eiointc_of_init()
473 ret = -ENODEV; in eiointc_of_init()
482 * In particular, the number of devices supported by the LS2K0500 in eiointc_of_init()
485 if (of_device_is_compatible(of_node, "loongson,ls2k0500-eiointc")) in eiointc_of_init()
486 priv->vec_count = 128; in eiointc_of_init()
488 priv->vec_count = VEC_COUNT; in eiointc_of_init()
490 priv->node = 0; in eiointc_of_init()
491 priv->domain_handle = of_node_to_fwnode(of_node); in eiointc_of_init()
504 IRQCHIP_DECLARE(loongson_ls2k0500_eiointc, "loongson,ls2k0500-eiointc", eiointc_of_init);
505 IRQCHIP_DECLARE(loongson_ls2k2000_eiointc, "loongson,ls2k2000-eiointc", eiointc_of_init);