diff --git a/drivers/gpio/gpio_npcm4xx.c b/drivers/gpio/gpio_npcm4xx.c index 70970dcfef82a6..0d9e4a635811d5 100644 --- a/drivers/gpio/gpio_npcm4xx.c +++ b/drivers/gpio/gpio_npcm4xx.c @@ -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;