Lines Matching full:msi

11 #include <linux/msi.h>
37 #define msi_hwirq(msi, msir_index, intr_index) \ argument
38 ((msir_index) << (msi)->srs_shift | \
39 ((intr_index) << (msi)->ibs_shift))
61 * in the cascade interrupt. So, this MSI interrupt has been acked
76 seq_printf(p, " fsl-msi-%d", cascade_virq); in fsl_msi_print_chip()
150 /* If the msi-address-64 property exists, then use it */ in fsl_compose_msi_msg()
151 reg = of_get_property(hose->dn, "msi-address-64", &len); in fsl_compose_msi_msg()
162 * that neither MSI nor MSI-X can work fine. in fsl_compose_msi_msg()
163 * This is a workaround to allow MSI-X to function in fsl_compose_msi_msg()
164 * properly. It only works for MSI-X, we prevent in fsl_compose_msi_msg()
165 * MSI on buggy chips in fsl_setup_msi_irqs(). in fsl_compose_msi_msg()
190 * MPIC version 2.0 has erratum PIC1. For now MSI in fsl_setup_msi_irqs()
191 * could not work. So check to prevent MSI from in fsl_setup_msi_irqs()
200 * If the PCI node has an fsl,msi property, then we need to use it in fsl_setup_msi_irqs()
201 * to find the specific MSI. in fsl_setup_msi_irqs()
203 np = of_parse_phandle(hose->dn, "fsl,msi", 0); in fsl_setup_msi_irqs()
205 if (of_device_is_compatible(np, "fsl,mpic-msi") || in fsl_setup_msi_irqs()
206 of_device_is_compatible(np, "fsl,vmpic-msi") || in fsl_setup_msi_irqs()
207 of_device_is_compatible(np, "fsl,vmpic-msi-v4.3")) in fsl_setup_msi_irqs()
211 "node %pOF has an invalid fsl,msi phandle %u\n", in fsl_setup_msi_irqs()
221 * Loop over all the MSI devices until we find one that has an in fsl_setup_msi_irqs()
226 * If the PCI node has an fsl,msi property, then we in fsl_setup_msi_irqs()
227 * restrict our search to the corresponding MSI node. in fsl_setup_msi_irqs()
228 * The simplest way is to skip over MSI nodes with the in fsl_setup_msi_irqs()
230 * has the additional benefit of skipping over MSI in fsl_setup_msi_irqs()
243 dev_err(&pdev->dev, "could not allocate MSI interrupt\n"); in fsl_setup_msi_irqs()
295 pr_err("fsl-msi: fh_vmpic_get_msir() failed for " in fsl_msi_cascade()
323 struct fsl_msi *msi = platform_get_drvdata(ofdev); in fsl_of_msi_remove() local
326 if (msi->list.prev != NULL) in fsl_of_msi_remove()
327 list_del(&msi->list); in fsl_of_msi_remove()
329 if (msi->cascade_array[i]) { in fsl_of_msi_remove()
330 virq = msi->cascade_array[i]->virq; in fsl_of_msi_remove()
334 free_irq(virq, msi->cascade_array[i]); in fsl_of_msi_remove()
335 kfree(msi->cascade_array[i]); in fsl_of_msi_remove()
339 if (msi->bitmap.bitmap) in fsl_of_msi_remove()
340 msi_bitmap_free(&msi->bitmap); in fsl_of_msi_remove()
341 if ((msi->feature & FSL_PIC_IP_MASK) != FSL_PIC_IP_VMPIC) in fsl_of_msi_remove()
342 iounmap(msi->msi_regs); in fsl_of_msi_remove()
343 kfree(msi); in fsl_of_msi_remove()
351 static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, in fsl_msi_setup_hwirq() argument
366 dev_err(&dev->dev, "No memory for MSI cascade data\n"); in fsl_msi_setup_hwirq()
372 cascade_data->msi_data = msi; in fsl_msi_setup_hwirq()
374 msi->cascade_array[irq_index] = cascade_data; in fsl_msi_setup_hwirq()
377 "fsl-msi-cascade", cascade_data); in fsl_msi_setup_hwirq()
384 /* Release the hwirqs corresponding to this MSI register */ in fsl_msi_setup_hwirq()
386 msi_bitmap_free_hwirqs(&msi->bitmap, in fsl_msi_setup_hwirq()
387 msi_hwirq(msi, offset, i), 1); in fsl_msi_setup_hwirq()
396 struct fsl_msi *msi; in fsl_of_msi_probe() local
410 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); in fsl_of_msi_probe()
412 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); in fsl_of_msi_probe()
413 if (!msi) { in fsl_of_msi_probe()
414 dev_err(&dev->dev, "No memory for MSI structure\n"); in fsl_of_msi_probe()
417 platform_set_drvdata(dev, msi); in fsl_of_msi_probe()
419 msi->irqhost = irq_domain_add_linear(dev->dev.of_node, in fsl_of_msi_probe()
420 NR_MSI_IRQS_MAX, &fsl_msi_host_ops, msi); in fsl_of_msi_probe()
422 if (msi->irqhost == NULL) { in fsl_of_msi_probe()
423 dev_err(&dev->dev, "No memory for MSI irqhost\n"); in fsl_of_msi_probe()
429 * Under the Freescale hypervisor, the msi nodes don't have a 'reg' in fsl_of_msi_probe()
430 * property. Instead, we use hypercalls to access the MSI. in fsl_of_msi_probe()
440 msi->msi_regs = ioremap(res.start, resource_size(&res)); in fsl_of_msi_probe()
441 if (!msi->msi_regs) { in fsl_of_msi_probe()
447 msi->msiir_offset = in fsl_of_msi_probe()
455 msi->msiir_offset = features->msiir_offset + in fsl_of_msi_probe()
458 msi->msiir_offset = msiir.start & MSIIR_OFFSET_MASK; in fsl_of_msi_probe()
461 msi->feature = features->fsl_pic_ip; in fsl_of_msi_probe()
466 msi->feature |= MSI_HW_ERRATA_ENDIAN; in fsl_of_msi_probe()
470 * that have an "fsl,msi" property. in fsl_of_msi_probe()
472 msi->phandle = dev->dev.of_node->phandle; in fsl_of_msi_probe()
474 err = fsl_msi_init_allocator(msi); in fsl_of_msi_probe()
476 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); in fsl_of_msi_probe()
480 p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len); in fsl_of_msi_probe()
482 if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3") || in fsl_of_msi_probe()
483 of_device_is_compatible(dev->dev.of_node, "fsl,vmpic-msi-v4.3")) { in fsl_of_msi_probe()
484 msi->srs_shift = MSIIR1_SRS_SHIFT; in fsl_of_msi_probe()
485 msi->ibs_shift = MSIIR1_IBS_SHIFT; in fsl_of_msi_probe()
487 dev_warn(&dev->dev, "%s: dose not support msi-available-ranges property\n", in fsl_of_msi_probe()
492 err = fsl_msi_setup_hwirq(msi, dev, in fsl_of_msi_probe()
501 msi->srs_shift = MSIIR_SRS_SHIFT; in fsl_of_msi_probe()
502 msi->ibs_shift = MSIIR_IBS_SHIFT; in fsl_of_msi_probe()
505 dev_err(&dev->dev, "%s: Malformed msi-available-ranges property\n", in fsl_of_msi_probe()
519 pr_warn("%s: %pOF: msi available range of %u at %u is not IRQ-aligned\n", in fsl_of_msi_probe()
530 err = fsl_msi_setup_hwirq(msi, dev, offset + j, in fsl_of_msi_probe()
538 list_add_tail(&msi->list, &msi_head); in fsl_of_msi_probe()
541 * Apply the MSI ops to all the controllers. in fsl_of_msi_probe()
543 * but bail out if we find another MSI driver. in fsl_of_msi_probe()
550 dev_err(&dev->dev, "Different MSI driver already installed!\n"); in fsl_of_msi_probe()
580 .compatible = "fsl,mpic-msi",
584 .compatible = "fsl,mpic-msi-v4.3",
588 .compatible = "fsl,ipic-msi",
593 .compatible = "fsl,vmpic-msi",
597 .compatible = "fsl,vmpic-msi-v4.3",
606 .name = "fsl-msi",