Skip to content

fby3: dl: Add oem get fw version for server board#418

Closed
DelphineChiu wants to merge 1 commit into
facebook:mainfrom
Wiwynn:Marshall/fby3-dl/oem_get_fw_version
Closed

fby3: dl: Add oem get fw version for server board#418
DelphineChiu wants to merge 1 commit into
facebook:mainfrom
Wiwynn:Marshall/fby3-dl/oem_get_fw_version

Conversation

@DelphineChiu

Copy link
Copy Markdown

Summary:

  • as the title.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 18, 2022
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment on lines +90 to +176
i2c_msg.tx_len = 1;
i2c_msg.rx_len = 7;
i2c_msg.bus = I2C_BUS8;
i2c_msg.data[0] = PMBUS_IC_DEVICE_ID;

if (i2c_master_read(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

if (memcmp(i2c_msg.data, ISL69254_DEVICE_ID, sizeof(ISL69254_DEVICE_ID)) == 0) {
/* Renesas isl69254 */
i2c_msg.tx_len = 3;
i2c_msg.data[0] = 0xC7; //command code
i2c_msg.data[1] = 0x3F; //register
i2c_msg.data[2] = 0x00; //dummy data

if (i2c_master_write(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

i2c_msg.tx_len = 1;
i2c_msg.rx_len = 4;
i2c_msg.data[0] = 0xC5; //command code

if (i2c_master_read(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

msg->data[0] = i2c_msg.data[3];
msg->data[1] = i2c_msg.data[2];
msg->data[2] = i2c_msg.data[1];
msg->data[3] = i2c_msg.data[0];
msg->data_len = 4;
msg->completion_code = CC_SUCCESS;

} else if (memcmp(i2c_msg.data, XDPE12284C_DEVICE_ID,
sizeof(XDPE12284C_DEVICE_ID)) == 0) {
/* Infineon xdpe12284c */
i2c_msg.tx_len = 2;
i2c_msg.data[0] = 0x00;
i2c_msg.data[1] = 0x62; //set page to 0x62

if (i2c_master_write(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

//Read lower word for the 32bit checksum value
i2c_msg.tx_len = 1;
i2c_msg.rx_len = 2;
i2c_msg.data[0] = 0x43;
if (i2c_master_read(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

msg->data[0] = i2c_msg.data[1];
msg->data[1] = i2c_msg.data[0];

i2c_msg.tx_len = 2;
i2c_msg.data[0] = 0x00;
i2c_msg.data[1] = 0x62; //set page to 0x62

if (i2c_master_write(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

//Read higher word for the 32bit checksum value
i2c_msg.tx_len = 1;
i2c_msg.rx_len = 2;
i2c_msg.data[0] = 0x42;
if (i2c_master_read(&i2c_msg, retry)) {
msg->completion_code = CC_UNSPECIFIED_ERROR;
return;
}

msg->data[2] = i2c_msg.data[1];
msg->data[3] = i2c_msg.data[0];
msg->data_len = 4;
msg->completion_code = CC_SUCCESS;
} else {
msg->completion_code = CC_UNSPECIFIED_ERROR;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we break this out into a separate function?

Comment on lines +77 to +88
if ((component == DL_COMPNT_PVCCIN) || (component == DL_COMPNT_PVCCSA)) {
i2c_msg.target_addr = VCCIN_VCCSA_ADDR;
}
if ((component == DL_COMPNT_PVCCIO) || (component == DL_COMPNT_P3V3_STBY)) {
i2c_msg.target_addr = VCCIO_P3V3_STBY_ADDR;
}
if (component == DL_COMPNT_PVDDR_ABC) {
i2c_msg.target_addr = VDDQ_ABC_ADDR;
}
if (component == DL_COMPNT_PVDDR_DEF) {
i2c_msg.target_addr = VDDQ_DEF_ADDR;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the code below is a separate function we can pass in the target address as a parameter, and refactor these into the case statements above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

4 participants