summaryrefslogtreecommitdiff
path: root/chip/it83xx/gpio.c
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2020-09-08 14:56:10 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-08 06:05:02 +0000
commit44f69459ded7bd93933a660c1f216f1ad0ae443e (patch)
treef57dbe0cb389e82316b82faa99c022ab03d58e9a /chip/it83xx/gpio.c
parenta54cd39627e62e60af73e2d3ef51504f43d1fb0e (diff)
downloadchrome-ec-44f69459ded7bd93933a660c1f216f1ad0ae443e.tar.gz
it83xx: enable selecting EC's VCC
The VCC is the power source of EC's GPM0~6, will connect to 1.8v or 3.3v depended on platform design. This change was made to ensure voltage level setting of GPM0~6 matches the corresponded VCC level. So we can enable internal pull-up no matter VCC is connected to 1.8v or 3.3v BUG=b:168783892 BRANCH=none TEST=- buildall. - The level setting is correct on these boards: asurada, drawcia, and reef_it8320 Change-Id: I4eae368e569987381a0437494262d588436bb011 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2397931 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'chip/it83xx/gpio.c')
-rw-r--r--chip/it83xx/gpio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/chip/it83xx/gpio.c b/chip/it83xx/gpio.c
index 3dd6d16268..90d8b717b7 100644
--- a/chip/it83xx/gpio.c
+++ b/chip/it83xx/gpio.c
@@ -667,6 +667,24 @@ void gpio_pre_init(void)
IT83XX_GPIO_GCR = 0x06;
+#if !defined(CONFIG_IT83XX_VCC_1P8V) && !defined(CONFIG_IT83XX_VCC_3P3V)
+#error Please select voltage level of VCC for EC.
+#endif
+
+#if defined(CONFIG_IT83XX_VCC_1P8V) && defined(CONFIG_IT83XX_VCC_3P3V)
+#error Must select only one voltage level of VCC for EC.
+#endif
+ /* The power level of GPM6 follows VCC */
+ IT83XX_GPIO_GCR29 |= BIT(0);
+
+ /* The power level (VCC) of GPM0~6 is 1.8V */
+ if (IS_ENABLED(CONFIG_IT83XX_VCC_1P8V))
+ IT83XX_GPIO_GCR30 |= BIT(4);
+
+ /* The power level (VCC) of GPM0~6 is 3.3V */
+ if (IS_ENABLED(CONFIG_IT83XX_VCC_3P3V))
+ IT83XX_GPIO_GCR30 &= ~BIT(4);
+
#if IT83XX_USBPD_PHY_PORT_COUNT < CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT
#error "ITE pd active port count should be less than physical port count !"
#endif