Lines Matching full:msi
24 #include <linux/msi.h>
64 struct rcar_msi msi; member
104 static struct rcar_pcie_host *msi_to_host(struct rcar_msi *msi) in msi_to_host() argument
106 return container_of(msi, struct rcar_pcie_host, msi); in msi_to_host()
494 /* Enable MSI */ in rcar_pcie_hw_init()
582 struct rcar_msi *msi = &host->msi; in rcar_pcie_msi_irq() local
588 /* MSI & INTx share an interrupt - we only handle MSI here */ in rcar_pcie_msi_irq()
596 ret = generic_handle_domain_irq(msi->domain->parent, index); in rcar_pcie_msi_irq()
598 /* Unknown MSI, just clear it */ in rcar_pcie_msi_irq()
599 dev_dbg(dev, "unexpected MSI\n"); in rcar_pcie_msi_irq()
628 .name = "PCIe MSI",
636 struct rcar_msi *msi = irq_data_get_irq_chip_data(d); in rcar_msi_irq_ack() local
637 struct rcar_pcie *pcie = &msi_to_host(msi)->pcie; in rcar_msi_irq_ack()
645 struct rcar_msi *msi = irq_data_get_irq_chip_data(d); in rcar_msi_irq_mask() local
646 struct rcar_pcie *pcie = &msi_to_host(msi)->pcie; in rcar_msi_irq_mask()
650 spin_lock_irqsave(&msi->mask_lock, flags); in rcar_msi_irq_mask()
654 spin_unlock_irqrestore(&msi->mask_lock, flags); in rcar_msi_irq_mask()
659 struct rcar_msi *msi = irq_data_get_irq_chip_data(d); in rcar_msi_irq_unmask() local
660 struct rcar_pcie *pcie = &msi_to_host(msi)->pcie; in rcar_msi_irq_unmask()
664 spin_lock_irqsave(&msi->mask_lock, flags); in rcar_msi_irq_unmask()
668 spin_unlock_irqrestore(&msi->mask_lock, flags); in rcar_msi_irq_unmask()
678 struct rcar_msi *msi = irq_data_get_irq_chip_data(data); in rcar_compose_msi_msg() local
679 struct rcar_pcie *pcie = &msi_to_host(msi)->pcie; in rcar_compose_msi_msg()
687 .name = "Rcar MSI",
698 struct rcar_msi *msi = domain->host_data; in rcar_msi_domain_alloc() local
702 mutex_lock(&msi->map_lock); in rcar_msi_domain_alloc()
704 hwirq = bitmap_find_free_region(msi->used, INT_PCI_MSI_NR, order_base_2(nr_irqs)); in rcar_msi_domain_alloc()
706 mutex_unlock(&msi->map_lock); in rcar_msi_domain_alloc()
723 struct rcar_msi *msi = domain->host_data; in rcar_msi_domain_free() local
725 mutex_lock(&msi->map_lock); in rcar_msi_domain_free()
727 bitmap_release_region(msi->used, d->hwirq, order_base_2(nr_irqs)); in rcar_msi_domain_free()
729 mutex_unlock(&msi->map_lock); in rcar_msi_domain_free()
743 static int rcar_allocate_domains(struct rcar_msi *msi) in rcar_allocate_domains() argument
745 struct rcar_pcie *pcie = &msi_to_host(msi)->pcie; in rcar_allocate_domains()
750 &rcar_msi_domain_ops, msi); in rcar_allocate_domains()
757 msi->domain = pci_msi_create_irq_domain(fwnode, &rcar_msi_info, parent); in rcar_allocate_domains()
758 if (!msi->domain) { in rcar_allocate_domains()
759 dev_err(pcie->dev, "failed to create MSI domain\n"); in rcar_allocate_domains()
767 static void rcar_free_domains(struct rcar_msi *msi) in rcar_free_domains() argument
769 struct irq_domain *parent = msi->domain->parent; in rcar_free_domains()
771 irq_domain_remove(msi->domain); in rcar_free_domains()
779 struct rcar_msi *msi = &host->msi; in rcar_pcie_enable_msi() local
783 mutex_init(&msi->map_lock); in rcar_pcie_enable_msi()
784 spin_lock_init(&msi->mask_lock); in rcar_pcie_enable_msi()
790 err = rcar_allocate_domains(msi); in rcar_pcie_enable_msi()
794 /* Two irqs are for MSI, but they are also used for non-MSI irqs */ in rcar_pcie_enable_msi()
795 err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq, in rcar_pcie_enable_msi()
803 err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq, in rcar_pcie_enable_msi()
815 * Setup MSI data target using RC base address address, which in rcar_pcie_enable_msi()
824 rcar_free_domains(msi); in rcar_pcie_enable_msi()
832 /* Disable all MSI interrupts */ in rcar_pcie_teardown_msi()
835 /* Disable address decoding of the MSI interrupt, MSIFE */ in rcar_pcie_teardown_msi()
838 rcar_free_domains(&host->msi); in rcar_pcie_teardown_msi()
868 dev_err(dev, "cannot get platform resources for msi interrupt\n"); in rcar_pcie_get_resources()
872 host->msi.irq1 = i; in rcar_pcie_get_resources()
876 dev_err(dev, "cannot get platform resources for msi interrupt\n"); in rcar_pcie_get_resources()
880 host->msi.irq2 = i; in rcar_pcie_get_resources()
891 irq_dispose_mapping(host->msi.irq1); in rcar_pcie_get_resources()
1039 "failed to enable MSI support: %d\n", in rcar_pcie_probe()
1065 irq_dispose_mapping(host->msi.irq2); in rcar_pcie_probe()
1066 irq_dispose_mapping(host->msi.irq1); in rcar_pcie_probe()
1096 /* Enable MSI */ in rcar_pcie_resume()
1105 bitmap_to_arr32(&val, host->msi.used, INT_PCI_MSI_NR); in rcar_pcie_resume()