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 (2414B)


      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/tomahawk3.h>
     15 #include <soc/bondoptions.h>
     16 
     17 extern soc_error_t soc_tomahawk3_avs_vcore_init(int unit);
     18 extern soc_error_t soc_tomahawk3_avs_vcore_deinit(int unit);
     19 extern soc_error_t soc_tomahawk3_avs_vcore_get(int unit, uint32 *voltage);
     20 extern soc_error_t soc_tomahawk3_avs_vcore_set(int unit, uint32 voltage);
     21 
     22 soc_error_t _soc_tomahawk3_avs_vcore_init(int unit)
     23 {
     24     /* defined in avs_vctl.c */
     25     return soc_tomahawk3_avs_vcore_init(unit);
     26 }
     27 
     28 soc_error_t _soc_tomahawk3_avs_vcore_deinit(int unit)
     29 {
     30     /* defined in avs_vctl.c */
     31     return soc_tomahawk3_avs_vcore_deinit(unit);
     32 }
     33 
     34 soc_error_t _soc_tomahawk3_avs_vcore_get(int unit, uint32 *voltage)
     35 {
     36     /* defined in avs_vctl.c */
     37     return soc_tomahawk3_avs_vcore_get(unit, voltage);
     38 }
     39 
     40 soc_error_t _soc_tomahawk3_avs_vcore_set(int unit, uint32 voltage)
     41 {
     42     /* defined in avs_vctl.c */
     43     return soc_tomahawk3_avs_vcore_set(unit, voltage);
     44 }
     45 
     46 soc_error_t _soc_tomahawk3_openloop_voltage_get(int unit, uint32 *voltage)
     47 {
     48     /* unit of voltage is mV */
     49     if (soc_feature(unit, soc_feature_untethered_otp)) {
     50         *voltage = SOC_BOND_INFO(unit)->avs_status;
     51     } else {
     52         *voltage = 8750;
     53     }
     54     return SOC_E_NONE;
     55 }
     56 
     57 soc_avs_functions_t _tomahawk3_avs_functions;
     58 soc_avs_vrm_access_t _tomahawk3_avs_vrm_access;
     59 
     60 soc_error_t
     61 soc_tomahawk3_avs_init(int unit)
     62 {
     63     /* register avs functions*/
     64     sal_memset(&_tomahawk3_avs_functions, 0, sizeof(soc_avs_functions_t));
     65     _tomahawk3_avs_functions.openloop_voltage_get = &_soc_tomahawk3_openloop_voltage_get;
     66     soc_avs_function_register(unit, &_tomahawk3_avs_functions);
     67 
     68     sal_memset(&_tomahawk3_avs_vrm_access, 0, sizeof(soc_avs_vrm_access_t));
     69     _tomahawk3_avs_vrm_access.vrm_init = &_soc_tomahawk3_avs_vcore_init;
     70     _tomahawk3_avs_vrm_access.voltage_set = &_soc_tomahawk3_avs_vcore_set;
     71     _tomahawk3_avs_vrm_access.voltage_get = &_soc_tomahawk3_avs_vcore_get;
     72     _tomahawk3_avs_vrm_access.vrm_deinit = &_soc_tomahawk3_avs_vcore_deinit;
     73     soc_avs_vrm_access_func_register(unit, &_tomahawk3_avs_vrm_access);
     74 
     75     return SOC_E_NONE;
     76 }
     77 
     78 #endif /* INCLUDE_AVS */