1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2014-2015 Broadcom Corporation
10 * enum iproc_pcie_type - iProc PCIe interface type
11 * @IPROC_PCIE_PAXB_BCMA: BCMA-based host controllers
12 * @IPROC_PCIE_PAXB: PAXB-based host controllers for
13 * NS, NSP, Cygnus, NS2, and Pegasus SOCs
14 * @IPROC_PCIE_PAXB_V2: PAXB-based host controllers for Stingray SoCs
15 * @IPROC_PCIE_PAXC: PAXC-based host controllers
16 * @IPROC_PCIE_PAXC_V2: PAXC-based host controllers (second generation)
18 * PAXB is the wrapper used in root complex that can be connected to an
19 * external endpoint device.
21 * PAXC is the wrapper used in root complex dedicated for internal emulated
24 enum iproc_pcie_type {
25 IPROC_PCIE_PAXB_BCMA = 0,
33 * struct iproc_pcie_ob - iProc PCIe outbound mapping
34 * @axi_offset: offset from the AXI address to the internal address used by
36 * @nr_windows: total number of supported outbound mapping windows
38 struct iproc_pcie_ob {
39 resource_size_t axi_offset;
40 unsigned int nr_windows;
44 * struct iproc_pcie_ib - iProc PCIe inbound mapping
45 * @nr_regions: total number of supported inbound mapping regions
47 struct iproc_pcie_ib {
48 unsigned int nr_regions;
51 struct iproc_pcie_ob_map;
52 struct iproc_pcie_ib_map;
56 * struct iproc_pcie - iProc PCIe device
57 * @dev: pointer to device data structure
58 * @type: iProc PCIe interface type
59 * @reg_offsets: register offsets
60 * @base: PCIe host controller I/O register base
61 * @base_addr: PCIe host controller register base physical address
62 * @mem: host bridge memory window resource
63 * @phy: optional PHY device that controls the Serdes
64 * @map_irq: function callback to map interrupts
65 * @ep_is_internal: indicates an internal emulated endpoint device is connected
66 * @iproc_cfg_read: indicates the iProc config read function should be used
67 * @rej_unconfig_pf: indicates the root complex needs to detect and reject
68 * enumeration against unconfigured physical functions emulated in the ASIC
69 * @has_apb_err_disable: indicates the controller can be configured to prevent
70 * unsupported request from being forwarded as an APB bus error
71 * @fix_paxc_cap: indicates the controller has corrupted capability list in its
72 * config space registers and requires SW based fixup
74 * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
75 * @ob: outbound mapping related parameters
76 * @ob_map: outbound mapping related parameters specific to the controller
78 * @need_ib_cfg: indicates SW needs to configure the inbound mapping window
79 * @ib: inbound mapping related parameters
80 * @ib_map: outbound mapping region related parameters
82 * @need_msi_steer: indicates additional configuration of the iProc PCIe
83 * controller is required to steer MSI writes to external interrupt controller
88 enum iproc_pcie_type type;
91 phys_addr_t base_addr;
94 int (*map_irq)(const struct pci_dev *, u8, u8);
98 bool has_apb_err_disable;
102 struct iproc_pcie_ob ob;
103 const struct iproc_pcie_ob_map *ob_map;
106 struct iproc_pcie_ib ib;
107 const struct iproc_pcie_ib_map *ib_map;
110 struct iproc_msi *msi;
113 int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
114 void iproc_pcie_remove(struct iproc_pcie *pcie);
115 int iproc_pcie_shutdown(struct iproc_pcie *pcie);
117 #ifdef CONFIG_PCIE_IPROC_MSI
118 int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
119 void iproc_msi_exit(struct iproc_pcie *pcie);
121 static inline int iproc_msi_init(struct iproc_pcie *pcie,
122 struct device_node *node)
126 static inline void iproc_msi_exit(struct iproc_pcie *pcie)
131 #endif /* _PCIE_IPROC_H */