Commit 354b2bd3 authored by Damien Le Moal's avatar Damien Le Moal Committed by Lorenzo Pieralisi
Browse files

PCI: xilinx-nwl: Use INTX instead of legacy

In the xilinx-nwl controller driver, change all use of "legacy" and
"leg" to "intx", to match the term used in the PCI specifications.

Link: https://lore.kernel.org/r/20231122060406.14695-17-dlemoal@kernel.org


Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 95da5fed
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ struct nwl_pcie {
	int irq_intx;
	int irq_misc;
	struct nwl_msi msi;
	struct irq_domain *legacy_irq_domain;
	struct irq_domain *intx_irq_domain;
	struct clk *clk;
	raw_spinlock_t leg_mask_lock;
};
@@ -324,7 +324,7 @@ static void nwl_pcie_leg_handler(struct irq_desc *desc)
	while ((status = nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
				MSGF_LEG_SR_MASKALL) != 0) {
		for_each_set_bit(bit, &status, PCI_NUM_INTX)
			generic_handle_domain_irq(pcie->legacy_irq_domain, bit);
			generic_handle_domain_irq(pcie->intx_irq_domain, bit);
	}

	chained_irq_exit(chip, desc);
@@ -364,7 +364,7 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc)
	chained_irq_exit(chip, desc);
}

static void nwl_mask_leg_irq(struct irq_data *data)
static void nwl_mask_intx_irq(struct irq_data *data)
{
	struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
	unsigned long flags;
@@ -378,7 +378,7 @@ static void nwl_mask_leg_irq(struct irq_data *data)
	raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags);
}

static void nwl_unmask_leg_irq(struct irq_data *data)
static void nwl_unmask_intx_irq(struct irq_data *data)
{
	struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
	unsigned long flags;
@@ -392,26 +392,26 @@ static void nwl_unmask_leg_irq(struct irq_data *data)
	raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags);
}

static struct irq_chip nwl_leg_irq_chip = {
static struct irq_chip nwl_intx_irq_chip = {
	.name = "nwl_pcie:legacy",
	.irq_enable = nwl_unmask_leg_irq,
	.irq_disable = nwl_mask_leg_irq,
	.irq_mask = nwl_mask_leg_irq,
	.irq_unmask = nwl_unmask_leg_irq,
	.irq_enable = nwl_unmask_intx_irq,
	.irq_disable = nwl_mask_intx_irq,
	.irq_mask = nwl_mask_intx_irq,
	.irq_unmask = nwl_unmask_intx_irq,
};

static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq,
static int nwl_intx_map(struct irq_domain *domain, unsigned int irq,
			irq_hw_number_t hwirq)
{
	irq_set_chip_and_handler(irq, &nwl_leg_irq_chip, handle_level_irq);
	irq_set_chip_and_handler(irq, &nwl_intx_irq_chip, handle_level_irq);
	irq_set_chip_data(irq, domain->host_data);
	irq_set_status_flags(irq, IRQ_LEVEL);

	return 0;
}

static const struct irq_domain_ops legacy_domain_ops = {
	.map = nwl_legacy_map,
static const struct irq_domain_ops intx_domain_ops = {
	.map = nwl_intx_map,
	.xlate = pci_irqd_intx_xlate,
};

@@ -525,20 +525,20 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
{
	struct device *dev = pcie->dev;
	struct device_node *node = dev->of_node;
	struct device_node *legacy_intc_node;
	struct device_node *intc_node;

	legacy_intc_node = of_get_next_child(node, NULL);
	if (!legacy_intc_node) {
	intc_node = of_get_next_child(node, NULL);
	if (!intc_node) {
		dev_err(dev, "No legacy intc node found\n");
		return -EINVAL;
	}

	pcie->legacy_irq_domain = irq_domain_add_linear(legacy_intc_node,
	pcie->intx_irq_domain = irq_domain_add_linear(intc_node,
						      PCI_NUM_INTX,
							&legacy_domain_ops,
						      &intx_domain_ops,
						      pcie);
	of_node_put(legacy_intc_node);
	if (!pcie->legacy_irq_domain) {
	of_node_put(intc_node);
	if (!pcie->intx_irq_domain) {
		dev_err(dev, "failed to create IRQ domain\n");
		return -ENOMEM;
	}
@@ -710,14 +710,14 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
	/* Enable all misc interrupts */
	nwl_bridge_writel(pcie, MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK);

	/* Disable all legacy interrupts */
	/* Disable all INTX interrupts */
	nwl_bridge_writel(pcie, (u32)~MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);

	/* Clear pending legacy interrupts */
	/* Clear pending INTX interrupts */
	nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
			  MSGF_LEG_SR_MASKALL, MSGF_LEG_STATUS);

	/* Enable all legacy interrupts */
	/* Enable all INTX interrupts */
	nwl_bridge_writel(pcie, MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);

	/* Enable the bridge config interrupt */