Commit dc14155d authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/irq-clean-up'

- Rename PCI_IRQ_LEGACY to PCI_IRQ_INTX to be more explicit and match spec
  terminology (Bjorn Helgaas)

- Use existing PCI_IRQ_INTX, PCI_IRQ_MSI, PCI_IRQ_MSIX in artpec6, cadence,
  designware, designware-plat, dra7xx, imx6, keembay, keystone, layerscape,
  mhi, ntb, qcom, rcar, rcar-gen4, rockchip, tegra194, uniphier, vntb; drop
  the redundant pci_epc_irq_type enum with the same values (Damien Le Moal)

- Use "intx" instead of "leg" or "legacy" when describing INTx interrupts
  in endpoint core, endpoint tests, cadence, dra7xx, designware,
  dw-rockchip, dwc core, imx6, keystone, layerscape, qcom, rcar-gen4,
  rockchip, tegra194, uniphier, xilinx-nwl (Damien Le Moal)

* pci/irq-clean-up:
  PCI: xilinx-nwl: Use INTX instead of legacy
  PCI: rockchip-host: Rename rockchip_pcie_legacy_int_handler()
  PCI: rockchip-ep: Use INTX instead of legacy
  PCI: uniphier: Use INTX instead of legacy
  PCI: tegra194: Use INTX instead of legacy
  PCI: dw-rockchip: Rename rockchip_pcie_legacy_int_handler()
  PCI: keystone: Use INTX instead of legacy
  PCI: dwc: Rename dw_pcie_ep_raise_legacy_irq()
  PCI: cadence: Use INTX instead of legacy
  PCI: dra7xx: Rename dra7xx_pcie_raise_legacy_irq()
  misc: pci_endpoint_test: Use INTX instead of LEGACY
  PCI: endpoint: Rename LEGACY to INTX in test function driver
  PCI: endpoint: Use INTX instead of legacy
  PCI: endpoint: Drop PCI_EPC_IRQ_XXX definitions
  PCI: Rename PCI_IRQ_LEGACY to PCI_IRQ_INTX
