diff options
| author | Jim Liu <[email protected]> | 2025-12-16 10:47:28 +0800 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-12-31 10:17:00 -0600 |
| commit | 1f6b701959a640646a0df98b0d320fd480213ee6 (patch) | |
| tree | 3f7ba4c9068a83354583bada1ffd2c1bfb703d2a | |
| parent | 73a7155ba3e8e8a78dc2b65f815079b99ec1f41a (diff) | |
gpio: sgpio: modify persist check condition
Modify the persist check condition to fix init error.
Signed-off-by: Jim Liu <[email protected]>
| -rw-r--r-- | drivers/gpio/npcm_sgpio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpio/npcm_sgpio.c b/drivers/gpio/npcm_sgpio.c index fcc42087d57..d0fad08be07 100644 --- a/drivers/gpio/npcm_sgpio.c +++ b/drivers/gpio/npcm_sgpio.c @@ -301,7 +301,7 @@ static bool is_gpio_persist(struct udevice *dev) status = npcm_get_reset_status(); if (status & PORST) - return false; + return true; if (status & CORST) regmap_read(priv->rst_regmap, CORSTC, &val); else if (status & WD0RST) @@ -320,9 +320,9 @@ static bool is_gpio_persist(struct udevice *dev) regmap_read(priv->rst_regmap, TIPRSTC, &val); if (priv->siox_num == 1) - return (val && BIT(NPCM_SIOX2)); + return !!(val & BIT(NPCM_SIOX2)); else - return (val && BIT(NPCM_SIOX1)); + return !!(val & BIT(NPCM_SIOX1)); } static const struct dm_gpio_ops npcm_sgpio_ops = { @@ -363,7 +363,7 @@ static int npcm_sgpio_probe(struct udevice *dev) uc_priv->gpio_count = priv->nin_sgpio + priv->nout_sgpio; uc_priv->bank_name = dev->name; - if (is_gpio_persist(dev)) { + if (!is_gpio_persist(dev)) { ofnode_for_each_subnode(node, dev_ofnode(dev)) { if (ofnode_read_bool(node, "persist-enable")) { rc = ofnode_read_u32_array(node, "gpios", val, 2); |
