driver: bbram: npcx: fix the way to clear bbram status
Bits in the BBRAM status register (BKUP_STS) are write-1-to-clear bits. The current driver writes 0 to clear those bits, which is incorrect. Fix it in this commit. Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
parent
383b97b742
commit
e555f20462
1 changed files with 9 additions and 1 deletions
|
|
@ -26,8 +26,16 @@ static int get_bit_and_reset(const struct device *dev, int mask)
|
||||||
{
|
{
|
||||||
int result = DRV_STATUS(dev) & 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;
|
DRV_STATUS(dev) &= ~mask;
|
||||||
|
#else
|
||||||
|
DRV_STATUS(dev) = mask;
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue