diff --git a/drivers/bbram/bbram_npcx.c b/drivers/bbram/bbram_npcx.c index ba9500ae6f1..ceca04b1d80 100644 --- a/drivers/bbram/bbram_npcx.c +++ b/drivers/bbram/bbram_npcx.c @@ -26,8 +26,16 @@ static int get_bit_and_reset(const struct device *dev, int mask) { int result = DRV_STATUS(dev) & mask; - /* Clear the bit(s) */ + /* + * Clear the bit(s): + * For emulator, write 0 to clear status bit(s). + * For real chip, write 1 to clear status bit(s). + */ +#ifdef CONFIG_BBRAM_NPCX_EMUL DRV_STATUS(dev) &= ~mask; +#else + DRV_STATUS(dev) = mask; +#endif return result; }