summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2020-10-14 13:57:49 -0600
committerCommit Bot <commit-bot@chromium.org>2021-01-15 03:54:26 +0000
commit953ea1c71730b31bacb842363c378986cb085297 (patch)
tree7a260e2b39d156f89cd2606e03a2eb86cc9bba3b
parentba30422a77aee92794a7b07aa8f2853980ffb25d (diff)
downloadchrome-ec-953ea1c71730b31bacb842363c378986cb085297.tar.gz
volteer: add a few named gpios
Adding gpios to the named_gpios node in device tree will make them accessible as enum gpio_signal values for gpio_get and gpio_set calls in platform/ec calls. BUG=b:169935802 TEST=verified that gpioget and gpioset command work on volteer Change-Id: I0086b2ed543c6a382fa6234e716a36e616261b4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2488502 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2630129 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/projects/volteer/CMakeLists.txt3
l---------zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h1
-rw-r--r--zephyr/projects/volteer/boards/arm/volteer/volteer.dts35
-rw-r--r--zephyr/projects/volteer/include/gpio_map.h24
4 files changed, 63 insertions, 0 deletions
diff --git a/zephyr/projects/volteer/CMakeLists.txt b/zephyr/projects/volteer/CMakeLists.txt
index 54ab8a7479..3ab1f87b81 100644
--- a/zephyr/projects/volteer/CMakeLists.txt
+++ b/zephyr/projects/volteer/CMakeLists.txt
@@ -9,3 +9,6 @@ set(BOARD volteer)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(volteer)
+
+# Include board specific header files
+zephyr_include_directories(include)
diff --git a/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h b/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h
new file mode 120000
index 0000000000..1bfd3e10b0
--- /dev/null
+++ b/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h
@@ -0,0 +1 @@
+../../../../../../../app/include/dt-bindings/gpio_defines.h \ No newline at end of file
diff --git a/zephyr/projects/volteer/boards/arm/volteer/volteer.dts b/zephyr/projects/volteer/boards/arm/volteer/volteer.dts
index 44b7ac834f..2eac2be2e5 100644
--- a/zephyr/projects/volteer/boards/arm/volteer/volteer.dts
+++ b/zephyr/projects/volteer/boards/arm/volteer/volteer.dts
@@ -7,6 +7,7 @@
/dts-v1/;
#include <nuvoton/npcx7m6fb.dtsi>
+#include <gpio_defines.h>
/ {
model = "Google Volteer EC";
@@ -17,6 +18,40 @@
zephyr,shell-uart = &uart1;
zephyr,flash = &flash0;
};
+
+ named-gpios {
+ compatible = "gpio-keys";
+
+ en_pp3300_a {
+ gpios = <&gpioa 3 GPIO_OUTPUT_LOW>;
+ label = "EN_PP3300_A";
+ };
+ en_pp5000_a {
+ gpios = <&gpioa 4 GPIO_OUTPUT_LOW>;
+ label = "EN_PP5000_A";
+ };
+ en_ppvar_vccin {
+ gpios = <&gpio4 4 GPIO_OUTPUT_LOW>;
+ label = "EN_PPVAR_VCCIN";
+ };
+ ec_pch_dsw_pwrok {
+ gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
+ label = "EC_PCH_DSW_PWROK";
+ };
+ tp_1 {
+ gpios = <&gpio8 6 (GPIO_INPUT | GPIO_PULL_UP)>;
+ label = "EC_KB_BL_EN";
+ };
+ tp_2 {
+ gpios = <&gpio5 7 (GPIO_INPUT | GPIO_PULL_UP)>;
+ label = "EC_ESPI_ALERT_L";
+ };
+ ec_batt_pres_odl {
+ gpios = <&gpioe 1 GPIO_INPUT>;
+ label = "EC_BATT_PRES_ODL";
+ };
+ };
+
};
/* Update flash size to 512KB from 196KB since we are using C variant */
diff --git a/zephyr/projects/volteer/include/gpio_map.h b/zephyr/projects/volteer/include/gpio_map.h
new file mode 100644
index 0000000000..97b75b035a
--- /dev/null
+++ b/zephyr/projects/volteer/include/gpio_map.h
@@ -0,0 +1,24 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __ZEPHYR_GPIO_MAP_H
+#define __ZEPHYR_GPIO_MAP_H
+
+#include <devicetree.h>
+#include <gpio_signal.h>
+
+/*
+ * Without https://github.com/zephyrproject-rtos/zephyr/pull/29282, we need
+ * to manually link GPIO_ defines that platform/ec code expects to the
+ * enum gpio_signal values that are generated by device tree bindings.
+ *
+ * Note we only need to create aliases for GPIOs that are referenced in common
+ * platform/ec code.
+ */
+#define GPIO_EN_PP3300_A NAMED_GPIO(en_pp3300_a)
+#define GPIO_EN_PP5000_A NAMED_GPIO(en_pp5000_a)
+
+
+#endif /* __ZEPHYR_GPIO_MAP_H */