parents eb30ad41 354b2bd3
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
#define DRV_MODULE_NAME "pci-endpoint-test" #define DRV_MODULE_NAME "pci-endpoint-test"
#define IRQ_TYPE_UNDEFINED -1 #define IRQ_TYPE_UNDEFINED -1
#define IRQ_TYPE_LEGACY 0 #define IRQ_TYPE_INTX 0
#define IRQ_TYPE_MSI 1 #define IRQ_TYPE_MSI 1
#define IRQ_TYPE_MSIX 2 #define IRQ_TYPE_MSIX 2
#define PCI_ENDPOINT_TEST_MAGIC 0x0 #define PCI_ENDPOINT_TEST_MAGIC 0x0
#define PCI_ENDPOINT_TEST_COMMAND 0x4 #define PCI_ENDPOINT_TEST_COMMAND 0x4
#define COMMAND_RAISE_LEGACY_IRQ BIT(0) #define COMMAND_RAISE_INTX_IRQ BIT(0)
#define COMMAND_RAISE_MSI_IRQ BIT(1) #define COMMAND_RAISE_MSI_IRQ BIT(1)
#define COMMAND_RAISE_MSIX_IRQ BIT(2) #define COMMAND_RAISE_MSIX_IRQ BIT(2)
#define COMMAND_READ BIT(3) #define COMMAND_READ BIT(3)
...@@ -183,8 +183,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, ...@@ -183,8 +183,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
bool res = true; bool res = true;
switch (type) { switch (type) {
case IRQ_TYPE_LEGACY: case IRQ_TYPE_INTX:
irq = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY); irq = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_INTX);
if (irq < 0) if (irq < 0)
dev_err(dev, "Failed to get Legacy interrupt\n"); dev_err(dev, "Failed to get Legacy interrupt\n");
break; break;
...@@ -244,7 +244,7 @@ static bool pci_endpoint_test_request_irq(struct pci_endpoint_test *test) ...@@ -244,7 +244,7 @@ static bool pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
fail: fail:
switch (irq_type) { switch (irq_type) {
case IRQ_TYPE_LEGACY: case IRQ_TYPE_INTX:
dev_err(dev, "Failed to request IRQ %d for Legacy\n", dev_err(dev, "Failed to request IRQ %d for Legacy\n",
pci_irq_vector(pdev, i)); pci_irq_vector(pdev, i));
break; break;
...@@ -291,15 +291,15 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test, ...@@ -291,15 +291,15 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
return true; return true;
} }
static bool pci_endpoint_test_legacy_irq(struct pci_endpoint_test *test) static bool pci_endpoint_test_intx_irq(struct pci_endpoint_test *test)
{ {
u32 val; u32 val;
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
IRQ_TYPE_LEGACY); IRQ_TYPE_INTX);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 0); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 0);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
COMMAND_RAISE_LEGACY_IRQ); COMMAND_RAISE_INTX_IRQ);
val = wait_for_completion_timeout(&test->irq_raised, val = wait_for_completion_timeout(&test->irq_raised,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
if (!val) if (!val)
...@@ -385,7 +385,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, ...@@ -385,7 +385,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test,
if (use_dma) if (use_dma)
flags |= FLAG_USE_DMA; flags |= FLAG_USE_DMA;
if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n"); dev_err(dev, "Invalid IRQ type option\n");
goto err; goto err;
} }
...@@ -521,7 +521,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, ...@@ -521,7 +521,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test,
if (use_dma) if (use_dma)
flags |= FLAG_USE_DMA; flags |= FLAG_USE_DMA;
if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n"); dev_err(dev, "Invalid IRQ type option\n");
goto err; goto err;
} }
...@@ -621,7 +621,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, ...@@ -621,7 +621,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test,
if (use_dma) if (use_dma)
flags |= FLAG_USE_DMA; flags |= FLAG_USE_DMA;
if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n"); dev_err(dev, "Invalid IRQ type option\n");
goto err; goto err;
} }
...@@ -691,7 +691,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test, ...@@ -691,7 +691,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
struct pci_dev *pdev = test->pdev; struct pci_dev *pdev = test->pdev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
if (req_irq_type < IRQ_TYPE_LEGACY || req_irq_type > IRQ_TYPE_MSIX) { if (req_irq_type < IRQ_TYPE_INTX || req_irq_type > IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n"); dev_err(dev, "Invalid IRQ type option\n");
return false; return false;
} }
...@@ -737,8 +737,8 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, ...@@ -737,8 +737,8 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
goto ret; goto ret;
ret = pci_endpoint_test_bar(test, bar); ret = pci_endpoint_test_bar(test, bar);
break; break;
case PCITEST_LEGACY_IRQ: case PCITEST_INTX_IRQ:
ret = pci_endpoint_test_legacy_irq(test); ret = pci_endpoint_test_intx_irq(test);
break; break;
case PCITEST_MSI: case PCITEST_MSI:
case PCITEST_MSIX: case PCITEST_MSIX:
...@@ -801,7 +801,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, ...@@ -801,7 +801,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
test->irq_type = IRQ_TYPE_UNDEFINED; test->irq_type = IRQ_TYPE_UNDEFINED;
if (no_msi) if (no_msi)
irq_type = IRQ_TYPE_LEGACY; irq_type = IRQ_TYPE_INTX;
data = (struct pci_endpoint_test_data *)ent->driver_data; data = (struct pci_endpoint_test_data *)ent->driver_data;
if (data) { if (data) {
......
...@@ -360,8 +360,8 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, u8 intx, ...@@ -360,8 +360,8 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, u8 intx,
writel(0, ep->irq_cpu_addr + offset); writel(0, ep->irq_cpu_addr + offset);
} }
static int cdns_pcie_ep_send_legacy_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn, static int cdns_pcie_ep_send_intx_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn,
u8 intx) u8 intx)
{ {
u16 cmd; u16 cmd;
...@@ -371,7 +371,7 @@ static int cdns_pcie_ep_send_legacy_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn, ...@@ -371,7 +371,7 @@ static int cdns_pcie_ep_send_legacy_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn,
cdns_pcie_ep_assert_intx(ep, fn, intx, true); cdns_pcie_ep_assert_intx(ep, fn, intx, true);
/* /*
* The mdelay() value was taken from dra7xx_pcie_raise_legacy_irq() * The mdelay() value was taken from dra7xx_pcie_raise_intx_irq()
*/ */
mdelay(1); mdelay(1);
cdns_pcie_ep_assert_intx(ep, fn, intx, false); cdns_pcie_ep_assert_intx(ep, fn, intx, false);
...@@ -532,25 +532,24 @@ static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn, ...@@ -532,25 +532,24 @@ static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn,
} }
static int cdns_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn, static int cdns_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct cdns_pcie_ep *ep = epc_get_drvdata(epc); struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
struct cdns_pcie *pcie = &ep->pcie; struct cdns_pcie *pcie = &ep->pcie;
struct device *dev = pcie->dev; struct device *dev = pcie->dev;
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
if (vfn > 0) { if (vfn > 0) {
dev_err(dev, "Cannot raise legacy interrupts for VF\n"); dev_err(dev, "Cannot raise INTX interrupts for VF\n");
return -EINVAL; return -EINVAL;
} }
return cdns_pcie_ep_send_legacy_irq(ep, fn, vfn, 0); return cdns_pcie_ep_send_intx_irq(ep, fn, vfn, 0);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return cdns_pcie_ep_send_msi_irq(ep, fn, vfn, interrupt_num); return cdns_pcie_ep_send_msi_irq(ep, fn, vfn, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return cdns_pcie_ep_send_msix_irq(ep, fn, vfn, interrupt_num); return cdns_pcie_ep_send_msix_irq(ep, fn, vfn, interrupt_num);
default: default:
......
...@@ -347,16 +347,16 @@ struct cdns_pcie_epf { ...@@ -347,16 +347,16 @@ struct cdns_pcie_epf {
* @max_regions: maximum number of regions supported by hardware * @max_regions: maximum number of regions supported by hardware
* @ob_region_map: bitmask of mapped outbound regions * @ob_region_map: bitmask of mapped outbound regions
* @ob_addr: base addresses in the AXI bus where the outbound regions start * @ob_addr: base addresses in the AXI bus where the outbound regions start
* @irq_phys_addr: base address on the AXI bus where the MSI/legacy IRQ * @irq_phys_addr: base address on the AXI bus where the MSI/INTX IRQ
* dedicated outbound regions is mapped. * dedicated outbound regions is mapped.
* @irq_cpu_addr: base address in the CPU space where a write access triggers * @irq_cpu_addr: base address in the CPU space where a write access triggers
* the sending of a memory write (MSI) / normal message (legacy * the sending of a memory write (MSI) / normal message (INTX
* IRQ) TLP through the PCIe bus. * IRQ) TLP through the PCIe bus.
* @irq_pci_addr: used to save the current mapping of the MSI/legacy IRQ * @irq_pci_addr: used to save the current mapping of the MSI/INTX IRQ
* dedicated outbound region. * dedicated outbound region.
* @irq_pci_fn: the latest PCI function that has updated the mapping of * @irq_pci_fn: the latest PCI function that has updated the mapping of
* the MSI/legacy IRQ dedicated outbound region. * the MSI/INTX IRQ dedicated outbound region.
* @irq_pending: bitmask of asserted legacy IRQs. * @irq_pending: bitmask of asserted INTX IRQs.
* @lock: spin lock to disable interrupts while modifying PCIe controller * @lock: spin lock to disable interrupts while modifying PCIe controller
* registers fields (RMW) accessible by both remote RC and EP to * registers fields (RMW) accessible by both remote RC and EP to
* minimize time between read and write * minimize time between read and write
...@@ -374,7 +374,7 @@ struct cdns_pcie_ep { ...@@ -374,7 +374,7 @@ struct cdns_pcie_ep {
u64 irq_pci_addr; u64 irq_pci_addr;
u8 irq_pci_fn; u8 irq_pci_fn;
u8 irq_pending; u8 irq_pending;
/* protect writing to PCI_STATUS while raising legacy interrupts */ /* protect writing to PCI_STATUS while raising INTX interrupts */
spinlock_t lock; spinlock_t lock;
struct cdns_pcie_epf *epf; struct cdns_pcie_epf *epf;
unsigned int quirk_detect_quiet_flag:1; unsigned int quirk_detect_quiet_flag:1;
......
...@@ -386,7 +386,7 @@ static void dra7xx_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -386,7 +386,7 @@ static void dra7xx_pcie_ep_init(struct dw_pcie_ep *ep)
dra7xx_pcie_enable_wrapper_interrupts(dra7xx); dra7xx_pcie_enable_wrapper_interrupts(dra7xx);
} }
static void dra7xx_pcie_raise_legacy_irq(struct dra7xx_pcie *dra7xx) static void dra7xx_pcie_raise_intx_irq(struct dra7xx_pcie *dra7xx)
{ {
dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_INTX_ASSERT, 0x1); dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_INTX_ASSERT, 0x1);
mdelay(1); mdelay(1);
...@@ -404,16 +404,16 @@ static void dra7xx_pcie_raise_msi_irq(struct dra7xx_pcie *dra7xx, ...@@ -404,16 +404,16 @@ static void dra7xx_pcie_raise_msi_irq(struct dra7xx_pcie *dra7xx,
} }
static int dra7xx_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int dra7xx_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci); struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
dra7xx_pcie_raise_legacy_irq(dra7xx); dra7xx_pcie_raise_intx_irq(dra7xx);
break; break;
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
dra7xx_pcie_raise_msi_irq(dra7xx, interrupt_num); dra7xx_pcie_raise_msi_irq(dra7xx, interrupt_num);
break; break;
default: default:
......
...@@ -1058,17 +1058,16 @@ static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -1058,17 +1058,16 @@ static void imx6_pcie_ep_init(struct dw_pcie_ep *ep)
} }
static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return dw_pcie_ep_raise_legacy_irq(ep, func_no); return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
default: default:
dev_err(pci->dev, "UNKNOWN IRQ type\n"); dev_err(pci->dev, "UNKNOWN IRQ type\n");
......
...@@ -115,8 +115,7 @@ struct keystone_pcie { ...@@ -115,8 +115,7 @@ struct keystone_pcie {
struct dw_pcie *pci; struct dw_pcie *pci;
/* PCI Device ID */ /* PCI Device ID */
u32 device_id; u32 device_id;
int legacy_host_irqs[PCI_NUM_INTX]; int intx_host_irqs[PCI_NUM_INTX];
struct device_node *legacy_intc_np;
int msi_host_irq; int msi_host_irq;
int num_lanes; int num_lanes;
...@@ -124,7 +123,7 @@ struct keystone_pcie { ...@@ -124,7 +123,7 @@ struct keystone_pcie {
struct phy **phy; struct phy **phy;
struct device_link **link; struct device_link **link;
struct device_node *msi_intc_np; struct device_node *msi_intc_np;
struct irq_domain *legacy_irq_domain; struct irq_domain *intx_irq_domain;
struct device_node *np; struct device_node *np;
/* Application register space */ /* Application register space */
...@@ -252,8 +251,8 @@ static int ks_pcie_msi_host_init(struct dw_pcie_rp *pp) ...@@ -252,8 +251,8 @@ static int ks_pcie_msi_host_init(struct dw_pcie_rp *pp)
return dw_pcie_allocate_domains(pp); return dw_pcie_allocate_domains(pp);
} }
static void ks_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie, static void ks_pcie_handle_intx_irq(struct keystone_pcie *ks_pcie,
int offset) int offset)
{ {
struct dw_pcie *pci = ks_pcie->pci; struct dw_pcie *pci = ks_pcie->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
...@@ -263,7 +262,7 @@ static void ks_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie, ...@@ -263,7 +262,7 @@ static void ks_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie,
if (BIT(0) & pending) { if (BIT(0) & pending) {
dev_dbg(dev, ": irq: irq_offset %d", offset); dev_dbg(dev, ": irq: irq_offset %d", offset);
generic_handle_domain_irq(ks_pcie->legacy_irq_domain, offset); generic_handle_domain_irq(ks_pcie->intx_irq_domain, offset);
} }
/* EOI the INTx interrupt */ /* EOI the INTx interrupt */
...@@ -307,38 +306,37 @@ static irqreturn_t ks_pcie_handle_error_irq(struct keystone_pcie *ks_pcie) ...@@ -307,38 +306,37 @@ static irqreturn_t ks_pcie_handle_error_irq(struct keystone_pcie *ks_pcie)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void ks_pcie_ack_legacy_irq(struct irq_data *d) static void ks_pcie_ack_intx_irq(struct irq_data *d)
{ {
} }
static void ks_pcie_mask_legacy_irq(struct irq_data *d) static void ks_pcie_mask_intx_irq(struct irq_data *d)
{ {
} }
static void ks_pcie_unmask_legacy_irq(struct irq_data *d) static void ks_pcie_unmask_intx_irq(struct irq_data *d)
{ {
} }
static struct irq_chip ks_pcie_legacy_irq_chip = { static struct irq_chip ks_pcie_intx_irq_chip = {
.name = "Keystone-PCI-Legacy-IRQ", .name = "Keystone-PCI-INTX-IRQ",
.irq_ack = ks_pcie_ack_legacy_irq, .irq_ack = ks_pcie_ack_intx_irq,
.irq_mask = ks_pcie_mask_legacy_irq, .irq_mask = ks_pcie_mask_intx_irq,
.irq_unmask = ks_pcie_unmask_legacy_irq, .irq_unmask = ks_pcie_unmask_intx_irq,
}; };
static int ks_pcie_init_legacy_irq_map(struct irq_domain *d, static int ks_pcie_init_intx_irq_map(struct irq_domain *d,
unsigned int irq, unsigned int irq, irq_hw_number_t hw_irq)
irq_hw_number_t hw_irq)
{ {
irq_set_chip_and_handler(irq, &ks_pcie_legacy_irq_chip, irq_set_chip_and_handler(irq, &ks_pcie_intx_irq_chip,
handle_level_irq); handle_level_irq);
irq_set_chip_data(irq, d->host_data); irq_set_chip_data(irq, d->host_data);
return 0; return 0;
} }
static const struct irq_domain_ops ks_pcie_legacy_irq_domain_ops = { static const struct irq_domain_ops ks_pcie_intx_irq_domain_ops = {
.map = ks_pcie_init_legacy_irq_map, .map = ks_pcie_init_intx_irq_map,
.xlate = irq_domain_xlate_onetwocell, .xlate = irq_domain_xlate_onetwocell,
}; };
...@@ -605,22 +603,22 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc) ...@@ -605,22 +603,22 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc)
} }
/** /**
* ks_pcie_legacy_irq_handler() - Handle legacy interrupt * ks_pcie_intx_irq_handler() - Handle INTX interrupt
* @desc: Pointer to irq descriptor * @desc: Pointer to irq descriptor
* *
* Traverse through pending legacy interrupts and invoke handler for each. Also * Traverse through pending INTX interrupts and invoke handler for each. Also
* takes care of interrupt controller level mask/ack operation. * takes care of interrupt controller level mask/ack operation.
*/ */
static void ks_pcie_legacy_irq_handler(struct irq_desc *desc) static void ks_pcie_intx_irq_handler(struct irq_desc *desc)
{ {
unsigned int irq = irq_desc_get_irq(desc); unsigned int irq = irq_desc_get_irq(desc);
struct keystone_pcie *ks_pcie = irq_desc_get_handler_data(desc); struct keystone_pcie *ks_pcie = irq_desc_get_handler_data(desc);
struct dw_pcie *pci = ks_pcie->pci; struct dw_pcie *pci = ks_pcie->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
u32 irq_offset = irq - ks_pcie->legacy_host_irqs[0]; u32 irq_offset = irq - ks_pcie->intx_host_irqs[0];
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
dev_dbg(dev, ": Handling legacy irq %d\n", irq); dev_dbg(dev, ": Handling INTX irq %d\n", irq);
/* /*
* The chained irq handler installation would have replaced normal * The chained irq handler installation would have replaced normal
...@@ -628,7 +626,7 @@ static void ks_pcie_legacy_irq_handler(struct irq_desc *desc) ...@@ -628,7 +626,7 @@ static void ks_pcie_legacy_irq_handler(struct irq_desc *desc)
* ack operation. * ack operation.
*/ */
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
ks_pcie_handle_legacy_irq(ks_pcie, irq_offset); ks_pcie_handle_intx_irq(ks_pcie, irq_offset);
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }
...@@ -686,10 +684,10 @@ static int ks_pcie_config_msi_irq(struct keystone_pcie *ks_pcie) ...@@ -686,10 +684,10 @@ static int ks_pcie_config_msi_irq(struct keystone_pcie *ks_pcie)
return ret; return ret;
} }
static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie) static int ks_pcie_config_intx_irq(struct keystone_pcie *ks_pcie)
{ {
struct device *dev = ks_pcie->pci->dev; struct device *dev = ks_pcie->pci->dev;
struct irq_domain *legacy_irq_domain; struct irq_domain *intx_irq_domain;
struct device_node *np = ks_pcie->np; struct device_node *np = ks_pcie->np;
struct device_node *intc_np; struct device_node *intc_np;
int irq_count, irq, ret = 0, i; int irq_count, irq, ret = 0, i;
...@@ -697,7 +695,7 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie) ...@@ -697,7 +695,7 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie)
intc_np = of_get_child_by_name(np, "legacy-interrupt-controller"); intc_np = of_get_child_by_name(np, "legacy-interrupt-controller");
if (!intc_np) { if (!intc_np) {
/* /*
* Since legacy interrupts are modeled as edge-interrupts in * Since INTX interrupts are modeled as edge-interrupts in
* AM6, keep it disabled for now. * AM6, keep it disabled for now.
*/ */
if (ks_pcie->is_am6) if (ks_pcie->is_am6)
...@@ -719,22 +717,21 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie) ...@@ -719,22 +717,21 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie)
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
ks_pcie->legacy_host_irqs[i] = irq; ks_pcie->intx_host_irqs[i] = irq;
irq_set_chained_handler_and_data(irq, irq_set_chained_handler_and_data(irq,
ks_pcie_legacy_irq_handler, ks_pcie_intx_irq_handler,
ks_pcie); ks_pcie);
} }
legacy_irq_domain = intx_irq_domain = irq_domain_add_linear(intc_np, PCI_NUM_INTX,
irq_domain_add_linear(intc_np, PCI_NUM_INTX, &ks_pcie_intx_irq_domain_ops, NULL);
&ks_pcie_legacy_irq_domain_ops, NULL); if (!intx_irq_domain) {
if (!legacy_irq_domain) { dev_err(dev, "Failed to add irq domain for INTX irqs\n");
dev_err(dev, "Failed to add irq domain for legacy irqs\n");
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
ks_pcie->legacy_irq_domain = legacy_irq_domain; ks_pcie->intx_irq_domain = intx_irq_domain;
for (i = 0; i < PCI_NUM_INTX; i++) for (i = 0; i < PCI_NUM_INTX; i++)
ks_pcie_app_writel(ks_pcie, IRQ_ENABLE_SET(i), INTx_EN); ks_pcie_app_writel(ks_pcie, IRQ_ENABLE_SET(i), INTx_EN);
...@@ -808,7 +805,7 @@ static int __init ks_pcie_host_init(struct dw_pcie_rp *pp) ...@@ -808,7 +805,7 @@ static int __init ks_pcie_host_init(struct dw_pcie_rp *pp)
if (!ks_pcie->is_am6) if (!ks_pcie->is_am6)
pp->bridge->child_ops = &ks_child_pcie_ops; pp->bridge->child_ops = &ks_child_pcie_ops;
ret = ks_pcie_config_legacy_irq(ks_pcie); ret = ks_pcie_config_intx_irq(ks_pcie);
if (ret) if (ret)
return ret; return ret;
...@@ -881,7 +878,7 @@ static void ks_pcie_am654_ep_init(struct dw_pcie_ep *ep) ...@@ -881,7 +878,7 @@ static void ks_pcie_am654_ep_init(struct dw_pcie_ep *ep)
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, flags); dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, flags);
} }
static void ks_pcie_am654_raise_legacy_irq(struct keystone_pcie *ks_pcie) static void ks_pcie_am654_raise_intx_irq(struct keystone_pcie *ks_pcie)
{ {
struct dw_pcie *pci = ks_pcie->pci; struct dw_pcie *pci = ks_pcie->pci;
u8 int_pin; u8 int_pin;
...@@ -900,20 +897,19 @@ static void ks_pcie_am654_raise_legacy_irq(struct keystone_pcie *ks_pcie) ...@@ -900,20 +897,19 @@ static void ks_pcie_am654_raise_legacy_irq(struct keystone_pcie *ks_pcie)
} }
static int ks_pcie_am654_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int ks_pcie_am654_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
ks_pcie_am654_raise_legacy_irq(ks_pcie); ks_pcie_am654_raise_intx_irq(ks_pcie);
break; break;
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
break; break;
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num); dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
break; break;
default: default:
......
...@@ -166,16 +166,16 @@ static void ls_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -166,16 +166,16 @@ static void ls_pcie_ep_init(struct dw_pcie_ep *ep)
} }
static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return dw_pcie_ep_raise_legacy_irq(ep, func_no); return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return dw_pcie_ep_raise_msix_irq_doorbell(ep, func_no, return dw_pcie_ep_raise_msix_irq_doorbell(ep, func_no,
interrupt_num); interrupt_num);
default: default:
......
...@@ -352,15 +352,15 @@ static void artpec6_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -352,15 +352,15 @@ static void artpec6_pcie_ep_init(struct dw_pcie_ep *ep)
} }
static int artpec6_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int artpec6_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
dev_err(pci->dev, "EP cannot trigger legacy IRQs\n"); dev_err(pci->dev, "EP cannot trigger INTx IRQs\n");
return -EINVAL; return -EINVAL;
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
default: default:
dev_err(pci->dev, "UNKNOWN IRQ type\n"); dev_err(pci->dev, "UNKNOWN IRQ type\n");
......
...@@ -386,7 +386,7 @@ static int dw_pcie_ep_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no, ...@@ -386,7 +386,7 @@ static int dw_pcie_ep_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
} }
static int dw_pcie_ep_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no, static int dw_pcie_ep_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
struct dw_pcie_ep *ep = epc_get_drvdata(epc); struct dw_pcie_ep *ep = epc_get_drvdata(epc);
...@@ -439,16 +439,16 @@ static const struct pci_epc_ops epc_ops = { ...@@ -439,16 +439,16 @@ static const struct pci_epc_ops epc_ops = {
.get_features = dw_pcie_ep_get_features, .get_features = dw_pcie_ep_get_features,
}; };
int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no) int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct device *dev = pci->dev; struct device *dev = pci->dev;
dev_err(dev, "EP cannot trigger legacy IRQs\n"); dev_err(dev, "EP cannot raise INTX IRQs\n");
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL_GPL(dw_pcie_ep_raise_legacy_irq); EXPORT_SYMBOL_GPL(dw_pcie_ep_raise_intx_irq);
int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
u8 interrupt_num) u8 interrupt_num)
......
...@@ -42,17 +42,16 @@ static void dw_plat_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -42,17 +42,16 @@ static void dw_plat_pcie_ep_init(struct dw_pcie_ep *ep)
} }
static int dw_plat_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int dw_plat_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return dw_pcie_ep_raise_legacy_irq(ep, func_no); return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
default: default:
dev_err(pci->dev, "UNKNOWN IRQ type\n"); dev_err(pci->dev, "UNKNOWN IRQ type\n");
......
...@@ -335,7 +335,7 @@ struct dw_pcie_ep_ops { ...@@ -335,7 +335,7 @@ struct dw_pcie_ep_ops {
void (*init)(struct dw_pcie_ep *ep); void (*init)(struct dw_pcie_ep *ep);
void (*deinit)(struct dw_pcie_ep *ep); void (*deinit)(struct dw_pcie_ep *ep);
int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no, int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, u16 interrupt_num); unsigned int type, u16 interrupt_num);
const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep); const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
/* /*
* Provide a method to implement the different func config space * Provide a method to implement the different func config space
...@@ -673,7 +673,7 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep); ...@@ -673,7 +673,7 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep);
int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep); int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep);
void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep); void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep);
void dw_pcie_ep_exit(struct dw_pcie_ep *ep); void dw_pcie_ep_exit(struct dw_pcie_ep *ep);
int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no); int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no);
int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
u8 interrupt_num); u8 interrupt_num);
int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
...@@ -706,7 +706,7 @@ static inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep) ...@@ -706,7 +706,7 @@ static inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep)
{ {
} }
static inline int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no) static inline int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no)
{ {
return 0; return 0;
} }
......
...@@ -72,7 +72,7 @@ static void rockchip_pcie_writel_apb(struct rockchip_pcie *rockchip, ...@@ -72,7 +72,7 @@ static void rockchip_pcie_writel_apb(struct rockchip_pcie *rockchip,
writel_relaxed(val, rockchip->apb_base + reg); writel_relaxed(val, rockchip->apb_base + reg);
} }
static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc) static void rockchip_pcie_intx_handler(struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc); struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc);
...@@ -202,7 +202,7 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp) ...@@ -202,7 +202,7 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp)
if (ret < 0) if (ret < 0)
dev_err(dev, "failed to init irq domain\n"); dev_err(dev, "failed to init irq domain\n");
irq_set_chained_handler_and_data(irq, rockchip_pcie_legacy_int_handler, irq_set_chained_handler_and_data(irq, rockchip_pcie_intx_handler,
rockchip); rockchip);
/* LTSSM enable control mode */ /* LTSSM enable control mode */
......
...@@ -289,19 +289,18 @@ static void keembay_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -289,19 +289,18 @@ static void keembay_pcie_ep_init(struct dw_pcie_ep *ep)
} }
static int keembay_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int keembay_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
/* Legacy interrupts are not supported in Keem Bay */ /* INTx interrupts are not supported in Keem Bay */
dev_err(pci->dev, "Legacy IRQ is not supported\n"); dev_err(pci->dev, "INTx IRQ is not supported\n");
return -EINVAL; return -EINVAL;
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
default: default:
dev_err(pci->dev, "Unknown IRQ type %d\n", type); dev_err(pci->dev, "Unknown IRQ type %d\n", type);
......
...@@ -726,14 +726,14 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev, ...@@ -726,14 +726,14 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
} }
static int qcom_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int qcom_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return dw_pcie_ep_raise_legacy_irq(ep, func_no); return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
default: default:
dev_err(pci->dev, "Unknown IRQ type\n"); dev_err(pci->dev, "Unknown IRQ type\n");
......
...@@ -362,15 +362,14 @@ static void rcar_gen4_pcie_ep_deinit(struct dw_pcie_ep *ep) ...@@ -362,15 +362,14 @@ static void rcar_gen4_pcie_ep_deinit(struct dw_pcie_ep *ep)
} }
static int rcar_gen4_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int rcar_gen4_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *dw = to_dw_pcie_from_ep(ep); struct dw_pcie *dw = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return dw_pcie_ep_raise_legacy_irq(ep, func_no); return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num); return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
default: default:
dev_err(dw->dev, "Unknown IRQ type\n"); dev_err(dw->dev, "Unknown IRQ type\n");
......
...@@ -773,13 +773,13 @@ static void tegra_pcie_enable_system_interrupts(struct dw_pcie_rp *pp) ...@@ -773,13 +773,13 @@ static void tegra_pcie_enable_system_interrupts(struct dw_pcie_rp *pp)
val_w); val_w);
} }
static void tegra_pcie_enable_legacy_interrupts(struct dw_pcie_rp *pp) static void tegra_pcie_enable_intx_interrupts(struct dw_pcie_rp *pp)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci); struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
u32 val; u32 val;
/* Enable legacy interrupt generation */ /* Enable INTX interrupt generation */
val = appl_readl(pcie, APPL_INTR_EN_L0_0); val = appl_readl(pcie, APPL_INTR_EN_L0_0);
val |= APPL_INTR_EN_L0_0_SYS_INTR_EN; val |= APPL_INTR_EN_L0_0_SYS_INTR_EN;
val |= APPL_INTR_EN_L0_0_INT_INT_EN; val |= APPL_INTR_EN_L0_0_INT_INT_EN;
...@@ -830,7 +830,7 @@ static void tegra_pcie_enable_interrupts(struct dw_pcie_rp *pp) ...@@ -830,7 +830,7 @@ static void tegra_pcie_enable_interrupts(struct dw_pcie_rp *pp)
appl_writel(pcie, 0xFFFFFFFF, APPL_INTR_STATUS_L1_17); appl_writel(pcie, 0xFFFFFFFF, APPL_INTR_STATUS_L1_17);
tegra_pcie_enable_system_interrupts(pp); tegra_pcie_enable_system_interrupts(pp);
tegra_pcie_enable_legacy_interrupts(pp); tegra_pcie_enable_intx_interrupts(pp);
if (IS_ENABLED(CONFIG_PCI_MSI)) if (IS_ENABLED(CONFIG_PCI_MSI))
tegra_pcie_enable_msi_interrupts(pp); tegra_pcie_enable_msi_interrupts(pp);
} }
...@@ -1947,7 +1947,7 @@ static irqreturn_t tegra_pcie_ep_pex_rst_irq(int irq, void *arg) ...@@ -1947,7 +1947,7 @@ static irqreturn_t tegra_pcie_ep_pex_rst_irq(int irq, void *arg)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int tegra_pcie_ep_raise_legacy_irq(struct tegra_pcie_dw *pcie, u16 irq) static int tegra_pcie_ep_raise_intx_irq(struct tegra_pcie_dw *pcie, u16 irq)
{ {
/* Tegra194 supports only INTA */ /* Tegra194 supports only INTA */
if (irq > 1) if (irq > 1)
...@@ -1979,20 +1979,19 @@ static int tegra_pcie_ep_raise_msix_irq(struct tegra_pcie_dw *pcie, u16 irq) ...@@ -1979,20 +1979,19 @@ static int tegra_pcie_ep_raise_msix_irq(struct tegra_pcie_dw *pcie, u16 irq)
} }
static int tegra_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int tegra_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci); struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return tegra_pcie_ep_raise_legacy_irq(pcie, interrupt_num); return tegra_pcie_ep_raise_intx_irq(pcie, interrupt_num);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return tegra_pcie_ep_raise_msi_irq(pcie, interrupt_num); return tegra_pcie_ep_raise_msi_irq(pcie, interrupt_num);
case PCI_EPC_IRQ_MSIX: case PCI_IRQ_MSIX:
return tegra_pcie_ep_raise_msix_irq(pcie, interrupt_num); return tegra_pcie_ep_raise_msix_irq(pcie, interrupt_num);
default: default:
......
...@@ -212,7 +212,7 @@ static void uniphier_pcie_ep_init(struct dw_pcie_ep *ep) ...@@ -212,7 +212,7 @@ static void uniphier_pcie_ep_init(struct dw_pcie_ep *ep)
dw_pcie_ep_reset_bar(pci, bar); dw_pcie_ep_reset_bar(pci, bar);
} }
static int uniphier_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep) static int uniphier_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct uniphier_pcie_ep_priv *priv = to_uniphier_pcie(pci); struct uniphier_pcie_ep_priv *priv = to_uniphier_pcie(pci);
...@@ -256,15 +256,14 @@ static int uniphier_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, ...@@ -256,15 +256,14 @@ static int uniphier_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep,
} }
static int uniphier_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, static int uniphier_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return uniphier_pcie_ep_raise_legacy_irq(ep); return uniphier_pcie_ep_raise_intx_irq(ep);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return uniphier_pcie_ep_raise_msi_irq(ep, func_no, return uniphier_pcie_ep_raise_msi_irq(ep, func_no,
interrupt_num); interrupt_num);
default: default:
......
...@@ -67,7 +67,7 @@ struct uniphier_pcie { ...@@ -67,7 +67,7 @@ struct uniphier_pcie {
struct clk *clk; struct clk *clk;
struct reset_control *rst; struct reset_control *rst;
struct phy *phy; struct phy *phy;
struct irq_domain *legacy_irq_domain; struct irq_domain *intx_irq_domain;
}; };
#define to_uniphier_pcie(x) dev_get_drvdata((x)->dev) #define to_uniphier_pcie(x) dev_get_drvdata((x)->dev)
...@@ -253,12 +253,12 @@ static void uniphier_pcie_irq_handler(struct irq_desc *desc) ...@@ -253,12 +253,12 @@ static void uniphier_pcie_irq_handler(struct irq_desc *desc)
reg = FIELD_GET(PCL_RCV_INTX_ALL_STATUS, val); reg = FIELD_GET(PCL_RCV_INTX_ALL_STATUS, val);
for_each_set_bit(bit, &reg, PCI_NUM_INTX) for_each_set_bit(bit, &reg, 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); chained_irq_exit(chip, desc);
} }
static int uniphier_pcie_config_legacy_irq(struct dw_pcie_rp *pp) static int uniphier_pcie_config_intx_irq(struct dw_pcie_rp *pp)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct uniphier_pcie *pcie = to_uniphier_pcie(pci); struct uniphier_pcie *pcie = to_uniphier_pcie(pci);
...@@ -279,9 +279,9 @@ static int uniphier_pcie_config_legacy_irq(struct dw_pcie_rp *pp) ...@@ -279,9 +279,9 @@ static int uniphier_pcie_config_legacy_irq(struct dw_pcie_rp *pp)
goto out_put_node; goto out_put_node;
} }
pcie->legacy_irq_domain = irq_domain_add_linear(np_intc, PCI_NUM_INTX, pcie->intx_irq_domain = irq_domain_add_linear(np_intc, PCI_NUM_INTX,
&uniphier_intx_domain_ops, pp); &uniphier_intx_domain_ops, pp);
if (!pcie->legacy_irq_domain) { if (!pcie->intx_irq_domain) {
dev_err(pci->dev, "Failed to get INTx domain\n"); dev_err(pci->dev, "Failed to get INTx domain\n");
ret = -ENODEV; ret = -ENODEV;
goto out_put_node; goto out_put_node;
...@@ -301,7 +301,7 @@ static int uniphier_pcie_host_init(struct dw_pcie_rp *pp) ...@@ -301,7 +301,7 @@ static int uniphier_pcie_host_init(struct dw_pcie_rp *pp)
struct uniphier_pcie *pcie = to_uniphier_pcie(pci); struct uniphier_pcie *pcie = to_uniphier_pcie(pci);
int ret; int ret;
ret = uniphier_pcie_config_legacy_irq(pp); ret = uniphier_pcie_config_intx_irq(pp);
if (ret) if (ret)
return ret; return ret;
......
...@@ -402,16 +402,15 @@ static int rcar_pcie_ep_assert_msi(struct rcar_pcie *pcie, ...@@ -402,16 +402,15 @@ static int rcar_pcie_ep_assert_msi(struct rcar_pcie *pcie,
} }
static int rcar_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn, static int rcar_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct rcar_pcie_endpoint *ep = epc_get_drvdata(epc); struct rcar_pcie_endpoint *ep = epc_get_drvdata(epc);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return rcar_pcie_ep_assert_intx(ep, fn, 0); return rcar_pcie_ep_assert_intx(ep, fn, 0);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return rcar_pcie_ep_assert_msi(&ep->pcie, fn, interrupt_num); return rcar_pcie_ep_assert_msi(&ep->pcie, fn, interrupt_num);
default: default:
......
...@@ -26,16 +26,16 @@ ...@@ -26,16 +26,16 @@
* @max_regions: maximum number of regions supported by hardware * @max_regions: maximum number of regions supported by hardware
* @ob_region_map: bitmask of mapped outbound regions * @ob_region_map: bitmask of mapped outbound regions
* @ob_addr: base addresses in the AXI bus where the outbound regions start * @ob_addr: base addresses in the AXI bus where the outbound regions start
* @irq_phys_addr: base address on the AXI bus where the MSI/legacy IRQ * @irq_phys_addr: base address on the AXI bus where the MSI/INTX IRQ
* dedicated outbound regions is mapped. * dedicated outbound regions is mapped.
* @irq_cpu_addr: base address in the CPU space where a write access triggers * @irq_cpu_addr: base address in the CPU space where a write access triggers
* the sending of a memory write (MSI) / normal message (legacy * the sending of a memory write (MSI) / normal message (INTX
* IRQ) TLP through the PCIe bus. * IRQ) TLP through the PCIe bus.
* @irq_pci_addr: used to save the current mapping of the MSI/legacy IRQ * @irq_pci_addr: used to save the current mapping of the MSI/INTX IRQ
* dedicated outbound region. * dedicated outbound region.
* @irq_pci_fn: the latest PCI function that has updated the mapping of * @irq_pci_fn: the latest PCI function that has updated the mapping of
* the MSI/legacy IRQ dedicated outbound region. * the MSI/INTX IRQ dedicated outbound region.
* @irq_pending: bitmask of asserted legacy IRQs. * @irq_pending: bitmask of asserted INTX IRQs.
*/ */
struct rockchip_pcie_ep { struct rockchip_pcie_ep {
struct rockchip_pcie rockchip; struct rockchip_pcie rockchip;
...@@ -325,8 +325,8 @@ static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn, ...@@ -325,8 +325,8 @@ static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn,
} }
} }
static int rockchip_pcie_ep_send_legacy_irq(struct rockchip_pcie_ep *ep, u8 fn, static int rockchip_pcie_ep_send_intx_irq(struct rockchip_pcie_ep *ep, u8 fn,
u8 intx) u8 intx)
{ {
u16 cmd; u16 cmd;
...@@ -407,15 +407,14 @@ static int rockchip_pcie_ep_send_msi_irq(struct rockchip_pcie_ep *ep, u8 fn, ...@@ -407,15 +407,14 @@ static int rockchip_pcie_ep_send_msi_irq(struct rockchip_pcie_ep *ep, u8 fn,
} }
static int rockchip_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn, static int rockchip_pcie_ep_raise_irq(struct pci_epc *epc, u8 fn, u8 vfn,
enum pci_epc_irq_type type, unsigned int type, u16 interrupt_num)
u16 interrupt_num)
{ {
struct rockchip_pcie_ep *ep = epc_get_drvdata(epc); struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
switch (type) { switch (type) {
case PCI_EPC_IRQ_LEGACY: case PCI_IRQ_INTX:
return rockchip_pcie_ep_send_legacy_irq(ep, fn, 0); return rockchip_pcie_ep_send_intx_irq(ep, fn, 0);
case PCI_EPC_IRQ_MSI: case PCI_IRQ_MSI:
return rockchip_pcie_ep_send_msi_irq(ep, fn, interrupt_num); return rockchip_pcie_ep_send_msi_irq(ep, fn, interrupt_num);
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -505,7 +505,7 @@ static irqreturn_t rockchip_pcie_client_irq_handler(int irq, void *arg) ...@@ -505,7 +505,7 @@ static irqreturn_t rockchip_pcie_client_irq_handler(int irq, void *arg)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc) static void rockchip_pcie_intx_handler(struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc); struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc);
...@@ -553,7 +553,7 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip) ...@@ -553,7 +553,7 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
return irq; return irq;
irq_set_chained_handler_and_data(irq, irq_set_chained_handler_and_data(irq,
rockchip_pcie_legacy_int_handler, rockchip_pcie_intx_handler,
rockchip); rockchip);
irq = platform_get_irq_byname(pdev, "client"); irq = platform_get_irq_byname(pdev, "client");
......
...@@ -166,7 +166,7 @@ struct nwl_pcie { ...@@ -166,7 +166,7 @@ struct nwl_pcie {
int irq_intx; int irq_intx;
int irq_misc; int irq_misc;
struct nwl_msi msi; struct nwl_msi msi;
struct irq_domain *legacy_irq_domain; struct irq_domain *intx_irq_domain;
struct clk *clk; struct clk *clk;
raw_spinlock_t leg_mask_lock; raw_spinlock_t leg_mask_lock;
}; };
...@@ -324,7 +324,7 @@ static void nwl_pcie_leg_handler(struct irq_desc *desc) ...@@ -324,7 +324,7 @@ static void nwl_pcie_leg_handler(struct irq_desc *desc)
while ((status = nwl_bridge_readl(pcie, MSGF_LEG_STATUS) & while ((status = nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
MSGF_LEG_SR_MASKALL) != 0) { MSGF_LEG_SR_MASKALL) != 0) {
for_each_set_bit(bit, &status, PCI_NUM_INTX) 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); chained_irq_exit(chip, desc);
...@@ -364,7 +364,7 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc) ...@@ -364,7 +364,7 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc)
chained_irq_exit(chip, 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); struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
unsigned long flags; unsigned long flags;
...@@ -378,7 +378,7 @@ static void nwl_mask_leg_irq(struct irq_data *data) ...@@ -378,7 +378,7 @@ static void nwl_mask_leg_irq(struct irq_data *data)
raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); 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); struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
unsigned long flags; unsigned long flags;
...@@ -392,26 +392,26 @@ static void nwl_unmask_leg_irq(struct irq_data *data) ...@@ -392,26 +392,26 @@ static void nwl_unmask_leg_irq(struct irq_data *data)
raw_spin_unlock_irqrestore(&pcie->leg_mask_lock, flags); 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", .name = "nwl_pcie:legacy",
.irq_enable = nwl_unmask_leg_irq, .irq_enable = nwl_unmask_intx_irq,
.irq_disable = nwl_mask_leg_irq, .irq_disable = nwl_mask_intx_irq,
.irq_mask = nwl_mask_leg_irq, .irq_mask = nwl_mask_intx_irq,
.irq_unmask = nwl_unmask_leg_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_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_chip_data(irq, domain->host_data);
irq_set_status_flags(irq, IRQ_LEVEL); irq_set_status_flags(irq, IRQ_LEVEL);
return 0; return 0;
} }
static const struct irq_domain_ops legacy_domain_ops = { static const struct irq_domain_ops intx_domain_ops = {
.map = nwl_legacy_map, .map = nwl_intx_map,
.xlate = pci_irqd_intx_xlate, .xlate = pci_irqd_intx_xlate,
}; };
...@@ -525,20 +525,20 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie) ...@@ -525,20 +525,20 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
{ {
struct device *dev = pcie->dev; struct device *dev = pcie->dev;
struct device_node *node = dev->of_node; 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); intc_node = of_get_next_child(node, NULL);
if (!legacy_intc_node) { if (!intc_node) {
dev_err(dev, "No legacy intc node found\n"); dev_err(dev, "No legacy intc node found\n");
return -EINVAL; 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, PCI_NUM_INTX,
&legacy_domain_ops, &intx_domain_ops,
pcie); pcie);
of_node_put(legacy_intc_node); of_node_put(intc_node);
if (!pcie->legacy_irq_domain) { if (!pcie->intx_irq_domain) {
dev_err(dev, "failed to create IRQ domain\n"); dev_err(dev, "failed to create IRQ domain\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -710,14 +710,14 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie) ...@@ -710,14 +710,14 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
/* Enable all misc interrupts */ /* Enable all misc interrupts */
nwl_bridge_writel(pcie, MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK); 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); 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) & nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
MSGF_LEG_SR_MASKALL, 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); nwl_bridge_writel(pcie, MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
/* Enable the bridge config interrupt */ /* Enable the bridge config interrupt */
......
...@@ -205,7 +205,7 @@ static void pci_epf_mhi_raise_irq(struct mhi_ep_cntrl *mhi_cntrl, u32 vector) ...@@ -205,7 +205,7 @@ static void pci_epf_mhi_raise_irq(struct mhi_ep_cntrl *mhi_cntrl, u32 vector)
* MHI supplies 0 based MSI vectors but the API expects the vector * MHI supplies 0 based MSI vectors but the API expects the vector
* number to start from 1, so we need to increment the vector by 1. * number to start from 1, so we need to increment the vector by 1.
*/ */
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no, PCI_EPC_IRQ_MSI, pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no, PCI_IRQ_MSI,
vector + 1); vector + 1);
} }
......
...@@ -140,9 +140,9 @@ static struct pci_epf_header epf_ntb_header = { ...@@ -140,9 +140,9 @@ static struct pci_epf_header epf_ntb_header = {
static int epf_ntb_link_up(struct epf_ntb *ntb, bool link_up) static int epf_ntb_link_up(struct epf_ntb *ntb, bool link_up)
{ {
enum pci_epc_interface_type type; enum pci_epc_interface_type type;
enum pci_epc_irq_type irq_type;
struct epf_ntb_epc *ntb_epc; struct epf_ntb_epc *ntb_epc;
struct epf_ntb_ctrl *ctrl; struct epf_ntb_ctrl *ctrl;
unsigned int irq_type;
struct pci_epc *epc; struct pci_epc *epc;
u8 func_no, vfunc_no; u8 func_no, vfunc_no;
bool is_msix; bool is_msix;
...@@ -159,7 +159,7 @@ static int epf_ntb_link_up(struct epf_ntb *ntb, bool link_up) ...@@ -159,7 +159,7 @@ static int epf_ntb_link_up(struct epf_ntb *ntb, bool link_up)
ctrl->link_status |= LINK_STATUS_UP; ctrl->link_status |= LINK_STATUS_UP;
else else
ctrl->link_status &= ~LINK_STATUS_UP; ctrl->link_status &= ~LINK_STATUS_UP;
irq_type = is_msix ? PCI_EPC_IRQ_MSIX : PCI_EPC_IRQ_MSI; irq_type = is_msix ? PCI_IRQ_MSIX : PCI_IRQ_MSI;
ret = pci_epc_raise_irq(epc, func_no, vfunc_no, irq_type, 1); ret = pci_epc_raise_irq(epc, func_no, vfunc_no, irq_type, 1);
if (ret) { if (ret) {
dev_err(&epc->dev, dev_err(&epc->dev,
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#include <linux/pci-epf.h> #include <linux/pci-epf.h>
#include <linux/pci_regs.h> #include <linux/pci_regs.h>
#define IRQ_TYPE_LEGACY 0 #define IRQ_TYPE_INTX 0
#define IRQ_TYPE_MSI 1 #define IRQ_TYPE_MSI 1
#define IRQ_TYPE_MSIX 2 #define IRQ_TYPE_MSIX 2
#define COMMAND_RAISE_LEGACY_IRQ BIT(0) #define COMMAND_RAISE_INTX_IRQ BIT(0)
#define COMMAND_RAISE_MSI_IRQ BIT(1) #define COMMAND_RAISE_MSI_IRQ BIT(1)
#define COMMAND_RAISE_MSIX_IRQ BIT(2) #define COMMAND_RAISE_MSIX_IRQ BIT(2)
#define COMMAND_READ BIT(3) #define COMMAND_READ BIT(3)
...@@ -600,9 +600,9 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test, ...@@ -600,9 +600,9 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test,
WRITE_ONCE(reg->status, status); WRITE_ONCE(reg->status, status);
switch (reg->irq_type) { switch (reg->irq_type) {
case IRQ_TYPE_LEGACY: case IRQ_TYPE_INTX:
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no, pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
PCI_EPC_IRQ_LEGACY, 0); PCI_IRQ_INTX, 0);
break; break;
case IRQ_TYPE_MSI: case IRQ_TYPE_MSI:
count = pci_epc_get_msi(epc, epf->func_no, epf->vfunc_no); count = pci_epc_get_msi(epc, epf->func_no, epf->vfunc_no);
...@@ -612,7 +612,7 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test, ...@@ -612,7 +612,7 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test,
return; return;
} }
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no, pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
PCI_EPC_IRQ_MSI, reg->irq_number); PCI_IRQ_MSI, reg->irq_number);
break; break;
case IRQ_TYPE_MSIX: case IRQ_TYPE_MSIX:
count = pci_epc_get_msix(epc, epf->func_no, epf->vfunc_no); count = pci_epc_get_msix(epc, epf->func_no, epf->vfunc_no);
...@@ -622,7 +622,7 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test, ...@@ -622,7 +622,7 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test,
return; return;
} }
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no, pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
PCI_EPC_IRQ_MSIX, reg->irq_number); PCI_IRQ_MSIX, reg->irq_number);
break; break;
default: default:
dev_err(dev, "Failed to raise IRQ, unknown type\n"); dev_err(dev, "Failed to raise IRQ, unknown type\n");
...@@ -659,7 +659,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) ...@@ -659,7 +659,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work)
} }
switch (command) { switch (command) {
case COMMAND_RAISE_LEGACY_IRQ: case COMMAND_RAISE_INTX_IRQ:
case COMMAND_RAISE_MSI_IRQ: case COMMAND_RAISE_MSI_IRQ:
case COMMAND_RAISE_MSIX_IRQ: case COMMAND_RAISE_MSIX_IRQ:
pci_epf_test_raise_irq(epf_test, reg); pci_epf_test_raise_irq(epf_test, reg);
......
...@@ -1172,11 +1172,8 @@ static int vntb_epf_peer_db_set(struct ntb_dev *ndev, u64 db_bits) ...@@ -1172,11 +1172,8 @@ static int vntb_epf_peer_db_set(struct ntb_dev *ndev, u64 db_bits)
func_no = ntb->epf->func_no; func_no = ntb->epf->func_no;
vfunc_no = ntb->epf->vfunc_no; vfunc_no = ntb->epf->vfunc_no;
ret = pci_epc_raise_irq(ntb->epf->epc, ret = pci_epc_raise_irq(ntb->epf->epc, func_no, vfunc_no,
func_no, PCI_IRQ_MSI, interrupt_num + 1);
vfunc_no,
PCI_EPC_IRQ_MSI,
interrupt_num + 1);
if (ret) if (ret)
dev_err(&ntb->ntb.dev, "Failed to raise IRQ\n"); dev_err(&ntb->ntb.dev, "Failed to raise IRQ\n");
......
...@@ -211,13 +211,13 @@ EXPORT_SYMBOL_GPL(pci_epc_start); ...@@ -211,13 +211,13 @@ EXPORT_SYMBOL_GPL(pci_epc_start);
* @epc: the EPC device which has to interrupt the host * @epc: the EPC device which has to interrupt the host
* @func_no: the physical endpoint function number in the EPC device * @func_no: the physical endpoint function number in the EPC device
* @vfunc_no: the virtual endpoint function number in the physical function * @vfunc_no: the virtual endpoint function number in the physical function
* @type: specify the type of interrupt; legacy, MSI or MSI-X * @type: specify the type of interrupt; INTX, MSI or MSI-X
* @interrupt_num: the MSI or MSI-X interrupt number with range (1-N) * @interrupt_num: the MSI or MSI-X interrupt number with range (1-N)
* *
* Invoke to raise an legacy, MSI or MSI-X interrupt * Invoke to raise an INTX, MSI or MSI-X interrupt
*/ */
int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no, int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
enum pci_epc_irq_type type, u16 interrupt_num) unsigned int type, u16 interrupt_num)
{ {
int ret; int ret;
......
...@@ -19,13 +19,6 @@ enum pci_epc_interface_type { ...@@ -19,13 +19,6 @@ enum pci_epc_interface_type {
SECONDARY_INTERFACE, SECONDARY_INTERFACE,
}; };
enum pci_epc_irq_type {
PCI_EPC_IRQ_UNKNOWN,
PCI_EPC_IRQ_LEGACY,
PCI_EPC_IRQ_MSI,
PCI_EPC_IRQ_MSIX,
};
static inline const char * static inline const char *
pci_epc_interface_string(enum pci_epc_interface_type type) pci_epc_interface_string(enum pci_epc_interface_type type)
{ {
...@@ -79,7 +72,7 @@ struct pci_epc_ops { ...@@ -79,7 +72,7 @@ struct pci_epc_ops {
u16 interrupts, enum pci_barno, u32 offset); u16 interrupts, enum pci_barno, u32 offset);
int (*get_msix)(struct pci_epc *epc, u8 func_no, u8 vfunc_no); int (*get_msix)(struct pci_epc *epc, u8 func_no, u8 vfunc_no);
int (*raise_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, int (*raise_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
enum pci_epc_irq_type type, u16 interrupt_num); unsigned int type, u16 interrupt_num);
int (*map_msi_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, int (*map_msi_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t phys_addr, u8 interrupt_num, phys_addr_t phys_addr, u8 interrupt_num,
u32 entry_size, u32 *msi_data, u32 entry_size, u32 *msi_data,
...@@ -229,7 +222,7 @@ int pci_epc_map_msi_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no, ...@@ -229,7 +222,7 @@ int pci_epc_map_msi_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t phys_addr, u8 interrupt_num, phys_addr_t phys_addr, u8 interrupt_num,
u32 entry_size, u32 *msi_data, u32 *msi_addr_offset); u32 entry_size, u32 *msi_data, u32 *msi_addr_offset);
int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no, int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
enum pci_epc_irq_type type, u16 interrupt_num); unsigned int type, u16 interrupt_num);
int pci_epc_start(struct pci_epc *epc); int pci_epc_start(struct pci_epc *epc);
void pci_epc_stop(struct pci_epc *epc); void pci_epc_stop(struct pci_epc *epc);
const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc,
......
...@@ -1073,11 +1073,13 @@ enum { ...@@ -1073,11 +1073,13 @@ enum {
PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* Scan all, not just dev 0 */ PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* Scan all, not just dev 0 */
}; };
#define PCI_IRQ_LEGACY (1 << 0) /* Allow legacy interrupts */ #define PCI_IRQ_INTX (1 << 0) /* Allow INTx interrupts */
#define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */ #define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */
#define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */ #define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */
#define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */ #define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */
#define PCI_IRQ_LEGACY PCI_IRQ_INTX /* Deprecated! Use PCI_IRQ_INTX */
/* These external functions are only available when PCI support is enabled */ /* These external functions are only available when PCI support is enabled */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#define __UAPI_LINUX_PCITEST_H #define __UAPI_LINUX_PCITEST_H
#define PCITEST_BAR _IO('P', 0x1) #define PCITEST_BAR _IO('P', 0x1)
#define PCITEST_LEGACY_IRQ _IO('P', 0x2) #define PCITEST_INTX_IRQ _IO('P', 0x2)
#define PCITEST_LEGACY_IRQ PCITEST_INTX_IRQ
#define PCITEST_MSI _IOW('P', 0x3, int) #define PCITEST_MSI _IOW('P', 0x3, int)
#define PCITEST_WRITE _IOW('P', 0x4, unsigned long) #define PCITEST_WRITE _IOW('P', 0x4, unsigned long)
#define PCITEST_READ _IOW('P', 0x5, unsigned long) #define PCITEST_READ _IOW('P', 0x5, unsigned long)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment