Skip to content

fby3: dl: GPIO oem command#458

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

fby3: dl: GPIO oem command#458
DelphineChiu wants to merge 1 commit into
facebook:mainfrom
Wiwynn:Marshall/fby3-dl/adjust_oem_gpio_command

Conversation

@DelphineChiu

Copy link
Copy Markdown

Summary:

  • Add get gpio config oem command.
  • Align yv3 ti server board gpio number.

Test plan:
Build code: pass

@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 Aug 4, 2022
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

Comment thread common/hal/hal_gpio.c Outdated
Comment on lines +141 to +177
uint32_t gpio_dir = sys_read32(GPIO_GROUP_REG_ACCESS[gpio_idx / 32] + 0x4);

return GETBIT(gpio_dir, gpio_idx % 32);
}

uint8_t get_gpio_interrupt_enable(uint8_t gpio_idx)
{
uint32_t gpio_intr_en = sys_read32(GPIO_GROUP_REG_ACCESS[gpio_idx / 32] + 0x8);

return GETBIT(gpio_intr_en, gpio_idx % 32);
}

uint8_t get_gpio_interrupt_type(uint8_t gpio_idx)
{
uint32_t gpio_intr_type = sys_read32(GPIO_GROUP_REG_ACCESS[gpio_idx / 32] + 0x10);

return GETBIT(gpio_intr_type, gpio_idx % 32);
}

uint8_t get_gpio_interrupt_trigger_mode(uint8_t gpio_idx)
{
uint8_t trigger_mode = 0;
uint32_t gpio_intr_dual_edge = sys_read32(GPIO_GROUP_REG_ACCESS[gpio_idx / 32] + 0x14);
uint32_t gpio_intr_rsing_falling_edge =
sys_read32(GPIO_GROUP_REG_ACCESS[gpio_idx / 32] + 0xC);

if (gpio_intr_dual_edge & BIT(gpio_idx % 32)) {
trigger_mode = 0x2; //both edge
} else {
if (gpio_intr_rsing_falling_edge & BIT(gpio_idx % 32)) {
trigger_mode = 0x1; //rising edge
} else {
trigger_mode = 0x0; //falling edge
}
}

return trigger_mode;

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 make this a little more generic in case we need to support different boards in the future?

Preferably we wouldn't used hard coded values here and also we would use some of the Zephyr GPIO APIs that might help here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

https://docs.zephyrproject.org/2.6.0/reference/peripherals/gpio.html
There is no Zephyr GPIO API for getting gpio direction and gpio interrupt information. After discussing with Aspeed, they suggested for maintaining a GPIO status table and get the information from the table. Currently ,we are studying how to implement this feature. Do you have any concern?

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.

No concern, thank you for looking into this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Modify this commit to a function of align ti BIC GPIO number. And the feature of GPIO will be added in the later commit.

facebook-github-bot pushed a commit that referenced this pull request Aug 15, 2022
Summary:
- Add sel when vr hot gpio interrupt.

Dependency: #458

Pull Request resolved: #459

Test Plan: build pass on fby3 dl

Reviewed By: garnermic

Differential Revision: D38464821

Pulled By: GoldenBug

fbshipit-source-id: b78e96116d445ddb5bc9b801ef07e0efa97963c5
Summary:
- Align yv3 ti server board gpio number.

Test plan:
Build code: pass
@MarshallZhan-wiwynn MarshallZhan-wiwynn force-pushed the Marshall/fby3-dl/adjust_oem_gpio_command branch from 24f82b1 to e85cf99 Compare August 16, 2022 03:48
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

@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 Aug 16, 2022
Summary:
- Remove GPIOG0 interrupt enable due to mis-config before
- Disable GPIOO3 in GPIO config because this pin is for LPCRST# function.
- Change FM_FORCE_ADR_N to RST_PLTRST_BMC_N on both firmware(CPLD/BIC) and hardware side
  (Original background: GPIO RST_PLTRST_BMC_N and LPCRST# are same pin on aspeed bic but aspeed bic cannot support dual function at the same time)

Dependency: #458

Pull Request resolved: #485

Test Plan: build pass on fby3 dl

Reviewed By: peterdelevoryas

Differential Revision: D38678804

Pulled By: GoldenBug

fbshipit-source-id: 79a5727d98acf091b1a579a1215b98c5615f5fc4
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