diff options
-rw-r--r-- | drivers/pci/host/pcie-xilinx-nwl.c | 45 | ||||
-rw-r--r-- | drivers/pci/host/pcie-xilinx.c | 2 |
2 files changed, 45 insertions, 2 deletions
diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index d1f7e4ca5a5a..eec641a34fc5 100644 --- a/drivers/pci/host/pcie-xilinx-nwl.c +++ b/drivers/pci/host/pcie-xilinx-nwl.c | |||
@@ -172,6 +172,7 @@ struct nwl_pcie { | |||
172 | u8 root_busno; | 172 | u8 root_busno; |
173 | struct nwl_msi msi; | 173 | struct nwl_msi msi; |
174 | struct irq_domain *legacy_irq_domain; | 174 | struct irq_domain *legacy_irq_domain; |
175 | raw_spinlock_t leg_mask_lock; | ||
175 | }; | 176 | }; |
176 | 177 | ||
177 | static inline u32 nwl_bridge_readl(struct nwl_pcie *pcie, u32 off) | 178 | static inline u32 nwl_bridge_readl(struct nwl_pcie *pcie, u32 off) |
@@ -383,11 +384,52 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc) | |||
383 | chained_irq_exit(chip, desc); | 384 | chained_irq_exit(chip, desc); |
384 | } | 385 | } |
385 | 386 | ||
387 | static void nwl_mask_leg_irq(struct irq_data *data) | ||
388 | { | ||
389 | struct irq_desc *desc = irq_to_desc(data->irq); | ||
390 | struct nwl_pcie *pcie; | ||
391 | unsigned long flags; | ||
392 | u32 mask; | ||
393 | u32 val; | ||
394 | |||
395 | pcie = irq_desc_get_chip_data(desc); | ||
396 | mask = 1 << (data->hwirq - 1); | ||
397 | raw_spin_lock_irqsave(&pcie->leg_mask_lock, flags); | ||
398 | val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); | ||
399 | nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); | ||
400 | raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); | ||
401 | } | ||
402 | |||
403 | static void nwl_unmask_leg_irq(struct irq_data *data) | ||
404 | { | ||
405 | struct irq_desc *desc = irq_to_desc(data->irq); | ||
406 | struct nwl_pcie *pcie; | ||
407 | unsigned long flags; | ||
408 | u32 mask; | ||
409 | u32 val; | ||
410 | |||
411 | pcie = irq_desc_get_chip_data(desc); | ||
412 | mask = 1 << (data->hwirq - 1); | ||
413 | raw_spin_lock_irqsave(&pcie->leg_mask_lock, flags); | ||
414 | val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); | ||
415 | nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); | ||
416 | raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); | ||
417 | } | ||
418 | |||
419 | static struct irq_chip nwl_leg_irq_chip = { | ||
420 | .name = "nwl_pcie:legacy", | ||
421 | .irq_enable = nwl_unmask_leg_irq, | ||
422 | .irq_disable = nwl_mask_leg_irq, | ||
423 | .irq_mask = nwl_mask_leg_irq, | ||
424 | .irq_unmask = nwl_unmask_leg_irq, | ||
425 | }; | ||
426 | |||
386 | static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq, | 427 | static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq, |
387 | irq_hw_number_t hwirq) | 428 | irq_hw_number_t hwirq) |
388 | { | 429 | { |
389 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); | 430 | irq_set_chip_and_handler(irq, &nwl_leg_irq_chip, handle_level_irq); |
390 | irq_set_chip_data(irq, domain->host_data); | 431 | irq_set_chip_data(irq, domain->host_data); |
432 | irq_set_status_flags(irq, IRQ_LEVEL); | ||
391 | 433 | ||
392 | return 0; | 434 | return 0; |
393 | } | 435 | } |
@@ -526,6 +568,7 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie) | |||
526 | return -ENOMEM; | 568 | return -ENOMEM; |
527 | } | 569 | } |
528 | 570 | ||
571 | raw_spin_lock_init(&pcie->leg_mask_lock); | ||
529 | nwl_pcie_init_msi_irq_domain(pcie); | 572 | nwl_pcie_init_msi_irq_domain(pcie); |
530 | return 0; | 573 | return 0; |
531 | } | 574 | } |
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c index d09b00579bde..f63fa5e0278c 100644 --- a/drivers/pci/host/pcie-xilinx.c +++ b/drivers/pci/host/pcie-xilinx.c | |||
@@ -704,7 +704,7 @@ error: | |||
704 | return err; | 704 | return err; |
705 | } | 705 | } |
706 | 706 | ||
707 | static struct of_device_id xilinx_pcie_of_match[] = { | 707 | static const struct of_device_id xilinx_pcie_of_match[] = { |
708 | { .compatible = "xlnx,axi-pcie-host-1.00.a", }, | 708 | { .compatible = "xlnx,axi-pcie-host-1.00.a", }, |
709 | {} | 709 | {} |
710 | }; | 710 | }; |