summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-02-09 17:36:01 -0700
committerCommit Bot <commit-bot@chromium.org>2022-02-12 01:20:41 +0000
commit4e0a6e0647fda7122c54145561146d0032dce511 (patch)
treed667d528b3d1065dd0f1bd0d6e71e35abbf98e6c
parent032734a4ab60667cf5155b7c06f1ce8475dcb992 (diff)
downloadchrome-ec-4e0a6e0647fda7122c54145561146d0032dce511.tar.gz
zephyr: Move 1 gpio into native_posix.dts
Move the entering_rw (GPIO_ENTERING_RW) into native_posix.dts, as all tests will need this once we start linking common/system.c. BRANCH=None BUG=b:214256453 TEST=zmake testall Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I57ee5c62b2ad06d0613aebe82e4af0cf1bd480f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3451270 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--zephyr/Kconfig.defaults6
-rw-r--r--zephyr/dts/board-overlays/native_posix.dts17
-rw-r--r--zephyr/projects/posix-ec/CMakeLists.txt2
-rw-r--r--zephyr/projects/posix-ec/include/gpio_map.h4
-rw-r--r--zephyr/test/drivers/overlay.dts4
5 files changed, 30 insertions, 3 deletions
diff --git a/zephyr/Kconfig.defaults b/zephyr/Kconfig.defaults
index 2b55e72156..b5637b7786 100644
--- a/zephyr/Kconfig.defaults
+++ b/zephyr/Kconfig.defaults
@@ -8,3 +8,9 @@
# runtime but not used in Zephyr EC.
config TIMESLICING
default n
+
+config GPIO_EMUL
+ default y if ARCH_POSIX
+
+config GPIO
+ default y if ARCH_POSIX
diff --git a/zephyr/dts/board-overlays/native_posix.dts b/zephyr/dts/board-overlays/native_posix.dts
index b8faf65842..a9a65d63c7 100644
--- a/zephyr/dts/board-overlays/native_posix.dts
+++ b/zephyr/dts/board-overlays/native_posix.dts
@@ -3,4 +3,19 @@
* found in the LICENSE file.
*/
-/* TODO(sjg): add things */
+#include <dt-bindings/gpio_defines.h>
+
+/ {
+ named-gpios {
+ compatible = "named-gpios";
+
+ entering_rw {
+ gpios = <&gpio0 1 GPIO_OUT_LOW>;
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ };
+};
+
+&gpio0 {
+ ngpios = <2>;
+};
diff --git a/zephyr/projects/posix-ec/CMakeLists.txt b/zephyr/projects/posix-ec/CMakeLists.txt
index e5287b0b17..165de682a8 100644
--- a/zephyr/projects/posix-ec/CMakeLists.txt
+++ b/zephyr/projects/posix-ec/CMakeLists.txt
@@ -6,3 +6,5 @@
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(posix-ec)
+
+zephyr_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
diff --git a/zephyr/projects/posix-ec/include/gpio_map.h b/zephyr/projects/posix-ec/include/gpio_map.h
new file mode 100644
index 0000000000..93e5f644ba
--- /dev/null
+++ b/zephyr/projects/posix-ec/include/gpio_map.h
@@ -0,0 +1,4 @@
+/* Copyright 2022 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.
+ */
diff --git a/zephyr/test/drivers/overlay.dts b/zephyr/test/drivers/overlay.dts
index d3111c6f76..3aba9ca0da 100644
--- a/zephyr/test/drivers/overlay.dts
+++ b/zephyr/test/drivers/overlay.dts
@@ -25,7 +25,7 @@
compatible = "named-gpios";
ec_batt_pres_odl {
- gpios = <&gpio0 1 GPIO_INPUT>;
+ gpios = <&gpio0 28 GPIO_INPUT>;
enum-name = "GPIO_BATT_PRES_ODL";
};
gpio_acok_od: acok_od {
@@ -683,7 +683,7 @@
};
&gpio0 {
- ngpios = <28>;
+ ngpios = <29>;
};
&i2c0 {