pci-keystone.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Keystone PCI Controller's common includes
  3. *
  4. * Copyright (C) 2013-2014 Texas Instruments., Ltd.
  5. * http://www.ti.com
  6. *
  7. * Author: Murali Karicheri <m-karicheri2@ti.com>
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #define MAX_MSI_HOST_IRQS 8
  15. struct keystone_pcie {
  16. struct dw_pcie *pci;
  17. struct clk *clk;
  18. /* PCI Device ID */
  19. u32 device_id;
  20. int num_legacy_host_irqs;
  21. int legacy_host_irqs[PCI_NUM_INTX];
  22. struct device_node *legacy_intc_np;
  23. int num_msi_host_irqs;
  24. int msi_host_irqs[MAX_MSI_HOST_IRQS];
  25. struct device_node *msi_intc_np;
  26. struct irq_domain *legacy_irq_domain;
  27. struct device_node *np;
  28. int error_irq;
  29. /* Application register space */
  30. void __iomem *va_app_base; /* DT 1st resource */
  31. struct resource app;
  32. };
  33. /* Keystone DW specific MSI controller APIs/definitions */
  34. void ks_dw_pcie_handle_msi_irq(struct keystone_pcie *ks_pcie, int offset);
  35. phys_addr_t ks_dw_pcie_get_msi_addr(struct pcie_port *pp);
  36. /* Keystone specific PCI controller APIs */
  37. void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie);
  38. void ks_dw_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie, int offset);
  39. void ks_dw_pcie_enable_error_irq(struct keystone_pcie *ks_pcie);
  40. irqreturn_t ks_dw_pcie_handle_error_irq(struct keystone_pcie *ks_pcie);
  41. int ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
  42. struct device_node *msi_intc_np);
  43. int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
  44. unsigned int devfn, int where, int size, u32 val);
  45. int ks_dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
  46. unsigned int devfn, int where, int size, u32 *val);
  47. void ks_dw_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie);
  48. void ks_dw_pcie_initiate_link_train(struct keystone_pcie *ks_pcie);
  49. void ks_dw_pcie_msi_set_irq(struct pcie_port *pp, int irq);
  50. void ks_dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq);
  51. void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp);
  52. int ks_dw_pcie_msi_host_init(struct pcie_port *pp,
  53. struct msi_controller *chip);
  54. int ks_dw_pcie_link_up(struct dw_pcie *pci);