Lines Matching full:msi

11 #include <linux/msi.h>
35 #define msi_hwirq(msi, msir_index, intr_index) \ argument
36 ((msir_index) << (msi)->srs_shift | \
37 ((intr_index) << (msi)->ibs_shift))
59 * in the cascade interrupt. So, this MSI interrupt has been acked
74 seq_printf(p, " fsl-msi-%d", cascade_virq); in fsl_msi_print_chip()
151 /* If the msi-address-64 property exists, then use it */ in fsl_compose_msi_msg()
152 reg = of_get_property(hose->dn, "msi-address-64", &len); in fsl_compose_msi_msg()
163 * that neither MSI nor MSI-X can work fine. in fsl_compose_msi_msg()
164 * This is a workaround to allow MSI-X to function in fsl_compose_msi_msg()
165 * properly. It only works for MSI-X, we prevent in fsl_compose_msi_msg()
166 * MSI on buggy chips in fsl_setup_msi_irqs(). in fsl_compose_msi_msg()
191 * MPIC version 2.0 has erratum PIC1. For now MSI in fsl_setup_msi_irqs()
192 * could not work. So check to prevent MSI from in fsl_setup_msi_irqs()
201 * If the PCI node has an fsl,msi property, then we need to use it in fsl_setup_msi_irqs()
202 * to find the specific MSI. in fsl_setup_msi_irqs()
204 np = of_parse_phandle(hose->dn, "fsl,msi", 0); in fsl_setup_msi_irqs()
206 if (of_device_is_compatible(np, "fsl,mpic-msi") || in fsl_setup_msi_irqs()
207 of_device_is_compatible(np, "fsl,vmpic-msi") || in fsl_setup_msi_irqs()
208 of_device_is_compatible(np, "fsl,vmpic-msi-v4.3")) in fsl_setup_msi_irqs()
212 "node %pOF has an invalid fsl,msi phandle %u\n", in fsl_setup_msi_irqs()
220 * Loop over all the MSI devices until we find one that has an in fsl_setup_msi_irqs()
225 * If the PCI node has an fsl,msi property, then we in fsl_setup_msi_irqs()
226 * restrict our search to the corresponding MSI node. in fsl_setup_msi_irqs()
227 * The simplest way is to skip over MSI nodes with the in fsl_setup_msi_irqs()
229 * has the additional benefit of skipping over MSI in fsl_setup_msi_irqs()
242 dev_err(&pdev->dev, "could not allocate MSI interrupt\n"); in fsl_setup_msi_irqs()
298 pr_err("fsl-msi: fh_vmpic_get_msir() failed for " in fsl_msi_cascade()
326 struct fsl_msi *msi = platform_get_drvdata(ofdev); in fsl_of_msi_remove() local
329 if (msi->list.prev != NULL) in fsl_of_msi_remove()
330 list_del(&msi->list); in fsl_of_msi_remove()
332 if (msi->cascade_array[i]) { in fsl_of_msi_remove()
333 virq = msi->cascade_array[i]->virq; in fsl_of_msi_remove()
337 free_irq(virq, msi->cascade_array[i]); in fsl_of_msi_remove()
338 kfree(msi->cascade_array[i]); in fsl_of_msi_remove()
342 if (msi->bitmap.bitmap) in fsl_of_msi_remove()
343 msi_bitmap_free(&msi->bitmap); in fsl_of_msi_remove()
344 if ((msi->feature & FSL_PIC_IP_MASK) != FSL_PIC_IP_VMPIC) in fsl_of_msi_remove()
345 iounmap(msi->msi_regs); in fsl_of_msi_remove()
346 kfree(msi); in fsl_of_msi_remove()
354 static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, in fsl_msi_setup_hwirq() argument
369 dev_err(&dev->dev, "No memory for MSI cascade data\n"); in fsl_msi_setup_hwirq()
375 cascade_data->msi_data = msi; in fsl_msi_setup_hwirq()
377 msi->cascade_array[irq_index] = cascade_data; in fsl_msi_setup_hwirq()
380 "fsl-msi-cascade", cascade_data); in fsl_msi_setup_hwirq()
387 /* Release the hwirqs corresponding to this MSI register */ in fsl_msi_setup_hwirq()
389 msi_bitmap_free_hwirqs(&msi->bitmap, in fsl_msi_setup_hwirq()
390 msi_hwirq(msi, offset, i), 1); in fsl_msi_setup_hwirq()
399 struct fsl_msi *msi; in fsl_of_msi_probe() local
413 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); in fsl_of_msi_probe()
415 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); in fsl_of_msi_probe()
416 if (!msi) { in fsl_of_msi_probe()
417 dev_err(&dev->dev, "No memory for MSI structure\n"); in fsl_of_msi_probe()
420 platform_set_drvdata(dev, msi); in fsl_of_msi_probe()
422 msi->irqhost = irq_domain_add_linear(dev->dev.of_node, in fsl_of_msi_probe()
423 NR_MSI_IRQS_MAX, &fsl_msi_host_ops, msi); in fsl_of_msi_probe()
425 if (msi->irqhost == NULL) { in fsl_of_msi_probe()
426 dev_err(&dev->dev, "No memory for MSI irqhost\n"); in fsl_of_msi_probe()
432 * Under the Freescale hypervisor, the msi nodes don't have a 'reg' in fsl_of_msi_probe()
433 * property. Instead, we use hypercalls to access the MSI. in fsl_of_msi_probe()
443 msi->msi_regs = ioremap(res.start, resource_size(&res)); in fsl_of_msi_probe()
444 if (!msi->msi_regs) { in fsl_of_msi_probe()
450 msi->msiir_offset = in fsl_of_msi_probe()
458 msi->msiir_offset = features->msiir_offset + in fsl_of_msi_probe()
461 msi->msiir_offset = msiir.start & MSIIR_OFFSET_MASK; in fsl_of_msi_probe()
464 msi->feature = features->fsl_pic_ip; in fsl_of_msi_probe()
469 msi->feature |= MSI_HW_ERRATA_ENDIAN; in fsl_of_msi_probe()
473 * that have an "fsl,msi" property. in fsl_of_msi_probe()
475 msi->phandle = dev->dev.of_node->phandle; in fsl_of_msi_probe()
477 err = fsl_msi_init_allocator(msi); in fsl_of_msi_probe()
479 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); in fsl_of_msi_probe()
483 p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len); in fsl_of_msi_probe()
485 if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3") || in fsl_of_msi_probe()
486 of_device_is_compatible(dev->dev.of_node, "fsl,vmpic-msi-v4.3")) { in fsl_of_msi_probe()
487 msi->srs_shift = MSIIR1_SRS_SHIFT; in fsl_of_msi_probe()
488 msi->ibs_shift = MSIIR1_IBS_SHIFT; in fsl_of_msi_probe()
490 dev_warn(&dev->dev, "%s: dose not support msi-available-ranges property\n", in fsl_of_msi_probe()
495 err = fsl_msi_setup_hwirq(msi, dev, in fsl_of_msi_probe()
504 msi->srs_shift = MSIIR_SRS_SHIFT; in fsl_of_msi_probe()
505 msi->ibs_shift = MSIIR_IBS_SHIFT; in fsl_of_msi_probe()
508 dev_err(&dev->dev, "%s: Malformed msi-available-ranges property\n", in fsl_of_msi_probe()
522 pr_warn("%s: %pOF: msi available range of %u at %u is not IRQ-aligned\n", in fsl_of_msi_probe()
533 err = fsl_msi_setup_hwirq(msi, dev, offset + j, in fsl_of_msi_probe()
541 list_add_tail(&msi->list, &msi_head); in fsl_of_msi_probe()
544 * Apply the MSI ops to all the controllers. in fsl_of_msi_probe()
546 * but bail out if we find another MSI driver. in fsl_of_msi_probe()
553 dev_err(&dev->dev, "Different MSI driver already installed!\n"); in fsl_of_msi_probe()
581 .compatible = "fsl,mpic-msi",
585 .compatible = "fsl,mpic-msi-v4.3",
589 .compatible = "fsl,ipic-msi",
594 .compatible = "fsl,vmpic-msi",
598 .compatible = "fsl,vmpic-msi-v4.3",
607 .name = "fsl-msi",