162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Synopsys DesignWare PCIe host controller driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2013 Samsung Electronics Co., Ltd. 662306a36Sopenharmony_ci * https://www.samsung.com 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Author: Jingoo Han <jg1.han@samsung.com> 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _PCIE_DESIGNWARE_H 1262306a36Sopenharmony_ci#define _PCIE_DESIGNWARE_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/bitfield.h> 1562306a36Sopenharmony_ci#include <linux/bitops.h> 1662306a36Sopenharmony_ci#include <linux/clk.h> 1762306a36Sopenharmony_ci#include <linux/dma-mapping.h> 1862306a36Sopenharmony_ci#include <linux/dma/edma.h> 1962306a36Sopenharmony_ci#include <linux/gpio/consumer.h> 2062306a36Sopenharmony_ci#include <linux/irq.h> 2162306a36Sopenharmony_ci#include <linux/msi.h> 2262306a36Sopenharmony_ci#include <linux/pci.h> 2362306a36Sopenharmony_ci#include <linux/reset.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#include <linux/pci-epc.h> 2662306a36Sopenharmony_ci#include <linux/pci-epf.h> 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* DWC PCIe IP-core versions (native support since v4.70a) */ 2962306a36Sopenharmony_ci#define DW_PCIE_VER_365A 0x3336352a 3062306a36Sopenharmony_ci#define DW_PCIE_VER_460A 0x3436302a 3162306a36Sopenharmony_ci#define DW_PCIE_VER_470A 0x3437302a 3262306a36Sopenharmony_ci#define DW_PCIE_VER_480A 0x3438302a 3362306a36Sopenharmony_ci#define DW_PCIE_VER_490A 0x3439302a 3462306a36Sopenharmony_ci#define DW_PCIE_VER_520A 0x3532302a 3562306a36Sopenharmony_ci#define DW_PCIE_VER_540A 0x3534302a 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#define __dw_pcie_ver_cmp(_pci, _ver, _op) \ 3862306a36Sopenharmony_ci ((_pci)->version _op DW_PCIE_VER_ ## _ver) 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define dw_pcie_ver_type_is(_pci, _ver, _type) \ 4562306a36Sopenharmony_ci (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ 4662306a36Sopenharmony_ci __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==)) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \ 4962306a36Sopenharmony_ci (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ 5062306a36Sopenharmony_ci __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=)) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* DWC PCIe controller capabilities */ 5362306a36Sopenharmony_ci#define DW_PCIE_CAP_REQ_RES 0 5462306a36Sopenharmony_ci#define DW_PCIE_CAP_IATU_UNROLL 1 5562306a36Sopenharmony_ci#define DW_PCIE_CAP_CDM_CHECK 2 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#define dw_pcie_cap_is(_pci, _cap) \ 5862306a36Sopenharmony_ci test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#define dw_pcie_cap_set(_pci, _cap) \ 6162306a36Sopenharmony_ci set_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci/* Parameters for the waiting for link up routine */ 6462306a36Sopenharmony_ci#define LINK_WAIT_MAX_RETRIES 10 6562306a36Sopenharmony_ci#define LINK_WAIT_USLEEP_MIN 90000 6662306a36Sopenharmony_ci#define LINK_WAIT_USLEEP_MAX 100000 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci/* Parameters for the waiting for iATU enabled routine */ 6962306a36Sopenharmony_ci#define LINK_WAIT_MAX_IATU_RETRIES 5 7062306a36Sopenharmony_ci#define LINK_WAIT_IATU 9 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci/* Synopsys-specific PCIe configuration registers */ 7362306a36Sopenharmony_ci#define PCIE_PORT_AFR 0x70C 7462306a36Sopenharmony_ci#define PORT_AFR_N_FTS_MASK GENMASK(15, 8) 7562306a36Sopenharmony_ci#define PORT_AFR_N_FTS(n) FIELD_PREP(PORT_AFR_N_FTS_MASK, n) 7662306a36Sopenharmony_ci#define PORT_AFR_CC_N_FTS_MASK GENMASK(23, 16) 7762306a36Sopenharmony_ci#define PORT_AFR_CC_N_FTS(n) FIELD_PREP(PORT_AFR_CC_N_FTS_MASK, n) 7862306a36Sopenharmony_ci#define PORT_AFR_ENTER_ASPM BIT(30) 7962306a36Sopenharmony_ci#define PORT_AFR_L0S_ENTRANCE_LAT_SHIFT 24 8062306a36Sopenharmony_ci#define PORT_AFR_L0S_ENTRANCE_LAT_MASK GENMASK(26, 24) 8162306a36Sopenharmony_ci#define PORT_AFR_L1_ENTRANCE_LAT_SHIFT 27 8262306a36Sopenharmony_ci#define PORT_AFR_L1_ENTRANCE_LAT_MASK GENMASK(29, 27) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define PCIE_PORT_LINK_CONTROL 0x710 8562306a36Sopenharmony_ci#define PORT_LINK_DLL_LINK_EN BIT(5) 8662306a36Sopenharmony_ci#define PORT_LINK_FAST_LINK_MODE BIT(7) 8762306a36Sopenharmony_ci#define PORT_LINK_MODE_MASK GENMASK(21, 16) 8862306a36Sopenharmony_ci#define PORT_LINK_MODE(n) FIELD_PREP(PORT_LINK_MODE_MASK, n) 8962306a36Sopenharmony_ci#define PORT_LINK_MODE_1_LANES PORT_LINK_MODE(0x1) 9062306a36Sopenharmony_ci#define PORT_LINK_MODE_2_LANES PORT_LINK_MODE(0x3) 9162306a36Sopenharmony_ci#define PORT_LINK_MODE_4_LANES PORT_LINK_MODE(0x7) 9262306a36Sopenharmony_ci#define PORT_LINK_MODE_8_LANES PORT_LINK_MODE(0xf) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define PCIE_PORT_DEBUG0 0x728 9562306a36Sopenharmony_ci#define PORT_LOGIC_LTSSM_STATE_MASK 0x1f 9662306a36Sopenharmony_ci#define PORT_LOGIC_LTSSM_STATE_L0 0x11 9762306a36Sopenharmony_ci#define PCIE_PORT_DEBUG1 0x72C 9862306a36Sopenharmony_ci#define PCIE_PORT_DEBUG1_LINK_UP BIT(4) 9962306a36Sopenharmony_ci#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C 10262306a36Sopenharmony_ci#define PORT_LOGIC_N_FTS_MASK GENMASK(7, 0) 10362306a36Sopenharmony_ci#define PORT_LOGIC_SPEED_CHANGE BIT(17) 10462306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH_MASK GENMASK(12, 8) 10562306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH(n) FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n) 10662306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH_1_LANES PORT_LOGIC_LINK_WIDTH(0x1) 10762306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH_2_LANES PORT_LOGIC_LINK_WIDTH(0x2) 10862306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH_4_LANES PORT_LOGIC_LINK_WIDTH(0x4) 10962306a36Sopenharmony_ci#define PORT_LOGIC_LINK_WIDTH_8_LANES PORT_LOGIC_LINK_WIDTH(0x8) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci#define PCIE_MSI_ADDR_LO 0x820 11262306a36Sopenharmony_ci#define PCIE_MSI_ADDR_HI 0x824 11362306a36Sopenharmony_ci#define PCIE_MSI_INTR0_ENABLE 0x828 11462306a36Sopenharmony_ci#define PCIE_MSI_INTR0_MASK 0x82C 11562306a36Sopenharmony_ci#define PCIE_MSI_INTR0_STATUS 0x830 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define GEN3_RELATED_OFF 0x890 11862306a36Sopenharmony_ci#define GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL BIT(0) 11962306a36Sopenharmony_ci#define GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS BIT(13) 12062306a36Sopenharmony_ci#define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16) 12162306a36Sopenharmony_ci#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24 12262306a36Sopenharmony_ci#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24) 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci#define PCIE_PORT_MULTI_LANE_CTRL 0x8C0 12562306a36Sopenharmony_ci#define PORT_MLTI_UPCFG_SUPPORT BIT(7) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define PCIE_VERSION_NUMBER 0x8F8 12862306a36Sopenharmony_ci#define PCIE_VERSION_TYPE 0x8FC 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* 13162306a36Sopenharmony_ci * iATU inbound and outbound windows CSRs. Before the IP-core v4.80a each 13262306a36Sopenharmony_ci * iATU region CSRs had been indirectly accessible by means of the dedicated 13362306a36Sopenharmony_ci * viewport selector. The iATU/eDMA CSRs space was re-designed in DWC PCIe 13462306a36Sopenharmony_ci * v4.80a in a way so the viewport was unrolled into the directly accessible 13562306a36Sopenharmony_ci * iATU/eDMA CSRs space. 13662306a36Sopenharmony_ci */ 13762306a36Sopenharmony_ci#define PCIE_ATU_VIEWPORT 0x900 13862306a36Sopenharmony_ci#define PCIE_ATU_REGION_DIR_IB BIT(31) 13962306a36Sopenharmony_ci#define PCIE_ATU_REGION_DIR_OB 0 14062306a36Sopenharmony_ci#define PCIE_ATU_VIEWPORT_BASE 0x904 14162306a36Sopenharmony_ci#define PCIE_ATU_UNROLL_BASE(dir, index) \ 14262306a36Sopenharmony_ci (((index) << 9) | ((dir == PCIE_ATU_REGION_DIR_IB) ? BIT(8) : 0)) 14362306a36Sopenharmony_ci#define PCIE_ATU_VIEWPORT_SIZE 0x2C 14462306a36Sopenharmony_ci#define PCIE_ATU_REGION_CTRL1 0x000 14562306a36Sopenharmony_ci#define PCIE_ATU_INCREASE_REGION_SIZE BIT(13) 14662306a36Sopenharmony_ci#define PCIE_ATU_TYPE_MEM 0x0 14762306a36Sopenharmony_ci#define PCIE_ATU_TYPE_IO 0x2 14862306a36Sopenharmony_ci#define PCIE_ATU_TYPE_CFG0 0x4 14962306a36Sopenharmony_ci#define PCIE_ATU_TYPE_CFG1 0x5 15062306a36Sopenharmony_ci#define PCIE_ATU_TD BIT(8) 15162306a36Sopenharmony_ci#define PCIE_ATU_FUNC_NUM(pf) ((pf) << 20) 15262306a36Sopenharmony_ci#define PCIE_ATU_REGION_CTRL2 0x004 15362306a36Sopenharmony_ci#define PCIE_ATU_ENABLE BIT(31) 15462306a36Sopenharmony_ci#define PCIE_ATU_BAR_MODE_ENABLE BIT(30) 15562306a36Sopenharmony_ci#define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19) 15662306a36Sopenharmony_ci#define PCIE_ATU_LOWER_BASE 0x008 15762306a36Sopenharmony_ci#define PCIE_ATU_UPPER_BASE 0x00C 15862306a36Sopenharmony_ci#define PCIE_ATU_LIMIT 0x010 15962306a36Sopenharmony_ci#define PCIE_ATU_LOWER_TARGET 0x014 16062306a36Sopenharmony_ci#define PCIE_ATU_BUS(x) FIELD_PREP(GENMASK(31, 24), x) 16162306a36Sopenharmony_ci#define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) 16262306a36Sopenharmony_ci#define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) 16362306a36Sopenharmony_ci#define PCIE_ATU_UPPER_TARGET 0x018 16462306a36Sopenharmony_ci#define PCIE_ATU_UPPER_LIMIT 0x020 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define PCIE_MISC_CONTROL_1_OFF 0x8BC 16762306a36Sopenharmony_ci#define PCIE_DBI_RO_WR_EN BIT(0) 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci#define PCIE_MSIX_DOORBELL 0x948 17062306a36Sopenharmony_ci#define PCIE_MSIX_DOORBELL_PF_SHIFT 24 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* 17362306a36Sopenharmony_ci * eDMA CSRs. DW PCIe IP-core v4.70a and older had the eDMA registers accessible 17462306a36Sopenharmony_ci * over the Port Logic registers space. Afterwards the unrolled mapping was 17562306a36Sopenharmony_ci * introduced so eDMA and iATU could be accessed via a dedicated registers 17662306a36Sopenharmony_ci * space. 17762306a36Sopenharmony_ci */ 17862306a36Sopenharmony_ci#define PCIE_DMA_VIEWPORT_BASE 0x970 17962306a36Sopenharmony_ci#define PCIE_DMA_UNROLL_BASE 0x80000 18062306a36Sopenharmony_ci#define PCIE_DMA_CTRL 0x008 18162306a36Sopenharmony_ci#define PCIE_DMA_NUM_WR_CHAN GENMASK(3, 0) 18262306a36Sopenharmony_ci#define PCIE_DMA_NUM_RD_CHAN GENMASK(19, 16) 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CONTROL_STATUS 0xB20 18562306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CHK_REG_START BIT(0) 18662306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS BIT(1) 18762306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR BIT(16) 18862306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR BIT(17) 18962306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_CHK_REG_COMPLETE BIT(18) 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define PCIE_PL_CHK_REG_ERR_ADDR 0xB28 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci/* 19462306a36Sopenharmony_ci * iATU Unroll-specific register definitions 19562306a36Sopenharmony_ci * From 4.80 core version the address translation will be made by unroll 19662306a36Sopenharmony_ci */ 19762306a36Sopenharmony_ci#define PCIE_ATU_UNR_REGION_CTRL1 0x00 19862306a36Sopenharmony_ci#define PCIE_ATU_UNR_REGION_CTRL2 0x04 19962306a36Sopenharmony_ci#define PCIE_ATU_UNR_LOWER_BASE 0x08 20062306a36Sopenharmony_ci#define PCIE_ATU_UNR_UPPER_BASE 0x0C 20162306a36Sopenharmony_ci#define PCIE_ATU_UNR_LOWER_LIMIT 0x10 20262306a36Sopenharmony_ci#define PCIE_ATU_UNR_LOWER_TARGET 0x14 20362306a36Sopenharmony_ci#define PCIE_ATU_UNR_UPPER_TARGET 0x18 20462306a36Sopenharmony_ci#define PCIE_ATU_UNR_UPPER_LIMIT 0x20 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci/* 20762306a36Sopenharmony_ci * RAS-DES register definitions 20862306a36Sopenharmony_ci */ 20962306a36Sopenharmony_ci#define PCIE_RAS_DES_EVENT_COUNTER_CONTROL 0x8 21062306a36Sopenharmony_ci#define EVENT_COUNTER_ALL_CLEAR 0x3 21162306a36Sopenharmony_ci#define EVENT_COUNTER_ENABLE_ALL 0x7 21262306a36Sopenharmony_ci#define EVENT_COUNTER_ENABLE_SHIFT 2 21362306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_SEL_MASK GENMASK(7, 0) 21462306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_SEL_SHIFT 16 21562306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_Tx_L0S 0x2 21662306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_Rx_L0S 0x3 21762306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_L1 0x5 21862306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_L1_1 0x7 21962306a36Sopenharmony_ci#define EVENT_COUNTER_EVENT_L1_2 0x8 22062306a36Sopenharmony_ci#define EVENT_COUNTER_GROUP_SEL_SHIFT 24 22162306a36Sopenharmony_ci#define EVENT_COUNTER_GROUP_5 0x5 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci#define PCIE_RAS_DES_EVENT_COUNTER_DATA 0xc 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci/* 22662306a36Sopenharmony_ci * The default address offset between dbi_base and atu_base. Root controller 22762306a36Sopenharmony_ci * drivers are not required to initialize atu_base if the offset matches this 22862306a36Sopenharmony_ci * default; the driver core automatically derives atu_base from dbi_base using 22962306a36Sopenharmony_ci * this offset, if atu_base not set. 23062306a36Sopenharmony_ci */ 23162306a36Sopenharmony_ci#define DEFAULT_DBI_ATU_OFFSET (0x3 << 20) 23262306a36Sopenharmony_ci#define DEFAULT_DBI_DMA_OFFSET PCIE_DMA_UNROLL_BASE 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci#define MAX_MSI_IRQS 256 23562306a36Sopenharmony_ci#define MAX_MSI_IRQS_PER_CTRL 32 23662306a36Sopenharmony_ci#define MAX_MSI_CTRLS (MAX_MSI_IRQS / MAX_MSI_IRQS_PER_CTRL) 23762306a36Sopenharmony_ci#define MSI_REG_CTRL_BLOCK_SIZE 12 23862306a36Sopenharmony_ci#define MSI_DEF_NUM_VECTORS 32 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci/* Maximum number of inbound/outbound iATUs */ 24162306a36Sopenharmony_ci#define MAX_IATU_IN 256 24262306a36Sopenharmony_ci#define MAX_IATU_OUT 256 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/* Default eDMA LLP memory size */ 24562306a36Sopenharmony_ci#define DMA_LLP_MEM_SIZE PAGE_SIZE 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_cistruct dw_pcie; 24862306a36Sopenharmony_cistruct dw_pcie_rp; 24962306a36Sopenharmony_cistruct dw_pcie_ep; 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_cienum dw_pcie_device_mode { 25262306a36Sopenharmony_ci DW_PCIE_UNKNOWN_TYPE, 25362306a36Sopenharmony_ci DW_PCIE_EP_TYPE, 25462306a36Sopenharmony_ci DW_PCIE_LEG_EP_TYPE, 25562306a36Sopenharmony_ci DW_PCIE_RC_TYPE, 25662306a36Sopenharmony_ci}; 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_cienum dw_pcie_app_clk { 25962306a36Sopenharmony_ci DW_PCIE_DBI_CLK, 26062306a36Sopenharmony_ci DW_PCIE_MSTR_CLK, 26162306a36Sopenharmony_ci DW_PCIE_SLV_CLK, 26262306a36Sopenharmony_ci DW_PCIE_NUM_APP_CLKS 26362306a36Sopenharmony_ci}; 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_cienum dw_pcie_core_clk { 26662306a36Sopenharmony_ci DW_PCIE_PIPE_CLK, 26762306a36Sopenharmony_ci DW_PCIE_CORE_CLK, 26862306a36Sopenharmony_ci DW_PCIE_AUX_CLK, 26962306a36Sopenharmony_ci DW_PCIE_REF_CLK, 27062306a36Sopenharmony_ci DW_PCIE_NUM_CORE_CLKS 27162306a36Sopenharmony_ci}; 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_cienum dw_pcie_app_rst { 27462306a36Sopenharmony_ci DW_PCIE_DBI_RST, 27562306a36Sopenharmony_ci DW_PCIE_MSTR_RST, 27662306a36Sopenharmony_ci DW_PCIE_SLV_RST, 27762306a36Sopenharmony_ci DW_PCIE_NUM_APP_RSTS 27862306a36Sopenharmony_ci}; 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_cienum dw_pcie_core_rst { 28162306a36Sopenharmony_ci DW_PCIE_NON_STICKY_RST, 28262306a36Sopenharmony_ci DW_PCIE_STICKY_RST, 28362306a36Sopenharmony_ci DW_PCIE_CORE_RST, 28462306a36Sopenharmony_ci DW_PCIE_PIPE_RST, 28562306a36Sopenharmony_ci DW_PCIE_PHY_RST, 28662306a36Sopenharmony_ci DW_PCIE_HOT_RST, 28762306a36Sopenharmony_ci DW_PCIE_PWR_RST, 28862306a36Sopenharmony_ci DW_PCIE_NUM_CORE_RSTS 28962306a36Sopenharmony_ci}; 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_cienum dw_pcie_ltssm { 29262306a36Sopenharmony_ci /* Need to align with PCIE_PORT_DEBUG0 bits 0:5 */ 29362306a36Sopenharmony_ci DW_PCIE_LTSSM_DETECT_QUIET = 0x0, 29462306a36Sopenharmony_ci DW_PCIE_LTSSM_DETECT_ACT = 0x1, 29562306a36Sopenharmony_ci DW_PCIE_LTSSM_L0 = 0x11, 29662306a36Sopenharmony_ci DW_PCIE_LTSSM_L2_IDLE = 0x15, 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci DW_PCIE_LTSSM_UNKNOWN = 0xFFFFFFFF, 29962306a36Sopenharmony_ci}; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_cistruct dw_pcie_host_ops { 30262306a36Sopenharmony_ci int (*host_init)(struct dw_pcie_rp *pp); 30362306a36Sopenharmony_ci void (*host_deinit)(struct dw_pcie_rp *pp); 30462306a36Sopenharmony_ci int (*msi_host_init)(struct dw_pcie_rp *pp); 30562306a36Sopenharmony_ci void (*pme_turn_off)(struct dw_pcie_rp *pp); 30662306a36Sopenharmony_ci}; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_cistruct dw_pcie_rp { 30962306a36Sopenharmony_ci bool has_msi_ctrl:1; 31062306a36Sopenharmony_ci bool cfg0_io_shared:1; 31162306a36Sopenharmony_ci u64 cfg0_base; 31262306a36Sopenharmony_ci void __iomem *va_cfg0_base; 31362306a36Sopenharmony_ci u32 cfg0_size; 31462306a36Sopenharmony_ci resource_size_t io_base; 31562306a36Sopenharmony_ci phys_addr_t io_bus_addr; 31662306a36Sopenharmony_ci u32 io_size; 31762306a36Sopenharmony_ci int irq; 31862306a36Sopenharmony_ci const struct dw_pcie_host_ops *ops; 31962306a36Sopenharmony_ci int msi_irq[MAX_MSI_CTRLS]; 32062306a36Sopenharmony_ci struct irq_domain *irq_domain; 32162306a36Sopenharmony_ci struct irq_domain *msi_domain; 32262306a36Sopenharmony_ci dma_addr_t msi_data; 32362306a36Sopenharmony_ci struct irq_chip *msi_irq_chip; 32462306a36Sopenharmony_ci u32 num_vectors; 32562306a36Sopenharmony_ci u32 irq_mask[MAX_MSI_CTRLS]; 32662306a36Sopenharmony_ci struct pci_host_bridge *bridge; 32762306a36Sopenharmony_ci raw_spinlock_t lock; 32862306a36Sopenharmony_ci DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); 32962306a36Sopenharmony_ci}; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_cistruct dw_pcie_ep_ops { 33262306a36Sopenharmony_ci void (*ep_init)(struct dw_pcie_ep *ep); 33362306a36Sopenharmony_ci int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no, 33462306a36Sopenharmony_ci enum pci_epc_irq_type type, u16 interrupt_num); 33562306a36Sopenharmony_ci const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep); 33662306a36Sopenharmony_ci /* 33762306a36Sopenharmony_ci * Provide a method to implement the different func config space 33862306a36Sopenharmony_ci * access for different platform, if different func have different 33962306a36Sopenharmony_ci * offset, return the offset of func. if use write a register way 34062306a36Sopenharmony_ci * return a 0, and implement code in callback function of platform 34162306a36Sopenharmony_ci * driver. 34262306a36Sopenharmony_ci */ 34362306a36Sopenharmony_ci unsigned int (*func_conf_select)(struct dw_pcie_ep *ep, u8 func_no); 34462306a36Sopenharmony_ci}; 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_cistruct dw_pcie_ep_func { 34762306a36Sopenharmony_ci struct list_head list; 34862306a36Sopenharmony_ci u8 func_no; 34962306a36Sopenharmony_ci u8 msi_cap; /* MSI capability offset */ 35062306a36Sopenharmony_ci u8 msix_cap; /* MSI-X capability offset */ 35162306a36Sopenharmony_ci}; 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_cistruct dw_pcie_ep { 35462306a36Sopenharmony_ci struct pci_epc *epc; 35562306a36Sopenharmony_ci struct list_head func_list; 35662306a36Sopenharmony_ci const struct dw_pcie_ep_ops *ops; 35762306a36Sopenharmony_ci phys_addr_t phys_base; 35862306a36Sopenharmony_ci size_t addr_size; 35962306a36Sopenharmony_ci size_t page_size; 36062306a36Sopenharmony_ci u8 bar_to_atu[PCI_STD_NUM_BARS]; 36162306a36Sopenharmony_ci phys_addr_t *outbound_addr; 36262306a36Sopenharmony_ci unsigned long *ib_window_map; 36362306a36Sopenharmony_ci unsigned long *ob_window_map; 36462306a36Sopenharmony_ci void __iomem *msi_mem; 36562306a36Sopenharmony_ci phys_addr_t msi_mem_phys; 36662306a36Sopenharmony_ci struct pci_epf_bar *epf_bar[PCI_STD_NUM_BARS]; 36762306a36Sopenharmony_ci}; 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_cistruct dw_pcie_ops { 37062306a36Sopenharmony_ci u64 (*cpu_addr_fixup)(struct dw_pcie *pcie, u64 cpu_addr); 37162306a36Sopenharmony_ci u32 (*read_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 37262306a36Sopenharmony_ci size_t size); 37362306a36Sopenharmony_ci void (*write_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 37462306a36Sopenharmony_ci size_t size, u32 val); 37562306a36Sopenharmony_ci void (*write_dbi2)(struct dw_pcie *pcie, void __iomem *base, u32 reg, 37662306a36Sopenharmony_ci size_t size, u32 val); 37762306a36Sopenharmony_ci int (*link_up)(struct dw_pcie *pcie); 37862306a36Sopenharmony_ci enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); 37962306a36Sopenharmony_ci int (*start_link)(struct dw_pcie *pcie); 38062306a36Sopenharmony_ci void (*stop_link)(struct dw_pcie *pcie); 38162306a36Sopenharmony_ci}; 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_cistruct dw_pcie { 38462306a36Sopenharmony_ci struct device *dev; 38562306a36Sopenharmony_ci void __iomem *dbi_base; 38662306a36Sopenharmony_ci void __iomem *dbi_base2; 38762306a36Sopenharmony_ci void __iomem *atu_base; 38862306a36Sopenharmony_ci size_t atu_size; 38962306a36Sopenharmony_ci u32 num_ib_windows; 39062306a36Sopenharmony_ci u32 num_ob_windows; 39162306a36Sopenharmony_ci u32 region_align; 39262306a36Sopenharmony_ci u64 region_limit; 39362306a36Sopenharmony_ci struct dw_pcie_rp pp; 39462306a36Sopenharmony_ci struct dw_pcie_ep ep; 39562306a36Sopenharmony_ci const struct dw_pcie_ops *ops; 39662306a36Sopenharmony_ci u32 version; 39762306a36Sopenharmony_ci u32 type; 39862306a36Sopenharmony_ci unsigned long caps; 39962306a36Sopenharmony_ci int num_lanes; 40062306a36Sopenharmony_ci int link_gen; 40162306a36Sopenharmony_ci u8 n_fts[2]; 40262306a36Sopenharmony_ci struct dw_edma_chip edma; 40362306a36Sopenharmony_ci struct clk_bulk_data app_clks[DW_PCIE_NUM_APP_CLKS]; 40462306a36Sopenharmony_ci struct clk_bulk_data core_clks[DW_PCIE_NUM_CORE_CLKS]; 40562306a36Sopenharmony_ci struct reset_control_bulk_data app_rsts[DW_PCIE_NUM_APP_RSTS]; 40662306a36Sopenharmony_ci struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; 40762306a36Sopenharmony_ci struct gpio_desc *pe_rst; 40862306a36Sopenharmony_ci bool suspended; 40962306a36Sopenharmony_ci}; 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci#define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci#define to_dw_pcie_from_ep(endpoint) \ 41462306a36Sopenharmony_ci container_of((endpoint), struct dw_pcie, ep) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ciint dw_pcie_get_resources(struct dw_pcie *pci); 41762306a36Sopenharmony_ci 41862306a36Sopenharmony_civoid dw_pcie_version_detect(struct dw_pcie *pci); 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ciu8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap); 42162306a36Sopenharmony_ciu16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap); 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ciint dw_pcie_read(void __iomem *addr, int size, u32 *val); 42462306a36Sopenharmony_ciint dw_pcie_write(void __iomem *addr, int size, u32 val); 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_ciu32 dw_pcie_read_dbi(struct dw_pcie *pci, u32 reg, size_t size); 42762306a36Sopenharmony_civoid dw_pcie_write_dbi(struct dw_pcie *pci, u32 reg, size_t size, u32 val); 42862306a36Sopenharmony_civoid dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val); 42962306a36Sopenharmony_ciint dw_pcie_link_up(struct dw_pcie *pci); 43062306a36Sopenharmony_civoid dw_pcie_upconfig_setup(struct dw_pcie *pci); 43162306a36Sopenharmony_ciint dw_pcie_wait_for_link(struct dw_pcie *pci); 43262306a36Sopenharmony_ciint dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, 43362306a36Sopenharmony_ci u64 cpu_addr, u64 pci_addr, u64 size); 43462306a36Sopenharmony_ciint dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index, 43562306a36Sopenharmony_ci int type, u64 cpu_addr, u64 pci_addr, u64 size); 43662306a36Sopenharmony_ciint dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int type, 43762306a36Sopenharmony_ci u64 cpu_addr, u64 pci_addr, u64 size); 43862306a36Sopenharmony_ciint dw_pcie_prog_ep_inbound_atu(struct dw_pcie *pci, u8 func_no, int index, 43962306a36Sopenharmony_ci int type, u64 cpu_addr, u8 bar); 44062306a36Sopenharmony_civoid dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index); 44162306a36Sopenharmony_civoid dw_pcie_setup(struct dw_pcie *pci); 44262306a36Sopenharmony_civoid dw_pcie_iatu_detect(struct dw_pcie *pci); 44362306a36Sopenharmony_ciint dw_pcie_edma_detect(struct dw_pcie *pci); 44462306a36Sopenharmony_civoid dw_pcie_edma_remove(struct dw_pcie *pci); 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ciint dw_pcie_suspend_noirq(struct dw_pcie *pci); 44762306a36Sopenharmony_ciint dw_pcie_resume_noirq(struct dw_pcie *pci); 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_cistatic inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val) 45062306a36Sopenharmony_ci{ 45162306a36Sopenharmony_ci dw_pcie_write_dbi(pci, reg, 0x4, val); 45262306a36Sopenharmony_ci} 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_cistatic inline u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg) 45562306a36Sopenharmony_ci{ 45662306a36Sopenharmony_ci return dw_pcie_read_dbi(pci, reg, 0x4); 45762306a36Sopenharmony_ci} 45862306a36Sopenharmony_ci 45962306a36Sopenharmony_cistatic inline void dw_pcie_writew_dbi(struct dw_pcie *pci, u32 reg, u16 val) 46062306a36Sopenharmony_ci{ 46162306a36Sopenharmony_ci dw_pcie_write_dbi(pci, reg, 0x2, val); 46262306a36Sopenharmony_ci} 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_cistatic inline u16 dw_pcie_readw_dbi(struct dw_pcie *pci, u32 reg) 46562306a36Sopenharmony_ci{ 46662306a36Sopenharmony_ci return dw_pcie_read_dbi(pci, reg, 0x2); 46762306a36Sopenharmony_ci} 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_cistatic inline void dw_pcie_writeb_dbi(struct dw_pcie *pci, u32 reg, u8 val) 47062306a36Sopenharmony_ci{ 47162306a36Sopenharmony_ci dw_pcie_write_dbi(pci, reg, 0x1, val); 47262306a36Sopenharmony_ci} 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_cistatic inline u8 dw_pcie_readb_dbi(struct dw_pcie *pci, u32 reg) 47562306a36Sopenharmony_ci{ 47662306a36Sopenharmony_ci return dw_pcie_read_dbi(pci, reg, 0x1); 47762306a36Sopenharmony_ci} 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_cistatic inline void dw_pcie_writel_dbi2(struct dw_pcie *pci, u32 reg, u32 val) 48062306a36Sopenharmony_ci{ 48162306a36Sopenharmony_ci dw_pcie_write_dbi2(pci, reg, 0x4, val); 48262306a36Sopenharmony_ci} 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_cistatic inline void dw_pcie_dbi_ro_wr_en(struct dw_pcie *pci) 48562306a36Sopenharmony_ci{ 48662306a36Sopenharmony_ci u32 reg; 48762306a36Sopenharmony_ci u32 val; 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci reg = PCIE_MISC_CONTROL_1_OFF; 49062306a36Sopenharmony_ci val = dw_pcie_readl_dbi(pci, reg); 49162306a36Sopenharmony_ci val |= PCIE_DBI_RO_WR_EN; 49262306a36Sopenharmony_ci dw_pcie_writel_dbi(pci, reg, val); 49362306a36Sopenharmony_ci} 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_cistatic inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci) 49662306a36Sopenharmony_ci{ 49762306a36Sopenharmony_ci u32 reg; 49862306a36Sopenharmony_ci u32 val; 49962306a36Sopenharmony_ci 50062306a36Sopenharmony_ci reg = PCIE_MISC_CONTROL_1_OFF; 50162306a36Sopenharmony_ci val = dw_pcie_readl_dbi(pci, reg); 50262306a36Sopenharmony_ci val &= ~PCIE_DBI_RO_WR_EN; 50362306a36Sopenharmony_ci dw_pcie_writel_dbi(pci, reg, val); 50462306a36Sopenharmony_ci} 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_cistatic inline int dw_pcie_start_link(struct dw_pcie *pci) 50762306a36Sopenharmony_ci{ 50862306a36Sopenharmony_ci if (pci->ops && pci->ops->start_link) 50962306a36Sopenharmony_ci return pci->ops->start_link(pci); 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_ci return 0; 51262306a36Sopenharmony_ci} 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_cistatic inline void dw_pcie_stop_link(struct dw_pcie *pci) 51562306a36Sopenharmony_ci{ 51662306a36Sopenharmony_ci if (pci->ops && pci->ops->stop_link) 51762306a36Sopenharmony_ci pci->ops->stop_link(pci); 51862306a36Sopenharmony_ci} 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_cistatic inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) 52162306a36Sopenharmony_ci{ 52262306a36Sopenharmony_ci u32 val; 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ci if (pci->ops && pci->ops->get_ltssm) 52562306a36Sopenharmony_ci return pci->ops->get_ltssm(pci); 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ci val = dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0); 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci return (enum dw_pcie_ltssm)FIELD_GET(PORT_LOGIC_LTSSM_STATE_MASK, val); 53062306a36Sopenharmony_ci} 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci#ifdef CONFIG_PCIE_DW_HOST 53362306a36Sopenharmony_ciirqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp); 53462306a36Sopenharmony_ciint dw_pcie_setup_rc(struct dw_pcie_rp *pp); 53562306a36Sopenharmony_ciint dw_pcie_host_init(struct dw_pcie_rp *pp); 53662306a36Sopenharmony_civoid dw_pcie_host_deinit(struct dw_pcie_rp *pp); 53762306a36Sopenharmony_ciint dw_pcie_allocate_domains(struct dw_pcie_rp *pp); 53862306a36Sopenharmony_civoid __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn, 53962306a36Sopenharmony_ci int where); 54062306a36Sopenharmony_ci#else 54162306a36Sopenharmony_cistatic inline irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp) 54262306a36Sopenharmony_ci{ 54362306a36Sopenharmony_ci return IRQ_NONE; 54462306a36Sopenharmony_ci} 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_cistatic inline int dw_pcie_setup_rc(struct dw_pcie_rp *pp) 54762306a36Sopenharmony_ci{ 54862306a36Sopenharmony_ci return 0; 54962306a36Sopenharmony_ci} 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_cistatic inline int dw_pcie_host_init(struct dw_pcie_rp *pp) 55262306a36Sopenharmony_ci{ 55362306a36Sopenharmony_ci return 0; 55462306a36Sopenharmony_ci} 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_cistatic inline void dw_pcie_host_deinit(struct dw_pcie_rp *pp) 55762306a36Sopenharmony_ci{ 55862306a36Sopenharmony_ci} 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_cistatic inline int dw_pcie_allocate_domains(struct dw_pcie_rp *pp) 56162306a36Sopenharmony_ci{ 56262306a36Sopenharmony_ci return 0; 56362306a36Sopenharmony_ci} 56462306a36Sopenharmony_cistatic inline void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, 56562306a36Sopenharmony_ci unsigned int devfn, 56662306a36Sopenharmony_ci int where) 56762306a36Sopenharmony_ci{ 56862306a36Sopenharmony_ci return NULL; 56962306a36Sopenharmony_ci} 57062306a36Sopenharmony_ci#endif 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci#ifdef CONFIG_PCIE_DW_EP 57362306a36Sopenharmony_civoid dw_pcie_ep_linkup(struct dw_pcie_ep *ep); 57462306a36Sopenharmony_ciint dw_pcie_ep_init(struct dw_pcie_ep *ep); 57562306a36Sopenharmony_ciint dw_pcie_ep_init_complete(struct dw_pcie_ep *ep); 57662306a36Sopenharmony_civoid dw_pcie_ep_init_notify(struct dw_pcie_ep *ep); 57762306a36Sopenharmony_civoid dw_pcie_ep_exit(struct dw_pcie_ep *ep); 57862306a36Sopenharmony_ciint dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no); 57962306a36Sopenharmony_ciint dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, 58062306a36Sopenharmony_ci u8 interrupt_num); 58162306a36Sopenharmony_ciint dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, 58262306a36Sopenharmony_ci u16 interrupt_num); 58362306a36Sopenharmony_ciint dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no, 58462306a36Sopenharmony_ci u16 interrupt_num); 58562306a36Sopenharmony_civoid dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar); 58662306a36Sopenharmony_cistruct dw_pcie_ep_func * 58762306a36Sopenharmony_cidw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no); 58862306a36Sopenharmony_ci#else 58962306a36Sopenharmony_cistatic inline void dw_pcie_ep_linkup(struct dw_pcie_ep *ep) 59062306a36Sopenharmony_ci{ 59162306a36Sopenharmony_ci} 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_cistatic inline int dw_pcie_ep_init(struct dw_pcie_ep *ep) 59462306a36Sopenharmony_ci{ 59562306a36Sopenharmony_ci return 0; 59662306a36Sopenharmony_ci} 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_cistatic inline int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep) 59962306a36Sopenharmony_ci{ 60062306a36Sopenharmony_ci return 0; 60162306a36Sopenharmony_ci} 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_cistatic inline void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep) 60462306a36Sopenharmony_ci{ 60562306a36Sopenharmony_ci} 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_cistatic inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep) 60862306a36Sopenharmony_ci{ 60962306a36Sopenharmony_ci} 61062306a36Sopenharmony_ci 61162306a36Sopenharmony_cistatic inline int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no) 61262306a36Sopenharmony_ci{ 61362306a36Sopenharmony_ci return 0; 61462306a36Sopenharmony_ci} 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_cistatic inline int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, 61762306a36Sopenharmony_ci u8 interrupt_num) 61862306a36Sopenharmony_ci{ 61962306a36Sopenharmony_ci return 0; 62062306a36Sopenharmony_ci} 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_cistatic inline int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, 62362306a36Sopenharmony_ci u16 interrupt_num) 62462306a36Sopenharmony_ci{ 62562306a36Sopenharmony_ci return 0; 62662306a36Sopenharmony_ci} 62762306a36Sopenharmony_ci 62862306a36Sopenharmony_cistatic inline int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, 62962306a36Sopenharmony_ci u8 func_no, 63062306a36Sopenharmony_ci u16 interrupt_num) 63162306a36Sopenharmony_ci{ 63262306a36Sopenharmony_ci return 0; 63362306a36Sopenharmony_ci} 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_cistatic inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) 63662306a36Sopenharmony_ci{ 63762306a36Sopenharmony_ci} 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_cistatic inline struct dw_pcie_ep_func * 64062306a36Sopenharmony_cidw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no) 64162306a36Sopenharmony_ci{ 64262306a36Sopenharmony_ci return NULL; 64362306a36Sopenharmony_ci} 64462306a36Sopenharmony_ci#endif 64562306a36Sopenharmony_ci#endif /* _PCIE_DESIGNWARE_H */ 646