Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Synopsys DesignWare PCIe host controller driver
0004  *
0005  * Copyright (C) 2013 Samsung Electronics Co., Ltd.
0006  *      https://www.samsung.com
0007  *
0008  * Author: Jingoo Han <jg1.han@samsung.com>
0009  */
0010 
0011 #ifndef _PCIE_DESIGNWARE_H
0012 #define _PCIE_DESIGNWARE_H
0013 
0014 #include <linux/bitfield.h>
0015 #include <linux/dma-mapping.h>
0016 #include <linux/irq.h>
0017 #include <linux/msi.h>
0018 #include <linux/pci.h>
0019 
0020 #include <linux/pci-epc.h>
0021 #include <linux/pci-epf.h>
0022 
0023 /* DWC PCIe IP-core versions (native support since v4.70a) */
0024 #define DW_PCIE_VER_365A        0x3336352a
0025 #define DW_PCIE_VER_460A        0x3436302a
0026 #define DW_PCIE_VER_470A        0x3437302a
0027 #define DW_PCIE_VER_480A        0x3438302a
0028 #define DW_PCIE_VER_490A        0x3439302a
0029 #define DW_PCIE_VER_520A        0x3532302a
0030 
0031 #define __dw_pcie_ver_cmp(_pci, _ver, _op) \
0032     ((_pci)->version _op DW_PCIE_VER_ ## _ver)
0033 
0034 #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
0035 
0036 #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
0037 
0038 #define dw_pcie_ver_type_is(_pci, _ver, _type) \
0039     (__dw_pcie_ver_cmp(_pci, _ver, ==) && \
0040      __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
0041 
0042 #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
0043     (__dw_pcie_ver_cmp(_pci, _ver, ==) && \
0044      __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
0045 
0046 /* Parameters for the waiting for link up routine */
0047 #define LINK_WAIT_MAX_RETRIES       10
0048 #define LINK_WAIT_USLEEP_MIN        90000
0049 #define LINK_WAIT_USLEEP_MAX        100000
0050 
0051 /* Parameters for the waiting for iATU enabled routine */
0052 #define LINK_WAIT_MAX_IATU_RETRIES  5
0053 #define LINK_WAIT_IATU          9
0054 
0055 /* Synopsys-specific PCIe configuration registers */
0056 #define PCIE_PORT_AFR           0x70C
0057 #define PORT_AFR_N_FTS_MASK     GENMASK(15, 8)
0058 #define PORT_AFR_N_FTS(n)       FIELD_PREP(PORT_AFR_N_FTS_MASK, n)
0059 #define PORT_AFR_CC_N_FTS_MASK      GENMASK(23, 16)
0060 #define PORT_AFR_CC_N_FTS(n)        FIELD_PREP(PORT_AFR_CC_N_FTS_MASK, n)
0061 #define PORT_AFR_ENTER_ASPM     BIT(30)
0062 #define PORT_AFR_L0S_ENTRANCE_LAT_SHIFT 24
0063 #define PORT_AFR_L0S_ENTRANCE_LAT_MASK  GENMASK(26, 24)
0064 #define PORT_AFR_L1_ENTRANCE_LAT_SHIFT  27
0065 #define PORT_AFR_L1_ENTRANCE_LAT_MASK   GENMASK(29, 27)
0066 
0067 #define PCIE_PORT_LINK_CONTROL      0x710
0068 #define PORT_LINK_DLL_LINK_EN       BIT(5)
0069 #define PORT_LINK_FAST_LINK_MODE    BIT(7)
0070 #define PORT_LINK_MODE_MASK     GENMASK(21, 16)
0071 #define PORT_LINK_MODE(n)       FIELD_PREP(PORT_LINK_MODE_MASK, n)
0072 #define PORT_LINK_MODE_1_LANES      PORT_LINK_MODE(0x1)
0073 #define PORT_LINK_MODE_2_LANES      PORT_LINK_MODE(0x3)
0074 #define PORT_LINK_MODE_4_LANES      PORT_LINK_MODE(0x7)
0075 #define PORT_LINK_MODE_8_LANES      PORT_LINK_MODE(0xf)
0076 
0077 #define PCIE_PORT_DEBUG0        0x728
0078 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f
0079 #define PORT_LOGIC_LTSSM_STATE_L0   0x11
0080 #define PCIE_PORT_DEBUG1        0x72C
0081 #define PCIE_PORT_DEBUG1_LINK_UP        BIT(4)
0082 #define PCIE_PORT_DEBUG1_LINK_IN_TRAINING   BIT(29)
0083 
0084 #define PCIE_LINK_WIDTH_SPEED_CONTROL   0x80C
0085 #define PORT_LOGIC_N_FTS_MASK       GENMASK(7, 0)
0086 #define PORT_LOGIC_SPEED_CHANGE     BIT(17)
0087 #define PORT_LOGIC_LINK_WIDTH_MASK  GENMASK(12, 8)
0088 #define PORT_LOGIC_LINK_WIDTH(n)    FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n)
0089 #define PORT_LOGIC_LINK_WIDTH_1_LANES   PORT_LOGIC_LINK_WIDTH(0x1)
0090 #define PORT_LOGIC_LINK_WIDTH_2_LANES   PORT_LOGIC_LINK_WIDTH(0x2)
0091 #define PORT_LOGIC_LINK_WIDTH_4_LANES   PORT_LOGIC_LINK_WIDTH(0x4)
0092 #define PORT_LOGIC_LINK_WIDTH_8_LANES   PORT_LOGIC_LINK_WIDTH(0x8)
0093 
0094 #define PCIE_MSI_ADDR_LO        0x820
0095 #define PCIE_MSI_ADDR_HI        0x824
0096 #define PCIE_MSI_INTR0_ENABLE       0x828
0097 #define PCIE_MSI_INTR0_MASK     0x82C
0098 #define PCIE_MSI_INTR0_STATUS       0x830
0099 
0100 #define GEN3_RELATED_OFF            0x890
0101 #define GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL    BIT(0)
0102 #define GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS BIT(13)
0103 #define GEN3_RELATED_OFF_GEN3_EQ_DISABLE    BIT(16)
0104 #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT  24
0105 #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK   GENMASK(25, 24)
0106 
0107 #define PCIE_PORT_MULTI_LANE_CTRL   0x8C0
0108 #define PORT_MLTI_UPCFG_SUPPORT     BIT(7)
0109 
0110 #define PCIE_VERSION_NUMBER     0x8F8
0111 #define PCIE_VERSION_TYPE       0x8FC
0112 
0113 /*
0114  * iATU inbound and outbound windows CSRs. Before the IP-core v4.80a each
0115  * iATU region CSRs had been indirectly accessible by means of the dedicated
0116  * viewport selector. The iATU/eDMA CSRs space was re-designed in DWC PCIe
0117  * v4.80a in a way so the viewport was unrolled into the directly accessible
0118  * iATU/eDMA CSRs space.
0119  */
0120 #define PCIE_ATU_VIEWPORT       0x900
0121 #define PCIE_ATU_REGION_DIR_IB      BIT(31)
0122 #define PCIE_ATU_REGION_DIR_OB      0
0123 #define PCIE_ATU_VIEWPORT_BASE      0x904
0124 #define PCIE_ATU_UNROLL_BASE(dir, index) \
0125     (((index) << 9) | ((dir == PCIE_ATU_REGION_DIR_IB) ? BIT(8) : 0))
0126 #define PCIE_ATU_VIEWPORT_SIZE      0x2C
0127 #define PCIE_ATU_REGION_CTRL1       0x000
0128 #define PCIE_ATU_INCREASE_REGION_SIZE   BIT(13)
0129 #define PCIE_ATU_TYPE_MEM       0x0
0130 #define PCIE_ATU_TYPE_IO        0x2
0131 #define PCIE_ATU_TYPE_CFG0      0x4
0132 #define PCIE_ATU_TYPE_CFG1      0x5
0133 #define PCIE_ATU_TD         BIT(8)
0134 #define PCIE_ATU_FUNC_NUM(pf)           ((pf) << 20)
0135 #define PCIE_ATU_REGION_CTRL2       0x004
0136 #define PCIE_ATU_ENABLE         BIT(31)
0137 #define PCIE_ATU_BAR_MODE_ENABLE    BIT(30)
0138 #define PCIE_ATU_FUNC_NUM_MATCH_EN      BIT(19)
0139 #define PCIE_ATU_LOWER_BASE     0x008
0140 #define PCIE_ATU_UPPER_BASE     0x00C
0141 #define PCIE_ATU_LIMIT          0x010
0142 #define PCIE_ATU_LOWER_TARGET       0x014
0143 #define PCIE_ATU_BUS(x)         FIELD_PREP(GENMASK(31, 24), x)
0144 #define PCIE_ATU_DEV(x)         FIELD_PREP(GENMASK(23, 19), x)
0145 #define PCIE_ATU_FUNC(x)        FIELD_PREP(GENMASK(18, 16), x)
0146 #define PCIE_ATU_UPPER_TARGET       0x018
0147 #define PCIE_ATU_UPPER_LIMIT        0x020
0148 
0149 #define PCIE_MISC_CONTROL_1_OFF     0x8BC
0150 #define PCIE_DBI_RO_WR_EN       BIT(0)
0151 
0152 #define PCIE_MSIX_DOORBELL      0x948
0153 #define PCIE_MSIX_DOORBELL_PF_SHIFT 24
0154 
0155 #define PCIE_PL_CHK_REG_CONTROL_STATUS          0xB20
0156 #define PCIE_PL_CHK_REG_CHK_REG_START           BIT(0)
0157 #define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS      BIT(1)
0158 #define PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR    BIT(16)
0159 #define PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR     BIT(17)
0160 #define PCIE_PL_CHK_REG_CHK_REG_COMPLETE        BIT(18)
0161 
0162 #define PCIE_PL_CHK_REG_ERR_ADDR            0xB28
0163 
0164 /*
0165  * iATU Unroll-specific register definitions
0166  * From 4.80 core version the address translation will be made by unroll
0167  */
0168 #define PCIE_ATU_UNR_REGION_CTRL1   0x00
0169 #define PCIE_ATU_UNR_REGION_CTRL2   0x04
0170 #define PCIE_ATU_UNR_LOWER_BASE     0x08
0171 #define PCIE_ATU_UNR_UPPER_BASE     0x0C
0172 #define PCIE_ATU_UNR_LOWER_LIMIT    0x10
0173 #define PCIE_ATU_UNR_LOWER_TARGET   0x14
0174 #define PCIE_ATU_UNR_UPPER_TARGET   0x18
0175 #define PCIE_ATU_UNR_UPPER_LIMIT    0x20
0176 
0177 /*
0178  * RAS-DES register definitions
0179  */
0180 #define PCIE_RAS_DES_EVENT_COUNTER_CONTROL  0x8
0181 #define EVENT_COUNTER_ALL_CLEAR     0x3
0182 #define EVENT_COUNTER_ENABLE_ALL    0x7
0183 #define EVENT_COUNTER_ENABLE_SHIFT  2
0184 #define EVENT_COUNTER_EVENT_SEL_MASK    GENMASK(7, 0)
0185 #define EVENT_COUNTER_EVENT_SEL_SHIFT   16
0186 #define EVENT_COUNTER_EVENT_Tx_L0S  0x2
0187 #define EVENT_COUNTER_EVENT_Rx_L0S  0x3
0188 #define EVENT_COUNTER_EVENT_L1      0x5
0189 #define EVENT_COUNTER_EVENT_L1_1    0x7
0190 #define EVENT_COUNTER_EVENT_L1_2    0x8
0191 #define EVENT_COUNTER_GROUP_SEL_SHIFT   24
0192 #define EVENT_COUNTER_GROUP_5       0x5
0193 
0194 #define PCIE_RAS_DES_EVENT_COUNTER_DATA     0xc
0195 
0196 /*
0197  * The default address offset between dbi_base and atu_base. Root controller
0198  * drivers are not required to initialize atu_base if the offset matches this
0199  * default; the driver core automatically derives atu_base from dbi_base using
0200  * this offset, if atu_base not set.
0201  */
0202 #define DEFAULT_DBI_ATU_OFFSET (0x3 << 20)
0203 
0204 #define MAX_MSI_IRQS            256
0205 #define MAX_MSI_IRQS_PER_CTRL       32
0206 #define MAX_MSI_CTRLS           (MAX_MSI_IRQS / MAX_MSI_IRQS_PER_CTRL)
0207 #define MSI_REG_CTRL_BLOCK_SIZE     12
0208 #define MSI_DEF_NUM_VECTORS     32
0209 
0210 /* Maximum number of inbound/outbound iATUs */
0211 #define MAX_IATU_IN         256
0212 #define MAX_IATU_OUT            256
0213 
0214 struct dw_pcie;
0215 struct dw_pcie_rp;
0216 struct dw_pcie_ep;
0217 
0218 enum dw_pcie_device_mode {
0219     DW_PCIE_UNKNOWN_TYPE,
0220     DW_PCIE_EP_TYPE,
0221     DW_PCIE_LEG_EP_TYPE,
0222     DW_PCIE_RC_TYPE,
0223 };
0224 
0225 struct dw_pcie_host_ops {
0226     int (*host_init)(struct dw_pcie_rp *pp);
0227     void (*host_deinit)(struct dw_pcie_rp *pp);
0228     int (*msi_host_init)(struct dw_pcie_rp *pp);
0229 };
0230 
0231 struct dw_pcie_rp {
0232     bool            has_msi_ctrl:1;
0233     bool            cfg0_io_shared:1;
0234     u64         cfg0_base;
0235     void __iomem        *va_cfg0_base;
0236     u32         cfg0_size;
0237     resource_size_t     io_base;
0238     phys_addr_t     io_bus_addr;
0239     u32         io_size;
0240     int         irq;
0241     const struct dw_pcie_host_ops *ops;
0242     int         msi_irq[MAX_MSI_CTRLS];
0243     struct irq_domain   *irq_domain;
0244     struct irq_domain   *msi_domain;
0245     dma_addr_t      msi_data;
0246     struct page     *msi_page;
0247     struct irq_chip     *msi_irq_chip;
0248     u32         num_vectors;
0249     u32         irq_mask[MAX_MSI_CTRLS];
0250     struct pci_host_bridge  *bridge;
0251     raw_spinlock_t      lock;
0252     DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
0253 };
0254 
0255 struct dw_pcie_ep_ops {
0256     void    (*ep_init)(struct dw_pcie_ep *ep);
0257     int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no,
0258                  enum pci_epc_irq_type type, u16 interrupt_num);
0259     const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
0260     /*
0261      * Provide a method to implement the different func config space
0262      * access for different platform, if different func have different
0263      * offset, return the offset of func. if use write a register way
0264      * return a 0, and implement code in callback function of platform
0265      * driver.
0266      */
0267     unsigned int (*func_conf_select)(struct dw_pcie_ep *ep, u8 func_no);
0268 };
0269 
0270 struct dw_pcie_ep_func {
0271     struct list_head    list;
0272     u8          func_no;
0273     u8          msi_cap;    /* MSI capability offset */
0274     u8          msix_cap;   /* MSI-X capability offset */
0275 };
0276 
0277 struct dw_pcie_ep {
0278     struct pci_epc      *epc;
0279     struct list_head    func_list;
0280     const struct dw_pcie_ep_ops *ops;
0281     phys_addr_t     phys_base;
0282     size_t          addr_size;
0283     size_t          page_size;
0284     u8          bar_to_atu[PCI_STD_NUM_BARS];
0285     phys_addr_t     *outbound_addr;
0286     unsigned long       *ib_window_map;
0287     unsigned long       *ob_window_map;
0288     void __iomem        *msi_mem;
0289     phys_addr_t     msi_mem_phys;
0290     struct pci_epf_bar  *epf_bar[PCI_STD_NUM_BARS];
0291 };
0292 
0293 struct dw_pcie_ops {
0294     u64 (*cpu_addr_fixup)(struct dw_pcie *pcie, u64 cpu_addr);
0295     u32 (*read_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
0296                 size_t size);
0297     void    (*write_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
0298                  size_t size, u32 val);
0299     void    (*write_dbi2)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
0300                   size_t size, u32 val);
0301     int (*link_up)(struct dw_pcie *pcie);
0302     int (*start_link)(struct dw_pcie *pcie);
0303     void    (*stop_link)(struct dw_pcie *pcie);
0304 };
0305 
0306 struct dw_pcie {
0307     struct device       *dev;
0308     void __iomem        *dbi_base;
0309     void __iomem        *dbi_base2;
0310     void __iomem        *atu_base;
0311     size_t          atu_size;
0312     u32         num_ib_windows;
0313     u32         num_ob_windows;
0314     u32         region_align;
0315     u64         region_limit;
0316     struct dw_pcie_rp   pp;
0317     struct dw_pcie_ep   ep;
0318     const struct dw_pcie_ops *ops;
0319     u32         version;
0320     u32         type;
0321     int         num_lanes;
0322     int         link_gen;
0323     u8          n_fts[2];
0324     bool            iatu_unroll_enabled: 1;
0325 };
0326 
0327 #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp)
0328 
0329 #define to_dw_pcie_from_ep(endpoint)   \
0330         container_of((endpoint), struct dw_pcie, ep)
0331 
0332 void dw_pcie_version_detect(struct dw_pcie *pci);
0333 
0334 u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap);
0335 u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap);
0336 
0337 int dw_pcie_read(void __iomem *addr, int size, u32 *val);
0338 int dw_pcie_write(void __iomem *addr, int size, u32 val);
0339 
0340 u32 dw_pcie_read_dbi(struct dw_pcie *pci, u32 reg, size_t size);
0341 void dw_pcie_write_dbi(struct dw_pcie *pci, u32 reg, size_t size, u32 val);
0342 void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val);
0343 int dw_pcie_link_up(struct dw_pcie *pci);
0344 void dw_pcie_upconfig_setup(struct dw_pcie *pci);
0345 int dw_pcie_wait_for_link(struct dw_pcie *pci);
0346 int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type,
0347                   u64 cpu_addr, u64 pci_addr, u64 size);
0348 int dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index,
0349                  int type, u64 cpu_addr, u64 pci_addr, u64 size);
0350 int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 func_no, int index,
0351                  int type, u64 cpu_addr, u8 bar);
0352 void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index);
0353 void dw_pcie_setup(struct dw_pcie *pci);
0354 void dw_pcie_iatu_detect(struct dw_pcie *pci);
0355 
0356 static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
0357 {
0358     dw_pcie_write_dbi(pci, reg, 0x4, val);
0359 }
0360 
0361 static inline u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg)
0362 {
0363     return dw_pcie_read_dbi(pci, reg, 0x4);
0364 }
0365 
0366 static inline void dw_pcie_writew_dbi(struct dw_pcie *pci, u32 reg, u16 val)
0367 {
0368     dw_pcie_write_dbi(pci, reg, 0x2, val);
0369 }
0370 
0371 static inline u16 dw_pcie_readw_dbi(struct dw_pcie *pci, u32 reg)
0372 {
0373     return dw_pcie_read_dbi(pci, reg, 0x2);
0374 }
0375 
0376 static inline void dw_pcie_writeb_dbi(struct dw_pcie *pci, u32 reg, u8 val)
0377 {
0378     dw_pcie_write_dbi(pci, reg, 0x1, val);
0379 }
0380 
0381 static inline u8 dw_pcie_readb_dbi(struct dw_pcie *pci, u32 reg)
0382 {
0383     return dw_pcie_read_dbi(pci, reg, 0x1);
0384 }
0385 
0386 static inline void dw_pcie_writel_dbi2(struct dw_pcie *pci, u32 reg, u32 val)
0387 {
0388     dw_pcie_write_dbi2(pci, reg, 0x4, val);
0389 }
0390 
0391 static inline void dw_pcie_dbi_ro_wr_en(struct dw_pcie *pci)
0392 {
0393     u32 reg;
0394     u32 val;
0395 
0396     reg = PCIE_MISC_CONTROL_1_OFF;
0397     val = dw_pcie_readl_dbi(pci, reg);
0398     val |= PCIE_DBI_RO_WR_EN;
0399     dw_pcie_writel_dbi(pci, reg, val);
0400 }
0401 
0402 static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci)
0403 {
0404     u32 reg;
0405     u32 val;
0406 
0407     reg = PCIE_MISC_CONTROL_1_OFF;
0408     val = dw_pcie_readl_dbi(pci, reg);
0409     val &= ~PCIE_DBI_RO_WR_EN;
0410     dw_pcie_writel_dbi(pci, reg, val);
0411 }
0412 
0413 static inline int dw_pcie_start_link(struct dw_pcie *pci)
0414 {
0415     if (pci->ops && pci->ops->start_link)
0416         return pci->ops->start_link(pci);
0417 
0418     return 0;
0419 }
0420 
0421 static inline void dw_pcie_stop_link(struct dw_pcie *pci)
0422 {
0423     if (pci->ops && pci->ops->stop_link)
0424         pci->ops->stop_link(pci);
0425 }
0426 
0427 #ifdef CONFIG_PCIE_DW_HOST
0428 irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp);
0429 int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
0430 int dw_pcie_host_init(struct dw_pcie_rp *pp);
0431 void dw_pcie_host_deinit(struct dw_pcie_rp *pp);
0432 int dw_pcie_allocate_domains(struct dw_pcie_rp *pp);
0433 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
0434                        int where);
0435 #else
0436 static inline irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp)
0437 {
0438     return IRQ_NONE;
0439 }
0440 
0441 static inline int dw_pcie_setup_rc(struct dw_pcie_rp *pp)
0442 {
0443     return 0;
0444 }
0445 
0446 static inline int dw_pcie_host_init(struct dw_pcie_rp *pp)
0447 {
0448     return 0;
0449 }
0450 
0451 static inline void dw_pcie_host_deinit(struct dw_pcie_rp *pp)
0452 {
0453 }
0454 
0455 static inline int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
0456 {
0457     return 0;
0458 }
0459 static inline void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus,
0460                              unsigned int devfn,
0461                              int where)
0462 {
0463     return NULL;
0464 }
0465 #endif
0466 
0467 #ifdef CONFIG_PCIE_DW_EP
0468 void dw_pcie_ep_linkup(struct dw_pcie_ep *ep);
0469 int dw_pcie_ep_init(struct dw_pcie_ep *ep);
0470 int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep);
0471 void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep);
0472 void dw_pcie_ep_exit(struct dw_pcie_ep *ep);
0473 int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no);
0474 int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
0475                  u8 interrupt_num);
0476 int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
0477                  u16 interrupt_num);
0478 int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no,
0479                        u16 interrupt_num);
0480 void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar);
0481 struct dw_pcie_ep_func *
0482 dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no);
0483 #else
0484 static inline void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
0485 {
0486 }
0487 
0488 static inline int dw_pcie_ep_init(struct dw_pcie_ep *ep)
0489 {
0490     return 0;
0491 }
0492 
0493 static inline int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
0494 {
0495     return 0;
0496 }
0497 
0498 static inline void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep)
0499 {
0500 }
0501 
0502 static inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep)
0503 {
0504 }
0505 
0506 static inline int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no)
0507 {
0508     return 0;
0509 }
0510 
0511 static inline int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
0512                        u8 interrupt_num)
0513 {
0514     return 0;
0515 }
0516 
0517 static inline int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
0518                        u16 interrupt_num)
0519 {
0520     return 0;
0521 }
0522 
0523 static inline int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep,
0524                              u8 func_no,
0525                              u16 interrupt_num)
0526 {
0527     return 0;
0528 }
0529 
0530 static inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)
0531 {
0532 }
0533 
0534 static inline struct dw_pcie_ep_func *
0535 dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)
0536 {
0537     return NULL;
0538 }
0539 #endif
0540 #endif /* _PCIE_DESIGNWARE_H */