From 0f7e08622984f9c749b4d4327e22bdaa25cd0f0c Mon Sep 17 00:00:00 2001 From: Maulik V Vaghela Date: Tue, 29 Jun 2021 17:16:49 +0530 Subject: drivers/intel/usb4/retimer: Update code to assign correct port number Since TBT controller can have maximum 2 ports per controller, our code will loop over DFP structure twice and determine port number. Retimer driver used to assign port number as below: 1. Check if power GPIO is assigned for particular DFP entry or not 2. If entry is there, assign loop count as port number Since loop count is 2, retimer will never assign port number = 2 even if it's present. In case of more than 1 controller, port number assigned will still be 0 or 1 even though actual port index might be 2 or 3. This will create an issue where even if you do transaction on device on controller 2 (port index 2 or 3), EC will route it on port 0 or 1 due to incorrect port index. Update the driver flow as per below to handle this scenario: 1. Check if power GPIO is assigned for particular DFP entry or not 2. Get USB port number from config since it's stored in usb port information under devicetree 3. Pass the port number to ACPI SSDT and EC code Above changes will ensure that we're assigning correct port number as per calculation and EC will use correct port index. BUG=b:189476816 BRANCH=None TEST=Checked that retimer firmware update works on both ports and update happens on correct port index. Change-Id: Ib11637ae39046e0afdacd33bc34e8a59e6f2bfb1 Signed-off-by: Maulik V Vaghela Reviewed-on: https://review.coreboot.org/c/coreboot/+/55945 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/drivers/intel/usb4/retimer/chip.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/drivers/intel/usb4/retimer/chip.h') diff --git a/src/drivers/intel/usb4/retimer/chip.h b/src/drivers/intel/usb4/retimer/chip.h index 5b1c76f53c..46bd77ab94 100644 --- a/src/drivers/intel/usb4/retimer/chip.h +++ b/src/drivers/intel/usb4/retimer/chip.h @@ -16,6 +16,8 @@ struct drivers_intel_usb4_retimer_config { struct acpi_gpio power_gpio; /* _PLD setting */ struct acpi_pld_group group; + /* Type-C port associated with retimer */ + DEVTREE_CONST struct device *typec_port; } dfp[DFP_NUM_MAX]; }; -- cgit v1.2.3