pci-keystone.h revision 1104528bc769bef26f837097459e1a6e4dae240c
10c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri/* 20c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * Keystone PCI Controller's common includes 30c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * 40c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * Copyright (C) 2013-2014 Texas Instruments., Ltd. 50c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * http://www.ti.com 60c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * 70c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * Author: Murali Karicheri <m-karicheri2@ti.com> 80c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * 90c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * 100c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * This program is free software; you can redistribute it and/or modify 110c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * it under the terms of the GNU General Public License version 2 as 120c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri * published by the Free Software Foundation. 130c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri */ 140c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 150c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri#define MAX_LEGACY_IRQS 4 160c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri#define MAX_MSI_HOST_IRQS 8 170c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri#define MAX_LEGACY_HOST_IRQS 4 180c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 190c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheristruct keystone_pcie { 200c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct clk *clk; 210c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct pcie_port pp; 228665a482dbb5dd4cba44f46e3099e783a3695027Murali Karicheri /* PCI Device ID */ 238665a482dbb5dd4cba44f46e3099e783a3695027Murali Karicheri u32 device_id; 240c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri int num_legacy_host_irqs; 250c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri int legacy_host_irqs[MAX_LEGACY_HOST_IRQS]; 260c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct device_node *legacy_intc_np; 270c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 280c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri int num_msi_host_irqs; 290c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri int msi_host_irqs[MAX_MSI_HOST_IRQS]; 300c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct device_node *msi_intc_np; 310c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct irq_domain *legacy_irq_domain; 320c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 330c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri /* Application register space */ 340c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri void __iomem *va_app_base; 350c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct resource app; 360c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri}; 370c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 380c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri/* Keystone DW specific MSI controller APIs/definitions */ 390c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_handle_msi_irq(struct keystone_pcie *ks_pcie, int offset); 401104528bc769bef26f837097459e1a6e4dae240cBjorn Helgaasu32 ks_dw_pcie_get_msi_addr(struct pcie_port *pp); 410c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri 420c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri/* Keystone specific PCI controller APIs */ 430c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie); 440c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie, int offset); 450c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheriint ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie, 460c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct device_node *msi_intc_np); 470c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheriint ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, 480c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri unsigned int devfn, int where, int size, u32 val); 490c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheriint ks_dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, 500c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri unsigned int devfn, int where, int size, u32 *val); 510c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie); 520c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheriint ks_dw_pcie_link_up(struct pcie_port *pp); 530c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_initiate_link_train(struct keystone_pcie *ks_pcie); 540c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_msi_set_irq(struct pcie_port *pp, int irq); 550c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq); 560c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicherivoid ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp); 570c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheriint ks_dw_pcie_msi_host_init(struct pcie_port *pp, 580c4ffcfe1fbc1ef564ec137eab21137cb013b00eMurali Karicheri struct msi_chip *chip); 59