summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-06-25 21:17:14 -0700
committerCommit Bot <commit-bot@chromium.org>2021-07-14 18:12:38 +0000
commit07767ada20750b2b99c9d279581e8574e6f9c48a (patch)
tree586b92b0536c76c5d7897236322a613dc367e6eb
parentc97cb76b816fc8e02fe3de0652794e85fe38f4c6 (diff)
downloadchrome-ec-07767ada20750b2b99c9d279581e8574e6f9c48a.tar.gz
qcom: Move enabling/disabling 3.3V rail to the board level
In the next generation, the 3.3V rail is not controlled by EC anymore. Move the control logic to the board level. The 3.3V rail should be enabled before the power on sequence, so use the hook chipset pre-init hook. Disable it on the chipset shutdown complete hook. For Trogdor, do it on the baseboard level. For Herobrine, do it on the board level, Herobrine-NPCX7, only. Herobrine-NPCX9 and other future boards don't need it. BRANCH=None BUG=b:187980397, b:192253134 TEST=Tested the Lazor EC-OS and Zephyr images and booted to AP. TEST=Tested the Herobrine-NPCX7 EC-OS and Zephyr images and booted to AP. Change-Id: I7e025123f8997629b9b0db46e30ea9c716bdbf99 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2993213 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--baseboard/trogdor/build.mk1
-rw-r--r--baseboard/trogdor/power.c22
-rw-r--r--board/herobrine_npcx7/build.mk1
-rw-r--r--board/herobrine_npcx7/power.c22
-rw-r--r--power/qcom.c6
-rw-r--r--zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt1
-rw-r--r--zephyr/projects/trogdor/lazor/CMakeLists.txt1
7 files changed, 50 insertions, 4 deletions
diff --git a/baseboard/trogdor/build.mk b/baseboard/trogdor/build.mk
index 38fc5e823a..0f36051eee 100644
--- a/baseboard/trogdor/build.mk
+++ b/baseboard/trogdor/build.mk
@@ -8,5 +8,6 @@
baseboard-y+=baseboard.o
baseboard-y+=hibernate.o
+baseboard-y+=power.o
baseboard-y+=usbc_config.o
baseboard-y+=usb_pd_policy.o
diff --git a/baseboard/trogdor/power.c b/baseboard/trogdor/power.c
new file mode 100644
index 0000000000..0a55b49d3d
--- /dev/null
+++ b/baseboard/trogdor/power.c
@@ -0,0 +1,22 @@
+/* Copyright 2021 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.
+ */
+
+#include "gpio.h"
+#include "hooks.h"
+
+void board_chipset_pre_init(void)
+{
+ /* Turn on the 3.3V rail */
+ gpio_set_level(GPIO_EN_PP3300_A, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_chipset_pre_init, HOOK_PRIO_DEFAULT);
+
+void board_chipset_shutdown_complete(void)
+{
+ /* Turn off the 3.3V and 5V rails. */
+ gpio_set_level(GPIO_EN_PP3300_A, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN_COMPLETE, board_chipset_shutdown_complete,
+ HOOK_PRIO_DEFAULT);
diff --git a/board/herobrine_npcx7/build.mk b/board/herobrine_npcx7/build.mk
index a43729b074..87265f93df 100644
--- a/board/herobrine_npcx7/build.mk
+++ b/board/herobrine_npcx7/build.mk
@@ -15,5 +15,6 @@ board-y+=battery.o
board-y+=board.o
board-y+=hibernate.o
board-y+=led.o
+board-y+=power.o
board-y+=switchcap.o
board-y+=usbc_config.o
diff --git a/board/herobrine_npcx7/power.c b/board/herobrine_npcx7/power.c
new file mode 100644
index 0000000000..0a55b49d3d
--- /dev/null
+++ b/board/herobrine_npcx7/power.c
@@ -0,0 +1,22 @@
+/* Copyright 2021 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.
+ */
+
+#include "gpio.h"
+#include "hooks.h"
+
+void board_chipset_pre_init(void)
+{
+ /* Turn on the 3.3V rail */
+ gpio_set_level(GPIO_EN_PP3300_A, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_chipset_pre_init, HOOK_PRIO_DEFAULT);
+
+void board_chipset_shutdown_complete(void)
+{
+ /* Turn off the 3.3V and 5V rails. */
+ gpio_set_level(GPIO_EN_PP3300_A, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN_COMPLETE, board_chipset_shutdown_complete,
+ HOOK_PRIO_DEFAULT);
diff --git a/power/qcom.c b/power/qcom.c
index a57f13483e..8fd96cbb54 100644
--- a/power/qcom.c
+++ b/power/qcom.c
@@ -616,8 +616,7 @@ static void power_off(void)
set_system_power(0);
}
- /* Turn off the 3.3V and 5V rails. */
- gpio_set_level(GPIO_EN_PP3300_A, 0);
+ /* Turn off the 5V rail. */
#ifdef CONFIG_POWER_PP5000_CONTROL
power_5v_enable(task_get_current(), 0);
#else /* !defined(CONFIG_POWER_PP5000_CONTROL) */
@@ -659,8 +658,7 @@ static int power_on(void)
{
int ret;
- /* Enable the 3.3V and 5V rail. */
- gpio_set_level(GPIO_EN_PP3300_A, 1);
+ /* Enable the 5V rail. */
#ifdef CONFIG_POWER_PP5000_CONTROL
power_5v_enable(task_get_current(), 1);
#else /* !defined(CONFIG_POWER_PP5000_CONTROL) */
diff --git a/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt b/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt
index b4b11127f4..fda44fc81a 100644
--- a/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt
+++ b/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt
@@ -26,6 +26,7 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
zephyr_library_sources(
"${PLATFORM_EC_BOARD}/battery.c"
"${PLATFORM_EC_BOARD}/hibernate.c"
+ "${PLATFORM_EC_BOARD}/power.c"
"${PLATFORM_EC_BOARD}/switchcap.c"
"${PLATFORM_EC_BOARD}/usbc_config.c")
diff --git a/zephyr/projects/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt
index f944971a63..53d4498018 100644
--- a/zephyr/projects/trogdor/lazor/CMakeLists.txt
+++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt
@@ -18,6 +18,7 @@ set(PLATFORM_EC_BOARD "${PLATFORM_EC}/board/lazor" CACHE PATH
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
"${PLATFORM_EC_BASEBOARD}/hibernate.c"
+ "${PLATFORM_EC_BASEBOARD}/power.c"
"${PLATFORM_EC_BASEBOARD}/usbc_config.c"
"${PLATFORM_EC_BASEBOARD}/usb_pd_policy.c")