Skip to content

Commit 13e87b5

Browse files
HungYi-Limeta-codesync[bot]
authored andcommitted
sb: rb: Fix bugs, add power capping and add RNS vr test mode functions (#2658)
Summary: - remove some pins that are not strap - fix clear clock status behavior - add 4v2 and 0v75 vr fault error event type - add tray location info in test info shell cmd - add i2c target 0x94 reg - ioexp: add U200053 IO expander init and refactor U200070 init - add shell cmd get_mb_pwr_en - add adc init vr vol buf - modify ASIC temp_threshold default value - add ASIC reset-to-IO-expander sync mechanism - init U200053/U200070 IO expanders in IRIS power-on ISR - fix GPIO pin MEDHA1_SW_EN - enable sensor polling when 1-step - fix GPIO name LV1 PWR CAP - add CHIPMODE T17CISB-862 - add temp event tmp - add asic bspi mux sell cmd - modify ASIC temp_threshold default value to zero - modify tmp432 open status and event - modify the data of asic thermtrip log - fix set value to table with IO - extend platform info shell output - fix shell_plat_reboot command to avoid error when reboot - Fix U200051 IO default output value - modify event log format - add shell command "asic_mfio_debug" - add thermtrip event when init - restrict asic_mfio_debug shell to EVB only - fix blackbox clear issue - fix vr power fault duplicate entries in blackbox - add get asic boot0, boot1 version and show temp array data in cli command - add i2c_switch_control cli command - fix CHIPMODE test strap pin - remove blank in shell_plat_asic_mfio_debug cli command - add adc_test get_good_status - disable polling before update reset - disable unused function - add vr test mode function(RNS) - update RNS vr test mode fenction and settings a.update VR settings b.remove P3v3 voltage range and Vout setting c.modifiedvoltage range and Vout setting can only used in test mode - add power capping function(level 2, level 3 are OK, level 1 face some issue need to debug) - add support for FRU board info registers 0x60~0x6C. - add support for FRU product info registers 0x70~0x76. - add mfio 12 13 14 in shell command "asic_mfio_debug" - add update boot0 version reading from asic - update platform extension info mapping in plat_class.c so VR_MODULE_RNS reports "VR_RNS_RAA229140_RAA228249" (was "VR_MPS_RAA229140_RAA228249"). Pull Request resolved: #2658 Test Plan: - Build code: Pass Reviewed By: amithash Differential Revision: D90950439 fbshipit-source-id: 8dd9018194aa0b4c6d61248906995cfdf7854f35
1 parent a77668e commit 13e87b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3530
-591
lines changed

common/dev/include/mp29816a.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ bool mp29816a_get_vout_max(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
2424
bool mp29816a_get_vout_min(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
2525
bool mp29816a_set_vout_max(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
2626
bool mp29816a_set_vout_min(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
27+
bool mp29816a_get_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t *value);
28+
bool mp29816a_set_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t value);
2729
bool mp29816a_fwupdate(uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size);
2830
bool mp29816a_get_vout_command(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
2931
bool mp29816a_set_vout_command(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);

common/dev/include/raa228249.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ int raa228249_get_remaining_wr(uint8_t bus, uint8_t addr, uint8_t *remain);
2828
bool raa228249_fwupdate(uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size);
2929
bool raa228249_get_vout_command(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
3030
bool raa228249_set_vout_command(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt);
31+
bool raa228249_get_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t *value);
32+
bool raa228249_set_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t value);
3133
bool raa228249_get_vr_status(sensor_cfg *cfg, uint8_t rail, uint8_t vr_status_rail,
3234
uint16_t *vr_status);
3335
bool raa228249_clear_vr_status(sensor_cfg *cfg, uint8_t rail);

common/dev/include/tmp431.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "sensor.h"
2121

2222
bool tmp432_get_temp_status(sensor_cfg *cfg, uint8_t *temp_status);
23+
bool tmp432_get_temp_open_status(sensor_cfg *cfg, uint8_t *temp_status);
2324
bool tmp432_clear_temp_status(sensor_cfg *cfg);
2425

2526
enum TMP431_CHANNELS {

common/dev/mp29816a.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ LOG_MODULE_REGISTER(mp29816a);
3838

3939
#define MP29816A_VOUT_MAX_REG 0x24
4040
#define MP29816A_VOUT_MIN_REG 0x2B
41+
#define MP29816A_SVI3_IOUT_RPT_REG 0x67
4142

4243
/* --------- PAGE1 ---------- */
4344
#define VR_REG_EXPECTED_USER_CRC 0xED
@@ -319,6 +320,74 @@ bool mp29816a_set_vout_min(sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
319320
return true;
320321
}
321322

323+
bool mp29816a_get_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t *value)
324+
{
325+
CHECK_NULL_ARG_WITH_RETURN(cfg, false);
326+
CHECK_NULL_ARG_WITH_RETURN(value, false);
327+
328+
uint8_t data[2] = { 0 };
329+
uint8_t scale_bit = 0;
330+
if (!mp29816a_i2c_read(cfg->port, cfg->target_addr, MP29816A_SVI3_IOUT_RPT_REG, data,
331+
sizeof(data))) {
332+
return false;
333+
}
334+
scale_bit = data[0] & 0x07;
335+
336+
if (!mp29816a_i2c_read(cfg->port, cfg->target_addr, PMBUS_IOUT_OC_WARN_LIMIT, data,
337+
sizeof(data))) {
338+
return false;
339+
}
340+
341+
// final value: 8 * data * scale_bit
342+
if (scale_bit == 7) {
343+
// 2A for scale_bit
344+
*value = 8 * (data[0] | (data[1] << 8)) * 2;
345+
} else if (scale_bit < 6 && scale_bit > 0) {
346+
// 1/32, 1/16, 1/8 ...
347+
*value = 8 * (data[0] | (data[1] << 8)) / (2 ^ (6 - scale_bit));
348+
} else {
349+
// 1A
350+
*value = 8 * (data[0] | (data[1] << 8));
351+
}
352+
353+
return true;
354+
}
355+
356+
bool mp29816a_set_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t value)
357+
{
358+
CHECK_NULL_ARG_WITH_RETURN(cfg, false);
359+
360+
uint8_t data[2] = { 0 };
361+
uint8_t scale_bit = 0;
362+
if (!mp29816a_i2c_read(cfg->port, cfg->target_addr, MP29816A_SVI3_IOUT_RPT_REG, data,
363+
sizeof(data))) {
364+
return false;
365+
}
366+
scale_bit = data[0] & 0x07;
367+
368+
// final value: (data / scale_bit) / 8
369+
if (scale_bit == 7) {
370+
// 2A for scale_bit
371+
value = (value / 2) / 8;
372+
} else if (scale_bit < 6 && scale_bit > 0) {
373+
// 1/32, 1/16, 1/8 ...
374+
value = (value * (2 ^ (6 - scale_bit))) / 8;
375+
} else {
376+
// 1A
377+
value = value / 8;
378+
}
379+
380+
data[0] = value & 0xFF;
381+
data[1] = value >> 8;
382+
383+
if (!mp29816a_i2c_write(cfg->port, cfg->target_addr, PMBUS_IOUT_OC_WARN_LIMIT, data,
384+
sizeof(data))) {
385+
return false;
386+
}
387+
388+
return true;
389+
}
390+
322391
static uint8_t mp29816a_do_update(struct cfg_data *cfg_data_list, uint32_t cfg_cnt, uint8_t bus,
323392
uint8_t addr)
324393
{

common/dev/raa228249.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,40 @@ bool raa228249_set_vout_command(sensor_cfg *cfg, uint8_t rail, uint16_t *millivo
519519
return true;
520520
}
521521

522+
bool raa228249_get_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t *value)
523+
{
524+
CHECK_NULL_ARG_WITH_RETURN(cfg, false);
525+
CHECK_NULL_ARG_WITH_RETURN(value, false);
526+
527+
uint8_t data[2] = { 0 };
528+
if (!raa228249_i2c_read(cfg->port, cfg->target_addr, PMBUS_IOUT_OC_WARN_LIMIT, data,
529+
sizeof(data))) {
530+
return false;
531+
}
532+
533+
// 1 unit = 0.1A
534+
*value = (data[0] | (data[1] << 8)) * 0.1;
535+
return true;
536+
}
537+
538+
bool raa228249_set_iout_oc_warn_limit(sensor_cfg *cfg, uint16_t value)
539+
{
540+
CHECK_NULL_ARG_WITH_RETURN(cfg, false);
541+
542+
/* input value unit: 1A */
543+
uint8_t data[2] = { 0 };
544+
uint16_t cal_value = value * 10;
545+
data[0] = cal_value & 0xFF;
546+
data[1] = cal_value >> 8;
547+
548+
if (!raa228249_i2c_write(cfg->port, cfg->target_addr, PMBUS_IOUT_OC_WARN_LIMIT, data,
549+
sizeof(data))) {
550+
return false;
551+
}
552+
553+
return true;
554+
}
555+
522556
bool raa228249_get_vr_status(sensor_cfg *cfg, uint8_t rail, uint8_t vr_status_rail,
523557
uint16_t *vr_status)
524558
{

common/dev/tmp431.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,28 @@ bool tmp432_get_temp_status(sensor_cfg *cfg, uint8_t *temp_status)
406406
return true;
407407
}
408408

409+
bool tmp432_get_temp_open_status(sensor_cfg *cfg, uint8_t *temp_status)
410+
{
411+
CHECK_NULL_ARG_WITH_RETURN(cfg, false);
412+
413+
I2C_MSG i2c_msg = { 0 };
414+
uint8_t retry = 5;
415+
i2c_msg.bus = cfg->port;
416+
i2c_msg.target_addr = cfg->target_addr;
417+
i2c_msg.tx_len = 1;
418+
i2c_msg.rx_len = 1;
419+
i2c_msg.data[0] = TMP432_OPEN_STATUS_REG;
420+
421+
if (i2c_master_read(&i2c_msg, retry)) {
422+
LOG_ERR("TMP[0x%x] get open status reg[0x%d] failed.", cfg->num,
423+
TMP432_OPEN_STATUS_REG);
424+
return false;
425+
}
426+
*temp_status = i2c_msg.data[0];
427+
428+
return true;
429+
}
430+
409431
bool tmp432_clear_temp_status(sensor_cfg *cfg)
410432
{
411433
CHECK_NULL_ARG_WITH_RETURN(cfg, false);

common/service/pldm/pldm_monitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ enum pldm_sensor_operational_state {
8888
PLDM_SENSOR_FAILED,
8989
PLDM_SENSOR_INITIALIZING,
9090
PLDM_SENSOR_SHUTTINGDOWN,
91-
PLDM_SENSOR_INTEST
91+
PLDM_SENSOR_INTEST,
92+
PLDM_SENSOR_OPEN_CIRCUIT,
9293
};
9394

9495
enum pldm_effecter_operational_state {

common/service/pldm/pldm_oem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ enum iris_event_source {
197197
IRIS_OWL_W_TRVDD0P75,
198198
IRIS_HAMSA_AVDD_PCIE,
199199
IRIS_HAMSA_VDDHRXTX_PCIE,
200+
IRIS_4V2,
201+
IRIS_P0V75_AVDD_HCSL,
200202
// VR Power Fault 2
201203
IRIS_MEDHA1_VDD,
202204
IRIS_MEDHA0_VDD,

common/service/sensor/pldm_sensor.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ void pldm_sensor_get_reading(sensor_cfg *pldm_sensor_cfg, uint32_t *update_time,
303303
if (pldm_sensor_cfg->post_sensor_read_hook) {
304304
if (!pldm_sensor_cfg->post_sensor_read_hook(
305305
pldm_sensor_cfg, pldm_sensor_cfg->post_sensor_read_args, &reading)) {
306-
pldm_sensor_cfg->cache_status = PLDM_SENSOR_FAILED;
306+
if (pldm_sensor_cfg->cache_status == SENSOR_OPEN_CIRCUIT)
307+
pldm_sensor_cfg->cache_status = PLDM_SENSOR_OPEN_CIRCUIT;
308+
else
309+
pldm_sensor_cfg->cache_status = PLDM_SENSOR_FAILED;
307310
*update_time_ms = k_uptime_get_32();
308311
*update_time = (*update_time_ms / 1000);
309312
LOG_DBG("Failed to pose read sensor_num 0x%x of thread %d", sensor_num,

common/service/sensor/sensor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ enum {
256256
SENSOR_PEC_ERROR,
257257
SENSOR_PARAMETER_NOT_VALID,
258258
SENSOR_UNAVAILABLE,
259+
SENSOR_OPEN_CIRCUIT,
259260
};
260261

261262
enum { SENSOR_INIT_SUCCESS, SENSOR_INIT_UNSPECIFIED_ERROR };

0 commit comments

Comments
 (0)