summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2022-02-24 18:23:47 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-23 08:15:52 +0000
commitc57ddf75cd7fe337f03d3c59c9d5e9e120ad6bc3 (patch)
treef2ed2aa9eb2e9fa8ee6553151776026c6fb5dc05
parent354b77acfd0178c5ac424a64d6bb7814d3506df0 (diff)
downloadchrome-ec-c57ddf75cd7fe337f03d3c59c9d5e9e120ad6bc3.tar.gz
krabby: migrate usbc structs to device tree
BUG=b:220814055 TEST=manually checked the array content BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I92540572d5c1b05495ae8f45464d1f3a6dbfa704 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3487363 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/projects/corsola/BUILD.py1
-rw-r--r--zephyr/projects/corsola/i2c_krabby.dts12
-rw-r--r--zephyr/projects/corsola/src/krabby/usbc_config.c40
-rw-r--r--zephyr/projects/corsola/usbc_krabby.dts46
4 files changed, 49 insertions, 50 deletions
diff --git a/zephyr/projects/corsola/BUILD.py b/zephyr/projects/corsola/BUILD.py
index 2fc11c9d60..9b662d17f4 100644
--- a/zephyr/projects/corsola/BUILD.py
+++ b/zephyr/projects/corsola/BUILD.py
@@ -39,6 +39,7 @@ register_corsola_project(
here / "cbi_eeprom.dts",
here / "motionsense_krabby.dts",
here / "pwm_krabby.dts",
+ here / "usbc_krabby.dts",
],
extra_kconfig_files=[here / "prj_krabby.conf"],
)
diff --git a/zephyr/projects/corsola/i2c_krabby.dts b/zephyr/projects/corsola/i2c_krabby.dts
index f77f231991..9a5ab2346f 100644
--- a/zephyr/projects/corsola/i2c_krabby.dts
+++ b/zephyr/projects/corsola/i2c_krabby.dts
@@ -28,19 +28,11 @@
i2c-port = <&i2c3>;
enum-name = "I2C_PORT_SENSOR";
};
- ppc0 {
- i2c-port = <&i2c2>;
- enum-name = "I2C_PORT_PPC0";
- };
- ppc1 {
- i2c-port = <&i2c4>;
- enum-name = "I2C_PORT_PPC1";
- };
- usb-c0 {
+ i2c_usb_c0: usb-c0 {
i2c-port = <&i2c2>;
enum-name = "I2C_PORT_USB_C0";
};
- usb-c1 {
+ i2c_usb_c1: usb-c1 {
i2c-port = <&i2c4>;
enum-name = "I2C_PORT_USB_C1";
};
diff --git a/zephyr/projects/corsola/src/krabby/usbc_config.c b/zephyr/projects/corsola/src/krabby/usbc_config.c
index bcb1ea2281..cdd5c147bf 100644
--- a/zephyr/projects/corsola/src/krabby/usbc_config.c
+++ b/zephyr/projects/corsola/src/krabby/usbc_config.c
@@ -36,28 +36,6 @@ const struct charger_config_t chg_chips[] = {
},
};
-/* PPC */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = RT1739_ADDR1_FLAGS,
- .drv = &rt1739_ppc_drv,
- .frs_en = GPIO_SIGNAL(DT_NODELABEL(usb_c0_ppc_frsinfo)),
- },
- {
- .i2c_port = I2C_PORT_PPC1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
- .frs_en = GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_frs_en)),
- },
-};
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-struct bc12_config bc12_ports[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- { .drv = &rt1739_bc12_drv },
- { .drv = &rt9490_bc12_drv },
-};
-
void c0_bc12_interrupt(enum gpio_signal signal)
{
rt1739_interrupt(0);
@@ -87,24 +65,6 @@ static void board_usbc_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_usbc_init, HOOK_PRIO_DEFAULT + 1);
-/* TCPC */
-struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_EMBEDDED,
- /* TCPC is embedded within EC so no i2c config needed */
- .drv = &it8xxx2_tcpm_drv,
- /* Alert is active-low, push-pull */
- .flags = 0,
- },
- {
- .bus_type = EC_BUS_TYPE_EMBEDDED,
- /* TCPC is embedded within EC so no i2c config needed */
- .drv = &it8xxx2_tcpm_drv,
- /* Alert is active-low, push-pull */
- .flags = 0,
- },
-};
-
void ppc_interrupt(enum gpio_signal signal)
{
if (signal == GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_ppc_int_odl)))
diff --git a/zephyr/projects/corsola/usbc_krabby.dts b/zephyr/projects/corsola/usbc_krabby.dts
new file mode 100644
index 0000000000..1a6ec75134
--- /dev/null
+++ b/zephyr/projects/corsola/usbc_krabby.dts
@@ -0,0 +1,46 @@
+/* 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.
+ */
+
+/ {
+ usbc {
+ compatible = "named-usbc-ports";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port0: usbc-port@0 {
+ reg = <0>;
+ bc12 {
+ compatible = "richtek,rt1739-bc12";
+ status = "okay";
+ };
+ ppc {
+ compatible = "richtek,rt1739-ppc";
+ status = "okay";
+ port = <&i2c_usb_c0>;
+ i2c-addr-flags = "RT1739_ADDR1_FLAGS";
+ };
+ tcpc {
+ compatible = "ite,it8xxx2-tcpc";
+ };
+ };
+
+ port1: usbc-port@1 {
+ reg = <1>;
+ bc12 {
+ compatible = "richtek,rt9490-bc12";
+ status = "okay";
+ };
+ ppc {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ port = <&i2c_usb_c1>;
+ i2c-addr-flags = "SYV682X_ADDR0_FLAGS";
+ frs_en_gpio = <&gpio_ec_x_gpio1>;
+ };
+ tcpc {
+ compatible = "ite,it8xxx2-tcpc";
+ };
+ };
+ };
+};