From 9577704f30c7e824c0590264df22d95a2c706575 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Wed, 2 Oct 2019 14:27:47 -0600 Subject: Rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT Certain SKUs of certain boards have lesser number of USB PD ports than defined by CONFIG_USB_PD_PORT_COUNT. Hence rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT. BUG=b:140816510, b:143196487 BRANCH=octopus TEST=make -j buildall; Boot to ChromeOS Change-Id: I7c33b27150730a1a3b5813b7b4a72fd24ab73c6a Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879337 Tested-by: Karthikeyan Ramasubramanian Reviewed-by: Jett Rink Commit-Queue: Jett Rink --- board/akemi/board.c | 6 +++--- board/ampton/battery.c | 2 +- board/ampton/board.c | 2 +- board/atlas/board.c | 8 ++++---- board/atlas/board.h | 2 +- board/atlas/usb_pd_policy.c | 9 +++++---- board/bloog/board.c | 2 +- board/bobba/board.c | 2 +- board/casta/board.c | 2 +- board/chell/board.c | 6 +++--- board/chell/board.h | 2 +- board/chell/usb_pd_policy.c | 6 +++--- board/cheza/board.c | 12 ++++++------ board/cheza/board.h | 2 +- board/cheza/usb_pd_policy.c | 11 ++++++----- board/chocodile_vpdmcu/board.h | 2 +- board/coffeecake/board.h | 2 +- board/coral/board.c | 6 +++--- board/coral/board.h | 2 +- board/coral/usb_pd_policy.c | 9 +++++---- board/dingdong/board.h | 2 +- board/dood/board.c | 2 +- board/dratini/board.c | 6 +++--- board/elm/board.c | 6 +++--- board/elm/board.h | 2 +- board/elm/usb_pd_policy.c | 4 ++-- board/eve/board.c | 6 +++--- board/eve/board.h | 2 +- board/eve/led.c | 2 +- board/eve/usb_pd_policy.c | 9 +++++---- board/fizz/board.c | 6 +++--- board/fizz/board.h | 2 +- board/fizz/usb_pd_policy.c | 4 ++-- board/flapjack/board.c | 4 ++-- board/flapjack/board.h | 2 +- board/flapjack/usb_pd_policy.c | 6 +++--- board/fleex/board.c | 2 +- board/garg/board.c | 2 +- board/glados/board.c | 6 +++--- board/glados/board.h | 2 +- board/glados/usb_pd_policy.c | 6 +++--- board/glados_pd/board.h | 2 +- board/glkrvp/board.h | 2 +- board/glkrvp/chg_usb_pd.c | 8 ++++---- board/glkrvp/usb_pd_policy.c | 4 ++-- board/glkrvp_ite/board.h | 2 +- board/glkrvp_ite/chg_usb_pd.c | 6 +++--- board/glkrvp_ite/usb_pd_policy.c | 4 ++-- board/hatch/board.c | 6 +++--- board/helios/board.c | 6 +++--- board/hoho/board.h | 2 +- board/it83xx_evb/board.c | 2 +- board/it83xx_evb/board.h | 2 +- board/it83xx_evb/usb_pd_policy.c | 4 ++-- board/jacuzzi/board.c | 4 ++-- board/kindred/board.c | 6 +++--- board/kodama/board.c | 4 ++-- board/kohaku/board.c | 8 ++++---- board/kukui/board.c | 4 ++-- board/liara/battery.c | 2 +- board/mchpevb1/board.c | 14 +++++++------- board/mchpevb1/board.h | 2 +- board/mchpevb1/usb_pd_policy.c | 6 +++--- board/meep/board.c | 2 +- board/nami/board.c | 8 ++++---- board/nami/board.h | 2 +- board/nami/usb_pd_policy.c | 9 +++++---- board/nautilus/board.c | 8 ++++---- board/nautilus/board.h | 2 +- board/nautilus/usb_pd_policy.c | 9 +++++---- board/nocturne/board.c | 8 ++++---- board/nocturne/board.h | 2 +- board/nocturne/usb_pd_policy.c | 6 +++--- board/oak/board.c | 12 ++++++------ board/oak/board.h | 2 +- board/oak/usb_pd_policy.c | 4 ++-- board/pdeval-stm32f072/PD_evaluation.md | 2 +- board/pdeval-stm32f072/board.c | 2 +- board/pdeval-stm32f072/board.h | 2 +- board/pdeval-stm32f072/usb_pd_policy.c | 6 +++--- board/phaser/board.c | 2 +- board/plankton/board.h | 2 +- board/poppy/board.c | 8 ++++---- board/poppy/board.h | 2 +- board/poppy/usb_pd_policy.c | 9 +++++---- board/puff/board.c | 6 +++--- board/puff/board.h | 2 +- board/puff/usb_pd_policy.c | 4 ++-- board/rainier/board.c | 4 ++-- board/rainier/board.h | 2 +- board/rainier/usb_pd_policy.c | 4 ++-- board/rammus/board.c | 8 ++++---- board/rammus/board.h | 2 +- board/rammus/usb_pd_policy.c | 9 +++++---- board/reef/board.c | 6 +++--- board/reef/board.h | 2 +- board/reef/usb_pd_policy.c | 9 +++++---- board/reef_it8320/board.c | 6 +++--- board/reef_it8320/board.h | 2 +- board/reef_it8320/usb_pd_policy.c | 9 +++++---- board/reef_mchp/board.c | 6 +++--- board/reef_mchp/board.h | 2 +- board/reef_mchp/usb_pd_policy.c | 9 +++++---- board/samus_pd/board.c | 2 +- board/samus_pd/board.h | 2 +- board/samus_pd/usb_mux.c | 4 ++-- board/samus_pd/usb_pd_policy.c | 4 ++-- board/scarlet/board.c | 4 ++-- board/scarlet/board.h | 2 +- board/scarlet/usb_pd_policy.c | 4 ++-- board/servo_v4/board.h | 2 +- board/servo_v4/usb_pd_policy.c | 2 +- board/strago/board.c | 6 +++--- board/strago/board.h | 2 +- board/strago/usb_pd_policy.c | 2 +- board/tglrvpu_ite/board.c | 2 +- board/tglrvpu_ite/board.h | 2 +- board/twinkie/board.h | 2 +- board/yorp/board.c | 2 +- board/zinger/board.h | 2 +- 120 files changed, 268 insertions(+), 257 deletions(-) (limited to 'board') diff --git a/board/akemi/board.c b/board/akemi/board.c index ab973bb581..f4af724a8d 100644 --- a/board/akemi/board.c +++ b/board/akemi/board.c @@ -120,7 +120,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -140,7 +140,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, @@ -368,7 +368,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/ampton/battery.c b/board/ampton/battery.c index 2bc0aa3482..481216cf61 100644 --- a/board/ampton/battery.c +++ b/board/ampton/battery.c @@ -133,7 +133,7 @@ static void reduce_input_voltage_when_full(void) else max_pd_voltage_mv = PD_MAX_VOLTAGE_MV; if (pd_get_max_voltage() != max_pd_voltage_mv) { - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) pd_set_external_voltage_limit(port, max_pd_voltage_mv); } } diff --git a/board/ampton/board.c b/board/ampton/board.c index 8c821eeb62..0025ae2567 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -68,7 +68,7 @@ int ppc_get_alert_status(int port) static int tune_mux(int port); -struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ITE_0] = { /* Use PS8751 as mux only */ .port_addr = MUX_PORT_AND_ADDR( diff --git a/board/atlas/board.c b/board/atlas/board.c index 10c918679b..76fd2c1b22 100644 --- a/board/atlas/board.c +++ b/board/atlas/board.c @@ -152,7 +152,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { /* left port */ .bus_type = EC_BUS_TYPE_I2C, @@ -177,7 +177,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -210,7 +210,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); @@ -482,7 +482,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are sourcing VBUS on the port */ int is_source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/atlas/board.h b/board/atlas/board.h index 23ce6b22c5..b7c64b96da 100644 --- a/board/atlas/board.h +++ b/board/atlas/board.h @@ -132,7 +132,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_TCPC #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/atlas/usb_pd_policy.c b/board/atlas/usb_pd_policy.c index a65a018752..a66411f931 100644 --- a/board/atlas/usb_pd_policy.c +++ b/board/atlas/usb_pd_policy.c @@ -55,8 +55,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -280,8 +281,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/bloog/board.c b/board/bloog/board.c index 14f522a285..42049d0ef7 100644 --- a/board/bloog/board.c +++ b/board/bloog/board.c @@ -305,7 +305,7 @@ const int keyboard_factory_scan_pins_used = void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/bobba/board.c b/board/bobba/board.c index 9f34cbc815..61503cce4d 100644 --- a/board/bobba/board.c +++ b/board/bobba/board.c @@ -399,7 +399,7 @@ void lid_angle_peripheral_enable(int enable) void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/casta/board.c b/board/casta/board.c index 6d7bd9cf46..a14e669a01 100644 --- a/board/casta/board.c +++ b/board/casta/board.c @@ -146,7 +146,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/chell/board.c b/board/chell/board.c index 64e4e13b5f..7b56ca621a 100644 --- a/board/chell/board.c +++ b/board/chell/board.c @@ -106,7 +106,7 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -181,7 +181,7 @@ static int ps874x_tune_mux(int port) return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x1A, .driver = &ps874x_usb_mux_driver, @@ -303,7 +303,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a realy physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source vbus on that port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/chell/board.h b/board/chell/board.h index 5686d0aa28..c11e9218fc 100644 --- a/board/chell/board.h +++ b/board/chell/board.h @@ -75,7 +75,7 @@ #define CONFIG_USB_PD_COMM_LOCKED #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c index 7031a39bcc..3a2a6b2afc 100644 --- a/board/chell/usb_pd_policy.c +++ b/board/chell/usb_pd_policy.c @@ -196,9 +196,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -261,7 +261,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; #define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) static void svdm_dp_post_config(int port) diff --git a/board/cheza/board.c b/board/cheza/board.c index 1a8400fadb..8fb927d436 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -255,7 +255,7 @@ struct ppc_config_t ppc_chips[] = { unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { /* Alert is active-low, open-drain */ [USB_PD_PORT_ANX3429] = { .bus_type = EC_BUS_TYPE_I2C, @@ -354,7 +354,7 @@ const struct usb_mux_driver port1_usb_mux_driver = { .enter_low_power_mode = &port1_usb_mux_enter_low_power, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &port0_usb_mux_driver, .hpd_update = &virtual_hpd_update, @@ -417,7 +417,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); @@ -534,7 +534,7 @@ void board_overcurrent_event(int port, int is_overcurrented) int board_set_active_charge_port(int port) { int is_real_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_COUNT); + port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; int rv; @@ -545,7 +545,7 @@ int board_set_active_charge_port(int port) if (port == CHARGE_PORT_NONE) { /* Disable all ports. */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { rv = board_vbus_sink_enable(i, 0); if (rv) { CPRINTS("Disabling p%d sink path failed.", i); @@ -566,7 +566,7 @@ int board_set_active_charge_port(int port) * Turn off the other ports' sink path FETs, before enabling the * requested charge port. */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { if (i == port) continue; diff --git a/board/cheza/board.h b/board/cheza/board.h index e7e524c06a..76e64277b5 100644 --- a/board/cheza/board.h +++ b/board/cheza/board.h @@ -106,7 +106,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_ANX3429 #define CONFIG_USB_PD_TCPM_PS8751 diff --git a/board/cheza/usb_pd_policy.c b/board/cheza/usb_pd_policy.c index d0ef297431..502a773150 100644 --- a/board/cheza/usb_pd_policy.c +++ b/board/cheza/usb_pd_policy.c @@ -133,8 +133,9 @@ int pd_is_valid_input_voltage(int mv) return 1; } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; static void board_vbus_update_source_current(int port) { @@ -300,8 +301,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -374,7 +375,7 @@ static int is_dp_muxable(int port) int i; const char *dp_str, *usb_str; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) if (i != port) { usb_mux_get(i, &dp_str, &usb_str); if (dp_str) diff --git a/board/chocodile_vpdmcu/board.h b/board/chocodile_vpdmcu/board.h index dc90b5f764..0ddf3374c0 100644 --- a/board/chocodile_vpdmcu/board.h +++ b/board/chocodile_vpdmcu/board.h @@ -57,7 +57,7 @@ #undef CONFIG_UART_TX_DMA #undef CONFIG_UART_RX_DMA #define CONFIG_UART_TX_BUF_SIZE 128 -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_VBUS_DETECT_NONE #define CONFIG_USB_PD_TCPM_STUB diff --git a/board/coffeecake/board.h b/board/coffeecake/board.h index 77abfa7f99..62dea70847 100644 --- a/board/coffeecake/board.h +++ b/board/coffeecake/board.h @@ -49,7 +49,7 @@ #define CONFIG_USB_PD_LOGGING #undef CONFIG_EVENT_LOG_SIZE #define CONFIG_EVENT_LOG_SIZE 256 -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #define CONFIG_USB_PD_VBUS_DETECT_NONE diff --git a/board/coral/board.c b/board/coral/board.c index 40d7a211b3..91df786a1a 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -221,7 +221,7 @@ struct i2c_stress_test i2c_stress_tests[] = { const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); #endif /* CONFIG_CMD_I2C_STRESS_TEST */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -272,7 +272,7 @@ static int ps8751_tune_mux(int port) return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, @@ -389,7 +389,7 @@ static void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); diff --git a/board/coral/board.h b/board/coral/board.h index 4bb007ea5e..a4d4f393b4 100644 --- a/board/coral/board.h +++ b/board/coral/board.h @@ -85,7 +85,7 @@ #define CONFIG_USB_PD_DISCHARGE_TCPC #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */ diff --git a/board/coral/usb_pd_policy.c b/board/coral/usb_pd_policy.c index d2ceecf074..9765b540d1 100644 --- a/board/coral/usb_pd_policy.c +++ b/board/coral/usb_pd_policy.c @@ -56,8 +56,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -270,8 +271,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/dingdong/board.h b/board/dingdong/board.h index 56d6495d78..8a0a835f92 100644 --- a/board/dingdong/board.h +++ b/board/dingdong/board.h @@ -39,7 +39,7 @@ #define CONFIG_USB_PD_LOGGING #undef CONFIG_EVENT_LOG_SIZE #define CONFIG_EVENT_LOG_SIZE 256 -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #undef CONFIG_WATCHDOG_HELP diff --git a/board/dood/board.c b/board/dood/board.c index 04fcdd6663..b246b83e1d 100644 --- a/board/dood/board.c +++ b/board/dood/board.c @@ -281,7 +281,7 @@ void lid_angle_peripheral_enable(int enable) void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/dratini/board.c b/board/dratini/board.c index f86436f856..2b0f8ef83c 100644 --- a/board/dratini/board.c +++ b/board/dratini/board.c @@ -126,7 +126,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -146,7 +146,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, @@ -399,7 +399,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/elm/board.c b/board/elm/board.c index 7dfc0a503d..80cc6ff02f 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -123,7 +123,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /* TCPC */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -162,7 +162,7 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &anx7688_usb_mux_driver, }, @@ -291,7 +291,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(GPIO_USB_C0_5V_EN); diff --git a/board/elm/board.h b/board/elm/board.h index 555447f06b..e9269b0775 100644 --- a/board/elm/board.h +++ b/board/elm/board.h @@ -92,7 +92,7 @@ #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_ANX7688 #define CONFIG_USB_PD_TCPM_TCPCI diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c index 766d38cc5c..11e1ca2c6a 100644 --- a/board/elm/usb_pd_policy.c +++ b/board/elm/usb_pd_policy.c @@ -209,9 +209,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/eve/board.c b/board/eve/board.c index 4d408915f7..e58bca9efd 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -202,7 +202,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -221,7 +221,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, @@ -310,7 +310,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); diff --git a/board/eve/board.h b/board/eve/board.h index 8b1f5e85ca..fb75e67791 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -163,7 +163,7 @@ #define CONFIG_BD9995X_DELAY_INPUT_PORT_SELECT #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/eve/led.c b/board/eve/led.c index a98a6d53e0..e851092672 100644 --- a/board/eve/led.c +++ b/board/eve/led.c @@ -439,7 +439,7 @@ static void eve_led_set_power_battery(void) /* Get active charge port which maps directly to left/right LED */ side = charge_manager_get_active_charge_port(); /* Ensure that side can be safely used as an index */ - if (side < 0 || side >= CONFIG_USB_PD_PORT_COUNT) + if (side < 0 || side >= CONFIG_USB_PD_PORT_MAX_COUNT) side = LED_BOTH; /* Get percent charge */ diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c index eda49eb08d..02e3bab978 100644 --- a/board/eve/usb_pd_policy.c +++ b/board/eve/usb_pd_policy.c @@ -56,8 +56,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -302,8 +303,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/fizz/board.c b/board/fizz/board.c index 6d3d3378d2..027bfdbb1a 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -174,7 +174,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -192,7 +192,7 @@ static int ps8751_tune_mux(int port) return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -238,7 +238,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); } diff --git a/board/fizz/board.h b/board/fizz/board.h index cabce30b3e..5471e77f1d 100644 --- a/board/fizz/board.h +++ b/board/fizz/board.h @@ -99,7 +99,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c index bac29cfa52..fe4a4c4192 100644 --- a/board/fizz/usb_pd_policy.c +++ b/board/fizz/usb_pd_policy.c @@ -266,8 +266,8 @@ int board_get_battery_soc(void) } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/flapjack/board.c b/board/flapjack/board.c index e84a5b947a..84d8e5016b 100644 --- a/board/flapjack/board.c +++ b/board/flapjack/board.c @@ -283,7 +283,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -293,7 +293,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { .drv = &mt6370_tcpm_drv}, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, diff --git a/board/flapjack/board.h b/board/flapjack/board.h index 9d75d49012..af3f05ce9b 100644 --- a/board/flapjack/board.h +++ b/board/flapjack/board.h @@ -141,7 +141,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MT6370 #define CONFIG_USB_PD_TCPM_TCPCI diff --git a/board/flapjack/usb_pd_policy.c b/board/flapjack/usb_pd_policy.c index d4a5c0aa5c..b2c992b4e2 100644 --- a/board/flapjack/usb_pd_policy.c +++ b/board/flapjack/usb_pd_policy.c @@ -219,9 +219,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -280,7 +280,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_dp_post_config(int port) { diff --git a/board/fleex/board.c b/board/fleex/board.c index 57f13b5e49..7ee6495b86 100644 --- a/board/fleex/board.c +++ b/board/fleex/board.c @@ -258,7 +258,7 @@ void lid_angle_peripheral_enable(int enable) void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/garg/board.c b/board/garg/board.c index db37841560..8da97ef1c8 100644 --- a/board/garg/board.c +++ b/board/garg/board.c @@ -295,7 +295,7 @@ void lid_angle_peripheral_enable(int enable) void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/glados/board.c b/board/glados/board.c index 5dabd57c7e..7a5a6247d2 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -118,7 +118,7 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -164,7 +164,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = { BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x54, .driver = &pi3usb30532_usb_mux_driver, @@ -275,7 +275,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a realy physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source vbus on that port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/glados/board.h b/board/glados/board.h index 040e01cc26..9e783d3c09 100644 --- a/board/glados/board.h +++ b/board/glados/board.h @@ -73,7 +73,7 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c index 10fefd8c11..1870791358 100644 --- a/board/glados/usb_pd_policy.c +++ b/board/glados/usb_pd_policy.c @@ -209,9 +209,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -273,7 +273,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; #define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) static void svdm_dp_post_config(int port) diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h index e2c26e1afe..287cb32b09 100644 --- a/board/glados_pd/board.h +++ b/board/glados_pd/board.h @@ -61,7 +61,7 @@ #define CONFIG_UART_TX_BUF_SIZE 128 #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_INTERNAL_COMP -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPC_TRACK_VBUS #define CONFIG_USBC_VCONN diff --git a/board/glkrvp/board.h b/board/glkrvp/board.h index 7ef92652f6..fd8963d8be 100644 --- a/board/glkrvp/board.h +++ b/board/glkrvp/board.h @@ -63,7 +63,7 @@ /* USB PD config */ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_TCPC diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c index 2536c051c3..f143dcece5 100644 --- a/board/glkrvp/chg_usb_pd.c +++ b/board/glkrvp/chg_usb_pd.c @@ -30,7 +30,7 @@ enum glkrvp_charge_ports { DC_JACK_PORT_0 = DEDICATED_CHARGE_PORT, }; -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -48,9 +48,9 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { .drv = &tcpci_tcpm_drv, }, }; -BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT); +BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x10, .driver = &ps874x_usb_mux_driver, @@ -200,7 +200,7 @@ DECLARE_HOOK(HOOK_INIT, board_charge_init, HOOK_PRIO_DEFAULT); int board_set_active_charge_port(int port) { /* if it's a PD port and sourcing VBUS, don't enable */ - if (port >= 0 && port < CONFIG_USB_PD_PORT_COUNT) + if (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT) if (board_charger_port_is_sourcing_vbus(port)) { CPRINTS("Skip enable p%d", port); return EC_ERROR_INVAL; diff --git a/board/glkrvp/usb_pd_policy.c b/board/glkrvp/usb_pd_policy.c index 57b114fe5d..72c54d3ec3 100644 --- a/board/glkrvp/usb_pd_policy.c +++ b/board/glkrvp/usb_pd_policy.c @@ -202,8 +202,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/glkrvp_ite/board.h b/board/glkrvp_ite/board.h index d76e582262..f761625136 100644 --- a/board/glkrvp_ite/board.h +++ b/board/glkrvp_ite/board.h @@ -63,7 +63,7 @@ /* USB PD config */ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_TCPC diff --git a/board/glkrvp_ite/chg_usb_pd.c b/board/glkrvp_ite/chg_usb_pd.c index 45621c3202..0dbf286b7e 100644 --- a/board/glkrvp_ite/chg_usb_pd.c +++ b/board/glkrvp_ite/chg_usb_pd.c @@ -30,7 +30,7 @@ enum glkrvp_charge_ports { DC_JACK_PORT_0 = DEDICATED_CHARGE_PORT, }; -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -48,9 +48,9 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { .drv = &tcpci_tcpm_drv, }, }; -BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT); +BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x10, .driver = &ps874x_usb_mux_driver, diff --git a/board/glkrvp_ite/usb_pd_policy.c b/board/glkrvp_ite/usb_pd_policy.c index bd11eb4d8f..e269d217f5 100644 --- a/board/glkrvp_ite/usb_pd_policy.c +++ b/board/glkrvp_ite/usb_pd_policy.c @@ -202,8 +202,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/hatch/board.c b/board/hatch/board.c index 1fede75512..679686fafb 100644 --- a/board/hatch/board.c +++ b/board/hatch/board.c @@ -125,7 +125,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -145,7 +145,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, @@ -485,7 +485,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/helios/board.c b/board/helios/board.c index 4ad7596a2e..9dd31ef613 100644 --- a/board/helios/board.c +++ b/board/helios/board.c @@ -148,7 +148,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -167,7 +167,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -389,7 +389,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/hoho/board.h b/board/hoho/board.h index 39027f7757..f052ad5de4 100644 --- a/board/hoho/board.h +++ b/board/hoho/board.h @@ -44,7 +44,7 @@ #define CONFIG_USB_PD_LOGGING #undef CONFIG_EVENT_LOG_SIZE #define CONFIG_EVENT_LOG_SIZE 256 -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #define CONFIG_USB_PD_VBUS_DETECT_NONE diff --git a/board/it83xx_evb/board.c b/board/it83xx_evb/board.c index 1ac7637ae5..b433856d36 100644 --- a/board/it83xx_evb/board.c +++ b/board/it83xx_evb/board.c @@ -38,7 +38,7 @@ int board_get_battery_soc(void) return 100; } -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { {-1, -1, &it83xx_tcpm_drv}, {-1, -1, &it83xx_tcpm_drv}, }; diff --git a/board/it83xx_evb/board.h b/board/it83xx_evb/board.h index 34cae4c144..8620ba19c6 100644 --- a/board/it83xx_evb/board.h +++ b/board/it83xx_evb/board.h @@ -40,7 +40,7 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_CHECK_MAX_REQUEST_ALLOWED #define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_ITE83XX #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/it83xx_evb/usb_pd_policy.c b/board/it83xx_evb/usb_pd_policy.c index 81e243dc61..03d83f02f3 100644 --- a/board/it83xx_evb/usb_pd_policy.c +++ b/board/it83xx_evb/usb_pd_policy.c @@ -195,9 +195,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c index ec1ca3160e..f8274dd6a5 100644 --- a/board/jacuzzi/board.c +++ b/board/jacuzzi/board.c @@ -94,7 +94,7 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { }; /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -114,7 +114,7 @@ static void board_hpd_status(int port, int hpd_lvl, int hpd_irq) host_set_single_event(EC_HOST_EVENT_USB_MUX); } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { /* Driver uses I2C_PORT_USB_MUX as I2C port */ .port_addr = IT5205_I2C_ADDR1_FLAGS, diff --git a/board/kindred/board.c b/board/kindred/board.c index 80619d24d9..c70ac61cda 100644 --- a/board/kindred/board.c +++ b/board/kindred/board.c @@ -126,7 +126,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -147,7 +147,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, @@ -438,7 +438,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/kodama/board.c b/board/kodama/board.c index 0e1d4bf0c0..905930963a 100644 --- a/board/kodama/board.c +++ b/board/kodama/board.c @@ -80,7 +80,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -100,7 +100,7 @@ static void board_hpd_status(int port, int hpd_lvl, int hpd_irq) host_set_single_event(EC_HOST_EVENT_USB_MUX); } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = IT5205_I2C_ADDR1_FLAGS, .driver = &it5205_usb_mux_driver, diff --git a/board/kohaku/board.c b/board/kohaku/board.c index a569ff131d..636bbf6c9f 100644 --- a/board/kohaku/board.c +++ b/board/kohaku/board.c @@ -112,7 +112,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -131,7 +131,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -143,7 +143,7 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { }; /* BC 1.2 chip Configuration */ -const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON, .chg_det_pin = GPIO_USB_C0_BC12_CHG_DET_L, @@ -473,7 +473,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/kukui/board.c b/board/kukui/board.c index b2a5f6dd59..bd7a2f9284 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -91,7 +91,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -135,7 +135,7 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void) return &battery_init_setting; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = IT5205_I2C_ADDR1_FLAGS, .driver = &it5205_usb_mux_driver, diff --git a/board/liara/battery.c b/board/liara/battery.c index b88b446473..ecb1202aa1 100644 --- a/board/liara/battery.c +++ b/board/liara/battery.c @@ -179,7 +179,7 @@ static void reduce_input_voltage_when_full(void) max_pd_voltage_mv = PD_MAX_VOLTAGE_MV; if (pd_get_max_voltage() != max_pd_voltage_mv) { - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) pd_set_external_voltage_limit(port, max_pd_voltage_mv); } } diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c index 33cb8a48ae..8ce5ea658d 100644 --- a/board/mchpevb1/board.c +++ b/board/mchpevb1/board.c @@ -263,7 +263,7 @@ int board_i2c_p2c(int port) } #ifdef CONFIG_USB_POWER_DELIVERY -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR_FLAGS, &tcpci_tcpm_drv}, @@ -387,7 +387,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = { BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x54, .driver = &pi3usb30532_usb_mux_driver, @@ -593,7 +593,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a realy physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source vbus on that port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); @@ -748,20 +748,20 @@ void board_hibernate_late(void) */ gpio_set_level(GPIO_USB_PD_WAKE, 0); -#ifdef CONFIG_USB_PD_PORT_COUNT +#ifdef CONFIG_USB_PD_PORT_MAX_COUNT /* * Leave USB-C charging enabled in hibernate, in order to * allow wake-on-plug. 5V enable must be pulled low. */ -#if CONFIG_USB_PD_PORT_COUNT > 0 +#if CONFIG_USB_PD_PORT_MAX_COUNT > 0 gpio_set_flags(GPIO_USB_C0_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT); gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0); #endif -#if CONFIG_USB_PD_PORT_COUNT > 1 +#if CONFIG_USB_PD_PORT_MAX_COUNT > 1 gpio_set_flags(GPIO_USB_C1_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT); gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0); #endif -#endif /* CONFIG_USB_PD_PORT_COUNT */ +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */ } /* Any glados boards post version 2 should have ROP_LDO_EN stuffed. */ diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h index a2fdeca7f7..33aa2719b9 100644 --- a/board/mchpevb1/board.h +++ b/board/mchpevb1/board.h @@ -235,7 +235,7 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #endif /* diff --git a/board/mchpevb1/usb_pd_policy.c b/board/mchpevb1/usb_pd_policy.c index d5eff63316..f763c3aa0e 100644 --- a/board/mchpevb1/usb_pd_policy.c +++ b/board/mchpevb1/usb_pd_policy.c @@ -212,9 +212,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -277,7 +277,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; #define PORT_TO_HPD(port) \ ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) diff --git a/board/meep/board.c b/board/meep/board.c index c62065e58b..200909dca0 100644 --- a/board/meep/board.c +++ b/board/meep/board.c @@ -303,7 +303,7 @@ const int keyboard_factory_scan_pins_used = void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/nami/board.c b/board/nami/board.c index 104f892566..24e9311acb 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -228,7 +228,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_PS8751] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -258,7 +258,7 @@ static int ps8751_tune_mux(int port) return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_PS8751] = { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -320,7 +320,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); } @@ -640,7 +640,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are sourcing VBUS on the port */ /* dnojiri: revisit */ int is_source = gpio_get_level(charge_port == 0 ? diff --git a/board/nami/board.h b/board/nami/board.h index 084e12c70d..4a99aed383 100644 --- a/board/nami/board.h +++ b/board/nami/board.h @@ -170,7 +170,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/board/nami/usb_pd_policy.c b/board/nami/usb_pd_policy.c index b32dd3e31d..2aa2f66ae3 100644 --- a/board/nami/usb_pd_policy.c +++ b/board/nami/usb_pd_policy.c @@ -55,8 +55,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -271,8 +272,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/nautilus/board.c b/board/nautilus/board.c index 48b316cd45..c305d67250 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -146,7 +146,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -165,7 +165,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -220,7 +220,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); @@ -464,7 +464,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/nautilus/board.h b/board/nautilus/board.h index 55105d461b..58ddc2d8ac 100644 --- a/board/nautilus/board.h +++ b/board/nautilus/board.h @@ -145,7 +145,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/nautilus/usb_pd_policy.c b/board/nautilus/usb_pd_policy.c index 85cc85dd78..2c162a47c1 100644 --- a/board/nautilus/usb_pd_policy.c +++ b/board/nautilus/usb_pd_policy.c @@ -54,8 +54,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -300,8 +301,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/nocturne/board.c b/board/nocturne/board.c index 4750b3c433..f97fc83945 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -298,7 +298,7 @@ struct ppc_config_t ppc_chips[] = { }; unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -317,7 +317,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -573,7 +573,7 @@ void board_overcurrent_event(int port, int is_overcurrented) int lvl; /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the levels are inverted because the pin is active low. */ @@ -688,7 +688,7 @@ void board_set_tcpc_power_mode(int port, int mode) int board_set_active_charge_port(int port) { int is_real_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_COUNT); + port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; int rv; int old_port; diff --git a/board/nocturne/board.h b/board/nocturne/board.h index b836fbdf99..2334488fcf 100644 --- a/board/nocturne/board.h +++ b/board/nocturne/board.h @@ -131,7 +131,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_PS8805 #define CONFIG_USB_PD_TCPM_TCPCI diff --git a/board/nocturne/usb_pd_policy.c b/board/nocturne/usb_pd_policy.c index 26cd49f09c..4e4474648f 100644 --- a/board/nocturne/usb_pd_policy.c +++ b/board/nocturne/usb_pd_policy.c @@ -252,8 +252,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { @@ -360,7 +360,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; #define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) diff --git a/board/oak/board.c b/board/oak/board.c index 2cc9b23457..3cd77454f1 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -112,7 +112,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); #endif -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -174,7 +174,7 @@ struct als_t als[] = { BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT); #endif -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x54, .driver = &pi3usb30532_usb_mux_driver, @@ -290,7 +290,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); @@ -338,7 +338,7 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; static void board_typec_set_dp_hpd(int port, int level) { @@ -479,11 +479,11 @@ void vbus_task(void) uint8_t device_type; uint8_t charger_status; uint8_t vbus; - } bc12[CONFIG_USB_PD_PORT_COUNT]; + } bc12[CONFIG_USB_PD_PORT_MAX_COUNT]; uint8_t port, vbus, reg, wake; while (1) { - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { #if BOARD_REV == OAK_REV3 vbus = !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : GPIO_USB_C0_VBUS_WAKE_L); diff --git a/board/oak/board.h b/board/oak/board.h index b2e07c8107..afd063a4f9 100644 --- a/board/oak/board.h +++ b/board/oak/board.h @@ -95,7 +95,7 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_TCPC diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c index 2268945144..be6868f268 100644 --- a/board/oak/usb_pd_policy.c +++ b/board/oak/usb_pd_policy.c @@ -207,9 +207,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/pdeval-stm32f072/PD_evaluation.md b/board/pdeval-stm32f072/PD_evaluation.md index 395466f477..95e31996fc 100644 --- a/board/pdeval-stm32f072/PD_evaluation.md +++ b/board/pdeval-stm32f072/PD_evaluation.md @@ -35,7 +35,7 @@ then document the new `CONFIG_USB_PD_TCPM_` variable in the [include/config.h](. ### Board configuration -In [board/pdeval-stm32f072/board.h](board.h), you can update `CONFIG_USB_PD_PORT_COUNT` to the actual number of ports on your board. +In [board/pdeval-stm32f072/board.h](board.h), you can update `CONFIG_USB_PD_PORT_MAX_COUNT` to the actual number of ports on your board. You also need to create/delete the corresponding `PD_Cx` tasks in [board/pdeval-stm32f072/ec.tasklist](ec.tasklist). By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running with a 100kHz clock, and tries to talk to TCPCs at i2c slave addresses 0x9c and 0x9e. diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c index d9462f4e1d..93f3f87082 100644 --- a/board/pdeval-stm32f072/board.c +++ b/board/pdeval-stm32f072/board.c @@ -57,7 +57,7 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h index 7d25def826..b008edc860 100644 --- a/board/pdeval-stm32f072/board.h +++ b/board/pdeval-stm32f072/board.h @@ -25,7 +25,7 @@ #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_VBUS_DETECT_TCPC #define CONFIG_USB_PD_TCPM_ANX7447 diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c index 283483d566..5821437f20 100644 --- a/board/pdeval-stm32f072/usb_pd_policy.c +++ b/board/pdeval-stm32f072/usb_pd_policy.c @@ -36,7 +36,7 @@ const uint32_t pd_snk_pdo[] = { const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); #if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447) -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &anx7447_usb_mux_driver, }, @@ -253,8 +253,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/phaser/board.c b/board/phaser/board.c index fb0878122a..009bbfb25a 100644 --- a/board/phaser/board.c +++ b/board/phaser/board.c @@ -294,7 +294,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/plankton/board.h b/board/plankton/board.h index f78a2825ec..92201ca68b 100644 --- a/board/plankton/board.h +++ b/board/plankton/board.h @@ -25,7 +25,7 @@ #define CONFIG_USB_PD_IDENTITY_HW_VERS 1 #define CONFIG_USB_PD_IDENTITY_SW_VERS 1 #define CONFIG_USB_PD_INTERNAL_COMP -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/poppy/board.c b/board/poppy/board.c index b4eae018f3..f99b06fbf9 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -188,7 +188,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -207,7 +207,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, @@ -306,7 +306,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); @@ -599,7 +599,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/poppy/board.h b/board/poppy/board.h index 0896685d96..8c9d687665 100644 --- a/board/poppy/board.h +++ b/board/poppy/board.h @@ -155,7 +155,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/poppy/usb_pd_policy.c b/board/poppy/usb_pd_policy.c index 678f547231..e6dbee1729 100644 --- a/board/poppy/usb_pd_policy.c +++ b/board/poppy/usb_pd_policy.c @@ -55,8 +55,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -301,8 +302,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/puff/board.c b/board/puff/board.c index de837d4db7..0797c24a93 100644 --- a/board/puff/board.c +++ b/board/puff/board.c @@ -56,9 +56,9 @@ const struct pwm_t pwm_channels[] = { /******************************************************************************/ /* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { }; /******************************************************************************/ @@ -132,7 +132,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /******************************************************************************/ /* USB-C PPC Configuration */ -struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = { +struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = { }; unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); diff --git a/board/puff/board.h b/board/puff/board.h index 1122b27bfa..7a6ea0848e 100644 --- a/board/puff/board.h +++ b/board/puff/board.h @@ -130,7 +130,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_VBUS_DETECT_PPC #define CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/board/puff/usb_pd_policy.c b/board/puff/usb_pd_policy.c index 49de8abbea..bcca6774da 100644 --- a/board/puff/usb_pd_policy.c +++ b/board/puff/usb_pd_policy.c @@ -212,8 +212,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/rainier/board.c b/board/rainier/board.c index 39da51f73d..4caefa94fb 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -126,7 +126,7 @@ const enum gpio_signal hibernate_wake_pins[] = { const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -137,7 +137,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, diff --git a/board/rainier/board.h b/board/rainier/board.h index fe633e12b3..da673c22ec 100644 --- a/board/rainier/board.h +++ b/board/rainier/board.h @@ -94,7 +94,7 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DISCHARGE_GPIO #define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPM_FUSB302 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_VBUS_DETECT_TCPC diff --git a/board/rainier/usb_pd_policy.c b/board/rainier/usb_pd_policy.c index 3b5ceb2152..e6c092ded9 100644 --- a/board/rainier/usb_pd_policy.c +++ b/board/rainier/usb_pd_policy.c @@ -215,9 +215,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/rammus/board.c b/board/rammus/board.c index 660ca860bc..a854416dda 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -146,7 +146,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_PS8751] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -166,7 +166,7 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_PS8751] = { .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -247,7 +247,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); } @@ -490,7 +490,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN); diff --git a/board/rammus/board.h b/board/rammus/board.h index caccc9cbe9..ed2489a84f 100644 --- a/board/rammus/board.h +++ b/board/rammus/board.h @@ -147,7 +147,7 @@ #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_TCPC_LOW_POWER /* TODO(b:121222079): Remove the config before FSI */ diff --git a/board/rammus/usb_pd_policy.c b/board/rammus/usb_pd_policy.c index 433d8d59c1..b46618feb6 100644 --- a/board/rammus/usb_pd_policy.c +++ b/board/rammus/usb_pd_policy.c @@ -54,8 +54,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -271,8 +272,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/reef/board.c b/board/reef/board.c index 8a73f6c3c7..8754d17bd0 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -226,7 +226,7 @@ struct i2c_stress_test i2c_stress_tests[] = { const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); #endif /* CONFIG_CMD_I2C_STRESS_TEST */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -277,7 +277,7 @@ static int ps8751_tune_mux(int port) return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, @@ -383,7 +383,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); diff --git a/board/reef/board.h b/board/reef/board.h index a4d6e22593..4d6a65ffcc 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -83,7 +83,7 @@ #define CONFIG_USB_PD_DISCHARGE_TCPC #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */ diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c index d2ceecf074..9765b540d1 100644 --- a/board/reef/usb_pd_policy.c +++ b/board/reef/usb_pd_policy.c @@ -56,8 +56,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -270,8 +271,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c index 010bfd48b5..e268de83ed 100644 --- a/board/reef_it8320/board.c +++ b/board/reef_it8320/board.c @@ -73,7 +73,7 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_EMBEDDED, .drv = &it83xx_tcpm_drv @@ -160,7 +160,7 @@ static void it83xx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq) } } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x54, .driver = &pi3usb30532_usb_mux_driver, @@ -247,7 +247,7 @@ static void board_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) usb_muxes[port].hpd_update(port, 0, 0); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_INIT_I2C + 1); diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h index 16038bddfa..1273e93a75 100644 --- a/board/reef_it8320/board.h +++ b/board/reef_it8320/board.h @@ -72,7 +72,7 @@ #define CONFIG_USB_PD_DISCHARGE_GPIO #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPM_ITE83XX #define CONFIG_USB_PD_TCPM_TCPCI diff --git a/board/reef_it8320/usb_pd_policy.c b/board/reef_it8320/usb_pd_policy.c index 8dbbc04102..03c7569682 100644 --- a/board/reef_it8320/usb_pd_policy.c +++ b/board/reef_it8320/usb_pd_policy.c @@ -56,8 +56,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -263,8 +264,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index 3b90eb4934..769f96197b 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -337,7 +337,7 @@ struct i2c_stress_test i2c_stress_tests[] = { const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); #endif /* CONFIG_CMD_I2C_STRESS_TEST */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -414,7 +414,7 @@ static int ps8751_tune_mux(int port) * tcpc_config array. The tcpc_config array contains the actual EC I2C * port, device slave address, and a function pointer into the driver code. */ -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ANX74XX] = { .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, @@ -529,7 +529,7 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { const struct usb_mux *mux = &usb_muxes[port]; mux->hpd_update(port, 0, 0); diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h index a427abad0d..acaf8d19be 100644 --- a/board/reef_mchp/board.h +++ b/board/reef_mchp/board.h @@ -83,7 +83,7 @@ #define CONFIG_USB_PD_DISCHARGE_TCPC #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */ diff --git a/board/reef_mchp/usb_pd_policy.c b/board/reef_mchp/usb_pd_policy.c index 230a8efee0..1d4212fdcb 100644 --- a/board/reef_mchp/usb_pd_policy.c +++ b/board/reef_mchp/usb_pd_policy.c @@ -58,8 +58,9 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, + TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -278,8 +279,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c index c942418ee6..69a67f6e44 100644 --- a/board/samus_pd/board.c +++ b/board/samus_pd/board.c @@ -318,7 +318,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a realy physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source vbus on that port */ if (is_real_port && usb_charger_port_is_sourcing_vbus(charge_port)) { CPRINTS("Skip enable p%d", charge_port); diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index a6e6d3ecec..9fc09340c1 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -63,7 +63,7 @@ #define CONFIG_USB_PD_FLASH_ERASE_CHECK #define CONFIG_USB_PD_INTERNAL_COMP #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/samus_pd/usb_mux.c b/board/samus_pd/usb_mux.c index 268c0c5843..2c3a0b3a45 100644 --- a/board/samus_pd/usb_mux.c +++ b/board/samus_pd/usb_mux.c @@ -37,7 +37,7 @@ static const struct usb_port_mux mux_gpios[] = { .ss2_dp_mode = GPIO_USB_C1_SS2_DP_MODE, }, }; -BUILD_ASSERT(ARRAY_SIZE(mux_gpios) == CONFIG_USB_PD_PORT_COUNT); +BUILD_ASSERT(ARRAY_SIZE(mux_gpios) == CONFIG_USB_PD_PORT_MAX_COUNT); static int board_init_usb_mux(int port) @@ -105,7 +105,7 @@ const struct usb_mux_driver board_custom_usb_mux_driver = { .get = board_get_usb_mux, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &board_custom_usb_mux_driver, }, diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index 595c3b6929..40277da8f8 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -214,9 +214,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, return 0; } -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 1ba595479b..4321d53179 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -122,7 +122,7 @@ const struct spi_device_t spi_devices[] = { const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -133,7 +133,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, diff --git a/board/scarlet/board.h b/board/scarlet/board.h index 2569f41e14..adcca92cdb 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -113,7 +113,7 @@ #define CONFIG_USB_PD_DISCHARGE_GPIO #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPM_FUSB302 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_VBUS_DETECT_TCPC diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c index 75ddb97d8c..69064fdcf6 100644 --- a/board/scarlet/usb_pd_policy.c +++ b/board/scarlet/usb_pd_policy.c @@ -216,9 +216,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; +static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* DP Status VDM as returned by UFP */ -static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_safe_dp_mode(int port) { diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h index be906787ad..ace902a4c3 100644 --- a/board/servo_v4/board.h +++ b/board/servo_v4/board.h @@ -106,7 +106,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DYNAMIC_SRC_CAP #define CONFIG_USB_PD_INTERNAL_COMP -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #undef CONFIG_USB_PD_PULLUP diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c index 138f53a4a7..5c8019dc08 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -108,7 +108,7 @@ struct vbus_prop { int mv; int ma; }; -static struct vbus_prop vbus[CONFIG_USB_PD_PORT_COUNT]; +static struct vbus_prop vbus[CONFIG_USB_PD_PORT_MAX_COUNT]; static int active_charge_port = CHARGE_PORT_NONE; static enum charge_supplier active_charge_supplier; static uint8_t vbus_rp = TYPEC_RP_RESERVED; diff --git a/board/strago/board.c b/board/strago/board.c index f63d95da27..03c4c814be 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -105,7 +105,7 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -139,7 +139,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = { BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT); -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { +struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { .port_addr = 0x55, .driver = &pi3usb30532_usb_mux_driver, @@ -285,7 +285,7 @@ int board_set_active_charge_port(int charge_port) { /* charge port is a realy physical port */ int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_COUNT); + charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); /* check if we are source vbus on that port */ int source = gpio_get_level(GPIO_USB_C0_5V_EN); diff --git a/board/strago/board.h b/board/strago/board.h index db6adcea63..1b44868e0a 100644 --- a/board/strago/board.h +++ b/board/strago/board.h @@ -40,7 +40,7 @@ #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c index 748e08a40e..0a12fec103 100644 --- a/board/strago/usb_pd_policy.c +++ b/board/strago/usb_pd_policy.c @@ -245,7 +245,7 @@ static int svdm_dp_config(int port, uint32_t *payload) * timestamp of the next possible toggle to ensure the 2-ms spacing * between IRQ_HPD. */ -static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT]; +static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; static void svdm_dp_post_config(int port) { diff --git a/board/tglrvpu_ite/board.c b/board/tglrvpu_ite/board.c index c98e5035e7..93a7d18984 100644 --- a/board/tglrvpu_ite/board.c +++ b/board/tglrvpu_ite/board.c @@ -71,7 +71,7 @@ const struct tcpc_gpio_config_t tcpc_gpios[] = { }, }, }; -BUILD_ASSERT(ARRAY_SIZE(tcpc_gpios) == CONFIG_USB_PD_PORT_COUNT); +BUILD_ASSERT(ARRAY_SIZE(tcpc_gpios) == CONFIG_USB_PD_PORT_MAX_COUNT); /* I2C ports */ const struct i2c_port_t i2c_ports[] = { diff --git a/board/tglrvpu_ite/board.h b/board/tglrvpu_ite/board.h index 9a050d2d5c..df6b892c5d 100644 --- a/board/tglrvpu_ite/board.h +++ b/board/tglrvpu_ite/board.h @@ -35,7 +35,7 @@ #define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1 /* USB ports */ -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define DEDICATED_CHARGE_PORT 2 /* USB-C port's USB2 & USB3 port numbers */ diff --git a/board/twinkie/board.h b/board/twinkie/board.h index 60f359e282..42944f37f1 100644 --- a/board/twinkie/board.h +++ b/board/twinkie/board.h @@ -23,7 +23,7 @@ #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_INTERNAL_COMP -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #define CONFIG_USB_PD_VBUS_DETECT_GPIO diff --git a/board/yorp/board.c b/board/yorp/board.c index cc44a6c088..89dee7fb41 100644 --- a/board/yorp/board.c +++ b/board/yorp/board.c @@ -249,7 +249,7 @@ DECLARE_HOOK(HOOK_INIT, post_old_board_warning, HOOK_PRIO_INIT_I2C + 1); void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; /* Note that the level is inverted because the pin is active low. */ diff --git a/board/zinger/board.h b/board/zinger/board.h index cc34b2f8b7..83ec02221c 100644 --- a/board/zinger/board.h +++ b/board/zinger/board.h @@ -60,7 +60,7 @@ #undef CONFIG_EVENT_LOG_SIZE #define CONFIG_EVENT_LOG_SIZE 256 #define CONFIG_USB_PD_LOW_POWER_IDLE_WHEN_CONNECTED -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 #define CONFIG_USB_PD_TCPC #define CONFIG_USB_PD_TCPM_STUB #undef CONFIG_USB_PD_RX_COMP_IRQ -- cgit v1.2.1