pcie-designware.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Synopsys DesignWare PCIe host controller driver
  4. *
  5. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  6. * https://www.samsung.com
  7. *
  8. * Author: Jingoo Han <[email protected]>
  9. */
  10. #ifndef _PCIE_DESIGNWARE_H
  11. #define _PCIE_DESIGNWARE_H
  12. #include <linux/bitfield.h>
  13. #include <linux/dma-mapping.h>
  14. #include <linux/irq.h>
  15. #include <linux/msi.h>
  16. #include <linux/pci.h>
  17. #include <linux/pci-epc.h>
  18. #include <linux/pci-epf.h>
  19. /* DWC PCIe IP-core versions (native support since v4.70a) */
  20. #define DW_PCIE_VER_365A 0x3336352a
  21. #define DW_PCIE_VER_460A 0x3436302a
  22. #define DW_PCIE_VER_470A 0x3437302a
  23. #define DW_PCIE_VER_480A 0x3438302a
  24. #define DW_PCIE_VER_490A 0x3439302a
  25. #define DW_PCIE_VER_520A 0x3532302a
  26. #define __dw_pcie_ver_cmp(_pci, _ver, _op) \
  27. ((_pci)->version _op DW_PCIE_VER_ ## _ver)
  28. #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
  29. #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
  30. #define dw_pcie_ver_type_is(_pci, _ver, _type) \
  31. (__dw_pcie_ver_cmp(_pci, _ver, ==) && \
  32. __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
  33. #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
  34. (__dw_pcie_ver_cmp(_pci, _ver, ==) && \
  35. __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
  36. /* Parameters for the waiting for link up routine */
  37. #define LINK_WAIT_MAX_RETRIES 10
  38. #define LINK_WAIT_USLEEP_MIN 90000
  39. #define LINK_WAIT_USLEEP_MAX 100000
  40. /* Parameters for the waiting for iATU enabled routine */
  41. #define LINK_WAIT_MAX_IATU_RETRIES 5
  42. #define LINK_WAIT_IATU 9
  43. /* Synopsys-specific PCIe configuration registers */
  44. #define PCIE_PORT_AFR 0x70C
  45. #define PORT_AFR_N_FTS_MASK GENMASK(15, 8)
  46. #define PORT_AFR_N_FTS(n) FIELD_PREP(PORT_AFR_N_FTS_MASK, n)
  47. #define PORT_AFR_CC_N_FTS_MASK GENMASK(23, 16)
  48. #define PORT_AFR_CC_N_FTS(n) FIELD_PREP(PORT_AFR_CC_N_FTS_MASK, n)
  49. #define PORT_AFR_ENTER_ASPM BIT(30)
  50. #define PORT_AFR_L0S_ENTRANCE_LAT_SHIFT 24
  51. #define PORT_AFR_L0S_ENTRANCE_LAT_MASK GENMASK(26, 24)
  52. #define PORT_AFR_L1_ENTRANCE_LAT_SHIFT 27
  53. #define PORT_AFR_L1_ENTRANCE_LAT_MASK GENMASK(29, 27)
  54. #define PCIE_PORT_LINK_CONTROL 0x710
  55. #define PORT_LINK_DLL_LINK_EN BIT(5)
  56. #define PORT_LINK_FAST_LINK_MODE BIT(7)
  57. #define PORT_LINK_MODE_MASK GENMASK(21, 16)
  58. #define PORT_LINK_MODE(n) FIELD_PREP(PORT_LINK_MODE_MASK, n)
  59. #define PORT_LINK_MODE_1_LANES PORT_LINK_MODE(0x1)
  60. #define PORT_LINK_MODE_2_LANES PORT_LINK_MODE(0x3)
  61. #define PORT_LINK_MODE_4_LANES PORT_LINK_MODE(0x7)
  62. #define PORT_LINK_MODE_8_LANES PORT_LINK_MODE(0xf)
  63. #define PCIE_PORT_DEBUG0 0x728
  64. #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f
  65. #define PORT_LOGIC_LTSSM_STATE_L0 0x11
  66. #define PCIE_PORT_DEBUG1 0x72C
  67. #define PCIE_PORT_DEBUG1_LINK_UP BIT(4)
  68. #define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29)
  69. #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C
  70. #define PORT_LOGIC_N_FTS_MASK GENMASK(7, 0)
  71. #define PORT_LOGIC_SPEED_CHANGE BIT(17)
  72. #define PORT_LOGIC_LINK_WIDTH_MASK GENMASK(12, 8)
  73. #define PORT_LOGIC_LINK_WIDTH(n) FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n)
  74. #define PORT_LOGIC_LINK_WIDTH_1_LANES PORT_LOGIC_LINK_WIDTH(0x1)
  75. #define PORT_LOGIC_LINK_WIDTH_2_LANES PORT_LOGIC_LINK_WIDTH(0x2)
  76. #define PORT_LOGIC_LINK_WIDTH_4_LANES PORT_LOGIC_LINK_WIDTH(0x4)
  77. #define PORT_LOGIC_LINK_WIDTH_8_LANES PORT_LOGIC_LINK_WIDTH(0x8)
  78. #define PCIE_MSI_ADDR_LO 0x820
  79. #define PCIE_MSI_ADDR_HI 0x824
  80. #define PCIE_MSI_INTR0_ENABLE 0x828
  81. #define PCIE_MSI_INTR0_MASK 0x82C
  82. #define PCIE_MSI_INTR0_STATUS 0x830
  83. #define GEN3_RELATED_OFF 0x890
  84. #define GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL BIT(0)
  85. #define GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS BIT(13)
  86. #define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16)
  87. #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24
  88. #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24)
  89. #define PCIE_PORT_MULTI_LANE_CTRL 0x8C0
  90. #define PORT_MLTI_UPCFG_SUPPORT BIT(7)
  91. #define PCIE_VERSION_NUMBER 0x8F8
  92. #define PCIE_VERSION_TYPE 0x8FC
  93. /*
  94. * iATU inbound and outbound windows CSRs. Before the IP-core v4.80a each
  95. * iATU region CSRs had been indirectly accessible by means of the dedicated
  96. * viewport selector. The iATU/eDMA CSRs space was re-designed in DWC PCIe
  97. * v4.80a in a way so the viewport was unrolled into the directly accessible
  98. * iATU/eDMA CSRs space.
  99. */
  100. #define PCIE_ATU_VIEWPORT 0x900
  101. #define PCIE_ATU_REGION_DIR_IB BIT(31)
  102. #define PCIE_ATU_REGION_DIR_OB 0
  103. #define PCIE_ATU_VIEWPORT_BASE 0x904
  104. #define PCIE_ATU_UNROLL_BASE(dir, index) \
  105. (((index) << 9) | ((dir == PCIE_ATU_REGION_DIR_IB) ? BIT(8) : 0))
  106. #define PCIE_ATU_VIEWPORT_SIZE 0x2C
  107. #define PCIE_ATU_REGION_CTRL1 0x000
  108. #define PCIE_ATU_INCREASE_REGION_SIZE BIT(13)
  109. #define PCIE_ATU_TYPE_MEM 0x0
  110. #define PCIE_ATU_TYPE_IO 0x2
  111. #define PCIE_ATU_TYPE_CFG0 0x4
  112. #define PCIE_ATU_TYPE_CFG1 0x5
  113. #define PCIE_ATU_TD BIT(8)
  114. #define PCIE_ATU_FUNC_NUM(pf) ((pf) << 20)
  115. #define PCIE_ATU_REGION_CTRL2 0x004
  116. #define PCIE_ATU_ENABLE BIT(31)
  117. #define PCIE_ATU_BAR_MODE_ENABLE BIT(30)
  118. #define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19)
  119. #define PCIE_ATU_LOWER_BASE 0x008
  120. #define PCIE_ATU_UPPER_BASE 0x00C
  121. #define PCIE_ATU_LIMIT 0x010
  122. #define PCIE_ATU_LOWER_TARGET 0x014
  123. #define PCIE_ATU_BUS(x) FIELD_PREP(GENMASK(31, 24), x)
  124. #define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x)
  125. #define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x)
  126. #define PCIE_ATU_UPPER_TARGET 0x018
  127. #define PCIE_ATU_UPPER_LIMIT 0x020
  128. #define PCIE_MISC_CONTROL_1_OFF 0x8BC
  129. #define PCIE_DBI_RO_WR_EN BIT(0)
  130. #define PCIE_MSIX_DOORBELL 0x948
  131. #define PCIE_MSIX_DOORBELL_PF_SHIFT 24
  132. #define PCIE_PL_CHK_REG_CONTROL_STATUS 0xB20
  133. #define PCIE_PL_CHK_REG_CHK_REG_START BIT(0)
  134. #define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS BIT(1)
  135. #define PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR BIT(16)
  136. #define PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR BIT(17)
  137. #define PCIE_PL_CHK_REG_CHK_REG_COMPLETE BIT(18)
  138. #define PCIE_PL_CHK_REG_ERR_ADDR 0xB28
  139. /*
  140. * iATU Unroll-specific register definitions
  141. * From 4.80 core version the address translation will be made by unroll
  142. */
  143. #define PCIE_ATU_UNR_REGION_CTRL1 0x00
  144. #define PCIE_ATU_UNR_REGION_CTRL2 0x04
  145. #define PCIE_ATU_UNR_LOWER_BASE 0x08
  146. #define PCIE_ATU_UNR_UPPER_BASE 0x0C
  147. #define PCIE_ATU_UNR_LOWER_LIMIT 0x10
  148. #define PCIE_ATU_UNR_LOWER_TARGET 0x14
  149. #define PCIE_ATU_UNR_UPPER_TARGET 0x18
  150. #define PCIE_ATU_UNR_UPPER_LIMIT 0x20
  151. /*
  152. * RAS-DES register definitions
  153. */
  154. #define PCIE_RAS_DES_EVENT_COUNTER_CONTROL 0x8
  155. #define EVENT_COUNTER_ALL_CLEAR 0x3
  156. #define EVENT_COUNTER_ENABLE_ALL 0x7
  157. #define EVENT_COUNTER_ENABLE_SHIFT 2
  158. #define EVENT_COUNTER_EVENT_SEL_MASK GENMASK(7, 0)
  159. #define EVENT_COUNTER_EVENT_SEL_SHIFT 16
  160. #define EVENT_COUNTER_EVENT_Tx_L0S 0x2
  161. #define EVENT_COUNTER_EVENT_Rx_L0S 0x3
  162. #define EVENT_COUNTER_EVENT_L1 0x5
  163. #define EVENT_COUNTER_EVENT_L1_1 0x7
  164. #define EVENT_COUNTER_EVENT_L1_2 0x8
  165. #define EVENT_COUNTER_GROUP_SEL_SHIFT 24
  166. #define EVENT_COUNTER_GROUP_5 0x5
  167. #define PCIE_RAS_DES_EVENT_COUNTER_DATA 0xc
  168. /*
  169. * The default address offset between dbi_base and atu_base. Root controller
  170. * drivers are not required to initialize atu_base if the offset matches this
  171. * default; the driver core automatically derives atu_base from dbi_base using
  172. * this offset, if atu_base not set.
  173. */
  174. #define DEFAULT_DBI_ATU_OFFSET (0x3 << 20)
  175. #define MAX_MSI_IRQS 256
  176. #define MAX_MSI_IRQS_PER_CTRL 32
  177. #define MAX_MSI_CTRLS (MAX_MSI_IRQS / MAX_MSI_IRQS_PER_CTRL)
  178. #define MSI_REG_CTRL_BLOCK_SIZE 12
  179. #define MSI_DEF_NUM_VECTORS 32
  180. /* Maximum number of inbound/outbound iATUs */
  181. #define MAX_IATU_IN 256
  182. #define MAX_IATU_OUT 256
  183. struct dw_pcie;
  184. struct dw_pcie_rp;
  185. struct dw_pcie_ep;
  186. enum dw_pcie_device_mode {
  187. DW_PCIE_UNKNOWN_TYPE,
  188. DW_PCIE_EP_TYPE,
  189. DW_PCIE_LEG_EP_TYPE,
  190. DW_PCIE_RC_TYPE,
  191. };
  192. struct dw_pcie_host_ops {
  193. int (*host_init)(struct dw_pcie_rp *pp);
  194. void (*host_deinit)(struct dw_pcie_rp *pp);
  195. int (*msi_host_init)(struct dw_pcie_rp *pp);
  196. };
  197. struct dw_pcie_rp {
  198. bool has_msi_ctrl:1;
  199. bool cfg0_io_shared:1;
  200. u64 cfg0_base;
  201. void __iomem *va_cfg0_base;
  202. u32 cfg0_size;
  203. resource_size_t io_base;
  204. phys_addr_t io_bus_addr;
  205. u32 io_size;
  206. int irq;
  207. const struct dw_pcie_host_ops *ops;
  208. int msi_irq[MAX_MSI_CTRLS];
  209. struct irq_domain *irq_domain;
  210. struct irq_domain *msi_domain;
  211. dma_addr_t msi_data;
  212. struct irq_chip *msi_irq_chip;
  213. u32 num_vectors;
  214. u32 irq_mask[MAX_MSI_CTRLS];
  215. struct pci_host_bridge *bridge;
  216. raw_spinlock_t lock;
  217. DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
  218. };
  219. struct dw_pcie_ep_ops {
  220. void (*ep_init)(struct dw_pcie_ep *ep);
  221. int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no,
  222. enum pci_epc_irq_type type, u16 interrupt_num);
  223. const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
  224. /*
  225. * Provide a method to implement the different func config space
  226. * access for different platform, if different func have different
  227. * offset, return the offset of func. if use write a register way
  228. * return a 0, and implement code in callback function of platform
  229. * driver.
  230. */
  231. unsigned int (*func_conf_select)(struct dw_pcie_ep *ep, u8 func_no);
  232. };
  233. struct dw_pcie_ep_func {
  234. struct list_head list;
  235. u8 func_no;
  236. u8 msi_cap; /* MSI capability offset */
  237. u8 msix_cap; /* MSI-X capability offset */
  238. };
  239. struct dw_pcie_ep {
  240. struct pci_epc *epc;
  241. struct list_head func_list;
  242. const struct dw_pcie_ep_ops *ops;
  243. phys_addr_t phys_base;
  244. size_t addr_size;
  245. size_t page_size;
  246. u8 bar_to_atu[PCI_STD_NUM_BARS];
  247. phys_addr_t *outbound_addr;
  248. unsigned long *ib_window_map;
  249. unsigned long *ob_window_map;
  250. void __iomem *msi_mem;
  251. phys_addr_t msi_mem_phys;
  252. struct pci_epf_bar *epf_bar[PCI_STD_NUM_BARS];
  253. };
  254. struct dw_pcie_ops {
  255. u64 (*cpu_addr_fixup)(struct dw_pcie *pcie, u64 cpu_addr);
  256. u32 (*read_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
  257. size_t size);
  258. void (*write_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
  259. size_t size, u32 val);
  260. void (*write_dbi2)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
  261. size_t size, u32 val);
  262. int (*link_up)(struct dw_pcie *pcie);
  263. int (*start_link)(struct dw_pcie *pcie);
  264. void (*stop_link)(struct dw_pcie *pcie);
  265. };
  266. struct dw_pcie {
  267. struct device *dev;
  268. void __iomem *dbi_base;
  269. void __iomem *dbi_base2;
  270. void __iomem *atu_base;
  271. size_t atu_size;
  272. u32 num_ib_windows;
  273. u32 num_ob_windows;
  274. u32 region_align;
  275. u64 region_limit;
  276. struct dw_pcie_rp pp;
  277. struct dw_pcie_ep ep;
  278. const struct dw_pcie_ops *ops;
  279. u32 version;
  280. u32 type;
  281. int num_lanes;
  282. int link_gen;
  283. u8 n_fts[2];
  284. bool iatu_unroll_enabled: 1;
  285. };
  286. #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp)
  287. #define to_dw_pcie_from_ep(endpoint) \
  288. container_of((endpoint), struct dw_pcie, ep)
  289. void dw_pcie_version_detect(struct dw_pcie *pci);
  290. u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap);
  291. u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap);
  292. int dw_pcie_read(void __iomem *addr, int size, u32 *val);
  293. int dw_pcie_write(void __iomem *addr, int size, u32 val);
  294. u32 dw_pcie_read_dbi(struct dw_pcie *pci, u32 reg, size_t size);
  295. void dw_pcie_write_dbi(struct dw_pcie *pci, u32 reg, size_t size, u32 val);
  296. void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val);
  297. int dw_pcie_link_up(struct dw_pcie *pci);
  298. void dw_pcie_upconfig_setup(struct dw_pcie *pci);
  299. int dw_pcie_wait_for_link(struct dw_pcie *pci);
  300. int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type,
  301. u64 cpu_addr, u64 pci_addr, u64 size);
  302. int dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index,
  303. int type, u64 cpu_addr, u64 pci_addr, u64 size);
  304. int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 func_no, int index,
  305. int type, u64 cpu_addr, u8 bar);
  306. void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index);
  307. void dw_pcie_setup(struct dw_pcie *pci);
  308. void dw_pcie_iatu_detect(struct dw_pcie *pci);
  309. static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
  310. {
  311. dw_pcie_write_dbi(pci, reg, 0x4, val);
  312. }
  313. static inline u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg)
  314. {
  315. return dw_pcie_read_dbi(pci, reg, 0x4);
  316. }
  317. static inline void dw_pcie_writew_dbi(struct dw_pcie *pci, u32 reg, u16 val)
  318. {
  319. dw_pcie_write_dbi(pci, reg, 0x2, val);
  320. }
  321. static inline u16 dw_pcie_readw_dbi(struct dw_pcie *pci, u32 reg)
  322. {
  323. return dw_pcie_read_dbi(pci, reg, 0x2);
  324. }
  325. static inline void dw_pcie_writeb_dbi(struct dw_pcie *pci, u32 reg, u8 val)
  326. {
  327. dw_pcie_write_dbi(pci, reg, 0x1, val);
  328. }
  329. static inline u8 dw_pcie_readb_dbi(struct dw_pcie *pci, u32 reg)
  330. {
  331. return dw_pcie_read_dbi(pci, reg, 0x1);
  332. }
  333. static inline void dw_pcie_writel_dbi2(struct dw_pcie *pci, u32 reg, u32 val)
  334. {
  335. dw_pcie_write_dbi2(pci, reg, 0x4, val);
  336. }
  337. static inline void dw_pcie_dbi_ro_wr_en(struct dw_pcie *pci)
  338. {
  339. u32 reg;
  340. u32 val;
  341. reg = PCIE_MISC_CONTROL_1_OFF;
  342. val = dw_pcie_readl_dbi(pci, reg);
  343. val |= PCIE_DBI_RO_WR_EN;
  344. dw_pcie_writel_dbi(pci, reg, val);
  345. }
  346. static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci)
  347. {
  348. u32 reg;
  349. u32 val;
  350. reg = PCIE_MISC_CONTROL_1_OFF;
  351. val = dw_pcie_readl_dbi(pci, reg);
  352. val &= ~PCIE_DBI_RO_WR_EN;
  353. dw_pcie_writel_dbi(pci, reg, val);
  354. }
  355. static inline int dw_pcie_start_link(struct dw_pcie *pci)
  356. {
  357. if (pci->ops && pci->ops->start_link)
  358. return pci->ops->start_link(pci);
  359. return 0;
  360. }
  361. static inline void dw_pcie_stop_link(struct dw_pcie *pci)
  362. {
  363. if (pci->ops && pci->ops->stop_link)
  364. pci->ops->stop_link(pci);
  365. }
  366. #ifdef CONFIG_PCIE_DW_HOST
  367. irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp);
  368. int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
  369. int dw_pcie_host_init(struct dw_pcie_rp *pp);
  370. void dw_pcie_host_deinit(struct dw_pcie_rp *pp);
  371. int dw_pcie_allocate_domains(struct dw_pcie_rp *pp);
  372. void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
  373. int where);
  374. #else
  375. static inline irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp)
  376. {
  377. return IRQ_NONE;
  378. }
  379. static inline int dw_pcie_setup_rc(struct dw_pcie_rp *pp)
  380. {
  381. return 0;
  382. }
  383. static inline int dw_pcie_host_init(struct dw_pcie_rp *pp)
  384. {
  385. return 0;
  386. }
  387. static inline void dw_pcie_host_deinit(struct dw_pcie_rp *pp)
  388. {
  389. }
  390. static inline int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
  391. {
  392. return 0;
  393. }
  394. static inline void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus,
  395. unsigned int devfn,
  396. int where)
  397. {
  398. return NULL;
  399. }
  400. #endif
  401. #ifdef CONFIG_PCIE_DW_EP
  402. void dw_pcie_ep_linkup(struct dw_pcie_ep *ep);
  403. int dw_pcie_ep_init(struct dw_pcie_ep *ep);
  404. int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep);
  405. void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep);
  406. void dw_pcie_ep_exit(struct dw_pcie_ep *ep);
  407. int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no);
  408. int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
  409. u8 interrupt_num);
  410. int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
  411. u16 interrupt_num);
  412. int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no,
  413. u16 interrupt_num);
  414. void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar);
  415. struct dw_pcie_ep_func *
  416. dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no);
  417. #else
  418. static inline void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
  419. {
  420. }
  421. static inline int dw_pcie_ep_init(struct dw_pcie_ep *ep)
  422. {
  423. return 0;
  424. }
  425. static inline int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
  426. {
  427. return 0;
  428. }
  429. static inline void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep)
  430. {
  431. }
  432. static inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep)
  433. {
  434. }
  435. static inline int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no)
  436. {
  437. return 0;
  438. }
  439. static inline int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
  440. u8 interrupt_num)
  441. {
  442. return 0;
  443. }
  444. static inline int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
  445. u16 interrupt_num)
  446. {
  447. return 0;
  448. }
  449. static inline int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep,
  450. u8 func_no,
  451. u16 interrupt_num)
  452. {
  453. return 0;
  454. }
  455. static inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)
  456. {
  457. }
  458. static inline struct dw_pcie_ep_func *
  459. dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)
  460. {
  461. return NULL;
  462. }
  463. #endif
  464. #endif /* _PCIE_DESIGNWARE_H */