summaryrefslogtreecommitdiffstats
path: root/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils
diff options
context:
space:
mode:
authorMark Pizzutillo <Mark.Pizzutillo@ibm.com>2019-04-10 17:25:23 -0400
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-05-29 15:21:13 -0500
commitee52194d04b1a2449e49cb759ea0e7e82bb1b75a (patch)
treea972edd0ab2bc746a6f92f6abd150af07988988d /src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils
parent678ca9786f8a7425db0b7d43331d074220d96794 (diff)
downloadtalos-hostboot-ee52194d04b1a2449e49cb759ea0e7e82bb1b75a.tar.gz
talos-hostboot-ee52194d04b1a2449e49cb759ea0e7e82bb1b75a.zip
Add code for PMIC bias procedure & UTs
Change-Id: I351c74f73624f46b195d37efbf407e1ff95006bf Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77317 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77775 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils')
-rw-r--r--src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C312
-rw-r--r--src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H120
-rw-r--r--src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_common_utils.H12
-rw-r--r--src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_consts.H24
4 files changed, 449 insertions, 19 deletions
diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C
index b9fd7c640..b4b59e165 100644
--- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C
+++ b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C
@@ -22,3 +22,315 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+///
+/// @file pmic_bias_utils.C
+/// @brief Procedure definition to bias PMIC
+///
+// *HWP HWP Owner: Mark Pizzutillo <mark.pizzutillo@ibm.com>
+// *HWP HWP Backup: Louis Stermole <stermole@us.ibm.com>
+// *HWP Team: Memory
+// *HWP Level: 2
+// *HWP Consumed by: FSP:HB
+
+#include <fapi2.H>
+#include <lib/utils/pmic_bias_utils.H>
+#include <lib/i2c/i2c_pmic.H>
+#include <lib/utils/pmic_consts.H>
+#include <lib/utils/pmic_common_utils.H>
+#include <pmic_regs.H>
+#include <generic/memory/lib/utils/c_str.H>
+#include <generic/memory/lib/utils/mss_math.H>
+
+namespace mss
+{
+namespace pmic
+{
+
+///
+/// @brief Set the voltage of a rail (post-rounding)
+///
+/// @param[in] i_pmic_target PMIC target
+/// @param[in] i_rail rail to set
+/// @param[in] i_target_voltage voltage to set to
+/// @param[in] i_range_selection range (0 or 1) of the rail
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_new_rail_voltage(
+ const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const uint32_t i_target_voltage,
+ const uint8_t i_range_selection)
+{
+ using CONSTS = mss::pmic::consts<mss::pmic::product::JEDEC_COMPLIANT>;
+ using FIELDS = pmicFields<mss::pmic::product::JEDEC_COMPLIANT>;
+
+ FAPI_ASSERT(i_range_selection < CONSTS::NUM_RANGES,
+ fapi2::PMIC_VOLTAGE_RANGE_SETTING_OUT_OF_RANGE()
+ .set_TARGET(i_pmic_target)
+ .set_RAIL(i_rail)
+ .set_RANGE_SETTING(i_range_selection),
+ "set_new_rail_voltage(): The voltage setting provided for PMIC %s on rail %u was out of range (Valid: 0,1). Given: %u",
+ mss::c_str(i_pmic_target), uint8_t(i_rail), i_range_selection);
+
+ {
+ // Make sure voltage falls within range
+ static const uint32_t MIN_VOLT = mss::pmic::VOLT_RANGE_MINS[i_rail][i_range_selection];
+ static const uint32_t MAX_VOLT = mss::pmic::VOLT_RANGE_MAXES[i_rail][i_range_selection];
+
+ FAPI_ASSERT((i_target_voltage >= MIN_VOLT) && (i_target_voltage <= MAX_VOLT),
+ fapi2::PMIC_BIAS_VOLTAGE_OUT_OF_RANGE()
+ .set_TARGET(i_pmic_target)
+ .set_VOLTAGE(i_target_voltage)
+ .set_MIN(MIN_VOLT)
+ .set_MAX(MAX_VOLT)
+ .set_RAIL(i_rail),
+ "set_new_rail_voltage(): After rounding the bias voltage, "
+ "the resulting voltage %lumV was out of range LOW: %lumV HIGH: %lumV for PMIC %s on rail %u",
+ i_target_voltage, MIN_VOLT, MAX_VOLT, mss::c_str(i_pmic_target), uint8_t(i_rail));
+ {
+ // Convert to bit mapping and write back
+ const uint32_t l_offset_from_min = i_target_voltage - MIN_VOLT;
+ const uint8_t l_voltage_bitmap = l_offset_from_min / CONSTS::VOLT_STEP;
+
+ // Shift and write back
+ fapi2::buffer<uint8_t> l_voltage_write_back;
+
+ l_voltage_write_back.insertFromRight<FIELDS::VOLTAGE_SETTING_START, FIELDS::VOLTAGE_SETTING_LENGTH>(l_voltage_bitmap);
+
+ FAPI_TRY(mss::pmic::i2c::reg_write(i_pmic_target, mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail], l_voltage_write_back),
+ "set_voltage_percent: Error writing 0x%02hhX of PMIC %s", mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail],
+ mss::c_str(i_pmic_target));
+ }
+ }
+
+ return fapi2::FAPI2_RC_SUCCESS;
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Round a target rail voltage to the nearest step of 5mV to create the voltage bitmap
+///
+/// @param[in] i_target_voltage_unrounded unrounded voltage
+/// @return float rounded voltage
+///
+uint32_t round_rail_target_voltage(const uint32_t i_target_voltage_unrounded)
+{
+ using CONSTS = mss::pmic::consts<mss::pmic::product::JEDEC_COMPLIANT>;
+
+ // Round to nearest unit by converting to a MV integer
+ const uint32_t l_target_multiple = CONSTS::VOLT_STEP;
+
+ const uint32_t l_target_voltage = mss::round_to_nearest_multiple(i_target_voltage_unrounded, l_target_multiple);
+
+ // Inform the user. This will be especially useful for debugging
+ FAPI_INF("Voltage rounded to %luV", l_target_voltage);
+
+ return l_target_voltage;
+}
+
+///
+/// @brief Checks if bias percentage is within the MAX_BIAS threshold
+///
+/// @param[in] i_percent percentage to check
+/// @param[in] i_force force change (would force evaluation to true)
+/// @return true if in range, false if not
+///
+bool bias_percent_within_threshold(const float i_percent, const bool i_force)
+{
+ return i_force || ((i_percent < mss::pmic::PERCENT_MAX_BIAS) && (i_percent > (-1) * mss::pmic::PERCENT_MAX_BIAS));
+}
+
+///
+/// @brief Get the current rail voltage of a JEDEC PMIC
+///
+/// @param[in] i_pmic_target PMIC target
+/// @param[in] i_rail rail to read from
+/// @param[out] o_current_rail_voltage voltage calculated for rail
+/// @param[out] o_range_selection range selection of that voltage
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success, else error
+/// @note not templated as the arguments may differ for other chips (if we ever use others)
+///
+fapi2::ReturnCode get_current_rail_voltage(const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>&
+ i_pmic_target,
+ const mss::pmic::rail i_rail,
+ uint32_t& o_current_rail_voltage,
+ uint8_t& o_range_selection)
+{
+ fapi2::buffer<uint8_t> l_voltage_setting_reg_contents;
+ fapi2::buffer<uint8_t> l_voltage_range_reg_contents;
+
+ using REGS = pmicRegs<mss::pmic::product::JEDEC_COMPLIANT>;
+ using FIELDS = pmicFields<mss::pmic::product::JEDEC_COMPLIANT>;
+ using CONSTS = mss::pmic::consts<mss::pmic::product::JEDEC_COMPLIANT>;
+
+ // Get voltage for rail
+ FAPI_TRY(mss::pmic::i2c::reg_read(i_pmic_target, mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail],
+ l_voltage_setting_reg_contents),
+ "set_voltage_percent: Error reading 0x%02hhX of PMIC %s", mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail],
+ mss::c_str(i_pmic_target));
+
+ // Get voltage range selections
+ FAPI_TRY(mss::pmic::i2c::reg_read_reverse_buffer(i_pmic_target, REGS::R2B, l_voltage_range_reg_contents),
+ "set_voltage_percent: Error reading 0x%02hhX of PMIC %s", REGS::R2B, mss::c_str(i_pmic_target));
+ {
+ // Identify range
+ const uint8_t l_range_selection = l_voltage_range_reg_contents.getBit(mss::pmic::VOLT_RANGE_FLDS[i_rail]);
+ uint8_t l_voltage_setting = 0;
+
+ l_voltage_setting_reg_contents.extractToRight<FIELDS::VOLTAGE_SETTING_START, FIELDS::VOLTAGE_SETTING_LENGTH>
+ (l_voltage_setting);
+
+ // Get current voltage using: range_min + (step * setting)
+ o_current_rail_voltage = mss::pmic::VOLT_RANGE_MINS[i_rail][l_range_selection] + (CONSTS::VOLT_STEP *
+ l_voltage_setting);
+ o_range_selection = l_range_selection;
+ }
+ return fapi2::FAPI2_RC_SUCCESS;
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Set the voltage percent on the specified rail of a JEDEC-compliant PMIC
+///
+/// @param[in] i_pmic_target PMIC to bias
+/// @param[in] i_rail rail to bias
+/// @param[in] i_percent percentage change
+/// @param[in] i_force override 10% change limit
+/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_voltage_percent(
+ const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const float i_percent,
+ const bool i_force)
+{
+ static constexpr float PERCENT_CONVERSION = 100;
+
+ // Make sure less than 10% if not overriding or within threshold
+ FAPI_ASSERT(bias_percent_within_threshold(i_percent, i_force),
+ fapi2::PMIC_BIAS_VOLTAGE_PAST_THRESHOLD()
+ .set_TARGET(i_pmic_target)
+ .set_PERCENT(i_percent)
+ .set_RAIL(i_rail),
+ "set_voltage_percent(): Bias percentage %f%% provided to PMIC %s exceed the maximum of 10%%. Use -f to override",
+ i_percent, mss::c_str(i_pmic_target));
+ {
+ uint32_t l_current_rail_voltage;
+ uint8_t l_range_selection;
+
+ FAPI_TRY(mss::pmic::get_current_rail_voltage(i_pmic_target, i_rail, l_current_rail_voltage, l_range_selection),
+ "set_voltage_percent: Error getting current rail voltage for rail # %u of PMIC %s", i_rail, mss::c_str(i_pmic_target));
+ {
+ // Obtain target voltage by percent offset
+ const uint32_t l_target_voltage_unrounded = l_current_rail_voltage * ((PERCENT_CONVERSION + i_percent) /
+ PERCENT_CONVERSION);
+
+ const uint32_t l_target_voltage = mss::pmic::round_rail_target_voltage(l_target_voltage_unrounded);
+
+ FAPI_TRY(set_new_rail_voltage(i_pmic_target, i_rail, l_target_voltage, l_range_selection),
+ "set_voltage_percent(): Error setting voltage on PMIC %s", mss::c_str(i_pmic_target));
+ }
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Set the voltage of a JEDEC_COMPLIANT pmic's rail
+///
+/// @param[in] i_pmic_target PMIC to bias
+/// @param[in] i_rail rail to bias
+/// @param[in] i_value value to set to
+/// @param[in] i_force override 10% change limit
+/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_voltage_value(
+ const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const float i_value,
+ const bool i_force)
+{
+ static constexpr float V_TO_MV_CONVERSION = 1000;
+ static constexpr float PERCENT_CONVERSION = 100;
+
+ const uint32_t l_value_mv = i_value * V_TO_MV_CONVERSION;
+
+ uint32_t l_current_rail_voltage = 0;
+ uint8_t l_range_selection;
+
+ // Get range selection and voltage
+ FAPI_TRY(mss::pmic::get_current_rail_voltage(i_pmic_target, i_rail, l_current_rail_voltage, l_range_selection),
+ "set_voltage_percent: Error getting current rail voltage for rail # %u of PMIC %s", i_rail, mss::c_str(i_pmic_target));
+ {
+ // Calculate percent change
+ // Float to avoid integer division
+ const float l_percent_change = (((l_current_rail_voltage / static_cast<float>(l_value_mv)) - 1)) * PERCENT_CONVERSION;
+
+ // Make sure less than 10% if not overriding or within threshold
+ FAPI_ASSERT(bias_percent_within_threshold(l_percent_change, i_force),
+ fapi2::PMIC_BIAS_VOLTAGE_PAST_THRESHOLD()
+ .set_TARGET(i_pmic_target)
+ .set_PERCENT(l_percent_change)
+ .set_RAIL(i_rail),
+ "set_voltage_value(): Bias percentage %f%% provided to PMIC %s exceed the maximum of 10%%. Use -f to override",
+ l_percent_change, mss::c_str(i_pmic_target));
+
+ {
+ const uint32_t l_target_voltage = mss::pmic::round_rail_target_voltage(l_value_mv);
+
+ // Verify new valid voltage and write to PMIC
+ FAPI_TRY(set_new_rail_voltage(i_pmic_target, i_rail, l_target_voltage, l_range_selection),
+ "set_voltage_value(): Error setting voltage on PMIC %s", mss::c_str(i_pmic_target));
+ }
+ }
+
+ return fapi2::FAPI2_RC_SUCCESS;
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief bias procedure for JEDEC compliant chips
+///
+/// @param[in] i_pmic_target - the pmic_target
+/// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.)
+/// @param[in] i_amount amount to change by
+/// @param[in] i_unit percentage or value
+/// @param[in] i_force ignore 10% change limit
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success
+/// @note not templated by vendor. As long as the TI
+///
+fapi2::ReturnCode bias_chip(
+ const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::setting i_setting,
+ const float i_amount,
+ const mss::pmic::unit i_unit,
+ const bool i_force)
+{
+ using CONSTS = mss::pmic::consts<mss::pmic::product::JEDEC_COMPLIANT>;
+
+ if (i_unit == mss::pmic::unit::PERCENT)
+ {
+ FAPI_TRY(set_voltage_percent(i_pmic_target,
+ static_cast<mss::pmic::rail>(i_setting % CONSTS::NUMBER_OF_RAILS),
+ i_amount, i_force));
+ }
+ else // value
+ {
+ FAPI_TRY(set_voltage_value(i_pmic_target,
+ static_cast<mss::pmic::rail>(i_setting % CONSTS::NUMBER_OF_RAILS),
+ i_amount, i_force));
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+} // pmic
+} // mss
diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H
index 58757e249..64fd9fdcf 100644
--- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H
+++ b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H
@@ -30,13 +30,18 @@
// *HWP HWP Owner: Mark Pizzutillo <mark.pizzutillo@ibm.com>
// *HWP HWP Backup: Louis Stermole <stermole@us.ibm.com>
// *HWP Team: Memory
-// *HWP Level: 1
+// *HWP Level: 2
// *HWP Consumed by: FSP:HB
#ifndef __PMIC_BIAS_UTILS_H__
#define __PMIC_BIAS_UTILS_H__
#include <fapi2.H>
+#include <lib/utils/pmic_consts.H>
+#include <lib/utils/pmic_common_utils.H>
+#include <pmic_regs.H>
+#include <pmic_regs_fld.H>
+#include <generic/memory/lib/utils/c_str.H>
namespace mss
{
@@ -49,12 +54,16 @@ namespace pmic
enum setting
{
// We order these by rail in groups of 4 so they match with the rail enums,
- // so the rail can be derived from just a % 4 when we have more settings to change
+ // so the rail can be derived from just a % 4 when we have more settings to change (see current)
SWA_VOLT = 0,
SWB_VOLT = 1,
SWC_VOLT = 2,
SWD_VOLT = 3,
- NO_SETTING = 4,
+ // SWA_CURRENT = 4,
+ // SWB_CURRENT = 5,
+ // ..
+ // ..
+ NO_SETTING = 8,
};
///
@@ -67,7 +76,108 @@ enum unit
PERCENT = 2,
};
-}// pmic
-}// mss
+// Max bias % change that the procedure will allow without override flag
+static constexpr float PERCENT_MAX_BIAS = 10.0;
+
+//-------- JEDEC SPECIFIC HELPER FUNCS ---------//
+
+///
+/// @brief Set the voltage of a rail (post-rounding)
+///
+/// @param[in] i_pmic_target PMIC target
+/// @param[in] i_rail rail to set
+/// @param[in] i_target_voltage voltage to set to
+/// @param[in] i_range_selection range (0 or 1) of the rail
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_new_rail_voltage(
+ const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const uint32_t i_target_voltage,
+ const uint8_t i_range_selection);
+
+///
+/// @brief round a target rail voltage to the nearest step of 5mV to create the voltage bitmap
+///
+/// @param[in] l_target_voltage_unrounded unrounded voltage
+/// @return uint32_t rounded voltage
+///
+uint32_t round_rail_target_voltage(const uint32_t l_target_voltage_unrounded);
+
+///
+/// @brief Checks if bias percentage is within the MAX_BIAS threshold
+///
+/// @param[in] i_percent percentage to check
+/// @param[in] i_force force change (would force evaluation to true)
+/// @return true if in range, false if not
+///
+bool bias_percent_within_threshold(const float i_percent, const bool i_force);
+
+///
+/// @brief Get the current rail voltage of a JEDEC PMIC
+///
+/// @param[in] i_pmic_target PMIC target
+/// @param[in] i_rail rail to read from
+/// @param[out] o_current_rail_voltage voltage calculated for rail
+/// @param[out] o_range_selection range selection of that voltage
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success, else error
+/// @note not templated as the arguments may differ for other chips (if we ever use others)
+///
+fapi2::ReturnCode get_current_rail_voltage(const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>&
+ i_pmic_target,
+ const mss::pmic::rail i_rail,
+ uint32_t& o_current_rail_voltage,
+ uint8_t& o_range_selection);
+
+//-------------- HELPER FUNCTIONS --------------//
+
+///
+/// @brief Set the voltage percent on the specified rail of a PMIC device
+///
+/// @param[in] i_pmic_target PMIC target
+/// @param[in] i_rail rail to bias
+/// @param[in] i_percent percentage change
+/// @param[in] i_force override 10% change limit
+/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_voltage_percent(const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const float i_percent,
+ const bool i_force);
+
+///
+/// @brief Set the voltage of a rail by a value
+///
+/// @param[in] i_pmic_target PMIC to bias
+/// @param[in] i_rail rail to bias
+/// @param[in] i_value value to set to
+/// @param[in] i_force override 10% change limit
+/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode set_voltage_value(const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::rail i_rail,
+ const float i_value,
+ const bool i_force);
+
+//------------------- BIAS FUNCTIONS -----------------//
+
+///
+/// @brief Bias a chip with the given settings
+///
+/// @param[in] i_pmic_target - the pmic_target
+/// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.)
+/// @param[in] i_amount amount to change by
+/// @param[in] i_unit percentage or value
+/// @param[in] i_force ignore 10% change limit
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success
+///
+fapi2::ReturnCode bias_chip(const fapi2::Target<fapi2::TargetType::TARGET_TYPE_PMIC>& i_pmic_target,
+ const mss::pmic::setting i_setting,
+ const float i_amount,
+ const mss::pmic::unit i_unit,
+ const bool i_force);
+
+} // pmic
+} // mss
#endif
diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_common_utils.H b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_common_utils.H
index 78cf87f6e..6516140c7 100644
--- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_common_utils.H
+++ b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_common_utils.H
@@ -63,6 +63,14 @@ using FIELDS = pmicFields<mss::pmic::product::JEDEC_COMPLIANT>;
using CONSTS = mss::pmic::consts<mss::pmic::product::JEDEC_COMPLIANT>;;
// Arrays to easily index common parameters by rail
+static constexpr uint8_t const VOLT_SETTING_ACTIVE_REGS[] =
+{
+ REGS::R21_SWA_VOLTAGE_SETTING,
+ REGS::R23_SWB_VOLTAGE_SETTING,
+ REGS::R25_SWC_VOLTAGE_SETTING,
+ REGS::R27_SWD_VOLTAGE_SETTING
+};
+
static constexpr uint8_t const VOLT_SETTING_REGS[] =
{
REGS::R21_SWA_VOLTAGE_SETTING,
@@ -79,7 +87,7 @@ static constexpr uint8_t const VOLT_RANGE_FLDS[] =
FIELDS::SWD_VOLTAGE_RANGE
};
-static constexpr float const VOLT_RANGE_MINS[][CONSTS::NUM_RANGES] =
+static constexpr uint32_t const VOLT_RANGE_MINS[][CONSTS::NUM_RANGES] =
{
{CONSTS::SWABC_VOLT_RANGE0_MIN, CONSTS::SWABC_VOLT_RANGE1_MIN},
{CONSTS::SWABC_VOLT_RANGE0_MIN, CONSTS::SWABC_VOLT_RANGE1_MIN},
@@ -87,7 +95,7 @@ static constexpr float const VOLT_RANGE_MINS[][CONSTS::NUM_RANGES] =
{CONSTS::SWD_VOLT_RANGE0_MIN, CONSTS::SWD_VOLT_RANGE1_MIN}
};
-static constexpr float const VOLT_RANGE_MAXES[][CONSTS::NUM_RANGES] =
+static constexpr uint32_t const VOLT_RANGE_MAXES[][CONSTS::NUM_RANGES] =
{
{CONSTS::SWABC_VOLT_RANGE0_MAX, CONSTS::SWABC_VOLT_RANGE1_MAX},
{CONSTS::SWABC_VOLT_RANGE0_MAX, CONSTS::SWABC_VOLT_RANGE1_MAX},
diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_consts.H b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_consts.H
index 3d5a45b5c..addf8ca6b 100644
--- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_consts.H
+++ b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_consts.H
@@ -289,18 +289,18 @@ struct consts<mss::pmic::product::JEDEC_COMPLIANT>
static constexpr uint8_t MAX_DELAY_BITMAP = 0b00000111;
static constexpr uint8_t CONVERT_RANGE1_TO_RANGE0 = 40;
- static constexpr float SWABC_VOLT_RANGE0_MIN = 0.8;
- static constexpr float SWABC_VOLT_RANGE0_MAX = 1.435;
- static constexpr float SWABC_VOLT_RANGE1_MIN = 0.6;
- static constexpr float SWABC_VOLT_RANGE1_MAX = 1.235;
-
- static constexpr float SWD_VOLT_RANGE0_MIN = 1.5;
- static constexpr float SWD_VOLT_RANGE0_MAX = 2.135;
- static constexpr float SWD_VOLT_RANGE1_MIN = 2.2;
- static constexpr float SWD_VOLT_RANGE1_MAX = 2.835;
-
- // the overarching JEDEC spec says 5. Sticking with 5 until we hear otherwise.
- static constexpr float VOLT_STEP = 0.005; // 5 mV
+ // Values below are in millivolts (mV)
+ static constexpr uint32_t SWABC_VOLT_RANGE0_MIN = 800;
+ static constexpr uint32_t SWABC_VOLT_RANGE0_MAX = 1435;
+ static constexpr uint32_t SWABC_VOLT_RANGE1_MIN = 600;
+ static constexpr uint32_t SWABC_VOLT_RANGE1_MAX = 1235;
+
+ static constexpr uint32_t SWD_VOLT_RANGE0_MIN = 1500;
+ static constexpr uint32_t SWD_VOLT_RANGE0_MAX = 2135;
+ static constexpr uint32_t SWD_VOLT_RANGE1_MIN = 2200;
+ static constexpr uint32_t SWD_VOLT_RANGE1_MAX = 2835;
+
+ static constexpr uint32_t VOLT_STEP = 5;
};
///
OpenPOWER on IntegriCloud