| /* |
| <:copyright-BRCM:2016:DUAL/GPL:standard |
| |
| Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| All Rights Reserved |
| |
| Unless you and Broadcom execute a separate written software license |
| agreement governing use of this software, this software is licensed |
| to you under the terms of the GNU General Public License version 2 |
| (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| with the following added to such license: |
| |
| As a special exception, the copyright holders of this software give |
| you permission to link this software with independent modules, and |
| to copy and distribute the resulting executable under terms of your |
| choice, provided that you also meet, for each linked independent |
| module, the terms and conditions of the license of that module. |
| An independent module is a module which is not derived from this |
| software. The special exception does not apply to any modifications |
| of the software. |
| |
| Not withstanding the above, under no circumstances may you combine |
| this software in any way with any other Broadcom software provided |
| under a license other than the GPL, without Broadcom's express prior |
| written consent. |
| |
| :> |
| */ |
| |
| /* |
| * bcm_llpcie.h - Low-level PCIe driver interface |
| */ |
| |
| #ifndef BCMOLT_LLPCIE_H_ |
| #define BCMOLT_LLPCIE_H_ |
| |
| #include "bcmos_system.h" |
| #define BCMOLT_MAX_MAPLE_DEVICES 2 /* 5 */ |
| |
| /** Low-level device info */ |
| typedef struct bcmolt_ll_dev_info |
| { |
| unsigned long soc_regs_base; /**< Device registers base in host address space */ |
| unsigned long soc_sram_base; /**< Device SRAM base in host address space */ |
| unsigned long soc_ddr_base; /**< Device DDR base in host address space */ |
| uint32_t soc_ddr_length; /**< Device DDR window size */ |
| uint32_t irq; /**< Device irq number */ |
| } bcm_ll_dev_info; |
| |
| /** Device PCIe link status change notification callback */ |
| typedef enum |
| { |
| BCM_LL_PCIE_LINK_DOWN, /**< PCIe link is down */ |
| BCM_LL_PCIE_LINK_UP, /**< PCIe link is up */ |
| } bcm_ll_pcie_link_status; |
| |
| /** Low-level device handle */ |
| typedef void *bcm_ll_pcie_dev; |
| |
| /** Status change indication */ |
| typedef void (*bcm_ll_pcie_status_change)(uint8_t dev_id, bcm_ll_pcie_link_status status); |
| |
| /** Register status change notification callback |
| * \param[in] cb Status change notification callback |
| * \return 0=OK or error <0 |
| */ |
| bcmos_errno bcm_ll_pcie_status_change_register(bcm_ll_pcie_status_change cb); |
| |
| /** Unregister status change notification callback |
| * \return 0=OK or error <0 |
| */ |
| bcmos_errno bcm_ll_pcie_status_change_unregister(void); |
| |
| /** Query PCIe device |
| * \param[in] dev_id Device id |
| * \param[out] info Device info |
| * \return 0=OK, BCM_ERR_IO-dev_id is in proper range, but link is down |
| */ |
| bcmos_errno bcm_ll_pcie_query(uint8_t dev_id, bcm_ll_dev_info *info); |
| |
| /** Get low-level device handle |
| * \param[in] dev_id Device id |
| * \param[out] lldev Low-level device handle |
| * \return device handle or NULL if link is down |
| */ |
| bcm_ll_pcie_dev bcm_ll_pcie_dev_get(uint8_t dev_id); |
| |
| /** Enable/disable host reset for all PCIe interfaces (automatic |
| * device reset when host is reset) |
| * \param[in] enabled Whether or not hot reset should be enabled |
| * \return 0=OK or error <0 |
| */ |
| bcmos_errno bcm_ll_pcie_host_reset_enable(uint8_t dev_id, bcmos_bool enabled); |
| |
| #ifdef TX_ENABLE_EVENT_TRACE |
| /** Handle low-level trace on target |
| * \param[in] dev_id Device id |
| * \param[in] lfile name for trace |
| * \return device handle or NULL if link is down |
| */ |
| bcmos_errno bcm_ll_pcie_setrace(uint8_t dev_id); |
| bcmos_errno bcm_ll_pcie_cleartrace(uint8_t dev_id); |
| bcmos_errno bcm_ll_pcie_savetrace(uint8_t dev_id, char *tracefilename); |
| #endif |
| #endif |