/* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * Copyright (C) 2011~2013 Lei Chuanhua */ /** \defgroup IFX_PCIE_EP_VRX320 PCIE EP Functions Reference This chapter describes the entire interfaces to the PCIE EP interface. */ #ifndef LANTIQ_PCIE_H #define LANTIQ_PCIE_H #include #include /* @{ */ /*! \def IFX_PCIE_EP_MAX_PEER \brief how many EP partners existed. In most cases, this number should be one for bonding application For the future extension, it could be bigger value. For example, multiple bonding */ #define IFX_PCIE_EP_MAX_PEER 1 /** Structure used to specify interrupt source so that EP can assign unique interruot to it */ typedef enum ltq_pcie_ep_int_module { IFX_PCIE_EP_INT_PPE, /*!< PPE2HOST_INT 0/1 */ IFX_PCIE_EP_INT_MEI, /*!< DSL MEI_IRQ */ IFX_PCIE_EP_INT_DYING_GASP, /*!< DSL Dying_Gasp */ IFX_PCIE_EP_INT_EDMA, /*!< PCIe eDMA */ IFX_PCIE_EP_INT_FPI_BCU, /*!< FPI BUC */ IFX_PCIE_EP_INT_ARC_LED0, /*!< ARC LED0 */ IFX_PCIE_EP_INT_ARC_LED1, /*!< ARC LED1 */ IFX_PCIE_EP_INT_DMA, /*!< Central DMA */ IFX_PCIE_EP_INT_MODULE_MAX, } ltq_pcie_ep_int_module_t; /** Structure used to extract attached EP detailed information for PPE/DSL_MEI driver/Bonding */ typedef struct pcie_ep_dev { u32 irq; /*!< MSI interrupt number for this device */ /*!< The EP inbound memory base address derived from BAR0, SoC virtual address for PPE/DSL_MEI driver */ u8 __iomem *membase; u32 phy_membase; /*!< The EP inbound memory base address derived from BAR0, physical address for PPE FW */ u32 peer_num; /*!< Bonding peer number available */ /*!< The bonding peer EP inbound memory base address derived from its BAR0, SoC virtual address for PPE/DSL_MEI driver */ u8 __iomem *peer_membase[IFX_PCIE_EP_MAX_PEER]; /*!< The bonding peer EP inbound memory base address derived from its BAR0, physical address for PPE FW */ u32 peer_phy_membase[IFX_PCIE_EP_MAX_PEER]; } ltq_pcie_ep_dev_t; /** This function returns the total number of EPs attached. Normally, the number should be one or two . Extended case is also considered \param[in/out] dev_num Pointer to detected EP numbers in total. \return -EIO Invalid total EP number which means this module is not initialized properly \return 0 Successfully return the detected EP numbers */ int ltq_pcie_ep_dev_num_get(int *dev_num); /** This function returns detailed EP device information for PPE/DSL/Bonding partner by its logical index obtained by \ref ltq_pcie_ep_dev_num_get and its interrupt module number \ref ltq_pcie_ep_int_module_t \param[in] dev_idx Logical device index referred to the related device \param[in] module EP interrupt module user \param[in/out] dev Pointer to returned detail device structure \ref ltq_pcie_ep_dev_t \return -EIO Invalid logical device index or too many modules referred to this module \return 0 Successfully return required device information \remarks This function normally will be called to trace the detailed device information after calling \ref ltq_pcie_ep_dev_num_get */ int ltq_pcie_ep_dev_info_req(int dev_idx, ltq_pcie_ep_int_module_t module, ltq_pcie_ep_dev_t *dev); /** This function releases the usage of this module by PPE/DSL \param[in] dev_idx Logical device index referred to the related device \return -EIO Invalid logical device index or release too many times to refer to this module \return 0 Successfully release the usage of this module \remarks This function should be called once their reference is over. The reference usage must matches \ref ltq_pcie_ep_dev_info_req */ int ltq_pcie_ep_dev_info_release(int dev_idx); /* @} */ #endif /* LANTIQ_PCIE_H */