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 <jg1.han@samsung.com> 9 */ 10 11 #ifndef _PCIE_DESIGNWARE_H 12 #define _PCIE_DESIGNWARE_H 13 14 #include <linux/bitfield.h> 15 #include <linux/bitops.h> 16 #include <linux/clk.h> 17 #include <linux/dma-mapping.h> 18 #include <linux/dma/edma.h> 19 #include <linux/gpio/consumer.h> 20 #include <linux/irq.h> 21 #include <linux/msi.h> 22 #include <linux/pci.h> 23 #include <linux/pci-ecam.h> 24 #include <linux/reset.h> 25 26 #include <linux/pci-epc.h> 27 #include <linux/pci-epf.h> 28 29 #include "../../pci.h" 30 31 /* DWC PCIe IP-core versions (native support since v4.70a) */ 32 #define DW_PCIE_VER_365A 0x3336352a 33 #define DW_PCIE_VER_460A 0x3436302a 34 #define DW_PCIE_VER_470A 0x3437302a 35 #define DW_PCIE_VER_480A 0x3438302a 36 #define DW_PCIE_VER_490A 0x3439302a 37 #define DW_PCIE_VER_500A 0x3530302a 38 #define DW_PCIE_VER_510A 0x3531302a 39 #define DW_PCIE_VER_520A 0x3532302a 40 #define DW_PCIE_VER_540A 0x3534302a 41 #define DW_PCIE_VER_562A 0x3536322a 42 43 #define __dw_pcie_ver_cmp(_pci, _ver, _op) \ 44 ((_pci)->version _op DW_PCIE_VER_ ## _ver) 45 46 #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==) 47 48 #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=) 49 50 #define dw_pcie_ver_type_is(_pci, _ver, _type) \ 51 (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ 52 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==)) 53 54 #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \ 55 (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ 56 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=)) 57 58 /* DWC PCIe controller capabilities */ 59 #define DW_PCIE_CAP_REQ_RES 0 60 #define DW_PCIE_CAP_IATU_UNROLL 1 61 #define DW_PCIE_CAP_CDM_CHECK 2 62 63 #define dw_pcie_cap_is(_pci, _cap) \ 64 test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) 65 66 #define dw_pcie_cap_set(_pci, _cap) \ 67 set_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) 68 69 /* Parameters for the waiting for iATU enabled routine */ 70 #define LINK_WAIT_MAX_IATU_RETRIES 5 71 #define LINK_WAIT_IATU 9 72 73 /* Synopsys-specific PCIe configuration registers */ 74 #define PCIE_PORT_FORCE 0x708 75 /* Bit[7:0] LINK_NUM: Link Number. Not used for endpoint */ 76 #define PORT_LINK_NUM_MASK GENMASK(7, 0) 77 #define PORT_FORCE_DO_DESKEW_FOR_SRIS BIT(23) 78 79 #define PCIE_PORT_AFR 0x70C 80 #define PORT_AFR_N_FTS_MASK GENMASK(15, 8) 81 #define PORT_AFR_N_FTS(n) FIELD_PREP(PORT_AFR_N_FTS_MASK, n) 82 #define PORT_AFR_CC_N_FTS_MASK GENMASK(23, 16) 83 #define PORT_AFR_CC_N_FTS(n) FIELD_PREP(PORT_AFR_CC_N_FTS_MASK, n) 84 #define PORT_AFR_ENTER_ASPM BIT(30) 85 #define PORT_AFR_L0S_ENTRANCE_LAT_SHIFT 24 86 #define PORT_AFR_L0S_ENTRANCE_LAT_MASK GENMASK(26, 24) 87 #define PORT_AFR_L1_ENTRANCE_LAT_SHIFT 27 88 #define PORT_AFR_L1_ENTRANCE_LAT_MASK GENMASK(29, 27) 89 90 #define PCIE_PORT_LINK_CONTROL 0x710 91 #define PORT_LINK_DLL_LINK_EN BIT(5) 92 #define PORT_LINK_FAST_LINK_MODE BIT(7) 93 #define PORT_LINK_MODE_MASK GENMASK(21, 16) 94 #define PORT_LINK_MODE(n) FIELD_PREP(PORT_LINK_MODE_MASK, n) 95 #define PORT_LINK_MODE_1_LANES PORT_LINK_MODE(0x1) 96 #define PORT_LINK_MODE_2_LANES PORT_LINK_MODE(0x3) 97 #define PORT_LINK_MODE_4_LANES PORT_LINK_MODE(0x7) 98 #define PORT_LINK_MODE_8_LANES PORT_LINK_MODE(0xf) 99 #define PORT_LINK_MODE_16_LANES PORT_LINK_MODE(0x1f) 100 101 #define PCIE_PORT_LANE_SKEW 0x714 102 #define PORT_LANE_SKEW_INSERT_MASK GENMASK(23, 0) 103 104 /* 105 * PCIE_TIMER_CTRL_MAX_FUNC_NUM: Timer Control and Max Function Number 106 * Register. 107 * 108 * This register holds the ack frequency, latency, replay, fast link 109 * scaling timers, and max function number values. 110 * 111 * Bit[30:29] FAST_LINK_SCALING_FACTOR: Fast Link Timer Scaling Factor. 112 * 0x0 (SF_1024): Scaling Factor is 1024 (1ms is 1us). 113 * When the LTSSM is in Config or L12 Entry State, 1ms 114 * timer is 2us, 2ms timer is 4us and 3ms timer is 6us. 115 * 0x1 (SF_256): Scaling Factor is 256 (1ms is 4us) 116 * 0x2 (SF_64): Scaling Factor is 64 (1ms is 16us) 117 * 0x3 (SF_16): Scaling Factor is 16 (1ms is 64us) 118 */ 119 #define PCIE_TIMER_CTRL_MAX_FUNC_NUM 0x718 120 #define PORT_FLT_SF_MASK GENMASK(30, 29) 121 #define PORT_FLT_SF_VAL_1024 0x0 122 #define PORT_FLT_SF_VAL_256 0x1 123 #define PORT_FLT_SF_VAL_64 0x2 124 #define PORT_FLT_SF_VAL_16 0x3 125 126 #define PCIE_PORT_DEBUG0 0x728 127 #define PORT_LOGIC_LTSSM_STATE_MASK 0x3f 128 #define PORT_LOGIC_LTSSM_STATE_L0 0x11 129 #define PCIE_PORT_DEBUG1 0x72C 130 #define PCIE_PORT_DEBUG1_LINK_UP BIT(4) 131 #define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29) 132 133 #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C 134 #define PORT_LOGIC_N_FTS_MASK GENMASK(7, 0) 135 #define PORT_LOGIC_SPEED_CHANGE BIT(17) 136 #define PORT_LOGIC_LINK_WIDTH_MASK GENMASK(12, 8) 137 #define PORT_LOGIC_LINK_WIDTH(n) FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n) 138 #define PORT_LOGIC_LINK_WIDTH_1_LANES PORT_LOGIC_LINK_WIDTH(0x1) 139 #define PORT_LOGIC_LINK_WIDTH_2_LANES PORT_LOGIC_LINK_WIDTH(0x2) 140 #define PORT_LOGIC_LINK_WIDTH_4_LANES PORT_LOGIC_LINK_WIDTH(0x4) 141 #define PORT_LOGIC_LINK_WIDTH_8_LANES PORT_LOGIC_LINK_WIDTH(0x8) 142 143 #define PCIE_MSI_ADDR_LO 0x820 144 #define PCIE_MSI_ADDR_HI 0x824 145 #define PCIE_MSI_INTR0_ENABLE 0x828 146 #define PCIE_MSI_INTR0_MASK 0x82C 147 #define PCIE_MSI_INTR0_STATUS 0x830 148 149 #define GEN3_RELATED_OFF 0x890 150 #define GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL BIT(0) 151 #define GEN3_RELATED_OFF_EQ_PHASE_2_3 BIT(9) 152 #define GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS BIT(13) 153 #define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16) 154 #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24 155 #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24) 156 157 #define GEN3_EQ_CONTROL_OFF 0x8A8 158 #define GEN3_EQ_CONTROL_OFF_FB_MODE GENMASK(3, 0) 159 #define GEN3_EQ_CONTROL_OFF_PHASE23_EXIT_MODE BIT(4) 160 #define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC GENMASK(23, 8) 161 #define GEN3_EQ_CONTROL_OFF_FOM_INC_INITIAL_EVAL BIT(24) 162 163 #define GEN3_EQ_FB_MODE_DIR_CHANGE_OFF 0x8AC 164 #define GEN3_EQ_FMDC_T_MIN_PHASE23 GENMASK(4, 0) 165 #define GEN3_EQ_FMDC_N_EVALS GENMASK(9, 5) 166 #define GEN3_EQ_FMDC_MAX_PRE_CURSOR_DELTA GENMASK(13, 10) 167 #define GEN3_EQ_FMDC_MAX_POST_CURSOR_DELTA GENMASK(17, 14) 168 169 #define COHERENCY_CONTROL_1_OFF 0x8E0 170 #define CFG_MEMTYPE_BOUNDARY_LOW_ADDR_MASK GENMASK(31, 2) 171 #define CFG_MEMTYPE_VALUE BIT(0) 172 173 #define COHERENCY_CONTROL_2_OFF 0x8E4 174 #define COHERENCY_CONTROL_3_OFF 0x8E8 175 176 #define PCIE_PORT_MULTI_LANE_CTRL 0x8C0 177 #define PORT_MLTI_UPCFG_SUPPORT BIT(7) 178 179 #define PCIE_VERSION_NUMBER 0x8F8 180 #define PCIE_VERSION_TYPE 0x8FC 181 182 /* 183 * iATU inbound and outbound windows CSRs. Before the IP-core v4.80a each 184 * iATU region CSRs had been indirectly accessible by means of the dedicated 185 * viewport selector. The iATU/eDMA CSRs space was re-designed in DWC PCIe 186 * v4.80a in a way so the viewport was unrolled into the directly accessible 187 * iATU/eDMA CSRs space. 188 */ 189 #define PCIE_ATU_VIEWPORT 0x900 190 #define PCIE_ATU_REGION_DIR_IB BIT(31) 191 #define PCIE_ATU_REGION_DIR_OB 0 192 #define PCIE_ATU_VIEWPORT_BASE 0x904 193 #define PCIE_ATU_UNROLL_BASE(dir, index) \ 194 (((index) << 9) | ((dir == PCIE_ATU_REGION_DIR_IB) ? BIT(8) : 0)) 195 #define PCIE_ATU_VIEWPORT_SIZE 0x2C 196 #define PCIE_ATU_REGION_CTRL1 0x000 197 #define PCIE_ATU_INCREASE_REGION_SIZE BIT(13) 198 #define PCIE_ATU_TD BIT(8) 199 #define PCIE_ATU_FUNC_NUM(pf) ((pf) << 20) 200 #define PCIE_ATU_REGION_CTRL2 0x004 201 #define PCIE_ATU_ENABLE BIT(31) 202 #define PCIE_ATU_BAR_MODE_ENABLE BIT(30) 203 #define PCIE_ATU_CFG_SHIFT_MODE_ENABLE BIT(28) 204 #define PCIE_ATU_INHIBIT_PAYLOAD BIT(22) 205 #define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19) 206 #define PCIE_ATU_LOWER_BASE 0x008 207 #define PCIE_ATU_UPPER_BASE 0x00C 208 #define PCIE_ATU_LIMIT 0x010 209 #define PCIE_ATU_LOWER_TARGET 0x014 210 #define PCIE_ATU_BUS(x) FIELD_PREP(GENMASK(31, 24), x) 211 #define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) 212 #define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) 213 #define PCIE_ATU_UPPER_TARGET 0x018 214 #define PCIE_ATU_UPPER_LIMIT 0x020 215 216 #define PCIE_MISC_CONTROL_1_OFF 0x8BC 217 #define PCIE_DBI_RO_WR_EN BIT(0) 218 219 #define PCIE_MSIX_DOORBELL 0x948 220 #define PCIE_MSIX_DOORBELL_PF_SHIFT 24 221 222 /* 223 * eDMA CSRs. DW PCIe IP-core v4.70a and older had the eDMA registers accessible 224 * over the Port Logic registers space. Afterwards the unrolled mapping was 225 * introduced so eDMA and iATU could be accessed via a dedicated registers 226 * space. 227 */ 228 #define PCIE_DMA_VIEWPORT_BASE 0x970 229 #define PCIE_DMA_UNROLL_BASE 0x80000 230 #define PCIE_DMA_CTRL 0x008 231 #define PCIE_DMA_NUM_WR_CHAN GENMASK(3, 0) 232 #define PCIE_DMA_NUM_RD_CHAN GENMASK(19, 16) 233 234 #define PCIE_PL_CHK_REG_CONTROL_STATUS 0xB20 235 #define PCIE_PL_CHK_REG_CHK_REG_START BIT(0) 236 #define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS BIT(1) 237 #define PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR BIT(16) 238 #define PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR BIT(17) 239 #define PCIE_PL_CHK_REG_CHK_REG_COMPLETE BIT(18) 240 241 #define PCIE_PL_CHK_REG_ERR_ADDR 0xB28 242 243 /* 244 * 16.0 GT/s (Gen 4) lane margining register definitions 245 */ 246 #define GEN4_LANE_MARGINING_1_OFF 0xB80 247 #define MARGINING_MAX_VOLTAGE_OFFSET GENMASK(29, 24) 248 #define MARGINING_NUM_VOLTAGE_STEPS GENMASK(22, 16) 249 #define MARGINING_MAX_TIMING_OFFSET GENMASK(13, 8) 250 #define MARGINING_NUM_TIMING_STEPS GENMASK(5, 0) 251 252 #define GEN4_LANE_MARGINING_2_OFF 0xB84 253 #define MARGINING_IND_ERROR_SAMPLER BIT(28) 254 #define MARGINING_SAMPLE_REPORTING_METHOD BIT(27) 255 #define MARGINING_IND_LEFT_RIGHT_TIMING BIT(26) 256 #define MARGINING_IND_UP_DOWN_VOLTAGE BIT(25) 257 #define MARGINING_VOLTAGE_SUPPORTED BIT(24) 258 #define MARGINING_MAXLANES GENMASK(20, 16) 259 #define MARGINING_SAMPLE_RATE_TIMING GENMASK(13, 8) 260 #define MARGINING_SAMPLE_RATE_VOLTAGE GENMASK(5, 0) 261 /* 262 * iATU Unroll-specific register definitions 263 * From 4.80 core version the address translation will be made by unroll 264 */ 265 #define PCIE_ATU_UNR_REGION_CTRL1 0x00 266 #define PCIE_ATU_UNR_REGION_CTRL2 0x04 267 #define PCIE_ATU_UNR_LOWER_BASE 0x08 268 #define PCIE_ATU_UNR_UPPER_BASE 0x0C 269 #define PCIE_ATU_UNR_LOWER_LIMIT 0x10 270 #define PCIE_ATU_UNR_LOWER_TARGET 0x14 271 #define PCIE_ATU_UNR_UPPER_TARGET 0x18 272 #define PCIE_ATU_UNR_UPPER_LIMIT 0x20 273 274 /* 275 * RAS-DES register definitions 276 */ 277 #define PCIE_RAS_DES_EVENT_COUNTER_CONTROL 0x8 278 #define EVENT_COUNTER_ALL_CLEAR 0x3 279 #define EVENT_COUNTER_ENABLE_ALL 0x7 280 #define EVENT_COUNTER_ENABLE_SHIFT 2 281 #define EVENT_COUNTER_EVENT_SEL_MASK GENMASK(7, 0) 282 #define EVENT_COUNTER_EVENT_SEL_SHIFT 16 283 #define EVENT_COUNTER_EVENT_Tx_L0S 0x2 284 #define EVENT_COUNTER_EVENT_Rx_L0S 0x3 285 #define EVENT_COUNTER_EVENT_L1 0x5 286 #define EVENT_COUNTER_EVENT_L1_1 0x7 287 #define EVENT_COUNTER_EVENT_L1_2 0x8 288 #define EVENT_COUNTER_GROUP_SEL_SHIFT 24 289 #define EVENT_COUNTER_GROUP_5 0x5 290 291 #define PCIE_RAS_DES_EVENT_COUNTER_DATA 0xc 292 293 /* PTM register definitions */ 294 #define PTM_RES_REQ_CTRL 0x8 295 #define PTM_RES_CCONTEXT_VALID BIT(0) 296 #define PTM_REQ_AUTO_UPDATE_ENABLED BIT(0) 297 #define PTM_REQ_START_UPDATE BIT(1) 298 299 #define PTM_LOCAL_LSB 0x10 300 #define PTM_LOCAL_MSB 0x14 301 #define PTM_T1_T2_LSB 0x18 302 #define PTM_T1_T2_MSB 0x1c 303 #define PTM_T3_T4_LSB 0x28 304 #define PTM_T3_T4_MSB 0x2c 305 #define PTM_MASTER_LSB 0x38 306 #define PTM_MASTER_MSB 0x3c 307 308 /* 309 * The default address offset between dbi_base and atu_base. Root controller 310 * drivers are not required to initialize atu_base if the offset matches this 311 * default; the driver core automatically derives atu_base from dbi_base using 312 * this offset, if atu_base not set. 313 */ 314 #define DEFAULT_DBI_ATU_OFFSET (0x3 << 20) 315 #define DEFAULT_DBI_DMA_OFFSET PCIE_DMA_UNROLL_BASE 316 317 #define MAX_MSI_IRQS 256 318 #define MAX_MSI_IRQS_PER_CTRL 32 319 #define MAX_MSI_CTRLS (MAX_MSI_IRQS / MAX_MSI_IRQS_PER_CTRL) 320 #define MSI_REG_CTRL_BLOCK_SIZE 12 321 #define MSI_DEF_NUM_VECTORS 32 322 323 /* Maximum number of inbound/outbound iATUs */ 324 #define MAX_IATU_IN 256 325 #define MAX_IATU_OUT 256 326 327 /* Default eDMA LLP memory size */ 328 #define DMA_LLP_MEM_SIZE PAGE_SIZE 329 330 /* Common struct pci_epc_feature bits among DWC EP glue drivers */ 331 #define DWC_EPC_COMMON_FEATURES .dynamic_inbound_mapping = true, \ 332 .subrange_mapping = true 333 334 struct dw_pcie; 335 struct dw_pcie_rp; 336 struct dw_pcie_ep; 337 338 enum dw_pcie_device_mode { 339 DW_PCIE_UNKNOWN_TYPE, 340 DW_PCIE_EP_TYPE, 341 DW_PCIE_LEG_EP_TYPE, 342 DW_PCIE_RC_TYPE, 343 }; 344 345 enum dw_pcie_app_clk { 346 DW_PCIE_DBI_CLK, 347 DW_PCIE_MSTR_CLK, 348 DW_PCIE_SLV_CLK, 349 DW_PCIE_NUM_APP_CLKS 350 }; 351 352 enum dw_pcie_core_clk { 353 DW_PCIE_PIPE_CLK, 354 DW_PCIE_CORE_CLK, 355 DW_PCIE_AUX_CLK, 356 DW_PCIE_REF_CLK, 357 DW_PCIE_NUM_CORE_CLKS 358 }; 359 360 enum dw_pcie_app_rst { 361 DW_PCIE_DBI_RST, 362 DW_PCIE_MSTR_RST, 363 DW_PCIE_SLV_RST, 364 DW_PCIE_NUM_APP_RSTS 365 }; 366 367 enum dw_pcie_core_rst { 368 DW_PCIE_NON_STICKY_RST, 369 DW_PCIE_STICKY_RST, 370 DW_PCIE_CORE_RST, 371 DW_PCIE_PIPE_RST, 372 DW_PCIE_PHY_RST, 373 DW_PCIE_HOT_RST, 374 DW_PCIE_PWR_RST, 375 DW_PCIE_NUM_CORE_RSTS 376 }; 377 378 enum dw_pcie_ltssm { 379 /* Need to align with PCIE_PORT_DEBUG0 bits 0:5 */ 380 DW_PCIE_LTSSM_DETECT_QUIET = 0x0, 381 DW_PCIE_LTSSM_DETECT_ACT = 0x1, 382 DW_PCIE_LTSSM_POLL_ACTIVE = 0x2, 383 DW_PCIE_LTSSM_POLL_COMPLIANCE = 0x3, 384 DW_PCIE_LTSSM_POLL_CONFIG = 0x4, 385 DW_PCIE_LTSSM_PRE_DETECT_QUIET = 0x5, 386 DW_PCIE_LTSSM_DETECT_WAIT = 0x6, 387 DW_PCIE_LTSSM_CFG_LINKWD_START = 0x7, 388 DW_PCIE_LTSSM_CFG_LINKWD_ACEPT = 0x8, 389 DW_PCIE_LTSSM_CFG_LANENUM_WAI = 0x9, 390 DW_PCIE_LTSSM_CFG_LANENUM_ACEPT = 0xa, 391 DW_PCIE_LTSSM_CFG_COMPLETE = 0xb, 392 DW_PCIE_LTSSM_CFG_IDLE = 0xc, 393 DW_PCIE_LTSSM_RCVRY_LOCK = 0xd, 394 DW_PCIE_LTSSM_RCVRY_SPEED = 0xe, 395 DW_PCIE_LTSSM_RCVRY_RCVRCFG = 0xf, 396 DW_PCIE_LTSSM_RCVRY_IDLE = 0x10, 397 DW_PCIE_LTSSM_L0 = 0x11, 398 DW_PCIE_LTSSM_L0S = 0x12, 399 DW_PCIE_LTSSM_L123_SEND_EIDLE = 0x13, 400 DW_PCIE_LTSSM_L1_IDLE = 0x14, 401 DW_PCIE_LTSSM_L2_IDLE = 0x15, 402 DW_PCIE_LTSSM_L2_WAKE = 0x16, 403 DW_PCIE_LTSSM_DISABLED_ENTRY = 0x17, 404 DW_PCIE_LTSSM_DISABLED_IDLE = 0x18, 405 DW_PCIE_LTSSM_DISABLED = 0x19, 406 DW_PCIE_LTSSM_LPBK_ENTRY = 0x1a, 407 DW_PCIE_LTSSM_LPBK_ACTIVE = 0x1b, 408 DW_PCIE_LTSSM_LPBK_EXIT = 0x1c, 409 DW_PCIE_LTSSM_LPBK_EXIT_TIMEOUT = 0x1d, 410 DW_PCIE_LTSSM_HOT_RESET_ENTRY = 0x1e, 411 DW_PCIE_LTSSM_HOT_RESET = 0x1f, 412 DW_PCIE_LTSSM_RCVRY_EQ0 = 0x20, 413 DW_PCIE_LTSSM_RCVRY_EQ1 = 0x21, 414 DW_PCIE_LTSSM_RCVRY_EQ2 = 0x22, 415 DW_PCIE_LTSSM_RCVRY_EQ3 = 0x23, 416 417 /* Vendor glue drivers provide pseudo L1 substates from get_ltssm() */ 418 DW_PCIE_LTSSM_L1_1 = 0x141, 419 DW_PCIE_LTSSM_L1_2 = 0x142, 420 421 DW_PCIE_LTSSM_UNKNOWN = 0xFFFFFFFF, 422 }; 423 424 struct dw_pcie_ob_atu_cfg { 425 int index; 426 int type; 427 u8 func_no; 428 u8 code; 429 u8 routing; 430 u32 ctrl2; 431 u64 parent_bus_addr; 432 u64 pci_addr; 433 u64 size; 434 }; 435 436 struct dw_pcie_host_ops { 437 int (*init)(struct dw_pcie_rp *pp); 438 void (*deinit)(struct dw_pcie_rp *pp); 439 void (*post_init)(struct dw_pcie_rp *pp); 440 int (*msi_init)(struct dw_pcie_rp *pp); 441 void (*pme_turn_off)(struct dw_pcie_rp *pp); 442 }; 443 444 struct dw_pcie_rp { 445 bool use_imsi_rx:1; 446 bool keep_rp_msi_en:1; 447 bool cfg0_io_shared:1; 448 u64 cfg0_base; 449 void __iomem *va_cfg0_base; 450 u32 cfg0_size; 451 resource_size_t io_base; 452 phys_addr_t io_bus_addr; 453 u32 io_size; 454 int irq; 455 const struct dw_pcie_host_ops *ops; 456 int msi_irq[MAX_MSI_CTRLS]; 457 struct irq_domain *irq_domain; 458 dma_addr_t msi_data; 459 struct irq_chip *msi_irq_chip; 460 u32 num_vectors; 461 u32 irq_mask[MAX_MSI_CTRLS]; 462 struct pci_host_bridge *bridge; 463 raw_spinlock_t lock; 464 DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); 465 bool use_atu_msg; 466 int msg_atu_index; 467 struct resource *msg_res; 468 struct pci_eq_presets presets; 469 struct pci_config_window *cfg; 470 bool ecam_enabled; 471 bool native_ecam; 472 bool skip_l23_ready; 473 bool skip_pwrctrl_off; 474 }; 475 476 struct dw_pcie_ep_ops { 477 void (*pre_init)(struct dw_pcie_ep *ep); 478 void (*init)(struct dw_pcie_ep *ep); 479 int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no, 480 unsigned int type, u16 interrupt_num); 481 const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep); 482 /* 483 * Provide a method to implement the different func config space 484 * access for different platform, if different func have different 485 * offset, return the offset of func. if use write a register way 486 * return a 0, and implement code in callback function of platform 487 * driver. 488 */ 489 unsigned int (*get_dbi_offset)(struct dw_pcie_ep *ep, u8 func_no); 490 unsigned int (*get_dbi2_offset)(struct dw_pcie_ep *ep, u8 func_no); 491 }; 492 493 struct dw_pcie_ep_func { 494 struct list_head list; 495 u8 func_no; 496 u8 msi_cap; /* MSI capability offset */ 497 u8 msix_cap; /* MSI-X capability offset */ 498 u8 bar_to_atu[PCI_STD_NUM_BARS]; 499 struct pci_epf_bar *epf_bar[PCI_STD_NUM_BARS]; 500 501 /* Only for Address Match Mode inbound iATU */ 502 u32 *ib_atu_indexes[PCI_STD_NUM_BARS]; 503 unsigned int num_ib_atu_indexes[PCI_STD_NUM_BARS]; 504 }; 505 506 struct dw_pcie_ep { 507 struct pci_epc *epc; 508 struct list_head func_list; 509 const struct dw_pcie_ep_ops *ops; 510 phys_addr_t phys_base; 511 size_t addr_size; 512 size_t page_size; 513 phys_addr_t *outbound_addr; 514 unsigned long *ib_window_map; 515 unsigned long *ob_window_map; 516 void __iomem *msi_mem; 517 phys_addr_t msi_mem_phys; 518 519 /* MSI outbound iATU state */ 520 bool msi_iatu_mapped; 521 u64 msi_msg_addr; 522 size_t msi_map_size; 523 }; 524 525 struct dw_pcie_ops { 526 u64 (*cpu_addr_fixup)(struct dw_pcie *pcie, u64 cpu_addr); 527 u32 (*read_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 528 size_t size); 529 void (*write_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 530 size_t size, u32 val); 531 void (*write_dbi2)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 532 size_t size, u32 val); 533 bool (*link_up)(struct dw_pcie *pcie); 534 enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); 535 int (*start_link)(struct dw_pcie *pcie); 536 void (*stop_link)(struct dw_pcie *pcie); 537 }; 538 539 struct debugfs_info { 540 struct dentry *debug_dir; 541 void *rasdes_info; 542 }; 543 544 struct dw_pcie { 545 struct device *dev; 546 void __iomem *dbi_base; 547 resource_size_t dbi_phys_addr; 548 void __iomem *dbi_base2; 549 void __iomem *atu_base; 550 void __iomem *elbi_base; 551 resource_size_t atu_phys_addr; 552 size_t atu_size; 553 resource_size_t parent_bus_offset; 554 u32 num_ib_windows; 555 u32 num_ob_windows; 556 u32 region_align; 557 u64 region_limit; 558 struct dw_pcie_rp pp; 559 struct dw_pcie_ep ep; 560 const struct dw_pcie_ops *ops; 561 u32 version; 562 u32 type; 563 unsigned long caps; 564 int num_lanes; 565 int max_link_speed; 566 u8 n_fts[2]; 567 struct dw_edma_chip edma; 568 phys_addr_t edma_reg_phys; 569 resource_size_t edma_reg_size; 570 bool l1ss_support; /* L1 PM Substates support */ 571 struct clk_bulk_data app_clks[DW_PCIE_NUM_APP_CLKS]; 572 struct clk_bulk_data core_clks[DW_PCIE_NUM_CORE_CLKS]; 573 struct reset_control_bulk_data app_rsts[DW_PCIE_NUM_APP_RSTS]; 574 struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; 575 struct gpio_desc *pe_rst; 576 bool suspended; 577 struct debugfs_info *debugfs; 578 enum dw_pcie_device_mode mode; 579 u16 ptm_vsec_offset; 580 struct pci_ptm_debugfs *ptm_debugfs; 581 582 /* 583 * If iATU input addresses are offset from CPU physical addresses, 584 * we previously required .cpu_addr_fixup() to convert them. We 585 * now rely on the devicetree instead. If .cpu_addr_fixup() 586 * exists, we compare its results with devicetree. 587 * 588 * If .cpu_addr_fixup() does not exist, we assume the offset is 589 * zero and warn if devicetree claims otherwise. If we know all 590 * devicetrees correctly describe the offset, set 591 * use_parent_dt_ranges to true to avoid this warning. 592 */ 593 bool use_parent_dt_ranges; 594 }; 595 596 #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) 597 598 #define to_dw_pcie_from_ep(endpoint) \ 599 container_of((endpoint), struct dw_pcie, ep) 600 601 int dw_pcie_get_resources(struct dw_pcie *pci); 602 603 void dw_pcie_version_detect(struct dw_pcie *pci); 604 605 u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap); 606 u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap); 607 void dw_pcie_remove_capability(struct dw_pcie *pci, u8 cap); 608 void dw_pcie_remove_ext_capability(struct dw_pcie *pci, u8 cap); 609 u16 dw_pcie_find_rasdes_capability(struct dw_pcie *pci); 610 u16 dw_pcie_find_ptm_capability(struct dw_pcie *pci); 611 612 int dw_pcie_read(void __iomem *addr, int size, u32 *val); 613 int dw_pcie_write(void __iomem *addr, int size, u32 val); 614 615 u32 dw_pcie_read_dbi(struct dw_pcie *pci, u32 reg, size_t size); 616 void dw_pcie_write_dbi(struct dw_pcie *pci, u32 reg, size_t size, u32 val); 617 void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val); 618 bool dw_pcie_link_up(struct dw_pcie *pci); 619 void dw_pcie_upconfig_setup(struct dw_pcie *pci); 620 int dw_pcie_wait_for_link(struct dw_pcie *pci); 621 int dw_pcie_link_get_max_link_width(struct dw_pcie *pci); 622 int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, 623 const struct dw_pcie_ob_atu_cfg *atu); 624 int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int type, 625 u64 parent_bus_addr, u64 pci_addr, u64 size); 626 int dw_pcie_prog_ep_inbound_atu(struct dw_pcie *pci, u8 func_no, int index, 627 int type, u64 parent_bus_addr, 628 u8 bar, size_t size); 629 void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index); 630 void dw_pcie_hide_unsupported_l1ss(struct dw_pcie *pci); 631 void dw_pcie_program_t_power_on(struct dw_pcie *pci, u32 t_power_on); 632 void dw_pcie_setup(struct dw_pcie *pci); 633 void dw_pcie_iatu_detect(struct dw_pcie *pci); 634 int dw_pcie_edma_detect(struct dw_pcie *pci); 635 void dw_pcie_edma_remove(struct dw_pcie *pci); 636 resource_size_t dw_pcie_parent_bus_offset(struct dw_pcie *pci, 637 const char *reg_name, 638 resource_size_t cpu_phy_addr); 639 640 static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val) 641 { 642 dw_pcie_write_dbi(pci, reg, 0x4, val); 643 } 644 645 static inline u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg) 646 { 647 return dw_pcie_read_dbi(pci, reg, 0x4); 648 } 649 650 static inline void dw_pcie_writew_dbi(struct dw_pcie *pci, u32 reg, u16 val) 651 { 652 dw_pcie_write_dbi(pci, reg, 0x2, val); 653 } 654 655 static inline u16 dw_pcie_readw_dbi(struct dw_pcie *pci, u32 reg) 656 { 657 return dw_pcie_read_dbi(pci, reg, 0x2); 658 } 659 660 static inline void dw_pcie_writeb_dbi(struct dw_pcie *pci, u32 reg, u8 val) 661 { 662 dw_pcie_write_dbi(pci, reg, 0x1, val); 663 } 664 665 static inline u8 dw_pcie_readb_dbi(struct dw_pcie *pci, u32 reg) 666 { 667 return dw_pcie_read_dbi(pci, reg, 0x1); 668 } 669 670 static inline void dw_pcie_writel_dbi2(struct dw_pcie *pci, u32 reg, u32 val) 671 { 672 dw_pcie_write_dbi2(pci, reg, 0x4, val); 673 } 674 675 static inline int dw_pcie_read_cfg_byte(struct dw_pcie *pci, int where, 676 u8 *val) 677 { 678 *val = dw_pcie_readb_dbi(pci, where); 679 return PCIBIOS_SUCCESSFUL; 680 } 681 682 static inline int dw_pcie_read_cfg_word(struct dw_pcie *pci, int where, 683 u16 *val) 684 { 685 *val = dw_pcie_readw_dbi(pci, where); 686 return PCIBIOS_SUCCESSFUL; 687 } 688 689 static inline int dw_pcie_read_cfg_dword(struct dw_pcie *pci, int where, 690 u32 *val) 691 { 692 *val = dw_pcie_readl_dbi(pci, where); 693 return PCIBIOS_SUCCESSFUL; 694 } 695 696 static inline unsigned int dw_pcie_ep_get_dbi_offset(struct dw_pcie_ep *ep, 697 u8 func_no) 698 { 699 unsigned int dbi_offset = 0; 700 701 if (ep->ops->get_dbi_offset) 702 dbi_offset = ep->ops->get_dbi_offset(ep, func_no); 703 704 return dbi_offset; 705 } 706 707 static inline u32 dw_pcie_ep_read_dbi(struct dw_pcie_ep *ep, u8 func_no, 708 u32 reg, size_t size) 709 { 710 unsigned int offset = dw_pcie_ep_get_dbi_offset(ep, func_no); 711 struct dw_pcie *pci = to_dw_pcie_from_ep(ep); 712 713 return dw_pcie_read_dbi(pci, offset + reg, size); 714 } 715 716 static inline void dw_pcie_ep_write_dbi(struct dw_pcie_ep *ep, u8 func_no, 717 u32 reg, size_t size, u32 val) 718 { 719 unsigned int offset = dw_pcie_ep_get_dbi_offset(ep, func_no); 720 struct dw_pcie *pci = to_dw_pcie_from_ep(ep); 721 722 dw_pcie_write_dbi(pci, offset + reg, size, val); 723 } 724 725 static inline void dw_pcie_ep_writel_dbi(struct dw_pcie_ep *ep, u8 func_no, 726 u32 reg, u32 val) 727 { 728 dw_pcie_ep_write_dbi(ep, func_no, reg, 0x4, val); 729 } 730 731 static inline u32 dw_pcie_ep_readl_dbi(struct dw_pcie_ep *ep, u8 func_no, 732 u32 reg) 733 { 734 return dw_pcie_ep_read_dbi(ep, func_no, reg, 0x4); 735 } 736 737 static inline void dw_pcie_ep_writew_dbi(struct dw_pcie_ep *ep, u8 func_no, 738 u32 reg, u16 val) 739 { 740 dw_pcie_ep_write_dbi(ep, func_no, reg, 0x2, val); 741 } 742 743 static inline u16 dw_pcie_ep_readw_dbi(struct dw_pcie_ep *ep, u8 func_no, 744 u32 reg) 745 { 746 return dw_pcie_ep_read_dbi(ep, func_no, reg, 0x2); 747 } 748 749 static inline void dw_pcie_ep_writeb_dbi(struct dw_pcie_ep *ep, u8 func_no, 750 u32 reg, u8 val) 751 { 752 dw_pcie_ep_write_dbi(ep, func_no, reg, 0x1, val); 753 } 754 755 static inline u8 dw_pcie_ep_readb_dbi(struct dw_pcie_ep *ep, u8 func_no, 756 u32 reg) 757 { 758 return dw_pcie_ep_read_dbi(ep, func_no, reg, 0x1); 759 } 760 761 static inline int dw_pcie_ep_read_cfg_byte(struct dw_pcie_ep *ep, u8 func_no, 762 int where, u8 *val) 763 { 764 *val = dw_pcie_ep_readb_dbi(ep, func_no, where); 765 return PCIBIOS_SUCCESSFUL; 766 } 767 768 static inline int dw_pcie_ep_read_cfg_word(struct dw_pcie_ep *ep, u8 func_no, 769 int where, u16 *val) 770 { 771 *val = dw_pcie_ep_readw_dbi(ep, func_no, where); 772 return PCIBIOS_SUCCESSFUL; 773 } 774 775 static inline int dw_pcie_ep_read_cfg_dword(struct dw_pcie_ep *ep, u8 func_no, 776 int where, u32 *val) 777 { 778 *val = dw_pcie_ep_readl_dbi(ep, func_no, where); 779 return PCIBIOS_SUCCESSFUL; 780 } 781 782 static inline unsigned int dw_pcie_ep_get_dbi2_offset(struct dw_pcie_ep *ep, 783 u8 func_no) 784 { 785 unsigned int dbi2_offset = 0; 786 787 if (ep->ops->get_dbi2_offset) 788 dbi2_offset = ep->ops->get_dbi2_offset(ep, func_no); 789 else if (ep->ops->get_dbi_offset) /* for backward compatibility */ 790 dbi2_offset = ep->ops->get_dbi_offset(ep, func_no); 791 792 return dbi2_offset; 793 } 794 795 static inline void dw_pcie_ep_write_dbi2(struct dw_pcie_ep *ep, u8 func_no, 796 u32 reg, size_t size, u32 val) 797 { 798 unsigned int offset = dw_pcie_ep_get_dbi2_offset(ep, func_no); 799 struct dw_pcie *pci = to_dw_pcie_from_ep(ep); 800 801 dw_pcie_write_dbi2(pci, offset + reg, size, val); 802 } 803 804 static inline void dw_pcie_ep_writel_dbi2(struct dw_pcie_ep *ep, u8 func_no, 805 u32 reg, u32 val) 806 { 807 dw_pcie_ep_write_dbi2(ep, func_no, reg, 0x4, val); 808 } 809 810 static inline void dw_pcie_dbi_ro_wr_en(struct dw_pcie *pci) 811 { 812 u32 reg; 813 u32 val; 814 815 reg = PCIE_MISC_CONTROL_1_OFF; 816 val = dw_pcie_readl_dbi(pci, reg); 817 val |= PCIE_DBI_RO_WR_EN; 818 dw_pcie_writel_dbi(pci, reg, val); 819 } 820 821 static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci) 822 { 823 u32 reg; 824 u32 val; 825 826 reg = PCIE_MISC_CONTROL_1_OFF; 827 val = dw_pcie_readl_dbi(pci, reg); 828 val &= ~PCIE_DBI_RO_WR_EN; 829 dw_pcie_writel_dbi(pci, reg, val); 830 } 831 832 static inline int dw_pcie_start_link(struct dw_pcie *pci) 833 { 834 if (pci->ops && pci->ops->start_link) 835 return pci->ops->start_link(pci); 836 837 return 0; 838 } 839 840 static inline void dw_pcie_stop_link(struct dw_pcie *pci) 841 { 842 if (pci->ops && pci->ops->stop_link) 843 pci->ops->stop_link(pci); 844 } 845 846 static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) 847 { 848 u32 val; 849 850 if (pci->ops && pci->ops->get_ltssm) 851 return pci->ops->get_ltssm(pci); 852 853 val = dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0); 854 855 return (enum dw_pcie_ltssm)FIELD_GET(PORT_LOGIC_LTSSM_STATE_MASK, val); 856 } 857 858 const char *dw_pcie_ltssm_status_string(enum dw_pcie_ltssm ltssm); 859 860 #ifdef CONFIG_PCIE_DW_HOST 861 int dw_pcie_suspend_noirq(struct dw_pcie *pci); 862 int dw_pcie_resume_noirq(struct dw_pcie *pci); 863 void dw_handle_msi_irq(struct dw_pcie_rp *pp); 864 void dw_pcie_msi_init(struct dw_pcie_rp *pp); 865 int dw_pcie_msi_host_init(struct dw_pcie_rp *pp); 866 void dw_pcie_free_msi(struct dw_pcie_rp *pp); 867 int dw_pcie_setup_rc(struct dw_pcie_rp *pp); 868 int dw_pcie_host_init(struct dw_pcie_rp *pp); 869 void dw_pcie_host_deinit(struct dw_pcie_rp *pp); 870 int dw_pcie_allocate_domains(struct dw_pcie_rp *pp); 871 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn, 872 int where); 873 #else 874 static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci) 875 { 876 return 0; 877 } 878 879 static inline int dw_pcie_resume_noirq(struct dw_pcie *pci) 880 { 881 return 0; 882 } 883 884 static inline void dw_handle_msi_irq(struct dw_pcie_rp *pp) { } 885 886 static inline void dw_pcie_msi_init(struct dw_pcie_rp *pp) 887 { } 888 889 static inline int dw_pcie_msi_host_init(struct dw_pcie_rp *pp) 890 { 891 return -ENODEV; 892 } 893 894 static inline void dw_pcie_free_msi(struct dw_pcie_rp *pp) 895 { } 896 897 static inline int dw_pcie_setup_rc(struct dw_pcie_rp *pp) 898 { 899 return 0; 900 } 901 902 static inline int dw_pcie_host_init(struct dw_pcie_rp *pp) 903 { 904 return 0; 905 } 906 907 static inline void dw_pcie_host_deinit(struct dw_pcie_rp *pp) 908 { 909 } 910 911 static inline int dw_pcie_allocate_domains(struct dw_pcie_rp *pp) 912 { 913 return 0; 914 } 915 static inline void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, 916 unsigned int devfn, 917 int where) 918 { 919 return NULL; 920 } 921 #endif 922 923 #ifdef CONFIG_PCIE_DW_EP 924 void dw_pcie_ep_linkup(struct dw_pcie_ep *ep); 925 void dw_pcie_ep_linkdown(struct dw_pcie_ep *ep); 926 int dw_pcie_ep_init(struct dw_pcie_ep *ep); 927 int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep); 928 void dw_pcie_ep_deinit(struct dw_pcie_ep *ep); 929 void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep); 930 int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no); 931 int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, 932 u8 interrupt_num); 933 int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, 934 u16 interrupt_num); 935 int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no, 936 u16 interrupt_num); 937 void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar); 938 struct dw_pcie_ep_func * 939 dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no); 940 #else 941 static inline void dw_pcie_ep_linkup(struct dw_pcie_ep *ep) 942 { 943 } 944 945 static inline void dw_pcie_ep_linkdown(struct dw_pcie_ep *ep) 946 { 947 } 948 949 static inline int dw_pcie_ep_init(struct dw_pcie_ep *ep) 950 { 951 return 0; 952 } 953 954 static inline int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) 955 { 956 return 0; 957 } 958 959 static inline void dw_pcie_ep_deinit(struct dw_pcie_ep *ep) 960 { 961 } 962 963 static inline void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) 964 { 965 } 966 967 static inline int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no) 968 { 969 return 0; 970 } 971 972 static inline int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, 973 u8 interrupt_num) 974 { 975 return 0; 976 } 977 978 static inline int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, 979 u16 interrupt_num) 980 { 981 return 0; 982 } 983 984 static inline int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, 985 u8 func_no, 986 u16 interrupt_num) 987 { 988 return 0; 989 } 990 991 static inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) 992 { 993 } 994 995 static inline struct dw_pcie_ep_func * 996 dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no) 997 { 998 return NULL; 999 } 1000 #endif 1001 1002 #ifdef CONFIG_PCIE_DW_DEBUGFS 1003 void dwc_pcie_debugfs_init(struct dw_pcie *pci, enum dw_pcie_device_mode mode); 1004 void dwc_pcie_debugfs_deinit(struct dw_pcie *pci); 1005 #else 1006 static inline void dwc_pcie_debugfs_init(struct dw_pcie *pci, 1007 enum dw_pcie_device_mode mode) 1008 { 1009 } 1010 static inline void dwc_pcie_debugfs_deinit(struct dw_pcie *pci) 1011 { 1012 } 1013 #endif 1014 1015 #endif /* _PCIE_DESIGNWARE_H */ 1016