diff options
author | Dawid Niedzwiecki <dawidn@google.com> | 2022-03-31 11:25:41 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-04 14:01:27 +0000 |
commit | b0a86e595df4b8ff6ba96238da4edc467ae14594 (patch) | |
tree | 785139970588d387de71141f25b39a7a2ee1fe92 /zephyr/projects/trogdor | |
parent | 4b86ca632ee67180f8ac16f332ba65335191387d (diff) | |
download | chrome-ec-b0a86e595df4b8ff6ba96238da4edc467ae14594.tar.gz |
zephyr: lazor: move UBC-C configuration into the devicetree
Some of the USB-C related Lazor arrays are declared in a board-specific
file. Fill the usbc node in dts which causes defining these arrays
automatically. It reduces the board-specific code.
The change shouldn't affect an output binary.
BUG=b:227359762
TEST=zmake testall && make sure usbc works on Lazor
BRANCH=main
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: Id70f6785fc25ba89e08bf285b2a0c3be5c71c19c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3563140
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'zephyr/projects/trogdor')
-rw-r--r-- | zephyr/projects/trogdor/lazor/i2c.dts | 8 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/src/usbc_config.c | 61 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/usbc.dts | 44 |
3 files changed, 48 insertions, 65 deletions
diff --git a/zephyr/projects/trogdor/lazor/i2c.dts b/zephyr/projects/trogdor/lazor/i2c.dts index 1ba02b383a..a45b900896 100644 --- a/zephyr/projects/trogdor/lazor/i2c.dts +++ b/zephyr/projects/trogdor/lazor/i2c.dts @@ -7,7 +7,7 @@ named-i2c-ports { compatible = "named-i2c-ports"; - power { + i2c_power: power { i2c-port = <&i2c0_0>; enum-name = "I2C_PORT_POWER"; }; @@ -24,15 +24,15 @@ i2c-port = <&i2c0_0>; enum-name = "I2C_PORT_CHARGER"; }; - tcpc0 { + i2c_tcpc0: tcpc0 { i2c-port = <&i2c1_0>; enum-name = "I2C_PORT_TCPC0"; }; - tcpc1 { + i2c_tcpc1: tcpc1 { i2c-port = <&i2c2_0>; enum-name = "I2C_PORT_TCPC1"; }; - eeprom { + i2c_eeprom: eeprom { i2c-port = <&i2c5_0>; enum-name = "I2C_PORT_EEPROM"; }; diff --git a/zephyr/projects/trogdor/lazor/src/usbc_config.c b/zephyr/projects/trogdor/lazor/src/usbc_config.c index 33c7437765..057453b343 100644 --- a/zephyr/projects/trogdor/lazor/src/usbc_config.c +++ b/zephyr/projects/trogdor/lazor/src/usbc_config.c @@ -76,16 +76,6 @@ enum ec_status charger_profile_override_set_param(uint32_t param, return EC_RES_INVALID_PARAM; } -void usb0_evt(enum gpio_signal signal) -{ - task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12); -} - -void usb1_evt(enum gpio_signal signal) -{ - task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12); -} - static void usba_oc_deferred(void) { /* Use next number after all USB-C ports to indicate the USB-A port */ @@ -148,41 +138,6 @@ void tcpc_alert_event(enum gpio_signal signal) schedule_deferred_pd_interrupt(port); } -/* Power Path Controller */ -struct ppc_config_t ppc_chips[] = { - { - .i2c_port = I2C_PORT_TCPC0, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv - }, - { - .i2c_port = I2C_PORT_TCPC1, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv - }, -}; -unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); - -/* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_TCPC0, - .addr_flags = PS8XXX_I2C_ADDR1_FLAGS, - }, - .drv = &ps8xxx_tcpm_drv, - }, - { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_TCPC1, - .addr_flags = PS8XXX_I2C_ADDR1_FLAGS, - }, - .drv = &ps8xxx_tcpm_drv, - }, -}; - /* * Port-0/1 USB mux driver. * @@ -207,18 +162,6 @@ const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A_5V, }; -/* BC1.2 */ -const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { - { - .i2c_port = I2C_PORT_POWER, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, - { - .i2c_port = I2C_PORT_EEPROM, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, -}; - __override int board_get_default_battery_type(void) { /* @@ -236,10 +179,6 @@ __override int board_get_default_battery_type(void) /* Initialize board USC-C things */ static void board_init_usbc(void) { - /* Enable BC1.2 interrupts */ - gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_bc12)); - gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c1_bc12)); - /* Enable USB-A overcurrent interrupt */ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_a0_oc)); /* diff --git a/zephyr/projects/trogdor/lazor/usbc.dts b/zephyr/projects/trogdor/lazor/usbc.dts index c7478e6d66..3d100d67bb 100644 --- a/zephyr/projects/trogdor/lazor/usbc.dts +++ b/zephyr/projects/trogdor/lazor/usbc.dts @@ -14,11 +14,55 @@ port0@0 { compatible = "named-usbc-port"; reg = <0>; + + bc12 { + compatible = "pericom,pi3usb9201"; + status = "okay"; + irq = <&int_usb_c0_bc12>; + port = <&i2c_power>; + i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + }; + + tcpc { + compatible = "parade,ps8xxx"; + status = "okay"; + port = <&i2c_tcpc0>; + i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; + }; + + ppc { + compatible = "ti,sn5s330"; + status = "okay"; + port = <&i2c_tcpc0>; + i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; + }; }; port1@1 { compatible = "named-usbc-port"; reg = <1>; + + bc12 { + compatible = "pericom,pi3usb9201"; + status = "okay"; + irq = <&int_usb_c1_bc12>; + port = <&i2c_eeprom>; + i2c-addr-flags = "PI3USB9201_I2C_ADDR_3_FLAGS"; + }; + + tcpc { + compatible = "parade,ps8xxx"; + status = "okay"; + port = <&i2c_tcpc1>; + i2c-addr-flags = "PS8XXX_I2C_ADDR1_FLAGS"; + }; + + ppc { + compatible = "ti,sn5s330"; + status = "okay"; + port = <&i2c_tcpc1>; + i2c-addr-flags = "SN5S330_ADDR0_FLAGS"; + }; }; }; }; |