Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion meta-facebook/sb-rb/src/platform/plat_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LOG_MODULE_REGISTER(plat_class);
static uint8_t vr_module = 0;
static uint8_t ubc_module = 0;
static uint8_t mmc_slot = 0;
static uint8_t asic_board_id = 0;

static bool plat_slot_read(uint8_t *data)
{
Expand Down Expand Up @@ -62,7 +63,12 @@ void init_plat_config()
vr_module = (module & 0x01);
ubc_module = (module >> 1) & 0x03;

change_sensor_cfg(vr_module);
change_sensor_cfg(vr_module, ubc_module);

uint8_t board_id = 0;
plat_read_cpld(CPLD_OFFSET_ASIC_BOARD_ID, &board_id, 1);

asic_board_id = board_id & 0x03;

// cpld fru offset 0: slot
plat_slot_read(&mmc_slot);
Expand All @@ -81,4 +87,9 @@ uint8_t get_ubc_module()
uint8_t get_mmc_slot()
{
return mmc_slot;
}

uint8_t get_asic_board_id()
{
return asic_board_id;
}
9 changes: 9 additions & 0 deletions meta-facebook/sb-rb/src/platform/plat_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ enum UBC_MODULE {
UBC_MODULE_UNKNOWN,
};

enum ASIC_BOARD_ID {
ASIC_BOARD_ID_RSVD1,
ASIC_BOARD_ID_RSVD2,
ASIC_BOARD_ID_RAINBOW,
ASIC_BOARD_ID_EVB,
ASIC_BOARD_ID_UNKNOWN,
};

void init_plat_config();
uint8_t get_vr_module();
uint8_t get_ubc_module();
uint8_t get_mmc_slot();
uint8_t get_asic_board_id();

#endif
3 changes: 0 additions & 3 deletions meta-facebook/sb-rb/src/platform/plat_cpld.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include "plat_hook.h"
#include <logging/log.h>

#define CPLD_ADDR (0x4C >> 1)
#define I2C_BUS_CPLD I2C_BUS11

#define POLLING_CPLD_STACK_SIZE 2048
#define CPLD_POLLING_INTERVAL_MS 1000 // 1 second polling interval

Expand Down
4 changes: 3 additions & 1 deletion meta-facebook/sb-rb/src/platform/plat_cpld.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#define CPLD_OFFSET_VR_VENDER_TYPE 0x15
#define CPLD_OFFSET_POWER_CLAMP 0x25
#define CPLD_OFFSET_USERCODE 0x32

#define CPLD_OFFSET_ASIC_BOARD_ID 0x3C
#define CPLD_ADDR (0x4C >> 1)
#define I2C_BUS_CPLD I2C_BUS11
typedef struct _cpld_info_ cpld_info;

typedef struct _cpld_info_ {
Expand Down
2 changes: 2 additions & 0 deletions meta-facebook/sb-rb/src/platform/plat_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#define ENABLE_MP29816A
#define ENABLE_RAA228249
#define ENABLE_EMC1413
#define ENABLE_BMR316
#define ENABLE_LX6301
#define ENABLE_MCTP_I3C

#define DISABLE_AST_ADC
Expand Down
9 changes: 6 additions & 3 deletions meta-facebook/sb-rb/src/platform/plat_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ GPIO_CFG plat_gpio_cfg[] = {
NULL },
{ CHIP_GPIO, 50, ENABLE, DISABLE, GPIO_OUTPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 51, ENABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE, NULL },
{ CHIP_GPIO, 52, ENABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE, NULL },
{ CHIP_GPIO, 51, ENABLE, DISABLE, GPIO_OUTPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 52, ENABLE, DISABLE, GPIO_OUTPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 53, DISABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 54, DISABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
Expand All @@ -144,7 +146,8 @@ GPIO_CFG plat_gpio_cfg[] = {
// GPIO 7 group
{ CHIP_GPIO, 56, DISABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 57, ENABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE, NULL },
{ CHIP_GPIO, 57, ENABLE, DISABLE, GPIO_OUTPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 58, DISABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
NULL },
{ CHIP_GPIO, 59, DISABLE, DISABLE, GPIO_INPUT, GPIO_LOW, PUSH_PULL, GPIO_INT_DISABLE,
Expand Down
13 changes: 10 additions & 3 deletions meta-facebook/sb-rb/src/platform/plat_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@

LOG_MODULE_REGISTER(plat_hook);

static struct k_mutex vr_mutex[VR_MAX_NUM];

#define EEPROM_MAX_WRITE_TIME 5 // the BR24G512 eeprom max write time is 3.5 ms
static struct k_mutex vr_mutex[VR_INDEX_MAX];

vr_pre_proc_arg vr_pre_read_args[] = {
{ .mutex = vr_mutex + 0, .vr_page = 0x0 }, { .mutex = vr_mutex + 0, .vr_page = 0x1 },
Expand All @@ -45,6 +43,15 @@ vr_pre_proc_arg vr_pre_read_args[] = {
{ .mutex = vr_mutex + 9, .vr_page = 0x0 }, { .mutex = vr_mutex + 9, .vr_page = 0x1 },
{ .mutex = vr_mutex + 10, .vr_page = 0x0 }, { .mutex = vr_mutex + 10, .vr_page = 0x1 },
{ .mutex = vr_mutex + 11, .vr_page = 0x0 }, { .mutex = vr_mutex + 11, .vr_page = 0x1 },
{ .mutex = vr_mutex + 12, .vr_page = 0x0 }, { .mutex = vr_mutex + 12, .vr_page = 0x1 },
};

mp2971_init_arg mp2971_init_args[] = {
[0] = { .vout_scale_enable = true },
};

mpc12109_init_arg mpc12109_init_args[] = {
[0] = { .iout_lsb = 0.5, .pout_lsb = 2 },
};

void *vr_mutex_get(enum VR_INDEX_E vr_index)
Expand Down
5 changes: 3 additions & 2 deletions meta-facebook/sb-rb/src/platform/plat_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#define PLAT_HOOK_H

#include "sensor.h"
#include "plat_pldm_sensor.h"

#define VR_MAX_NUM 12
#define VR_MUTEX_LOCK_TIMEOUT_MS 1000

#include "plat_pldm_sensor.h"
extern mp2971_init_arg mp2971_init_args[];

enum VR_INDEX_E {
VR_INDEX_E_1 = 0,
Expand All @@ -37,6 +37,7 @@ enum VR_INDEX_E {
VR_INDEX_E_10,
VR_INDEX_E_11,
VR_INDEX_E_12,
VR_INDEX_E_13, // P3V3 OSFP
VR_INDEX_MAX,
};

Expand Down
2 changes: 1 addition & 1 deletion meta-facebook/sb-rb/src/platform/plat_i2c_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static bool command_reply_data_handle(void *arg)
/* I2C target init-config table */
const struct _i2c_target_config I2C_TARGET_CONFIG_TABLE[MAX_TARGET_NUM] = {
{ 0xFF, 0xA }, { 0xFF, 0xA }, { 0xFF, 0xA },
{ 0xFF, 0xA }, { 0xFF, 0xA }, { 0x40, 0xA, command_reply_data_handle },
{ 0xFF, 0xA }, { 0xFF, 0xA }, { 0x42, 0xA, command_reply_data_handle },
{ 0xFF, 0xA }, { 0xFF, 0xA }, { 0xFF, 0xA },
{ 0xFF, 0xA }, { 0xFF, 0xA }, { 0xFF, 0xA },
};
18 changes: 14 additions & 4 deletions meta-facebook/sb-rb/src/platform/plat_mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
LOG_MODULE_REGISTER(plat_mctp);

/* i2c 8 bit address */
#define I2C_ADDR_BIC 0x40
#define I2C_ADDR_BIC 0x42
#define I2C_ADDR_BMC 0x20

/* i2c dev bus */
Expand Down Expand Up @@ -87,10 +87,10 @@ uint8_t MCTP_SUPPORTED_MESSAGES_TYPES[] = {
static mctp *find_mctp_by_bus(uint8_t bus)
{
uint8_t i;
for (i = 0; i < ARRAY_SIZE(plat_mctp_port); i++) {
mctp_port *p = plat_mctp_port + i;
for (i = 0; i < ARRAY_SIZE(smbus_port); i++) {
mctp_port *p = smbus_port + i;

if (bus == p->conf.i3c_conf.bus)
if (bus == p->conf.smbus_conf.bus)
return p->mctp_inst;
}

Expand Down Expand Up @@ -192,6 +192,16 @@ int load_mctp_support_types(uint8_t *type_len, uint8_t *types)
return MCTP_SUCCESS;
}

uint8_t plat_get_mctp_port_count()
{
return ARRAY_SIZE(smbus_port);
}

mctp_port *plat_get_mctp_port(uint8_t index)
{
return smbus_port + index;
}

void plat_i3c_set_pid(void)
{
I3C_MSG i3c_msg;
Expand Down
3 changes: 3 additions & 0 deletions meta-facebook/sb-rb/src/platform/plat_pldm_fw_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ static bool get_vr_fw_version(void *info_p, uint8_t *buf, uint8_t *len)
if (cfg->type == sensor_dev_mp2891 || cfg->type == sensor_dev_mp29816a) {
*len += bin2hex((uint8_t *)&version, 2, buf_p, 4);
buf_p += 4;
} else if (cfg->type == sensor_dev_raa228249 || cfg->type == sensor_dev_mp2971) {
*len += bin2hex((uint8_t *)&version, 4, buf_p, 8);
buf_p += 8;
} else {
LOG_ERR("Unsupport VR type(%d)", cfg->type);
}
Expand Down
Loading
Loading