summaryrefslogtreecommitdiff
path: root/zephyr/shim/chip
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/shim/chip')
-rw-r--r--zephyr/shim/chip/CMakeLists.txt2
-rw-r--r--zephyr/shim/chip/it8xxx2/CMakeLists.txt2
-rw-r--r--zephyr/shim/chip/it8xxx2/clock.c3
-rw-r--r--zephyr/shim/chip/it8xxx2/gpio.c2
-rw-r--r--zephyr/shim/chip/it8xxx2/include/flash_chip.h2
-rw-r--r--zephyr/shim/chip/it8xxx2/keyboard_raw.c4
-rw-r--r--zephyr/shim/chip/it8xxx2/power_policy.c4
-rw-r--r--zephyr/shim/chip/it8xxx2/system.c2
-rw-r--r--zephyr/shim/chip/mchp/CMakeLists.txt2
-rw-r--r--zephyr/shim/chip/mchp/Kconfig.xec2
-rw-r--r--zephyr/shim/chip/mchp/clock.c3
-rw-r--r--zephyr/shim/chip/mchp/gpio.c2
-rw-r--r--zephyr/shim/chip/mchp/include/clock_chip.h2
-rw-r--r--zephyr/shim/chip/mchp/include/flash_chip.h2
-rw-r--r--zephyr/shim/chip/mchp/include/system_chip.h2
-rw-r--r--zephyr/shim/chip/mchp/keyboard_raw.c4
-rw-r--r--zephyr/shim/chip/mchp/system.c2
-rw-r--r--zephyr/shim/chip/mchp/system_download_from_flash.c2
-rw-r--r--zephyr/shim/chip/mchp/system_external_storage.c2
-rw-r--r--zephyr/shim/chip/npcx/CMakeLists.txt2
-rw-r--r--zephyr/shim/chip/npcx/Kconfig.npcx50
-rw-r--r--zephyr/shim/chip/npcx/clock.c3
-rw-r--r--zephyr/shim/chip/npcx/gpio.c144
-rw-r--r--zephyr/shim/chip/npcx/include/clock_chip.h2
-rw-r--r--zephyr/shim/chip/npcx/include/flash_chip.h2
-rw-r--r--zephyr/shim/chip/npcx/include/rom_chip.h2
-rw-r--r--zephyr/shim/chip/npcx/include/system_chip.h2
-rw-r--r--zephyr/shim/chip/npcx/keyboard_raw.c4
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/CMakeLists.txt2
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c2
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.h2
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.ld2
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/registers.h2
-rw-r--r--zephyr/shim/chip/npcx/power_policy.c4
-rw-r--r--zephyr/shim/chip/npcx/shi.c4
-rw-r--r--zephyr/shim/chip/npcx/system.c2
-rw-r--r--zephyr/shim/chip/npcx/system_download_from_flash.c2
-rw-r--r--zephyr/shim/chip/npcx/system_external_storage.c2
38 files changed, 234 insertions, 47 deletions
diff --git a/zephyr/shim/chip/CMakeLists.txt b/zephyr/shim/chip/CMakeLists.txt
index 54281508aa..1d58857c11 100644
--- a/zephyr/shim/chip/CMakeLists.txt
+++ b/zephyr/shim/chip/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/it8xxx2/CMakeLists.txt b/zephyr/shim/chip/it8xxx2/CMakeLists.txt
index 539fd9f029..2a1c9d5909 100644
--- a/zephyr/shim/chip/it8xxx2/CMakeLists.txt
+++ b/zephyr/shim/chip/it8xxx2/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/it8xxx2/clock.c b/zephyr/shim/chip/it8xxx2/clock.c
index da57bbeb50..14dbc0e7eb 100644
--- a/zephyr/shim/chip/it8xxx2/clock.c
+++ b/zephyr/shim/chip/it8xxx2/clock.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,6 @@
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
#include <soc/ite_it8xxx2/reg_def_cros.h>
#include <zephyr/sys/util.h>
diff --git a/zephyr/shim/chip/it8xxx2/gpio.c b/zephyr/shim/chip/it8xxx2/gpio.c
index 3baf128eab..7106b2a294 100644
--- a/zephyr/shim/chip/it8xxx2/gpio.c
+++ b/zephyr/shim/chip/it8xxx2/gpio.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/it8xxx2/include/flash_chip.h b/zephyr/shim/chip/it8xxx2/include/flash_chip.h
index 06b33ee6e1..00aaba05fd 100644
--- a/zephyr/shim/chip/it8xxx2/include/flash_chip.h
+++ b/zephyr/shim/chip/it8xxx2/include/flash_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/it8xxx2/keyboard_raw.c b/zephyr/shim/chip/it8xxx2/keyboard_raw.c
index 480d528e41..0a117cda14 100644
--- a/zephyr/shim/chip/it8xxx2/keyboard_raw.c
+++ b/zephyr/shim/chip/it8xxx2/keyboard_raw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#include <zephyr/device.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include "drivers/cros_kb_raw.h"
#include "keyboard_raw.h"
diff --git a/zephyr/shim/chip/it8xxx2/power_policy.c b/zephyr/shim/chip/it8xxx2/power_policy.c
index 978f620060..c8efb0ca96 100644
--- a/zephyr/shim/chip/it8xxx2/power_policy.c
+++ b/zephyr/shim/chip/it8xxx2/power_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,7 +6,7 @@
#include <zephyr/pm/pm.h>
#include <zephyr/pm/policy.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include "system.h"
diff --git a/zephyr/shim/chip/it8xxx2/system.c b/zephyr/shim/chip/it8xxx2/system.c
index d9dcd7ccfb..e5f9cc5cf0 100644
--- a/zephyr/shim/chip/it8xxx2/system.c
+++ b/zephyr/shim/chip/it8xxx2/system.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/CMakeLists.txt b/zephyr/shim/chip/mchp/CMakeLists.txt
index 0948424275..f59a1be2b1 100644
--- a/zephyr/shim/chip/mchp/CMakeLists.txt
+++ b/zephyr/shim/chip/mchp/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/mchp/Kconfig.xec b/zephyr/shim/chip/mchp/Kconfig.xec
index 3b18b1c192..28a6b3ea3c 100644
--- a/zephyr/shim/chip/mchp/Kconfig.xec
+++ b/zephyr/shim/chip/mchp/Kconfig.xec
@@ -1,4 +1,4 @@
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/mchp/clock.c b/zephyr/shim/chip/mchp/clock.c
index 9328627a4b..6ee4cd931c 100644
--- a/zephyr/shim/chip/mchp/clock.c
+++ b/zephyr/shim/chip/mchp/clock.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,6 @@
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
#include "clock_chip.h"
#include "module_id.h"
diff --git a/zephyr/shim/chip/mchp/gpio.c b/zephyr/shim/chip/mchp/gpio.c
index 3a16b9639d..7801c6f7cc 100644
--- a/zephyr/shim/chip/mchp/gpio.c
+++ b/zephyr/shim/chip/mchp/gpio.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/include/clock_chip.h b/zephyr/shim/chip/mchp/include/clock_chip.h
index c317ccb415..4c14d60ff9 100644
--- a/zephyr/shim/chip/mchp/include/clock_chip.h
+++ b/zephyr/shim/chip/mchp/include/clock_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/include/flash_chip.h b/zephyr/shim/chip/mchp/include/flash_chip.h
index d2b71eea7d..de8138614c 100644
--- a/zephyr/shim/chip/mchp/include/flash_chip.h
+++ b/zephyr/shim/chip/mchp/include/flash_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/include/system_chip.h b/zephyr/shim/chip/mchp/include/system_chip.h
index 5d60fff874..01cd1e7391 100644
--- a/zephyr/shim/chip/mchp/include/system_chip.h
+++ b/zephyr/shim/chip/mchp/include/system_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/keyboard_raw.c b/zephyr/shim/chip/mchp/keyboard_raw.c
index 0b9280aa41..95ad642d12 100644
--- a/zephyr/shim/chip/mchp/keyboard_raw.c
+++ b/zephyr/shim/chip/mchp/keyboard_raw.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#include <zephyr/device.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include "drivers/cros_kb_raw.h"
#include "keyboard_raw.h"
diff --git a/zephyr/shim/chip/mchp/system.c b/zephyr/shim/chip/mchp/system.c
index 09ddefd6ee..35ba806533 100644
--- a/zephyr/shim/chip/mchp/system.c
+++ b/zephyr/shim/chip/mchp/system.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/system_download_from_flash.c b/zephyr/shim/chip/mchp/system_download_from_flash.c
index 409f84dd4b..ced7f4d89c 100644
--- a/zephyr/shim/chip/mchp/system_download_from_flash.c
+++ b/zephyr/shim/chip/mchp/system_download_from_flash.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/mchp/system_external_storage.c b/zephyr/shim/chip/mchp/system_external_storage.c
index 983cebd64e..4250b05fe3 100644
--- a/zephyr/shim/chip/mchp/system_external_storage.c
+++ b/zephyr/shim/chip/mchp/system_external_storage.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/CMakeLists.txt b/zephyr/shim/chip/npcx/CMakeLists.txt
index 3019118cf4..79b8cf2a62 100644
--- a/zephyr/shim/chip/npcx/CMakeLists.txt
+++ b/zephyr/shim/chip/npcx/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/npcx/Kconfig.npcx b/zephyr/shim/chip/npcx/Kconfig.npcx
index b044912ae1..5202d14448 100644
--- a/zephyr/shim/chip/npcx/Kconfig.npcx
+++ b/zephyr/shim/chip/npcx/Kconfig.npcx
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,4 +15,52 @@ config CROS_SYSTEM_NPCX_PRE_INIT_PRIORITY
must be a lower priority than CONFIG_BBRAM_INIT_PRIORITY and
must be a higher priority than PLATFORM_EC_SYSTEM_PRE_INIT.
+config PLATFORM_EC_CONSOLE_CMD_GPIODBG
+ bool "Console command: gpiodbg"
+ depends on SOC_FAMILY_NPCX
+ help
+ Enable the "gpiodbg" command. This lists all IO pads used on platform
+ and turns on/off specific pad's input buffer to observe leakage
+ current through it.
+
+ Example:
+ gpiodbg list
+
+ IDX|ON| GPIO | Name
+ ---+--+------+----------
+ 00 |* | io03 | recovery_l
+ 01 |* | io93 | wp_l
+ 02 |* | iod2 | ac_present
+ 03 |* | io00 | power_button_l
+ 04 |* | io01 | lid_open
+ 05 |* | io36 | entering_rw
+ 06 |* | io50 | pch_wake_l
+ 07 |* | ioc7 | pgood_fan
+ 08 |* | ioa5 | spi_cs_l
+ 09 |* | io64 | board_version1
+ 10 |* | io65 | board_version2
+ 11 |* | io66 | board_version3
+ 12 |* | io52 | unused pin
+ 13 |* | io54 | unused pin
+
+ gpiodbg off 11
+ gpiodbg list
+
+ IDX|ON| GPIO | Name
+ ---+--+------+----------
+ 00 |* | io03 | recovery_l
+ 01 |* | io93 | wp_l
+ 02 |* | iod2 | ac_present
+ 03 |* | io00 | power_button_l
+ 04 |* | io01 | lid_open
+ 05 |* | io36 | entering_rw
+ 06 |* | io50 | pch_wake_l
+ 07 |* | ioc7 | pgood_fan
+ 08 |* | ioa5 | spi_cs_l
+ 09 |* | io64 | board_version1
+ 10 |* | io65 | board_version2
+ 11 | | io66 | board_version3
+ 12 |* | io52 | unused pin
+ 13 |* | io54 | unused pin
+
endif # PLATFORM_EC
diff --git a/zephyr/shim/chip/npcx/clock.c b/zephyr/shim/chip/npcx/clock.c
index 48f47855ca..fc483ef775 100644
--- a/zephyr/shim/chip/npcx/clock.c
+++ b/zephyr/shim/chip/npcx/clock.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,6 @@
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
#include "clock_chip.h"
#include "module_id.h"
diff --git a/zephyr/shim/chip/npcx/gpio.c b/zephyr/shim/chip/npcx/gpio.c
index 3baf128eab..e8bf3dfdf5 100644
--- a/zephyr/shim/chip/npcx/gpio.c
+++ b/zephyr/shim/chip/npcx/gpio.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,10 +6,13 @@
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
+#include <zephyr/shell/shell.h>
#include <zephyr/logging/log.h>
#include "gpio/gpio.h"
+#include "soc_gpio.h"
+#include "util.h"
LOG_MODULE_REGISTER(shim_cros_gpio, LOG_LEVEL_ERR);
@@ -53,3 +56,142 @@ int gpio_config_unused_pins(void)
return 0;
}
+
+#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_GPIODBG
+/*
+ * IO information about each GPIO that is configured in the `named_gpios` and
+ *` unused_pins` device tree nodes.
+ */
+struct npcx_io_info {
+ /* A npcx gpio port device */
+ const struct device *dev;
+ /* A npcx gpio port number */
+ int port;
+ /* Bit number of pin within a npcx gpio port */
+ gpio_pin_t pin;
+ /* GPIO net name */
+ const char *name;
+ /* Enable flag of npcx gpio input buffer */
+ bool enable;
+};
+
+#define NAMED_GPIO_INFO(node) \
+ { \
+ .dev = DEVICE_DT_GET(DT_GPIO_CTLR(node, gpios)), \
+ .port = DT_PROP(DT_GPIO_CTLR(node, gpios), index), \
+ .pin = DT_GPIO_PIN(node, gpios), \
+ .name = DT_NODE_FULL_NAME(node), \
+ .enable = true, \
+ },
+
+#define UNUSED_GPIO_INFO(node, prop, idx) \
+ { \
+ .dev = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(node, prop, idx)), \
+ .port = DT_PROP(DT_GPIO_CTLR_BY_IDX(node, prop, idx), index), \
+ .pin = DT_GPIO_PIN_BY_IDX(node, prop, idx), \
+ .name = "unused pin", \
+ .enable = true, \
+ },
+
+#define NAMED_GPIO_INIT(node) \
+ COND_CODE_1(DT_NODE_HAS_PROP(node, gpios), (NAMED_GPIO_INFO(node)), ())
+
+static struct npcx_io_info gpio_info[] = {
+#if DT_NODE_EXISTS(DT_PATH(named_gpios))
+ DT_FOREACH_CHILD(DT_PATH(named_gpios), NAMED_GPIO_INIT)
+#endif
+#if DT_NODE_EXISTS(DT_PATH(unused_pins))
+ DT_FOREACH_PROP_ELEM(DT_PATH(unused_pins), unused_gpios,
+ UNUSED_GPIO_INFO)
+#endif
+};
+
+static int get_index_from_arg(const struct shell *sh, char **argv, int *index)
+{
+ char *end_ptr;
+ int num = strtol(argv[1], &end_ptr, 0);
+ const int gpio_cnt = ARRAY_SIZE(gpio_info);
+
+ if (*end_ptr != '\0') {
+ shell_error(sh, "Failed to parse %s", argv[1]);
+ return -EINVAL;
+ }
+
+ if (num >= gpio_cnt) {
+ shell_error(sh, "Index shall be less than %u, was %u", gpio_cnt,
+ num);
+ return -EINVAL;
+ }
+
+ *index = num;
+
+ return 0;
+}
+
+static int cmd_gpio_list_all(const struct shell *sh, size_t argc, char **argv)
+{
+ ARG_UNUSED(argc);
+ ARG_UNUSED(argv);
+
+ /* Print header */
+ shell_print(sh, "IDX|ON| GPIO | Name");
+ shell_print(sh, "---+--+------+----------");
+
+ /* List all GPIOs in 'named-gpios' and 'unused_pins' DT nodes */
+ for (int i = 0; i < ARRAY_SIZE(gpio_info); i++) {
+ shell_print(sh, "%02d |%s | io%x%x | %s", i,
+ gpio_info[i].enable ? "*" : " ", gpio_info[i].port,
+ gpio_info[i].pin, gpio_info[i].name);
+ }
+
+ return 0;
+}
+
+static int cmd_gpio_turn_on(const struct shell *sh, size_t argc, char **argv)
+{
+ int index;
+ int res = get_index_from_arg(sh, argv, &index);
+
+ if (res < 0) {
+ return res;
+ }
+
+ /* Turn on GPIO's input buffer by index */
+ gpio_info[index].enable = true;
+ npcx_gpio_enable_io_pads(gpio_info[index].dev, gpio_info[index].pin);
+
+ return 0;
+}
+
+static int cmd_gpio_turn_off(const struct shell *sh, size_t argc, char **argv)
+{
+ int index;
+ int res = get_index_from_arg(sh, argv, &index);
+
+ if (res < 0) {
+ return res;
+ }
+
+ /* Turn off GPIO's input buffer by index */
+ gpio_info[index].enable = false;
+ npcx_gpio_disable_io_pads(gpio_info[index].dev, gpio_info[index].pin);
+
+ return 0;
+}
+
+SHELL_STATIC_SUBCMD_SET_CREATE(
+ sub_gpiodbg,
+ SHELL_CMD_ARG(list, NULL, "List all GPIOs used on platform by index",
+ cmd_gpio_list_all, 1, 0),
+ SHELL_CMD_ARG(on, NULL, "<index_in_list> Turn on GPIO's input buffer",
+ cmd_gpio_turn_on, 2, 0),
+ SHELL_CMD_ARG(off, NULL, "<index_in_list> Turn off GPIO's input buffer",
+ cmd_gpio_turn_off, 2, 0),
+ SHELL_SUBCMD_SET_END /* Array terminated. */
+);
+
+SHELL_CMD_ARG_REGISTER(gpiodbg, &sub_gpiodbg,
+ "Commands for power consumption "
+ "investigation",
+ NULL, 2, 0);
+#endif /* CONFIG_PLATFORM_EC_CONSOLE_CMD_GPIODBG */
diff --git a/zephyr/shim/chip/npcx/include/clock_chip.h b/zephyr/shim/chip/npcx/include/clock_chip.h
index 0c39ed8174..6ecca330b6 100644
--- a/zephyr/shim/chip/npcx/include/clock_chip.h
+++ b/zephyr/shim/chip/npcx/include/clock_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/include/flash_chip.h b/zephyr/shim/chip/npcx/include/flash_chip.h
index 3b9375348b..362d8b2414 100644
--- a/zephyr/shim/chip/npcx/include/flash_chip.h
+++ b/zephyr/shim/chip/npcx/include/flash_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/include/rom_chip.h b/zephyr/shim/chip/npcx/include/rom_chip.h
index 8def236498..d59a649c7b 100644
--- a/zephyr/shim/chip/npcx/include/rom_chip.h
+++ b/zephyr/shim/chip/npcx/include/rom_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/include/system_chip.h b/zephyr/shim/chip/npcx/include/system_chip.h
index f446d6b634..2f59ad4627 100644
--- a/zephyr/shim/chip/npcx/include/system_chip.h
+++ b/zephyr/shim/chip/npcx/include/system_chip.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/keyboard_raw.c b/zephyr/shim/chip/npcx/keyboard_raw.c
index 86d6af068b..4d43134482 100644
--- a/zephyr/shim/chip/npcx/keyboard_raw.c
+++ b/zephyr/shim/chip/npcx/keyboard_raw.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include <zephyr/logging/log.h>
#include <soc.h>
#include <soc_gpio.h>
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include "drivers/cros_kb_raw.h"
#include "keyboard_raw.h"
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/CMakeLists.txt b/zephyr/shim/chip/npcx/npcx_monitor/CMakeLists.txt
index 661eb86e91..d74881b2d9 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/CMakeLists.txt
+++ b/zephyr/shim/chip/npcx/npcx_monitor/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
index 8b135f66cc..e3fecc0cbd 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
+++ b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.h b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.h
index caf96a8351..80e605eea0 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.h
+++ b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.ld b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.ld
index 03e38b0609..98892babc6 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.ld
+++ b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.ld
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/registers.h b/zephyr/shim/chip/npcx/npcx_monitor/registers.h
index a52ba34349..85ab3b2389 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/registers.h
+++ b/zephyr/shim/chip/npcx/npcx_monitor/registers.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/zephyr/shim/chip/npcx/power_policy.c b/zephyr/shim/chip/npcx/power_policy.c
index 1e5a7b15ce..aea6e62d30 100644
--- a/zephyr/shim/chip/npcx/power_policy.c
+++ b/zephyr/shim/chip/npcx/power_policy.c
@@ -1,9 +1,9 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include <zephyr/pm/pm.h>
#include <zephyr/pm/policy.h>
#include <soc.h>
diff --git a/zephyr/shim/chip/npcx/shi.c b/zephyr/shim/chip/npcx/shi.c
index 74dfca12cd..8bec57252d 100644
--- a/zephyr/shim/chip/npcx/shi.c
+++ b/zephyr/shim/chip/npcx/shi.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include <zephyr/dt-bindings/clock/npcx_clock.h>
#include <zephyr/logging/log.h>
#include <soc.h>
-#include <zephyr/zephyr.h>
+#include <zephyr/kernel.h>
#include <ap_power/ap_power.h>
#include "chipset.h"
diff --git a/zephyr/shim/chip/npcx/system.c b/zephyr/shim/chip/npcx/system.c
index f6751ae46a..2240acea54 100644
--- a/zephyr/shim/chip/npcx/system.c
+++ b/zephyr/shim/chip/npcx/system.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/system_download_from_flash.c b/zephyr/shim/chip/npcx/system_download_from_flash.c
index 556140bf21..1aef9560d1 100644
--- a/zephyr/shim/chip/npcx/system_download_from_flash.c
+++ b/zephyr/shim/chip/npcx/system_download_from_flash.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/shim/chip/npcx/system_external_storage.c b/zephyr/shim/chip/npcx/system_external_storage.c
index f871ad310b..81e1968cf4 100644
--- a/zephyr/shim/chip/npcx/system_external_storage.c
+++ b/zephyr/shim/chip/npcx/system_external_storage.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/