Lines Matching +full:msi +full:- +full:base +full:- +full:spi
6 * Antoine Tenart <antoine.tenart@free-electrons.com>
16 #include <linux/irqchip/arm-gic.h>
17 #include <linux/msi.h>
26 #include <asm/msi.h>
63 spin_lock(&priv->msi_map_lock); in alpine_msix_allocate_sgi()
65 first = bitmap_find_next_zero_area(priv->msi_map, priv->num_spis, 0, in alpine_msix_allocate_sgi()
67 if (first >= priv->num_spis) { in alpine_msix_allocate_sgi()
68 spin_unlock(&priv->msi_map_lock); in alpine_msix_allocate_sgi()
69 return -ENOSPC; in alpine_msix_allocate_sgi()
72 bitmap_set(priv->msi_map, first, num_req); in alpine_msix_allocate_sgi()
74 spin_unlock(&priv->msi_map_lock); in alpine_msix_allocate_sgi()
76 return priv->spi_first + first; in alpine_msix_allocate_sgi()
82 int first = sgi - priv->spi_first; in alpine_msix_free_sgi()
84 spin_lock(&priv->msi_map_lock); in alpine_msix_free_sgi()
86 bitmap_clear(priv->msi_map, first, num_req); in alpine_msix_free_sgi()
88 spin_unlock(&priv->msi_map_lock); in alpine_msix_free_sgi()
95 phys_addr_t msg_addr = priv->addr; in alpine_msix_compose_msi_msg()
97 msg_addr |= (data->hwirq << 3); in alpine_msix_compose_msi_msg()
99 msg->address_hi = upper_32_bits(msg_addr); in alpine_msix_compose_msi_msg()
100 msg->address_lo = lower_32_bits(msg_addr); in alpine_msix_compose_msi_msg()
101 msg->data = 0; in alpine_msix_compose_msi_msg()
126 if (!is_of_node(domain->parent->fwnode)) in alpine_msix_gic_domain_alloc()
127 return -EINVAL; in alpine_msix_gic_domain_alloc()
129 fwspec.fwnode = domain->parent->fwnode; in alpine_msix_gic_domain_alloc()
139 d = irq_domain_get_irq_data(domain->parent, virq); in alpine_msix_gic_domain_alloc()
140 d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING); in alpine_msix_gic_domain_alloc()
149 struct alpine_msix_data *priv = domain->host_data; in alpine_msix_middle_domain_alloc()
181 alpine_msix_free_sgi(priv, d->hwirq, nr_irqs); in alpine_msix_middle_domain_free()
198 return -ENODEV; in alpine_msix_init_domains()
205 return -ENXIO; in alpine_msix_init_domains()
213 return -ENOMEM; in alpine_msix_init_domains()
220 pr_err("Failed to create MSI domain\n"); in alpine_msix_init_domains()
222 return -ENOMEM; in alpine_msix_init_domains()
237 return -ENOMEM; in alpine_msix_init()
239 spin_lock_init(&priv->msi_map_lock); in alpine_msix_init()
254 priv->addr = res.start & GENMASK_ULL(63,20); in alpine_msix_init()
255 priv->addr |= ALPINE_MSIX_SPI_TARGET_CLUSTER0; in alpine_msix_init()
257 if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) { in alpine_msix_init()
258 pr_err("Unable to parse MSI base\n"); in alpine_msix_init()
259 ret = -EINVAL; in alpine_msix_init()
263 if (of_property_read_u32(node, "al,msi-num-spis", &priv->num_spis)) { in alpine_msix_init()
264 pr_err("Unable to parse MSI numbers\n"); in alpine_msix_init()
265 ret = -EINVAL; in alpine_msix_init()
269 priv->msi_map = bitmap_zalloc(priv->num_spis, GFP_KERNEL); in alpine_msix_init()
270 if (!priv->msi_map) { in alpine_msix_init()
271 ret = -ENOMEM; in alpine_msix_init()
276 priv->num_spis, priv->spi_first); in alpine_msix_init()
285 bitmap_free(priv->msi_map); in alpine_msix_init()
290 IRQCHIP_DECLARE(alpine_msix, "al,alpine-msix", alpine_msix_init);