Skip to content

fby3.5: bb: Support sled cycle button#132

Closed
rainlin024 wants to merge 1 commit into
facebook:mainfrom
rainlin024:fby3.5-bd-Support_sled_cycle_btn
Closed

fby3.5: bb: Support sled cycle button#132
rainlin024 wants to merge 1 commit into
facebook:mainfrom
rainlin024:fby3.5-bd-Support_sled_cycle_btn

Conversation

@rainlin024

Copy link
Copy Markdown

Summary:

  • When pressing the baseboard button for more than 4 seconds will sled cycle system.
  • When pressing the debug card PWR button for more than 4 seconds will sled cycle system.

Test plan:

  • Build code: Pass
  • No unexpected log: Pass
  • Baseboard button: Pass
  • Debug card PWR button: Pass

Log:

  • Pressing the baseboard button
    uart:~$ ?)I00:00:00.000,000] usb_dc_aspeed: select ep[0x81] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: select ep[0x82] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e ***
    Hello, welcome to yv35 baseboard POC 1
    ipmi_init
    : pre-selected ep[0x2] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: select ep[0x3] as OUT endpoint
    [00:00:00.103,000] usb_cdc_acm: Device suspended

  • Pressing the debug card PWR button
    uart:~$ ?)I00:00:00.000,000] usb_dc_aspeed: select ep[0x81] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: select ep[0x82] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e ***
    Hello, welcome to yv35 baseboard POC 1
    ipmi_init
    : pre-selected ep[0x2] as IN endpoint
    [00:00:00.000,000] usb_dc_aspeed: select ep[0x3] as OUT endpoint
    [00:00:00.103,000] usb_cdc_acm: Device suspended

Summary:
- When pressing the baseboard button for more than 4 seconds will sled cycle system.
- When pressing the debug card PWR button for more than 4 seconds will sled cycle system.

Test plan:
- Build code: Pass
- No unexpected log: Pass
- Baseboard button: Pass
- Debug card PWR button: Pass

Log:
- Pressing the baseboard button
uart:~$ ?)I00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x81] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x82] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e  ***
Hello, welcome to yv35 baseboard POC 1
ipmi_init
: pre-selected ep[0x2] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x3] as OUT endpoint
[00:00:00.103,000] <inf> usb_cdc_acm: Device suspended

- Pressing the debug card PWR button
uart:~$ ?)I00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x81] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x82] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e  ***
Hello, welcome to yv35 baseboard POC 1
ipmi_init
: pre-selected ep[0x2] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x3] as OUT endpoint
[00:00:00.103,000] <inf> usb_cdc_acm: Device suspended
@rainlin024 rainlin024 requested a review from GoldenBug January 14, 2022 05:35
@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 Jan 14, 2022
Comment on lines +6 to +41
struct k_delayed_work sled_cycle_work;

K_DELAYED_WORK_DEFINE(sled_cycle_work, sled_cycle_work_handler);

void ISR_sled_cycle() {
uint8_t bb_btn_status = GPIO_HIGH;

bb_btn_status = gpio_get(BB_BUTTON_BMC_BIC_N_R);
// press sled cycle button
if (bb_btn_status == GPIO_LOW) {
k_delayed_work_submit(&sled_cycle_work, K_SECONDS(MAX_PRESS_SLED_BTN_TIME_s));

// release sled cycle button
} else if (bb_btn_status == GPIO_HIGH) {
k_delayed_work_cancel(&sled_cycle_work);
}
}


void sled_cycle_work_handler(struct k_work *item) {
set_sled_cycle();
}

void set_sled_cycle() {
uint8_t retry = 5;
I2C_MSG msg;

msg.bus = CPLD_IO_I2C_BUS;
msg.slave_addr = CPLD_IO_I2C_ADDR;
msg.tx_len = 2;
msg.data[0] = CPLD_IO_REG_OFS_SLED_CYCLE; // offset
msg.data[1] = 0x01; // value

if (i2c_master_write(&msg, retry) < 0) {
printk("sled cycle fail\n");
}

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.

Is this something we expect to only ever need on Yv3.5 BB or could it be useful for future platforms as well?
If so, we should try and make it common code.

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.

Hi @GoldenBug,
Thanks for your comment.
We currently expect this part to be used only on Yv3.5 BB BIC.

@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.

1 similar comment
@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.

@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.

@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.

facebook-github-bot pushed a commit that referenced this pull request Jan 26, 2022
Summary:
- When pressing the baseboard button for more than 4 seconds will sled cycle system.
- When pressing the debug card PWR button for more than 4 seconds will sled cycle system.

Pull Request resolved: #132

Test Plan:
- Build code: Pass
- No unexpected log: Pass
- Baseboard button: Pass
- Debug card PWR button: Pass

Log:
- Pressing the baseboard button
uart:~$ ?)I�00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x81] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x82] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e  ***
Hello, welcome to yv35 baseboard POC 1
ipmi_init
: pre-selected ep[0x2] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x3] as OUT endpoint
[00:00:00.103,000] <inf> usb_cdc_acm: Device suspended

- Pressing the debug card PWR button
uart:~$ ?)I�00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x81] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x82] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed: pre-selected ep[0x1] as IN endpoint
[00:00:00.000,000] <wrn> usb_dc_aspeed*** Booting Zephyr OS build v00.01.03-18-g67d81d89470e  ***
Hello, welcome to yv35 baseboard POC 1
ipmi_init
: pre-selected ep[0x2] as IN endpoint
[00:00:00.000,000] <inf> usb_dc_aspeed: select ep[0x3] as OUT endpoint
[00:00:00.103,000] <inf> usb_cdc_acm: Device suspended

Reviewed By: garnermic

Differential Revision: D33703115

Pulled By: GoldenBug

fbshipit-source-id: 802a82f
@rainlin024 rainlin024 deleted the fby3.5-bd-Support_sled_cycle_btn branch January 26, 2022 05:20
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