summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/CMakeLists.txt2
-rw-r--r--zephyr/Kconfig.usba64
-rw-r--r--zephyr/dts/bindings/gpio/gpio-enum-name.yaml8
-rw-r--r--zephyr/projects/brya/brya/prj.conf1
-rw-r--r--zephyr/projects/corsola/prj_kingler.conf1
-rw-r--r--zephyr/projects/corsola/prj_krabby.conf1
-rw-r--r--zephyr/projects/herobrine/prj.conf1
-rw-r--r--zephyr/projects/trogdor/lazor/prj.conf1
-rw-r--r--zephyr/projects/volteer/volteer/prj.conf1
-rw-r--r--zephyr/shim/include/config_chip.h20
10 files changed, 91 insertions, 9 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index caf13efc0c..3fd43a73eb 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -371,6 +371,8 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_CHARGER
"${PLATFORM_EC}/common/usb_charger.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB
"${PLATFORM_EC}/common/usb_port_power_dumb.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART
+ "${PLATFORM_EC}/common/usb_port_power_smart.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USB_POWER_DELIVERY
"${PLATFORM_EC}/common/usb_common.c"
diff --git a/zephyr/Kconfig.usba b/zephyr/Kconfig.usba
index 9633b7d2cf..1d7d9027d6 100644
--- a/zephyr/Kconfig.usba
+++ b/zephyr/Kconfig.usba
@@ -7,6 +7,12 @@ menuconfig PLATFORM_EC_USBA
help
Enable USB Type A ports
+ To use this your board code must provide a usb_port_enable[] array
+ with the GPIOs to use for each port, which may be specified via
+ device tree with "cros-ec,usba-port-enable-pins" nodes. This
+ implements the EC_CMD_USB_CHARGE_SET_MODE host command and provides
+ a 'usbchargemode' console command.
+
if PLATFORM_EC_USBA
config PLATFORM_EC_USB_A_PORT_COUNT
@@ -18,22 +24,62 @@ config PLATFORM_EC_USB_A_PORT_COUNT
external devices (according to the USB 3 spec, not the Battery Charger
standard) and to charge devices slowly if power is enabled to them.
-config PLATFORM_EC_USB_PORT_POWER_DUMB
- bool "Simple control of power to USB-A ports"
+choice
+ prompt "Port power control mode"
depends on PLATFORM_EC_USB_A_PORT_COUNT > 0
- default y
+
+config PLATFORM_EC_USB_PORT_POWER_DUMB
+ bool "Dumb"
help
- Enable this to provide simple control of the power to USB ports
- using GPIOs. To use this your board code must provide a
- usb_port_enable[] array with the GPIOs to use for each port. This
- implements the EC_CMD_USB_CHARGE_SET_MODE host command and provides
- a 'usbchargemode' console command.
+ USB-A ports are controlled with a single GPIO each, where turning it
+ on enables the port and turning it off disables the port.
+
+config PLATFORM_EC_USB_PORT_POWER_SMART
+ bool "Smart"
+ help
+ USB-A ports are controlled via a smart switch, which allows dynamic
+ selection of port current limits and BC1.2 charging modes as well
+ as a signal to enable or disable power to the port.
+
+endchoice
config PLATFORM_EC_USB_PORT_POWER_DUMB_CUSTOM_HOOK
- bool "Simple control of power to USB-A ports"
+ bool "Disable default dumb port power hooks"
depends on PLATFORM_EC_USB_PORT_POWER_DUMB
help
Enable this if your board does not want to use the default S3 hooks
from USB_PORT_POWER_DUMB.
+if PLATFORM_EC_USB_PORT_POWER_SMART
+
+config PLATFORM_EC_USB_PORT_POWER_SMART_CDP_SDP_ONLY
+ bool "CDP/SDP mode only"
+ help
+ Enable this if the USB-A smart switch mode selection is fixed and
+ the only control is for CDP or SDP mode via current limit selection.
+ Only the ILIM GPIOs will be controlled, not CTL*.
+
+config PLATFORM_EC_USB_PORT_POWER_SMART_SIMPLE
+ bool "Shared 2-wire control"
+ depends on !PLATFORM_EC_USB_PORT_POWER_SMART_CDP_SDP_ONLY
+ select PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED
+ help
+ Enable this if the EC has a single GPIO tied to the CTL1 line and a
+ single ILIM signal, each shared with every USB-A port. This implies
+ that only these lines can be manipulated (CTL2 and CTL3 are fixed in
+ hardware) and that any configuration to one port will also adjust the
+ others.
+
+ If disabled, the EC controls all of ILIM and CTL1 through CTL3 for
+ every port individually.
+
+config PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED
+ bool "ILIM signal polarity is inverted"
+ help
+ Select this option if the ILIM signal going to the port controller(s)
+ is inverted, meaning a low value indicates a high current limit and a
+ high value requests a low current limit.
+
+endif # PLATFORM_EC_USB_PORT_POWER_SMART
+
endif # PLATFORM_EC_USBA
diff --git a/zephyr/dts/bindings/gpio/gpio-enum-name.yaml b/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
index 1ca5d1eebc..1cdb7a43f7 100644
--- a/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
+++ b/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
@@ -108,6 +108,14 @@ properties:
- GPIO_USB_C1_TCPC_RST_L
- GPIO_USB_C2_BC12_INT_ODL
- GPIO_USB_C2_PPC_INT_ODL
+ - GPIO_USB1_CTL1
+ - GPIO_USB1_CTL2
+ - GPIO_USB1_CTL3
+ - GPIO_USB1_ILIM_SEL
+ - GPIO_USB2_CTL1
+ - GPIO_USB2_CTL2
+ - GPIO_USB2_CTL3
+ - GPIO_USB2_ILIM_SEL
- GPIO_VBOB_EN
- GPIO_VCCST_PWRGD_OD
- GPIO_VOLUME_DOWN_L
diff --git a/zephyr/projects/brya/brya/prj.conf b/zephyr/projects/brya/brya/prj.conf
index f68288c8dd..abe72aa3a1 100644
--- a/zephyr/projects/brya/brya/prj.conf
+++ b/zephyr/projects/brya/brya/prj.conf
@@ -161,6 +161,7 @@ CONFIG_PLATFORM_EC_USB_PD_TCPM_TCPCI=y
CONFIG_PLATFORM_EC_USBC_PPC_DEDICATED_INT=y
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP=n
CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=n
CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG=n
diff --git a/zephyr/projects/corsola/prj_kingler.conf b/zephyr/projects/corsola/prj_kingler.conf
index 6ee5cf157b..8bce7e8d3b 100644
--- a/zephyr/projects/corsola/prj_kingler.conf
+++ b/zephyr/projects/corsola/prj_kingler.conf
@@ -106,6 +106,7 @@ CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y
# USBA
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
# USBC
CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
diff --git a/zephyr/projects/corsola/prj_krabby.conf b/zephyr/projects/corsola/prj_krabby.conf
index 4f893d0eaa..6c37355029 100644
--- a/zephyr/projects/corsola/prj_krabby.conf
+++ b/zephyr/projects/corsola/prj_krabby.conf
@@ -110,6 +110,7 @@ CONFIG_TASK_PD_STACK_SIZE=1280
# USB-A
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
# USB-C
CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
diff --git a/zephyr/projects/herobrine/prj.conf b/zephyr/projects/herobrine/prj.conf
index 031b65fc7f..a1896c9199 100644
--- a/zephyr/projects/herobrine/prj.conf
+++ b/zephyr/projects/herobrine/prj.conf
@@ -105,6 +105,7 @@ CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
# USB-A
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
# USB-C
CONFIG_PLATFORM_EC_USB_PD_FRS=y
diff --git a/zephyr/projects/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf
index 3c18baae75..ab4cc2009c 100644
--- a/zephyr/projects/trogdor/lazor/prj.conf
+++ b/zephyr/projects/trogdor/lazor/prj.conf
@@ -99,6 +99,7 @@ CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
# USB-A
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
# USB-C
CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
diff --git a/zephyr/projects/volteer/volteer/prj.conf b/zephyr/projects/volteer/volteer/prj.conf
index bb2fb3720d..ba914ce5ad 100644
--- a/zephyr/projects/volteer/volteer/prj.conf
+++ b/zephyr/projects/volteer/volteer/prj.conf
@@ -139,6 +139,7 @@ CONFIG_PLATFORM_EC_USB_PD_TCPM_MUX=y
CONFIG_PLATFORM_EC_USBC_PPC_DEDICATED_INT=y
CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP=n
CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=n
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 0bbd216ff7..4505091c40 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1052,6 +1052,26 @@ extern struct jump_data mock_jump_data;
#define CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK
#endif
+#undef CONFIG_USB_PORT_POWER_SMART
+#ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART
+#define CONFIG_USB_PORT_POWER_SMART
+#endif
+
+#undef CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY
+#ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_CDP_SDP_ONLY
+#define CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY
+#endif
+
+#undef CONFIG_USB_PORT_POWER_SMART_SIMPLE
+#ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_SIMPLE
+#define CONFIG_USB_PORT_POWER_SMART_SIMPLE
+#endif
+
+#undef CONFIG_USB_PORT_POWER_SMART_INVERTED
+#ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED
+#define CONFIG_USB_PORT_POWER_SMART_INVERTED
+#endif
+
#undef CONFIG_BC12_DETECT_PI3USB9201
#ifdef CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201
#define CONFIG_BC12_DETECT_PI3USB9201