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()
149 /* If the msi-address-64 property exists, then use it */ in fsl_compose_msi_msg()
150 reg = of_get_property(hose->dn, "msi-address-64", &len); in fsl_compose_msi_msg()
161 * that neither MSI nor MSI-X can work fine. in fsl_compose_msi_msg()
162 * This is a workaround to allow MSI-X to function in fsl_compose_msi_msg()
163 * properly. It only works for MSI-X, we prevent in fsl_compose_msi_msg()
164 * MSI on buggy chips in fsl_setup_msi_irqs(). in fsl_compose_msi_msg()
189 * MPIC version 2.0 has erratum PIC1. For now MSI in fsl_setup_msi_irqs()
190 * could not work. So check to prevent MSI from in fsl_setup_msi_irqs()
199 * If the PCI node has an fsl,msi property, then we need to use it in fsl_setup_msi_irqs()
200 * to find the specific MSI. in fsl_setup_msi_irqs()
202 np = of_parse_phandle(hose->dn, "fsl,msi", 0); in fsl_setup_msi_irqs()
204 if (of_device_is_compatible(np, "fsl,mpic-msi") || in fsl_setup_msi_irqs()
205 of_device_is_compatible(np, "fsl,vmpic-msi") || in fsl_setup_msi_irqs()
206 of_device_is_compatible(np, "fsl,vmpic-msi-v4.3")) in fsl_setup_msi_irqs()
210 "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()
294 pr_err("fsl-msi: fh_vmpic_get_msir() failed for " in fsl_msi_cascade()
322 struct fsl_msi *msi = platform_get_drvdata(ofdev); in fsl_of_msi_remove() local
325 if (msi->list.prev != NULL) in fsl_of_msi_remove()
326 list_del(&msi->list); in fsl_of_msi_remove()
328 if (msi->cascade_array[i]) { in fsl_of_msi_remove()
329 virq = msi->cascade_array[i]->virq; in fsl_of_msi_remove()
333 free_irq(virq, msi->cascade_array[i]); in fsl_of_msi_remove()
334 kfree(msi->cascade_array[i]); in fsl_of_msi_remove()
338 if (msi->bitmap.bitmap) in fsl_of_msi_remove()
339 msi_bitmap_free(&msi->bitmap); in fsl_of_msi_remove()
340 if ((msi->feature & FSL_PIC_IP_MASK) != FSL_PIC_IP_VMPIC) in fsl_of_msi_remove()
341 iounmap(msi->msi_regs); in fsl_of_msi_remove()
342 kfree(msi); in fsl_of_msi_remove()
350 static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, in fsl_msi_setup_hwirq() argument
365 dev_err(&dev->dev, "No memory for MSI cascade data\n"); in fsl_msi_setup_hwirq()
371 cascade_data->msi_data = msi; in fsl_msi_setup_hwirq()
373 msi->cascade_array[irq_index] = cascade_data; in fsl_msi_setup_hwirq()
376 "fsl-msi-cascade", cascade_data); in fsl_msi_setup_hwirq()
383 /* Release the hwirqs corresponding to this MSI register */ in fsl_msi_setup_hwirq()
385 msi_bitmap_free_hwirqs(&msi->bitmap, in fsl_msi_setup_hwirq()
386 msi_hwirq(msi, offset, i), 1); in fsl_msi_setup_hwirq()
395 struct fsl_msi *msi; in fsl_of_msi_probe() local
409 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); in fsl_of_msi_probe()
411 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); in fsl_of_msi_probe()
412 if (!msi) { in fsl_of_msi_probe()
413 dev_err(&dev->dev, "No memory for MSI structure\n"); in fsl_of_msi_probe()
416 platform_set_drvdata(dev, msi); in fsl_of_msi_probe()
418 msi->irqhost = irq_domain_add_linear(dev->dev.of_node, in fsl_of_msi_probe()
419 NR_MSI_IRQS_MAX, &fsl_msi_host_ops, msi); in fsl_of_msi_probe()
421 if (msi->irqhost == NULL) { in fsl_of_msi_probe()
422 dev_err(&dev->dev, "No memory for MSI irqhost\n"); in fsl_of_msi_probe()
428 * Under the Freescale hypervisor, the msi nodes don't have a 'reg' in fsl_of_msi_probe()
429 * property. Instead, we use hypercalls to access the MSI. in fsl_of_msi_probe()
439 msi->msi_regs = ioremap(res.start, resource_size(&res)); in fsl_of_msi_probe()
440 if (!msi->msi_regs) { in fsl_of_msi_probe()
446 msi->msiir_offset = in fsl_of_msi_probe()
454 msi->msiir_offset = features->msiir_offset + in fsl_of_msi_probe()
457 msi->msiir_offset = msiir.start & MSIIR_OFFSET_MASK; in fsl_of_msi_probe()
460 msi->feature = features->fsl_pic_ip; in fsl_of_msi_probe()
465 msi->feature |= MSI_HW_ERRATA_ENDIAN; in fsl_of_msi_probe()
469 * that have an "fsl,msi" property. in fsl_of_msi_probe()
471 msi->phandle = dev->dev.of_node->phandle; in fsl_of_msi_probe()
473 err = fsl_msi_init_allocator(msi); in fsl_of_msi_probe()
475 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); in fsl_of_msi_probe()
479 p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len); in fsl_of_msi_probe()
481 if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3") || in fsl_of_msi_probe()
482 of_device_is_compatible(dev->dev.of_node, "fsl,vmpic-msi-v4.3")) { in fsl_of_msi_probe()
483 msi->srs_shift = MSIIR1_SRS_SHIFT; in fsl_of_msi_probe()
484 msi->ibs_shift = MSIIR1_IBS_SHIFT; in fsl_of_msi_probe()
486 dev_warn(&dev->dev, "%s: dose not support msi-available-ranges property\n", in fsl_of_msi_probe()
491 err = fsl_msi_setup_hwirq(msi, dev, in fsl_of_msi_probe()
500 msi->srs_shift = MSIIR_SRS_SHIFT; in fsl_of_msi_probe()
501 msi->ibs_shift = MSIIR_IBS_SHIFT; in fsl_of_msi_probe()
504 dev_err(&dev->dev, "%s: Malformed msi-available-ranges property\n", in fsl_of_msi_probe()
518 pr_warn("%s: %pOF: msi available range of %u at %u is not IRQ-aligned\n", in fsl_of_msi_probe()
529 err = fsl_msi_setup_hwirq(msi, dev, offset + j, in fsl_of_msi_probe()
537 list_add_tail(&msi->list, &msi_head); in fsl_of_msi_probe()
540 * Apply the MSI ops to all the controllers. in fsl_of_msi_probe()
542 * but bail out if we find another MSI driver. in fsl_of_msi_probe()
549 dev_err(&dev->dev, "Different MSI driver already installed!\n"); in fsl_of_msi_probe()
577 .compatible = "fsl,mpic-msi",
581 .compatible = "fsl,mpic-msi-v4.3",
585 .compatible = "fsl,ipic-msi",
590 .compatible = "fsl,vmpic-msi",
594 .compatible = "fsl,vmpic-msi-v4.3",
603 .name = "fsl-msi",