openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

avs.c (1023B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        avs.c
      8  */
      9 
     10 #include <shared/bsl.h>
     11 
     12 #ifdef INCLUDE_AVS
     13 #include <soc/avs.h>
     14 #include <soc/tomahawk2.h>
     15 #include <soc/bondoptions.h>
     16 
     17 STATIC soc_error_t
     18 _soc_th2_openloop_voltage_get(int unit, uint32 *voltage)
     19 {
     20     /* unit of voltage is mV */
     21     if (soc_feature(unit, soc_feature_untethered_otp)) {
     22         *voltage = SOC_BOND_INFO(unit)->avs_status;
     23     } else {
     24         *voltage = 9500;
     25     }
     26     return SOC_E_NONE;
     27 }
     28 
     29 static soc_avs_functions_t _th2_avs_functions;
     30 
     31 soc_error_t
     32 soc_th2_avs_init(int unit)
     33 {
     34     /* register avs functions*/
     35     sal_memset(&_th2_avs_functions, 0, sizeof(soc_avs_functions_t));
     36     _th2_avs_functions.openloop_voltage_get = &_soc_th2_openloop_voltage_get;
     37     soc_avs_function_register(unit, &_th2_avs_functions);
     38 
     39     return SOC_E_NONE;
     40 }
     41 
     42 #endif /* INCLUDE_AVS */