merlin16_pcieg3_config.h (13282B)
1 /*********************************************************************************** 2 *********************************************************************************** 3 * * 4 * Revision : * 5 * * 6 * Description : Config functions targeted to IP user * 7 * * 8 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 9 * 10 * Copyright 2007-2019 Broadcom Inc. All rights reserved. * 11 * No portions of this material may be reproduced in any form without * 12 * the written permission of: * 13 * Broadcom Corporation * 14 * 5300 California Avenue * 15 * Irvine, CA 92617 * 16 * * 17 * All information contained in this document is Broadcom Corporation * 18 * company private proprietary, and trade secret. * 19 */ 20 21 /** @file merlin16_pcieg3_config.h 22 * Configuration functions provided to IP User 23 */ 24 25 #ifndef MERLIN16_PCIEG3_API_CONFIG_H 26 #define MERLIN16_PCIEG3_API_CONFIG_H 27 28 #include "merlin16_pcieg3_ipconfig.h" 29 #include "common/srds_api_enum.h" 30 #include "common/srds_api_err_code.h" 31 #include "common/srds_api_types.h" 32 #include "merlin16_pcieg3_enum.h" 33 #include "merlin16_pcieg3_types.h" 34 #include "merlin16_pcieg3_select_defns.h" 35 #include "merlin16_pcieg3_access.h" 36 37 /****************************************************/ 38 /* CORE Based APIs - Required to be used per Core */ 39 /****************************************************/ 40 /* Returns API Version Number */ 41 /** API Version Number. 42 * @param *api_version API Version Number returned by the API 43 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 44 */ 45 err_code_t merlin16_pcieg3_version(uint32_t *api_version); 46 47 #define GRACEFUL_STOP_TIME 200 48 49 50 51 /*-----------------------------------*/ 52 /* Microcode Load/Verify Functions */ 53 /*-----------------------------------*/ 54 55 /** Load Microcode into Micro through Register (MDIO) Interface. 56 * Once the microcode is loaded, de-assert reset to 8051 to start executing microcode "wrc_micro_mdio_dw8051_reset_n(0x1)". 57 * \n Note: Micro should be loaded only after issuing a merlin16_pcieg3_uc_reset(1) followed by asserting and de-asserting 58 * core_s_reset. Information table should be intialized with merlin16_pcieg3_init_merlin16_pcieg3_info after microcode load. 59 * See relevant Programmers guide for more details. 60 * @param sa__ is an opaque state vector passed through to device access functions. 61 * @param *ucode_image pointer to the Microcode image organized in bytes 62 * @param ucode_len Length of Microcode Image (number of bytes) 63 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 64 */ 65 err_code_t merlin16_pcieg3_ucode_mdio_load(srds_access_t *sa__, uint8_t *ucode_image, uint16_t ucode_len); 66 67 /** To verify the Microcode image loaded in the Micro. 68 * Read back the microcode from Micro and check against expected microcode image. 69 * @param sa__ is an opaque state vector passed through to device access functions. 70 * @param *ucode_image pointer to the expeted Microcode image organized in bytes 71 * @param ucode_len Length of Microcode Image (number of bytes) 72 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 73 */ 74 err_code_t merlin16_pcieg3_ucode_load_verify(srds_access_t *sa__, uint8_t *ucode_image, uint16_t ucode_len); 75 76 /** To verify the CRC of the microcode loaded in the Micro. 77 * Instruct uC to read image and calculate CRC and check against expected CRC. 78 * @param sa__ is an opaque state vector passed through to device access functions. 79 * @param ucode_len Length of Microcode Image (number of bytes) 80 * @param expected_crc_value Expected CRC value of the microcode 81 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 82 */ 83 err_code_t merlin16_pcieg3_ucode_crc_verify(srds_access_t *sa__, uint16_t ucode_len, uint16_t expected_crc_value); 84 85 /** To instruct the micro to start calculating the CRC of the microcode. 86 * Instruct uC to read image and calculate CRC. 87 * Control is returned after triggering start of CRC calculation (does NOT wait for completion of CRC calculation). \n \n 88 * NOTE: No uC commands should be executed between starting the CRC calculaion [merlin16_pcieg3_ucode_crc_verify()] and verifying the CRC value [merlin16_pcieg3_start_ucode_crc_calc()]. 89 * @param sa__ is an opaque state vector passed through to device access functions. 90 * @param ucode_len Length of Microcode Image (number of bytes) 91 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 92 */ 93 err_code_t merlin16_pcieg3_start_ucode_crc_calc(srds_access_t *sa__, uint16_t ucode_len); 94 95 /** To check the expected CRC against the CRC calulated by the micro. 96 * NOTE: No uC commands should be executed between starting the CRC calculation [merlin16_pcieg3_ucode_crc_verify()] and verifying the CRC value [merlin16_pcieg3_start_ucode_crc_calc()]. 97 * @param sa__ is an opaque state vector passed through to device access functions. 98 * @param expected_crc_value Expected CRC value of the microcode 99 * @param timeout_ms Time interval in milliseconds inside which the previous command (calculate CRC) should be completed 100 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 101 */ 102 err_code_t merlin16_pcieg3_check_ucode_crc(srds_access_t *sa__, uint16_t expected_crc_value, uint32_t timeout_ms); 103 104 /** Load the Micro through the pram bus. 105 * NOTE: Information table should be intialized with merlin16_pcieg3_init_merlin16_pcieg3_info after microcode load. 106 * @param sa__ is an opaque state vector passed through to device access functions. 107 * @param ucode_image Microcode Image to be written 108 * @param ucode_len Length of Microcode Image (number of bytes) 109 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 110 */ 111 err_code_t merlin16_pcieg3_ucode_pram_load(srds_access_t *sa__, char const * ucode_image, uint16_t ucode_len); 112 113 /** Enable or Disable the uC reset. 114 * Note: Micro should be reset using the API everytime before reloading the microcode 115 * @param sa__ is an opaque state vector passed through to device access functions. 116 * @param enable Enable/Disable uC reset (1 = Enable; 0 = Disable) 117 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 118 */ 119 err_code_t merlin16_pcieg3_uc_reset(srds_access_t *sa__, uint8_t enable); 120 121 122 123 /** Initialize the merlin16_pcieg3_info for the uC. 124 * @param sa__ is an opaque state vector passed through to device access functions. 125 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 126 */ 127 err_code_t merlin16_pcieg3_init_merlin16_pcieg3_info(srds_access_t *sa__); 128 129 130 /**************************************************/ 131 /* LANE Based APIs - Required to be used per Lane */ 132 /**************************************************/ 133 134 135 /*--------------------------------------------*/ 136 /* APIs to Enable or Disable datapath reset */ 137 /*--------------------------------------------*/ 138 139 /** Enable or Disable TX datapath reset. 140 * Asserts handshake signals upon disable. 141 * @param sa__ is an opaque state vector passed through to device access functions. 142 * @param enable Enable/Disable TX datapath reset (1 = Enable; 0 = Disable) 143 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 144 */ 145 err_code_t merlin16_pcieg3_tx_dp_reset(srds_access_t *sa__, uint8_t enable); 146 147 /** Enable or Disable RX datapath reset. 148 * @param sa__ is an opaque state vector passed through to device access functions. 149 * @param enable Enable/Disable RX datapath reset (1 = Enable; 0 = Disable) 150 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 151 */ 152 err_code_t merlin16_pcieg3_rx_dp_reset(srds_access_t *sa__, uint8_t enable); 153 154 /** Enable or Disable Core datapath reset. 155 * @param sa__ is an opaque state vector passed through to device access functions. 156 * @param enable Enable/Disable Core datapath reset (1 = Enable; 0 = Disable) 157 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 158 */ 159 err_code_t merlin16_pcieg3_core_dp_reset(srds_access_t *sa__, uint8_t enable); 160 161 /*---------------------------*/ 162 /* Merlin16 TX Analog APIs */ 163 /*---------------------------*/ 164 165 166 167 /*----------------*/ 168 /* PMD_RX_LOCK */ 169 /*----------------*/ 170 171 /** PMD rx lock status of current lane. 172 * @param sa__ is an opaque state vector passed through to device access functions. 173 * @param *pmd_rx_lock PMD_RX_LOCK status of current lane returned by API 174 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 175 */ 176 err_code_t merlin16_pcieg3_pmd_lock_status(srds_access_t *sa__, uint8_t *pmd_rx_lock); 177 178 /*--------------------------------*/ 179 /* Serdes TX disable/RX Restart */ 180 /*--------------------------------*/ 181 /** TX Disable. 182 * @param sa__ is an opaque state vector passed through to device access functions. 183 * @param enable Enable/Disable TX disable (1 = TX Disable asserted; 0 = TX Disable removed) 184 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 185 */ 186 err_code_t merlin16_pcieg3_tx_disable(srds_access_t *sa__, uint8_t enable); 187 188 189 190 191 /*-----------------------------*/ 192 /* Stop/Resume RX Adaptation */ 193 /*-----------------------------*/ 194 /** Stop RX Adaptation on a Lane. Control is returned only after attempting to stop adaptation. 195 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 196 * @param sa__ is an opaque state vector passed through to device access functions. 197 * @param enable Enable RX Adaptation stop (1 = Stop RX Adaptation on lane; 0 = Resume RX Adaptation on lane) 198 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 199 */ 200 err_code_t merlin16_pcieg3_stop_rx_adaptation(srds_access_t *sa__, uint8_t enable); 201 202 /** Request to stop RX Adaptation on a Lane. 203 * Control will be returned immediately before adaptaion is completely stopped. 204 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 205 * To resume RX adaptation, use the merlin16_pcieg3_stop_rx_adaptation() API. 206 * @param sa__ is an opaque state vector passed through to device access functions. 207 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 208 */ 209 err_code_t merlin16_pcieg3_request_stop_rx_adaptation(srds_access_t *sa__); 210 211 /*------------------------------------*/ 212 /* Read/Write all RX AFE parameters */ 213 /*------------------------------------*/ 214 215 /** Write to RX AFE settings. 216 * Note: RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 217 * @param sa__ is an opaque state vector passed through to device access functions. 218 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be modified 219 * @param val Value to be written to the selected AFE setting 220 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 221 */ 222 err_code_t merlin16_pcieg3_write_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t val); 223 224 /** Read from RX AFE settings. 225 * @param sa__ is an opaque state vector passed through to device access functions. 226 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be read 227 * @param *val Value to be written to the selected AFE setting 228 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 229 */ 230 err_code_t merlin16_pcieg3_read_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t *val); 231 232 /*-----------------------------*/ 233 /* TX_PI Fixed Frequency Mode */ 234 /*-----------------------------*/ 235 236 /** TX_PI Fixed Frequency Mode. 237 * @param sa__ is an opaque state vector passed through to device access functions. 238 * @param enable Enable/Disable TX_PI (1 = Enable; 0 = Disable) 239 * @param freq_override_val Fixed Frequency Override value (freq_override_val = desired_ppm*8192/781.25; Range: -8192 to + 8192); 240 * @return Error Code generated by invalid TX_PI settings (returns ERR_CODE_NONE if no errors) 241 */ 242 err_code_t merlin16_pcieg3_tx_pi_freq_override(srds_access_t *sa__, uint8_t enable, int16_t freq_override_val); 243 244 /** Perform steps necessary to align TX clocks 245 * @param sa__ is an opaque state vector passed through to device access functions. 246 * @param num_lanes is the number of lanes available in the SerDes IP core (4) 247 * @param enable 1 = Enable ; 0 = Disable 248 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 249 */ 250 err_code_t merlin16_pcieg3_tx_clock_align(srds_access_t *sa__, int num_lanes, int enable); 251 252 /*--------------------------------------------*/ 253 /* Loopback and Ultra-Low Latency Functions */ 254 /*--------------------------------------------*/ 255 256 257 #endif