From cbe48038124bb4c190a35bf4d5eec935b5237ad8 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Sun, 29 Aug 2021 10:34:54 -0600 Subject: [PATCH] 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 --- drivers/bbram/Kconfig.bbram_emul | 3 +++ drivers/bbram/Kconfig.npcx | 3 +++ drivers/bbram/bbram_npcx.c | 8 +++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/bbram/Kconfig.bbram_emul b/drivers/bbram/Kconfig.bbram_emul index 4ed2cb5e66e..9fe7bc4d071 100644 --- a/drivers/bbram/Kconfig.bbram_emul +++ b/drivers/bbram/Kconfig.bbram_emul @@ -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. diff --git a/drivers/bbram/Kconfig.npcx b/drivers/bbram/Kconfig.npcx index 3e95e604fff..cd39f1cd328 100644 --- a/drivers/bbram/Kconfig.npcx +++ b/drivers/bbram/Kconfig.npcx @@ -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. diff --git a/drivers/bbram/bbram_npcx.c b/drivers/bbram/bbram_npcx.c index b7fb8b02ed3..4aa00dd6f08 100644 --- a/drivers/bbram/bbram_npcx.c +++ b/drivers/bbram/bbram_npcx.c @@ -7,7 +7,7 @@ #define DT_DRV_COMPAT nuvoton_npcx_bbram #include -#include +#include #include #include @@ -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; }