blackhawk_tsc_config.h (35609B)
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 blackhawk_tsc_config.h 22 * Configuration functions provided to IP User 23 */ 24 25 #ifndef BLACKHAWK_TSC_API_CONFIG_H 26 #define BLACKHAWK_TSC_API_CONFIG_H 27 28 #include "blackhawk_tsc_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 "blackhawk_tsc_enum.h" 33 #include "blackhawk_tsc_types.h" 34 #include "blackhawk_tsc_select_defns.h" 35 #include "blackhawk_tsc_access.h" 36 37 #define GRACEFUL_STOP_TIME 800 38 39 #define RELEASE_LOCK_AND_RETURN(__x__) \ 40 USR_RELEASE_LOCK; \ 41 return (__x__); 42 43 /****************************************************/ 44 /* CORE Based APIs - Required to be used per Core */ 45 /****************************************************/ 46 /* Returns API Version Number */ 47 /** API Version Number. 48 * @param sa__ is an opaque state vector passed through to device access functions. 49 * @param *api_version API Version Number returned by the API 50 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 51 */ 52 err_code_t blackhawk_tsc_version(srds_access_t *sa__, uint32_t *api_version); 53 54 /*------------------------------------------------*/ 55 /* APIs to Read Core Config variables in uC RAM */ 56 /*------------------------------------------------*/ 57 /** Read value of core_config uC RAM variable. 58 * Note that various API configuration functions can modify core config. 59 * Since the value returned by this can become stale, re-read after modifying core configuration. 60 * @param sa__ is an opaque state vector passed through to device access functions. 61 * @param *struct_val Value to be written into core_config RAM variable 62 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 63 */ 64 err_code_t blackhawk_tsc_get_uc_core_config(srds_access_t *sa__, struct blackhawk_tsc_uc_core_config_st *struct_val); 65 66 /*------------------------------------------------*/ 67 /* APIs to get number of uc cores */ 68 /*------------------------------------------------*/ 69 /** Get the number of uc cores. 70 * Note that various API configuration functions can modify core config. 71 * Since the value returned by this can become stale, re-read after modifying core configuration. 72 * @param sa__ is an opaque state vector passed through to device access functions. 73 * @param *num_micros Value to be written with number of uc cores 74 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 75 */ 76 77 err_code_t blackhawk_tsc_get_micro_num_uc_cores(srds_access_t *sa__, uint8_t *num_micros); 78 /*-----------------------------------*/ 79 /* Microcode Load/Verify Functions */ 80 /*-----------------------------------*/ 81 #ifndef DISABLE_MDIO_LOAD 82 /** Load Microcode into Micro through Register (MDIO) Interface. 83 * Once the microcode is loaded, de-assert reset to 8051 to start executing microcode "wrc_micro_mdio_dw8051_reset_n(0x1)". 84 * \n Note: Micro should be loaded only after issuing a blackhawk_tsc_uc_reset(1) followed by asserting and de-asserting 85 * core_s_reset. Information table should be intialized with blackhawk_tsc_init_blackhawk_tsc_info after microcode load. 86 * See relevant Programmers guide for more details. 87 * @param sa__ is an opaque state vector passed through to device access functions. 88 * @param *ucode_image pointer to the Microcode image organized in bytes 89 * @param ucode_len Length of Microcode Image (number of bytes) 90 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 91 */ 92 err_code_t blackhawk_tsc_ucode_mdio_load(srds_access_t *sa__, uint8_t *ucode_image, uint32_t ucode_len); 93 #endif /* DISABLE_MDIO_LOAD */ 94 95 /** To verify the Microcode image loaded in the Micro. 96 * Read back the microcode from Micro and check against expected microcode image. 97 * @param sa__ is an opaque state vector passed through to device access functions. 98 * @param *ucode_image pointer to the expeted Microcode image organized in bytes 99 * @param ucode_len Length of Microcode Image (number of bytes) 100 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 101 */ 102 err_code_t blackhawk_tsc_ucode_load_verify(srds_access_t *sa__, uint8_t *ucode_image, uint32_t ucode_len); 103 104 /** To verify the CRC of the microcode loaded in the Micro. 105 * Instruct uC to read image and calculate CRC and check against expected CRC. 106 * @param sa__ is an opaque state vector passed through to device access functions. 107 * @param ucode_len Length of Microcode Image (number of bytes) 108 * @param expected_crc_value Expected CRC value of the microcode 109 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 110 */ 111 err_code_t blackhawk_tsc_ucode_crc_verify(srds_access_t *sa__, uint16_t ucode_len, uint16_t expected_crc_value); 112 113 /** To instruct the micro to start calculating the CRC of the microcode. 114 * Instruct uC to read image and calculate CRC. 115 * Control is returned after triggering start of CRC calculation (does NOT wait for completion of CRC calculation). \n \n 116 * NOTE: No uC commands should be executed between starting the CRC calculaion [blackhawk_tsc_ucode_crc_verify()] and verifying the CRC value [blackhawk_tsc_start_ucode_crc_calc()]. 117 * @param sa__ is an opaque state vector passed through to device access functions. 118 * @param ucode_len Length of Microcode Image (number of bytes) 119 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 120 */ 121 err_code_t blackhawk_tsc_start_ucode_crc_calc(srds_access_t *sa__, uint16_t ucode_len); 122 123 /** To check the expected CRC against the CRC calulated by the micro. 124 * NOTE: No uC commands should be executed between starting the CRC calculation [blackhawk_tsc_ucode_crc_verify()] and verifying the CRC value [blackhawk_tsc_start_ucode_crc_calc()]. 125 * @param sa__ is an opaque state vector passed through to device access functions. 126 * @param expected_crc_value Expected CRC value of the microcode 127 * @param timeout_ms Time interval in milliseconds inside which the previous command (calculate CRC) should be completed 128 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 129 */ 130 err_code_t blackhawk_tsc_check_ucode_crc(srds_access_t *sa__, uint16_t expected_crc_value, uint32_t timeout_ms); 131 132 /** Load the Micro through the pram bus. 133 * NOTE: Information table should be intialized with blackhawk_tsc_init_blackhawk_tsc_info after microcode load. 134 * @param sa__ is an opaque state vector passed through to device access functions. 135 * @param ucode_image Microcode Image to be written 136 * @param ucode_len Length of Microcode Image (number of bytes) 137 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 138 */ 139 err_code_t blackhawk_tsc_ucode_pram_load(srds_access_t *sa__, char const * ucode_image, uint32_t ucode_len); 140 141 /** Enable or Disable the uC reset. 142 * Note: Micro should be reset using the API everytime before reloading the microcode 143 * @param sa__ is an opaque state vector passed through to device access functions. 144 * @param enable Enable/Disable uC reset (1 = Enable; 0 = Disable) 145 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 146 */ 147 err_code_t blackhawk_tsc_uc_reset(srds_access_t *sa__, uint8_t enable); 148 149 /** Enable or Disable the uC reset. 150 * Note: Micro should be reset using the API everytime before reloading the microcode 151 * @param sa__ is an opaque state vector passed through to device access functions. 152 * @param enable Enable/Disable uC reset (1 = Enable; 0 = Disable) 153 * @param ucode_info struct has information regarding stack size 154 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 155 */ 156 err_code_t blackhawk_tsc_uc_reset_with_info(srds_access_t *sa__, uint8_t enable, ucode_info_t ucode_info); 157 158 /** Wait for the uC to become active. 159 * @param sa__ is an opaque state vector passed through to device access functions. 160 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 161 */ 162 err_code_t blackhawk_tsc_wait_uc_active(srds_access_t *sa__); 163 164 /** Initialize the blackhawk_tsc_info for the uC. 165 * @param sa__ is an opaque state vector passed through to device access functions. 166 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 167 */ 168 err_code_t blackhawk_tsc_init_blackhawk_tsc_info(srds_access_t *sa__); 169 170 171 /** Set the core_cfg_from_pcs flag in the core configuration. 172 * @param sa__ is an opaque state vector passed through to device access functions. 173 * @param core_cfg_from_pcs The value to set 174 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 175 */ 176 err_code_t blackhawk_tsc_set_core_config_from_pcs(srds_access_t *sa__, uint8_t core_cfg_from_pcs); 177 178 179 180 /** Configure the lane address mapping. 181 * Note: Micro and core data path must be in reset when this function is called. 182 * @param sa__ is an opaque state vector passed through to device access functions. 183 * @param num_lanes The number of entries in tx_lane_map and rx_lane_map. 184 * This must match the number of lanes associated with the core. 185 * @param *tx_lane_map A num_lanes-sized array of lane indexes to map to the TX lanes. 186 * Each entry must be from 0 to num_lanes-1, and each entry must be unique. 187 * @param *rx_lane_map A num_lanes-sized array of lane indexes to map to the RX lanes. 188 * Each entry must be from 0 to num_lanes-1, and each entry must be unique. 189 * If independent TX / RX lane mapping is not enabled for a core, then this must match tx_lane_map. 190 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 191 */ 192 err_code_t blackhawk_tsc_map_lanes(srds_access_t *sa__, uint8_t num_lanes, uint8_t const *tx_lane_map, uint8_t const *rx_lane_map); 193 194 195 /*-----------------*/ 196 /* Configure PLL */ 197 /*-----------------*/ 198 199 /** The pll can be configured by providing all four parameters: refclk frequency, divider value, VCO output frequency and the PLL options. 200 * This is the only option in SMALL_FOOTPRINT 201 */ 202 #define blackhawk_tsc_configure_pll_refclk_div_vco blackhawk_tsc_INTERNAL_configure_pll 203 /** Configure PLL. 204 * 205 * Use core_s_rstb to re-initialize all registers to default before calling this function. 206 * 207 * Configures PLL registers to obtain the required configuration. 208 * PLL configuration for this fucntion is based on refclk frequency and divider value. 209 * @param sa__ is an opaque state vector passed through to device access functions. 210 * @param refclk Reference clock frequency (enumerated) 211 * @param srds_div Divider value (enumerated) 212 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 213 */ 214 err_code_t blackhawk_tsc_configure_pll_refclk_div(srds_access_t *sa__, 215 enum blackhawk_tsc_pll_refclk_enum refclk, 216 enum blackhawk_tsc_pll_div_enum srds_div); 217 218 /** Configure PLL. 219 * 220 * Use core_s_rstb to re-initialize all registers to default before calling this function. 221 * 222 * Configures PLL registers to obtain the required configuration. 223 * PLL configuration for this function is based on refclk frequency and VCO output frequency. 224 * @param sa__ is an opaque state vector passed through to device access functions. 225 * @param refclk Reference clock frequency (enumerated) 226 * @param vco_freq_khz VCO output frequency, in kHz 227 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 228 */ 229 err_code_t blackhawk_tsc_configure_pll_refclk_vco(srds_access_t *sa__, 230 enum blackhawk_tsc_pll_refclk_enum refclk, 231 uint32_t vco_freq_khz); 232 233 /** Configure PLL. 234 * 235 * Use core_s_rstb to re-initialize all registers to default before calling this function. 236 * 237 * Configures PLL registers to obtain the required configuration. 238 * PLL configuration for this function is based on divider value and VCO output frequency. 239 * @param sa__ is an opaque state vector passed through to device access functions. 240 * @param srds_div Divider value (enumerated) 241 * @param vco_freq_khz VCO output frequency, in kHz 242 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 243 */ 244 err_code_t blackhawk_tsc_configure_pll_div_vco(srds_access_t *sa__, 245 enum blackhawk_tsc_pll_div_enum srds_div, 246 uint32_t vco_freq_khz); 247 248 /** Configure PLL. 249 * 250 * Use core_s_rstb to re-initialize all registers to default before calling this function. 251 * 252 * Configures PLL registers to obtain the required configuration. 253 * PLL configuration for this fucntion is based on input refclk frequency and divider value. 254 * but first divides the input refclk by 2 and adjusts parameters accordingly. 255 * @param sa__ is an opaque state vector passed through to device access functions. 256 * @param refclk Input Reference clock frequency before refclk divide by 2 (enumerated) 257 * @param srds_div Divider value based on input reference clock frequency (enumerated) 258 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 259 */ 260 err_code_t blackhawk_tsc_configure_pll_refclk_div_div2refclk(srds_access_t *sa__, 261 enum blackhawk_tsc_pll_refclk_enum refclk, 262 enum blackhawk_tsc_pll_div_enum srds_div); 263 264 /** Configure PLL. 265 * 266 * Use core_s_rstb to re-initialize all registers to default before calling this function. 267 * 268 * Configures PLL registers to obtain the required configuration. 269 * PLL configuration for this function is based on input refclk frequency and VCO output frequency. 270 * but first divides the input refclk by 2 and adjusts parameters accordingly. 271 * @param sa__ is an opaque state vector passed through to device access functions. 272 * @param refclk Input Reference clock frequency before refclk divide by 2 (enumerated) 273 * @param vco_freq_khz VCO output frequency, in kHz 274 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 275 */ 276 err_code_t blackhawk_tsc_configure_pll_refclk_vco_div2refclk(srds_access_t *sa__, 277 enum blackhawk_tsc_pll_refclk_enum refclk, 278 uint32_t vco_freq_khz); 279 280 /** Configure PLL. 281 * 282 * Use core_s_rstb to re-initialize all registers to default before calling this function. 283 * 284 * Configures PLL registers to obtain the required configuration. 285 * PLL configuration for this function is based on divider value and VCO output frequency. 286 * but first divides the input refclk by 2 and adjusts parameters accordingly. 287 * @param sa__ is an opaque state vector passed through to device access functions. 288 * @param srds_div Divider value based on input refclk frequency before refclk divide by 2 (enumerated) 289 * @param vco_freq_khz VCO output frequency, in kHz 290 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 291 */ 292 err_code_t blackhawk_tsc_configure_pll_div_vco_div2refclk(srds_access_t *sa__, 293 enum blackhawk_tsc_pll_div_enum srds_div, 294 uint32_t vco_freq_khz); 295 /** Configure PLL. 296 * 297 * Use core_s_rstb to re-initialize all registers to default before calling this function. 298 * 299 * Configures PLL registers to obtain the required configuration. 300 * PLL configuration for this fucntion is based on input refclk frequency and divider value. 301 * but first divides the input refclk by 4 and adjusts parameters accordingly. 302 * @param sa__ is an opaque state vector passed through to device access functions. 303 * @param refclk Input Reference clock frequency before refclk divide by 4 (enumerated) 304 * @param srds_div Divider value based on input reference clock frequency (enumerated) 305 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 306 */ 307 err_code_t blackhawk_tsc_configure_pll_refclk_div_div4refclk(srds_access_t *sa__, 308 enum blackhawk_tsc_pll_refclk_enum refclk, 309 enum blackhawk_tsc_pll_div_enum srds_div); 310 311 /** Configure PLL. 312 * 313 * Use core_s_rstb to re-initialize all registers to default before calling this function. 314 * 315 * Configures PLL registers to obtain the required configuration. 316 * PLL configuration for this function is based on input refclk frequency and VCO output frequency. 317 * but first divides the input refclk by 4 and adjusts parameters accordingly. 318 * @param sa__ is an opaque state vector passed through to device access functions. 319 * @param refclk Input Reference clock frequency before refclk divide by 4 (enumerated) 320 * @param vco_freq_khz VCO output frequency, in kHz 321 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 322 */ 323 err_code_t blackhawk_tsc_configure_pll_refclk_vco_div4refclk(srds_access_t *sa__, 324 enum blackhawk_tsc_pll_refclk_enum refclk, 325 uint32_t vco_freq_khz); 326 327 /** Configure PLL. 328 * 329 * Use core_s_rstb to re-initialize all registers to default before calling this function. 330 * 331 * Configures PLL registers to obtain the required configuration. 332 * PLL configuration for this function is based on divider value and VCO output frequency. 333 * but first divides the input refclk by 4 and adjusts parameters accordingly. 334 * @param sa__ is an opaque state vector passed through to device access functions. 335 * @param srds_div Divider value based on input refclk frequency before refclk divide by 4 (enumerated) 336 * @param vco_freq_khz VCO output frequency, in kHz 337 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 338 */ 339 err_code_t blackhawk_tsc_configure_pll_div_vco_div4refclk(srds_access_t *sa__, 340 enum blackhawk_tsc_pll_div_enum srds_div, 341 uint32_t vco_freq_khz); 342 343 /** Configure PLL. 344 * 345 * Use core_s_rstb to re-initialize all registers to default before calling this function. 346 * 347 * Configures PLL registers to obtain the required configuration. 348 * PLL configuration for this fucntion is based on refclk frequency and divider value. 349 * Enables refclk doubler. 350 * @param sa__ is an opaque state vector passed through to device access functions. 351 * @param refclk Reference clock frequency (enumerated) 352 * @param srds_div Divider value (enumerated) 353 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 354 */ 355 err_code_t blackhawk_tsc_configure_pll_refclk_div_refclk_2x(srds_access_t *sa__, 356 enum blackhawk_tsc_pll_refclk_enum refclk, 357 enum blackhawk_tsc_pll_div_enum srds_div); 358 359 /** Configure PLL. 360 * 361 * Use core_s_rstb to re-initialize all registers to default before calling this function. 362 * 363 * Configures PLL registers to obtain the required configuration. 364 * PLL configuration for this function is based on refclk frequency and VCO output frequency. 365 * Enables refclk doubler. 366 * @param sa__ is an opaque state vector passed through to device access functions. 367 * @param refclk Reference clock frequency (enumerated) 368 * @param vco_freq_khz VCO output frequency, in kHz 369 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 370 */ 371 err_code_t blackhawk_tsc_configure_pll_refclk_vco_refclk_2x(srds_access_t *sa__, 372 enum blackhawk_tsc_pll_refclk_enum refclk, 373 uint32_t vco_freq_khz); 374 375 /** Configure PLL. 376 * 377 * Use core_s_rstb to re-initialize all registers to default before calling this function. 378 * 379 * Configures PLL registers to obtain the required configuration. 380 * PLL configuration for this function is based on divider value and VCO output frequency. 381 * Enables refclk doubler. 382 * @param sa__ is an opaque state vector passed through to device access functions. 383 * @param srds_div Divider value (enumerated) 384 * @param vco_freq_khz VCO output frequency, in kHz 385 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 386 */ 387 err_code_t blackhawk_tsc_configure_pll_div_vco_refclk_2x(srds_access_t *sa__, 388 enum blackhawk_tsc_pll_div_enum srds_div, 389 uint32_t vco_freq_khz); 390 391 /** Get the VCO frequency in kHz, based on the reference clock frequency and divider value 392 * @param sa__ is an opaque state vector passed through to device access functions. 393 * @param refclk_freq_hz Reference clock frequency, in Hz. 394 * @param srds_div Divider value, in the same encoding as enum #blackhawk_tsc_pll_div_enum. 395 * @param *vco_freq_khz VCO output frequency, in kHz, obtained based on reference clock frequency and dic value 396 * @param pll_option Select PLL configuration option from enum #blackhawk_tsc_pll_option_enum. 397 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 398 */ 399 err_code_t blackhawk_tsc_get_vco_from_refclk_div(srds_access_t *sa__, uint32_t refclk_freq_hz, enum blackhawk_tsc_pll_div_enum srds_div, uint32_t *vco_freq_khz, enum blackhawk_tsc_pll_option_enum pll_option); 400 401 /**************************************************/ 402 /* LANE Based APIs - Required to be used per Lane */ 403 /**************************************************/ 404 405 /*------------------------------------------------------------*/ 406 /* APIs to Write Lane Config and User variables into uC RAM */ 407 /*------------------------------------------------------------*/ 408 /** Write to lane_config uC RAM variable. 409 * Note: This API should be used only during configuration under dp_reset. 410 * @param sa__ is an opaque state vector passed through to device access functions. 411 * @param struct_val Value to be written into lane_config RAM variable 412 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 413 */ 414 err_code_t blackhawk_tsc_set_uc_lane_cfg(srds_access_t *sa__, struct blackhawk_tsc_uc_lane_config_st struct_val); 415 416 /*-----------------------------------------------------------*/ 417 /* APIs to Read Lane Config and User variables from uC RAM */ 418 /*-----------------------------------------------------------*/ 419 /** Read value of lane_config uC RAM variable. 420 * @param sa__ is an opaque state vector passed through to device access functions. 421 * @param *struct_val Value read from lane_config RAM variable 422 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 423 */ 424 err_code_t blackhawk_tsc_get_uc_lane_cfg(srds_access_t *sa__, struct blackhawk_tsc_uc_lane_config_st *struct_val); 425 426 427 /*--------------------------------------------*/ 428 /* APIs to Enable or Disable datapath reset */ 429 /*--------------------------------------------*/ 430 431 /** Enable or Disable TX datapath reset. 432 * Asserts handshake signals upon disable. 433 * @param sa__ is an opaque state vector passed through to device access functions. 434 * @param enable Enable/Disable TX datapath reset (1 = Enable; 0 = Disable) 435 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 436 */ 437 err_code_t blackhawk_tsc_tx_dp_reset(srds_access_t *sa__, uint8_t enable); 438 439 /** Enable or Disable RX datapath reset. 440 * @param sa__ is an opaque state vector passed through to device access functions. 441 * @param enable Enable/Disable RX datapath reset (1 = Enable; 0 = Disable) 442 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 443 */ 444 err_code_t blackhawk_tsc_rx_dp_reset(srds_access_t *sa__, uint8_t enable); 445 446 /** Enable or Disable Core datapath reset. 447 * @param sa__ is an opaque state vector passed through to device access functions. 448 * @param enable Enable/Disable Core datapath reset (1 = Enable; 0 = Disable) 449 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 450 */ 451 err_code_t blackhawk_tsc_core_dp_reset(srds_access_t *sa__, uint8_t enable); 452 453 454 /*---------------------------*/ 455 /* Blackhawk TX Analog APIs */ 456 /*---------------------------*/ 457 /** Write TX AFE parameters. 458 * NOTE: This API should be used only after lane_dp_reset is released. 459 * @param sa__ is an opaque state vector passed through to device access functions. 460 * @param param selects the parameter to write based on #blackhawk_tsc_tx_afe_settings_enum 461 * @param val is the signed input value to the parameter 462 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 463 */ 464 err_code_t blackhawk_tsc_write_tx_afe(srds_access_t *sa__, enum blackhawk_tsc_tx_afe_settings_enum param, int16_t val); 465 466 /** Read TX AFE parameters. 467 * @param sa__ is an opaque state vector passed through to device access functions. 468 * @param param selects the parameter to read based on #blackhawk_tsc_tx_afe_settings_enum 469 * @param *val is the returned signed value of the parameter 470 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 471 */ 472 err_code_t blackhawk_tsc_read_tx_afe(srds_access_t *sa__, enum blackhawk_tsc_tx_afe_settings_enum param, int16_t *val); 473 474 /** Validates Blackhawk TXFIR tap settings. 475 * Returns failcodes if TXFIR settings are invalid. 476 * @param sa__ is an opaque state vector passed through to device access functions. 477 * @param enable_taps Enable TXFIR TAPs based on #blackhawk_tsc_txfir_tap_enable_enum 478 * @param pre2 TXFIR pre2 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 479 * @param pre1 TXFIR pre1 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 480 * @param main TXFIR main tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 481 * @param post1 TXFIR post tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 482 * @param post2 TXFIR post2 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 483 * @param post3 TXFIR post3 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 484 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 485 */ 486 err_code_t blackhawk_tsc_validate_txfir_cfg(srds_access_t *sa__, enum blackhawk_tsc_txfir_tap_enable_enum enable_taps, int16_t pre2, int16_t pre1, int16_t main, int16_t post1, int16_t post2, int16_t post3); 487 488 /** Writes Serdes TXFIR tap settings. 489 * Returns failcodes if TXFIR settings are invalid 490 * NOTE: Dynamically switching between enable_6tap and !enable_6tap will cause a 1UI slip in TX 491 * @param sa__ is an opaque state vector passed through to device access functions. 492 * @param enable_taps Enable TXFIR TAPs based on #blackhawk_tsc_txfir_tap_enable_enum 493 * @param pre2 TXFIR pre2 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 494 * @param pre1 TXFIR pre1 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 495 * @param main TXFIR main tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 496 * @param post1 TXFIR post tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 497 * @param post2 TXFIR post2 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 498 * @param post3 TXFIR post3 tap value (-168 to +168 when in PAM4 mode, otherwise -127 to 127) 499 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 500 */ 501 err_code_t blackhawk_tsc_apply_txfir_cfg(srds_access_t *sa__, enum blackhawk_tsc_txfir_tap_enable_enum enable_taps, int16_t pre2, int16_t pre1, int16_t main, int16_t post1, int16_t post2, int16_t post3); 502 503 /** Validates Blackhawk TXFIR tap settings. 504 * Returns failcodes if TXFIR settings are invalid. 505 * @param sa__ is an opaque state vector passed through to device access functions. 506 * @param enable_taps Enable TXFIR TAPs based on #blackhawk_tsc_txfir_tap_enable_enum 507 * @param txfir the 12 TXFIR tap values (-168 to +168 when in PAM4 mode, otherwise -127 to +127) 508 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 509 */ 510 err_code_t blackhawk_tsc_validate_full_txfir_cfg(srds_access_t *sa__, enum blackhawk_tsc_txfir_tap_enable_enum enable_taps, blackhawk_tsc_txfir_st txfir); 511 512 /** Writes Serdes TXFIR tap settings. 513 * Returns failcodes if TXFIR settings are invalid 514 * @param sa__ is an opaque state vector passed through to device access functions. 515 * @param enable_taps Enable TXFIR TAPs based on #blackhawk_tsc_txfir_tap_enable_enum 516 * @param txfir the 12 TXFIR tap values (-168 to +168 when in PAM4 mode, otherwise -63 to +63) 517 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 518 */ 519 err_code_t blackhawk_tsc_apply_full_txfir_cfg(srds_access_t *sa__, enum blackhawk_tsc_txfir_tap_enable_enum enable_taps, blackhawk_tsc_txfir_st txfir); 520 521 522 /*----------------*/ 523 /* PMD_RX_LOCK */ 524 /*----------------*/ 525 526 /** PMD rx lock status of current lane. 527 * @param sa__ is an opaque state vector passed through to device access functions. 528 * @param *pmd_rx_lock PMD_RX_LOCK status of current lane returned by API 529 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 530 */ 531 err_code_t blackhawk_tsc_pmd_lock_status(srds_access_t *sa__, uint8_t *pmd_rx_lock); 532 533 /*--------------------------------*/ 534 /* Serdes TX disable/RX Restart */ 535 /*--------------------------------*/ 536 /** TX Disable. 537 * @param sa__ is an opaque state vector passed through to device access functions. 538 * @param enable Enable/Disable TX disable (1 = TX Disable asserted; 0 = TX Disable removed) 539 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 540 */ 541 err_code_t blackhawk_tsc_tx_disable(srds_access_t *sa__, uint8_t enable); 542 543 /** Enable/disable Restart RX and hold. 544 * (Reset DSC state machine into RESTART State and hold it till disabled) 545 * @param sa__ is an opaque state vector passed through to device access functions. 546 * @param enable Enable/Disable Restart RX and hold (1 = RX restart and hold; 0 = Release hold in restart state) 547 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 548 */ 549 err_code_t blackhawk_tsc_rx_restart(srds_access_t *sa__, uint8_t enable); 550 551 552 /*-----------------------------*/ 553 /* Stop/Resume RX Adaptation */ 554 /*-----------------------------*/ 555 /** Stop RX Adaptation on a Lane. Control is returned only after attempting to stop adaptation. 556 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 557 * @param sa__ is an opaque state vector passed through to device access functions. 558 * @param enable Enable RX Adaptation stop (1 = Stop RX Adaptation on lane; 0 = Resume RX Adaptation on lane) 559 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 560 */ 561 err_code_t blackhawk_tsc_stop_rx_adaptation(srds_access_t *sa__, uint8_t enable); 562 563 /** Request to stop RX Adaptation on a Lane. 564 * Control will be returned immediately before adaptaion is completely stopped. 565 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 566 * To resume RX adaptation, use the blackhawk_tsc_stop_rx_adaptation() API. 567 * @param sa__ is an opaque state vector passed through to device access functions. 568 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 569 */ 570 err_code_t blackhawk_tsc_request_stop_rx_adaptation(srds_access_t *sa__); 571 572 /*------------------------------------*/ 573 /* Read/Write all RX AFE parameters */ 574 /*------------------------------------*/ 575 576 /** Write to RX AFE settings. 577 * Note: RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 578 * @param sa__ is an opaque state vector passed through to device access functions. 579 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be modified 580 * @param val Value to be written to the selected AFE setting 581 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 582 */ 583 err_code_t blackhawk_tsc_write_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t val); 584 585 /** Read from RX AFE settings. 586 * @param sa__ is an opaque state vector passed through to device access functions. 587 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be read 588 * @param *val Value to be written to the selected AFE setting 589 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 590 */ 591 err_code_t blackhawk_tsc_read_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t *val); 592 593 /*-----------------------------*/ 594 /* TX_PI Fixed Frequency Mode */ 595 /*-----------------------------*/ 596 597 /** TX_PI Fixed Frequency Mode. 598 * @param sa__ is an opaque state vector passed through to device access functions. 599 * @param enable Enable/Disable TX_PI (1 = Enable; 0 = Disable) 600 * @param freq_override_val Fixed Frequency Override value (freq_override_val = desired_ppm*8192/781.25; Range: -8192 to + 8192); 601 * @return Error Code generated by invalid TX_PI settings (returns ERR_CODE_NONE if no errors) 602 */ 603 err_code_t blackhawk_tsc_tx_pi_freq_override(srds_access_t *sa__, uint8_t enable, int16_t freq_override_val); 604 605 /** Perform steps necessary to align TX clocks 606 * @param sa__ is an opaque state vector passed through to device access functions. 607 * @param num_lanes is the number of lanes available in the SerDes IP core (4) 608 * @param enable 1 = Enable ; 0 = Disable 609 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 610 */ 611 err_code_t blackhawk_tsc_tx_clock_align(srds_access_t *sa__, int num_lanes, int enable); 612 613 /*--------------------------------------------*/ 614 /* Loopback and Ultra-Low Latency Functions */ 615 /*--------------------------------------------*/ 616 617 /** Locks TX_PI to Loop timing. 618 * @param sa__ is an opaque state vector passed through to device access functions. 619 * @param enable Enable TX_PI lock to loop timing (1 = Enable Lock; 0 = Disable Lock) 620 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 621 */ 622 err_code_t blackhawk_tsc_loop_timing(srds_access_t *sa__, uint8_t enable); 623 624 /** Enable/Disable Remote Loopback. 625 * @param sa__ is an opaque state vector passed through to device access functions. 626 * @param enable Enable Remote Loopback (1 = Enable rmt_lpbk; 0 = Disable rmt_lpbk) 627 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 628 */ 629 err_code_t blackhawk_tsc_rmt_lpbk(srds_access_t *sa__, uint8_t enable); 630 err_code_t blackhawk_tsc_firmware_load_none_init_blackhawk_tsc_info(srds_access_t *sa__); 631 632 #endif