summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-12-03 10:11:55 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-15 03:55:27 +0000
commit7ef0196dd3bf701575aba3fc6ea9bfa9f4f0d64e (patch)
tree349ddc73fba821ecf1affbeadae5321ea0185b87
parentc3d4badd49ab9c6239c67ea67f566ee810796793 (diff)
downloadchrome-ec-7ef0196dd3bf701575aba3fc6ea9bfa9f4f0d64e.tar.gz
gpio_defines: make header visible to chameleon
Move this to include/ so chameleon can use it too. BUG=b:174754428 TEST=compiles Change-Id: I8898a7e2beb5c30c0577fe0fd36d69fe631d0624 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2570998 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2630149 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/include/dt-bindings/gpio_defines.h47
l---------zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h1
-rw-r--r--zephyr/projects/volteer/boards/arm/volteer/volteer.dts2
3 files changed, 48 insertions, 2 deletions
diff --git a/zephyr/include/dt-bindings/gpio_defines.h b/zephyr/include/dt-bindings/gpio_defines.h
new file mode 100644
index 0000000000..07a499299b
--- /dev/null
+++ b/zephyr/include/dt-bindings/gpio_defines.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2020 Google LLC.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef DT_BINDINGS_GPIO_DEFINES_H_
+#define DT_BINDINGS_GPIO_DEFINES_H_
+
+#include <dt-bindings/gpio/gpio.h>
+
+/*
+ * The GPIO_INPUT and GPIO_OUTPUT defines are normally not available to
+ * the device tree. For GPIOs that are controlled by the platform/ec module, we
+ * allow device tree to set the initial state.
+ *
+ * Note the raw defines (e.g. GPIO_OUTPUT) in this file are copies from
+ * <drivers/gpio.h>
+ *
+ * The combined defined (e.g. GPIO_OUT_LOW) have been renamed to fit with
+ * gpio defined in platform/ec codebase.
+ */
+
+/** Enables pin as input. */
+#define GPIO_INPUT (1U << 8)
+
+/** Enables pin as output, no change to the output state. */
+#define GPIO_OUTPUT (1U << 9)
+
+/* Initializes output to a low state. */
+#define GPIO_OUTPUT_INIT_LOW (1U << 10)
+
+/* Initializes output to a high state. */
+#define GPIO_OUTPUT_INIT_HIGH (1U << 11)
+
+/** Configures GPIO pin as output and initializes it to a low state. */
+#define GPIO_OUT_LOW (GPIO_OUTPUT | GPIO_OUTPUT_INIT_LOW)
+
+/** Configures GPIO pin as output and initializes it to a high state. */
+#define GPIO_OUT_HIGH (GPIO_OUTPUT | GPIO_OUTPUT_INIT_HIGH)
+
+/** Configures GPIO pin as ODR output and initializes it to a low state. */
+#define GPIO_ODR_LOW (GPIO_OUT_LOW | GPIO_OPEN_DRAIN)
+
+/** Configures GPIO pin as ODR output and initializes it to a high state. */
+#define GPIO_ODR_HIGH (GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
+
+#endif /* DT_BINDINGS_GPIO_DEFINES_H_ */
diff --git a/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h b/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h
deleted file mode 120000
index 1bfd3e10b0..0000000000
--- a/zephyr/projects/volteer/boards/arm/volteer/dts/gpio_defines.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../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 1c087afbc8..5e09fef7da 100644
--- a/zephyr/projects/volteer/boards/arm/volteer/volteer.dts
+++ b/zephyr/projects/volteer/boards/arm/volteer/volteer.dts
@@ -6,8 +6,8 @@
/dts-v1/;
+#include <dt-bindings/gpio_defines.h>
#include <nuvoton/npcx7m6fb.dtsi>
-#include <gpio_defines.h>
/ {
model = "Google Volteer EC";