drivers: bbram: fix npcx driver and update Kconfig defaults

There was a typo that snuck into the bbram driver for npcx.
Fix the driver and update the Kconfig to automatically include the
driver if the compatible string exists in the dts. This ensures that
the driver is built when building the npcx evbs.

Signed-off-by: Yuval Peress <peress@chromium.org>
This commit is contained in:
Yuval Peress 2021-08-29 10:34:54 -06:00 committed by Anas Nashif
parent e35cbfb85c
commit cbe4803812
3 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,10 @@
# Copyright (c) 2021 Google Inc
# SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ST_BBRAM_EMUL := zephyr,bbram-emul
config BBRAM_EMUL
bool "Battery-backed RAM emulated drivers"
default $(dt_compat_enabled,${DT_COMPAT_ST_BBRAM_EMUL})
help
This option enables the BBRAM emulation driver.

View File

@ -1,8 +1,11 @@
# Copyright (c) 2021 Google Inc
# SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ST_BBRAM_NPCX := nuvoton,npcx-bbram
config BBRAM_NPCX
bool "Nuvoton NPCX embedded controller (EC) Battery-backed RAM drivers"
depends on SOC_FAMILY_NPCX
default $(dt_compat_enabled,${DT_COMPAT_ST_BBRAM_NPCX})
help
This option enables the BBRAM driver for NPCX family of processors.

View File

@ -7,7 +7,7 @@
#define DT_DRV_COMPAT nuvoton_npcx_bbram
#include <drivers/bbram.h>
#include <errono.h>
#include <errno.h>
#include <sys/util.h>
#include <logging/log.h>
@ -74,7 +74,7 @@ static int bbram_npcx_read(const struct device *dev, size_t offset, size_t size,
}
bytecpy(data, ((volatile uint8_t *)config->base_addr + offset), size);
bytecpy(data, ((uint8_t *)config->base_addr + offset), size);
return 0;
}
@ -87,7 +87,7 @@ static int bbram_npcx_write(const struct device *dev, size_t offset, size_t size
return -EFAULT;
}
bytecpy(((volatile uint8_t *)config->base_addr + offset), data, size);
bytecpy(((uint8_t *)config->base_addr + offset), data, size);
return 0;
}
@ -102,6 +102,8 @@ static const struct bbram_driver_api bbram_npcx_driver_api = {
static int bbram_npcx_init(const struct device *dev)
{
ARG_UNUSED(dev);
return 0;
}