Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed

Conversation

DelphineChiu
Copy link

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
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
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
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants