2018-01-27 02:50:27 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-09-03 07:26:19 +08:00
|
|
|
/*
|
|
|
|
* Keystone PCI Controller's common includes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2014 Texas Instruments., Ltd.
|
|
|
|
* http://www.ti.com
|
|
|
|
*
|
|
|
|
* Author: Murali Karicheri <m-karicheri2@ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MAX_MSI_HOST_IRQS 8
|
|
|
|
|
|
|
|
struct keystone_pcie {
|
2017-02-15 21:18:14 +08:00
|
|
|
struct dw_pcie *pci;
|
2014-09-03 07:26:19 +08:00
|
|
|
struct clk *clk;
|
2014-09-11 01:12:39 +08:00
|
|
|
/* PCI Device ID */
|
|
|
|
u32 device_id;
|
2014-09-03 07:26:19 +08:00
|
|
|
int num_legacy_host_irqs;
|
2017-08-16 05:27:57 +08:00
|
|
|
int legacy_host_irqs[PCI_NUM_INTX];
|
2014-09-03 07:26:19 +08:00
|
|
|
struct device_node *legacy_intc_np;
|
|
|
|
|
|
|
|
int num_msi_host_irqs;
|
|
|
|
int msi_host_irqs[MAX_MSI_HOST_IRQS];
|
|
|
|
struct device_node *msi_intc_np;
|
|
|
|
struct irq_domain *legacy_irq_domain;
|
2016-04-11 22:50:30 +08:00
|
|
|
struct device_node *np;
|
|
|
|
|
|
|
|
int error_irq;
|
2014-09-03 07:26:19 +08:00
|
|
|
|
|
|
|
/* Application register space */
|
2016-10-07 02:36:57 +08:00
|
|
|
void __iomem *va_app_base; /* DT 1st resource */
|
2014-09-03 07:26:19 +08:00
|
|
|
struct resource app;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Keystone DW specific MSI controller APIs/definitions */
|
|
|
|
void ks_dw_pcie_handle_msi_irq(struct keystone_pcie *ks_pcie, int offset);
|
2015-09-19 02:58:35 +08:00
|
|
|
phys_addr_t ks_dw_pcie_get_msi_addr(struct pcie_port *pp);
|
2014-09-03 07:26:19 +08:00
|
|
|
|
|
|
|
/* Keystone specific PCI controller APIs */
|
|
|
|
void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie);
|
|
|
|
void ks_dw_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie, int offset);
|
2016-10-07 02:36:56 +08:00
|
|
|
void ks_dw_pcie_enable_error_irq(struct keystone_pcie *ks_pcie);
|
|
|
|
irqreturn_t ks_dw_pcie_handle_error_irq(struct keystone_pcie *ks_pcie);
|
2014-09-03 07:26:19 +08:00
|
|
|
int ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
|
|
|
|
struct device_node *msi_intc_np);
|
|
|
|
int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
|
|
|
|
unsigned int devfn, int where, int size, u32 val);
|
|
|
|
int ks_dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
|
|
|
|
unsigned int devfn, int where, int size, u32 *val);
|
|
|
|
void ks_dw_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie);
|
|
|
|
void ks_dw_pcie_initiate_link_train(struct keystone_pcie *ks_pcie);
|
2018-03-06 19:54:53 +08:00
|
|
|
void ks_dw_pcie_msi_irq_ack(int i, struct pcie_port *pp);
|
2014-09-03 07:26:19 +08:00
|
|
|
void ks_dw_pcie_msi_set_irq(struct pcie_port *pp, int irq);
|
|
|
|
void ks_dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq);
|
|
|
|
void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp);
|
2018-03-06 19:54:54 +08:00
|
|
|
int ks_dw_pcie_msi_host_init(struct pcie_port *pp);
|
2017-02-15 21:18:14 +08:00
|
|
|
int ks_dw_pcie_link_up(struct dw_pcie *pci);
|