diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-04-07 20:21:00 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-06 15:47:24 +0000 |
commit | 0e1584749f333086e04b24d3f568bff36bb0de61 (patch) | |
tree | 9b2cd2b610d0ad1b1090c687ad8af98abbfdc8dc | |
parent | 086009f55adcee29e4d3d8d8d0379d13a99ce946 (diff) | |
download | chrome-ec-0e1584749f333086e04b24d3f568bff36bb0de61.tar.gz |
zephyr: move Krabby USB mux configuration into the DTS
USB muxes configuration of the Krabby is moved to the device tree.
BUG=b:227757117
TEST=zmake testall
TEST=check if usb_muxes structure is correct using gdb:
gdb ./build/zephyr/krabby/output/zephyr.ro.elf
p usb_muxes
BRANCH=none
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: Ib50e830ca028ec6e3c78bfd17695f695c883b1b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579119
Tested-by: Tomasz Michalec <tmichalec@google.com>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/projects/corsola/i2c_krabby.dts | 4 | ||||
-rw-r--r-- | zephyr/projects/corsola/src/krabby/usbc_config.c | 29 | ||||
-rw-r--r-- | zephyr/projects/corsola/usbc_krabby.dts | 22 |
3 files changed, 24 insertions, 31 deletions
diff --git a/zephyr/projects/corsola/i2c_krabby.dts b/zephyr/projects/corsola/i2c_krabby.dts index 13d5011b88..dd12e11f2c 100644 --- a/zephyr/projects/corsola/i2c_krabby.dts +++ b/zephyr/projects/corsola/i2c_krabby.dts @@ -36,11 +36,11 @@ i2c-port = <&i2c4>; enum-name = "I2C_PORT_USB_C1"; }; - usb-mux0 { + i2c_usb_mux0: usb-mux0 { i2c-port = <&i2c2>; enum-name = "I2C_PORT_USB_MUX0"; }; - usb-mux1 { + i2c_usb_mux1: usb-mux1 { i2c-port = <&i2c4>; enum-name = "I2C_PORT_USB_MUX1"; }; diff --git a/zephyr/projects/corsola/src/krabby/usbc_config.c b/zephyr/projects/corsola/src/krabby/usbc_config.c index dec82715a2..73ecd2f7bd 100644 --- a/zephyr/projects/corsola/src/krabby/usbc_config.c +++ b/zephyr/projects/corsola/src/krabby/usbc_config.c @@ -165,35 +165,6 @@ int board_set_active_charge_port(int port) return EC_SUCCESS; } -const struct usb_mux usbc0_virtual_mux = { - .usb_port = 0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; -const struct usb_mux usbc1_virtual_mux = { - .usb_port = 1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; - -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .usb_port = 0, - .i2c_port = I2C_PORT_USB_MUX0, - .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS, - .driver = &it5205_usb_mux_driver, - .next_mux = &usbc0_virtual_mux, - }, - { - .usb_port = 1, - .i2c_port = I2C_PORT_USB_MUX1, - .i2c_addr_flags = TUSB1064_I2C_ADDR0_FLAGS, - .driver = &tusb1064_usb_mux_driver, - .hpd_update = &tusb1044_hpd_update, - .next_mux = &usbc1_virtual_mux, - }, -}; - #ifdef CONFIG_USB_PD_VBUS_MEASURE_ADC_EACH_PORT enum adc_channel board_get_vbus_adc(int port) { diff --git a/zephyr/projects/corsola/usbc_krabby.dts b/zephyr/projects/corsola/usbc_krabby.dts index c0453f85ab..2156782dbc 100644 --- a/zephyr/projects/corsola/usbc_krabby.dts +++ b/zephyr/projects/corsola/usbc_krabby.dts @@ -29,6 +29,17 @@ status = "okay"; port = <&i2c_charger>; }; + usb-muxes = <&it5205_mux_0 &virtual_mux_0>; + }; + port0-muxes { + it5205_mux_0: it5205-mux-0 { + compatible = "ite,it5205"; + port = <&i2c_usb_mux0>; + i2c-addr-flags = "IT5205_I2C_ADDR1_FLAGS"; + }; + virtual_mux_0: virtual-mux-0 { + compatible = "cros-ec,usbc-mux-virtual"; + }; }; port1@1 { @@ -49,6 +60,17 @@ tcpc { compatible = "ite,it8xxx2-tcpc"; }; + usb-muxes = <&tusb1064_mux_1 &virtual_mux_1>; + }; + port1-muxes { + tusb1064_mux_1: tusb1064-mux-1 { + compatible = "ti,tusb1064"; + port = <&i2c_usb_mux1>; + i2c-addr-flags = "TUSB1064_I2C_ADDR0_FLAGS"; + }; + virtual_mux_1: virtual-mux-1 { + compatible = "cros-ec,usbc-mux-virtual"; + }; }; }; }; |