diff options
author | Kapil Porwal <kapilporwal@google.com> | 2023-07-10 11:40:16 +0000 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-07-15 12:48:01 +0000 |
commit | 400f1aade873028cc8a12121abc27e34a8c283f5 (patch) | |
tree | 06c733c85675f48887000662377a90f118ee784d /src/soc/intel/common/block | |
parent | 2ba4b1bebea4321cc4998ac5bf51a9e97795157e (diff) |
soc/intel/common: Add support for AP initiated mode entry
Add support for AP initiated mode entry. The code flow has been
optimized as below -
Code flow when AP initiated mode entry is disabled:
+-------+
| Start |
+---+---+
|
|
+---------+---------+
|wait_for_connection|
| Is DP ALT mode |
| available? |
+---------+---------+
|
+--------------->-------+
Yes| No |
+---------+---------+ |
|Skip enter_dp_mode | |
+---------+---------+ |
| |
| |
+-----------+----------+ |
|wait_for_dp_mode_entry| |
| Is DP flag set? | |
+-----------+----------+ |
| |
+--------------->--------
Yes| No |
+-----------+----------+ |
| wait_for_hpd | |
| Is HPD_LVL flag set? | |
+-----------+----------+ |
| |
+--------------->--------
Yes| No |
+-----------+----------+ |
| Rest of the code | |
+-----------+----------+ |
| |
+---------------<-------+
|
+---+---+
| End |
+-------+
Code flow when AP initiated mode entry is enabled:
+-------+
| Start |
+---+---+
|
+------------+-----------+
|Skip wait_for_connection|
+------------+-----------+
|
+--------+-------+
| enter_dp_mode |
| Is USB device? |
+--------+-------+
|
+--------------->-------+
Yes| No |
+---------+---------+ |
| enter_dp_mode | |
| Send DP mode | |
| entry command | |
+---------+---------+ |
| |
+-----------+----------+ |
|wait_for_dp_mode_entry| |
| Is DP flag set? | |
| (If not, loop wait | |
| until timed out) | |
+-----------+----------+ |
| |
+--------------->--------
Yes| No |
+-----------+----------+ |
| wait_for_hpd | |
| Is HPD_LVL flag set? | |
| (If not, loop wait | |
| until timed out) | |
+-----------+----------+ |
| |
+--------------->--------
Yes| No |
+-----------+----------+ |
| Rest of the code | |
+-----------+----------+ |
| |
+---------------<-------+
|
+---+---+
| End |
+-------+
BUG=b:247670186
TEST=Verify display over TCSS and its impact on boot time for
google/rex
Time taken by enter_dp_mode / wait_for_dp+hpd / MultiPhaseSiInit
functions with this patch train:
1. When AP Mode entry is enabled
- With type-c display on C1 and SuzyQ on C0: 6.9ms / 420ms / 616ms
- With USB key on C1 and SuzyQ on C0 : 6.0ms / 505ms / 666ms
- Without any device on C1 and SuzyQ on C0 : 3.7ms / 0ms / 178ms
2. When AP Mode entry is disabled
- With type-c display on C1 and SuzyQ on C0: 1.7ms / 2.5ms / 213ms
- With USB key on C1 and SuzyQ on C0 : 0.9ms / 3.3ms / 177ms
- Without any device on C1 and SuzyQ on C0 : 0.8ms / 1.8ms / 165ms
Without this patch train, wait_for_hpd would cause a constant delay of
WAIT_FOR_HPD_TIMEOUT_MS (i.e. 3 seconds) per type-c port when there is
no device connected.
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Change-Id: I514ccbdbaf905c49585dc00746d047554d7c7a58
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76366
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Diffstat (limited to 'src/soc/intel/common/block')
-rw-r--r-- | src/soc/intel/common/block/tcss/tcss.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/soc/intel/common/block/tcss/tcss.c b/src/soc/intel/common/block/tcss/tcss.c index 85687df059..a0ecb5f00e 100644 --- a/src/soc/intel/common/block/tcss/tcss.c +++ b/src/soc/intel/common/block/tcss/tcss.c @@ -20,6 +20,9 @@ #define BIAS_CTRL_VW_INDEX_SHIFT 16 #define BIAS_CTRL_BIT_POS_SHIFT 8 +#define WAIT_FOR_DISPLAYPORT_TIMEOUT_MS 1000 +#define WAIT_FOR_DP_MODE_ENTRY_TIMEOUT_MS 500 +#define WAIT_FOR_HPD_TIMEOUT_MS 3000 static uint32_t tcss_make_conn_cmd(int u, int u3, int u2, int ufp, int hsl, int sbu, int acc) @@ -277,7 +280,7 @@ static void tcss_init_mux(int port, const struct tcss_port_map *port_map) static void tcss_configure_dp_mode(const struct tcss_port_map *port_map, size_t num_ports) { - int ret; + int ret, port_bitmask; size_t i; const struct usbc_ops *ops; struct usbc_mux_info mux_info; @@ -290,9 +293,28 @@ static void tcss_configure_dp_mode(const struct tcss_port_map *port_map, size_t if (ops == NULL) return; + port_bitmask = ops->dp_ops.wait_for_connection(WAIT_FOR_DISPLAYPORT_TIMEOUT_MS); + if (!port_bitmask) /* No DP device is connected */ + return; + for (i = 0; i < num_ports; i++) { + if (!(port_bitmask & BIT(i))) + continue; + + ret = ops->dp_ops.enter_dp_mode(i); + if (ret < 0) + continue; + + ret = ops->dp_ops.wait_for_dp_mode_entry(i, WAIT_FOR_DP_MODE_ENTRY_TIMEOUT_MS); + if (ret < 0) + continue; + + ret = ops->dp_ops.wait_for_hpd(i, WAIT_FOR_HPD_TIMEOUT_MS); + if (ret < 0) + continue; + ret = ops->mux_ops.get_mux_info(i, &mux_info); - if ((ret < 0) || (!mux_info.dp)) + if (ret < 0) continue; port_info = &port_map[i]; |