Skip to content

Commit

Permalink
drivers: gpio: npcm4xx: fix wrong setting when setup gpio open drain …
Browse files Browse the repository at this point in the history
…mode

fix wrong setting when setup gpio open drain mode.

only output open drain mode with pull-up setting need enable DEVALTCX bit.

Signed-off-by: James Chiang <[email protected]>
  • Loading branch information
James Chiang authored and jc849 committed Sep 20, 2024
1 parent f87b530 commit fe2f344
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/gpio/gpio_npcm4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,14 @@ static int gpio_npcm4xx_config(const struct device *dev,
else
inst->PTYPE &= ~mask;

/* Select opend drain with pull up need enable GPIO_PULL_EN */
if (((flags & GPIO_OPEN_DRAIN) != 0) &&
((flags & GPIO_PULL_UP) != 0)) {
inst_scfg->DEVALTCX |= BIT(NPCM4XX_DEVALTCX_GPIO_PULL_EN);
/* Open drain output mode want to enable internal pull up/down */
if ((flags & GPIO_OPEN_DRAIN) && (flags & GPIO_OUTPUT)) {
if ((flags & GPIO_PULL_UP)) {
inst_scfg->DEVALTCX |= BIT(NPCM4XX_DEVALTCX_GPIO_PULL_EN);
}
}

/* Select pull-up/down of GPIO 0:pull-up 1:pull-down */
/* Enable and select pull-up/down of GPIO 0:pull-up 1:pull-down */
if ((flags & GPIO_PULL_UP) != 0) {
inst->PPUD &= ~mask;
inst->PPULL |= mask;
Expand Down

0 comments on commit fe2f344

Please sign in to comment.