summaryrefslogtreecommitdiff
path: root/zephyr/shim/chip/npcx
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-09-08 00:25:50 -0600
committerCommit Bot <commit-bot@chromium.org>2021-09-10 17:48:12 +0000
commit316b2b4456aa78d986b675dabe547b73c59a7097 (patch)
treee17a852dbeebb05fb06355573b6551791db97569 /zephyr/shim/chip/npcx
parentca19275b9e9b86056783525bda71f610d798bd2b (diff)
downloadchrome-ec-316b2b4456aa78d986b675dabe547b73c59a7097.tar.gz
zephyr: driver: bbram: Migrate to upstream driver
Migrate the BBRAM driver to the upstream version. BRANCH=none BUG=b:195843756 TEST=zmake testall Cq-Depend: chromium:3147080 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I441e58f94c4874e268aad36df2f036a88187801b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147230 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
Diffstat (limited to 'zephyr/shim/chip/npcx')
-rw-r--r--zephyr/shim/chip/npcx/Kconfig.npcx2
-rw-r--r--zephyr/shim/chip/npcx/system.c28
2 files changed, 15 insertions, 15 deletions
diff --git a/zephyr/shim/chip/npcx/Kconfig.npcx b/zephyr/shim/chip/npcx/Kconfig.npcx
index 1107a846a8..b044912ae1 100644
--- a/zephyr/shim/chip/npcx/Kconfig.npcx
+++ b/zephyr/shim/chip/npcx/Kconfig.npcx
@@ -12,7 +12,7 @@ config CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY
help
This sets the priority of the NPCX chip system initialization. The
chip system initialization verifies the integrity of the BBRAM and
- must be a lower priority than CONFIG_CROS_BBRAM_NPCX_INIT_PRIORITY and
+ must be a lower priority than CONFIG_BBRAM_INIT_PRIORITY and
must be a higher priority than PLATFORM_EC_SYSTEM_PRE_INIT.
endif # PLATFORM_EC
diff --git a/zephyr/shim/chip/npcx/system.c b/zephyr/shim/chip/npcx/system.c
index 0a1f50844e..3700026104 100644
--- a/zephyr/shim/chip/npcx/system.c
+++ b/zephyr/shim/chip/npcx/system.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include <drivers/cros_bbram.h>
+#include <drivers/bbram.h>
#include <logging/log.h>
#include "system.h"
@@ -11,9 +11,10 @@
LOG_MODULE_REGISTER(shim_npcx_system, LOG_LEVEL_ERR);
-void chip_bbram_status_check(void)
+static void chip_bbram_status_check(void)
{
const struct device *bbram_dev;
+ int res;
bbram_dev = DEVICE_DT_GET(DT_NODELABEL(bbram));
if (!device_is_ready(bbram_dev)) {
@@ -21,18 +22,18 @@ void chip_bbram_status_check(void)
return;
}
- if (cros_bbram_get_ibbr(bbram_dev)) {
+ res = bbram_check_invalid(bbram_dev);
+ if (res != 0 && res != -ENOTSUP)
LOG_ERR("VBAT power drop!");
- cros_bbram_reset_ibbr(bbram_dev);
- }
- if (cros_bbram_get_vsby(bbram_dev)) {
+
+ res = bbram_check_standby_power(bbram_dev);
+ if (res != 0 && res != -ENOTSUP)
LOG_ERR("VSBY power drop!");
- cros_bbram_reset_vsby(bbram_dev);
- }
- if (cros_bbram_get_vcc1(bbram_dev)) {
+
+ res = bbram_check_power(bbram_dev);
+ if (res != 0 && res != -ENOTSUP)
LOG_ERR("VCC1 power drop!");
- cros_bbram_reset_vcc1(bbram_dev);
- }
+
}
/*
@@ -89,10 +90,9 @@ static int chip_system_init(const struct device *unused)
/*
* The priority should be lower than CROS_BBRAM_NPCX_INIT_PRIORITY.
*/
-#if (CONFIG_CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY <= \
- CONFIG_CROS_BBRAM_NPCX_INIT_PRIORITY)
+#if (CONFIG_CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY <= CONFIG_BBRAM_INIT_PRIORITY)
#error CONFIG_CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY must greater than \
- CONFIG_CROS_BBRAM_NPCX_INIT_PRIORITY
+ CONFIG_BBRAM_INIT_PRIORITY
#endif
SYS_INIT(chip_system_init, PRE_KERNEL_1,
CONFIG_CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY);