diff options
-rw-r--r-- | baseboard/honeybuns/baseboard.h | 13 | ||||
-rw-r--r-- | baseboard/honeybuns/usb_pd_policy.c | 12 | ||||
-rw-r--r-- | board/baklava/board.c | 5 | ||||
-rw-r--r-- | board/gingerbread/board.c | 20 | ||||
-rw-r--r-- | board/quiche/board.c | 20 |
5 files changed, 59 insertions, 11 deletions
diff --git a/baseboard/honeybuns/baseboard.h b/baseboard/honeybuns/baseboard.h index 76bcaf490d..a8b8e9e902 100644 --- a/baseboard/honeybuns/baseboard.h +++ b/baseboard/honeybuns/baseboard.h @@ -219,6 +219,11 @@ struct power_seq { unsigned int delay_ms; /* delay (in msec) after setting gpio_signal */ }; +enum mf_preference { + MF_OFF = 0, + MF_ON, +}; + /* * This is required as adc_channel is included in adc.h which ends up being * included when TCPMv2 functions are included @@ -240,6 +245,14 @@ void baseboard_power_button_evt(int level); int baseboard_usbc_init(int port); /* + * Get a board's desired multi-function (MF) prefernce. This allows for board + * specific policy. + * + * @return 1 if multi function (DP + USB3) is preferred, 0 otherwise + */ +int dock_get_mf_preference(void); + +/* * Set MST_LANE_CONTROL gpio to match the DP pin configuration selected * by the host in the DP Configure SVDM message. * diff --git a/baseboard/honeybuns/usb_pd_policy.c b/baseboard/honeybuns/usb_pd_policy.c index 3a670b51ff..67ff188178 100644 --- a/baseboard/honeybuns/usb_pd_policy.c +++ b/baseboard/honeybuns/usb_pd_policy.c @@ -326,17 +326,7 @@ static int amode_dp_status(int port, uint32_t *payload) { int opos = PD_VDO_OPOS(payload[0]); int hpd = gpio_get_level(GPIO_DP_HPD); - uint32_t fw_config; - int mf = 0; - int rv; - - /* MF (multi function) preferece is indicated by bit 0 of the fw_config - * data field. If this data field does not exist, then default to 4 lane - * mode. - */ - rv = cbi_get_fw_config(&fw_config); - if (!rv) - mf = fw_config & 1; + int mf = dock_get_mf_preference(); if (opos != OPOS_DP) return 0; /* nak */ diff --git a/board/baklava/board.c b/board/baklava/board.c index dbabeefbc6..158fefc416 100644 --- a/board/baklava/board.c +++ b/board/baklava/board.c @@ -289,6 +289,11 @@ void board_overcurrent_event(int port, int is_overcurrented) { /* TODO(b/174825406): check correct operation for honeybuns */ } + +int dock_get_mf_preference(void) +{ + return MF_ON; +} #endif /* SECTION_IS_RW */ static void board_init(void) diff --git a/board/gingerbread/board.c b/board/gingerbread/board.c index a3cc78598f..4672ba0886 100644 --- a/board/gingerbread/board.c +++ b/board/gingerbread/board.c @@ -6,6 +6,7 @@ /* Gingerbread board-specific configuration */ #include "common.h" +#include "cros_board_info.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/stm32gx.h" @@ -290,6 +291,25 @@ void board_overcurrent_event(int port, int is_overcurrented) { /* TODO: b/ - check correct operation for honeybuns */ } + +int dock_get_mf_preference(void) +{ + int rv; + uint32_t fw_config; + int mf = MF_OFF; + + /* + * MF (multi function) preferece is indicated by bit 0 of the fw_config + * data field. If this data field does not exist, then default to 4 lane + * mode. + */ + rv = cbi_get_fw_config(&fw_config); + if (!rv) + mf = CBI_FW_MF_PREFERENCE(fw_config); + + return mf; +} + #endif /* SECTION_IS_RW */ static void board_init(void) diff --git a/board/quiche/board.c b/board/quiche/board.c index 782d5ef243..1a3e6f058b 100644 --- a/board/quiche/board.c +++ b/board/quiche/board.c @@ -6,6 +6,7 @@ /* Quiche board-specific configuration */ #include "common.h" +#include "cros_board_info.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/stm32gx.h" @@ -347,6 +348,25 @@ void board_overcurrent_event(int port, int is_overcurrented) { /* TODO(b/174825406): check correct operation for honeybuns */ } + +int dock_get_mf_preference(void) +{ + int rv; + uint32_t fw_config; + int mf = MF_OFF; + + /* + * MF (multi function) preferece is indicated by bit 0 of the fw_config + * data field. If this data field does not exist, then default to 4 lane + * mode. + */ + rv = cbi_get_fw_config(&fw_config); + if (!rv) + mf = CBI_FW_MF_PREFERENCE(fw_config); + + return mf; +} + #endif /* SECTION_IS_RW */ static void board_init(void) |