Brandon Breitenstein has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: WIP: drivers/intel/usb4/mux_retimer: Enable retimer FW upgrade mux interaction ......................................................................
WIP: drivers/intel/usb4/mux_retimer: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and in a specific mode. This DSM allows for the use of an EC RAM Byte to get the current state of each port and wether or not it has a retimer. It also allows Kernel to issue a state for the retimer to be put into for firmware updates.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- A src/drivers/intel/usb4/mux_retimer/Kconfig A src/drivers/intel/usb4/mux_retimer/Makefile.inc A src/drivers/intel/usb4/mux_retimer/mux_retimer.c M src/ec/google/chromeec/acpi/emem.asl M src/mainboard/google/volteer/Kconfig 5 files changed, 119 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/1
diff --git a/src/drivers/intel/usb4/mux_retimer/Kconfig b/src/drivers/intel/usb4/mux_retimer/Kconfig new file mode 100644 index 0000000..d5dc3f9 --- /dev/null +++ b/src/drivers/intel/usb4/mux_retimer/Kconfig @@ -0,0 +1,6 @@ +config DRIVERS_INTEL_USB4_MUX_RETIMER + bool + depends on HAVE_ACPI_TABLES + help + The mux retimer driver is required when synchronization is needed + between the EC and Kernel on the retimer upgrade path for BB retimer diff --git a/src/drivers/intel/usb4/mux_retimer/Makefile.inc b/src/drivers/intel/usb4/mux_retimer/Makefile.inc new file mode 100644 index 0000000..bca87fc --- /dev/null +++ b/src/drivers/intel/usb4/mux_retimer/Makefile.inc @@ -0,0 +1 @@ +ramstage-$(CONFIG_DRIVERS_INTEL_USB4_MUX_RETIMER) += mux_retimer.c diff --git a/src/drivers/intel/usb4/mux_retimer/mux_retimer.c b/src/drivers/intel/usb4/mux_retimer/mux_retimer.c new file mode 100644 index 0000000..de538e2 --- /dev/null +++ b/src/drivers/intel/usb4/mux_retimer/mux_retimer.c @@ -0,0 +1,110 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <acpi/acpigen.h> +#include <acpi/acpi_device.h> +#include <console/console.h> +#include <device/device.h> +#include <device/path.h> +#include <gpio.h> +#include <string.h> + +/* Unique ID for the Mux Retimer Upgrade _DSM. */ +#define INTEL_USB4_MUX_RETIMER_DSM_UUID "5e7fb958-b2c5-49dc-90b9-f95b1275e824" + +/* + * Arg0: UUID + * Arg1: Revision ID (set to 1) + * Arg2: Function Index + * 0: Query command implemented + * 1: Query current MUX state and ports with retimers + * 2: Set MUX state for retimer upgrade + * Arg3: A package containing parameters for the function specified by the UUID + * revision ID and function index. + * Function 2: Value to set EC RAM + */ + +static void usb4_mux_cb_standard_query(void *arg) +{ + /* + * ToInteger (Arg1, Local2) + * If (Local2 == 1) { + * Return(Buffer() {0x07}) + * } + * Return (Buffer() {0x01}) + */ + acpigen_write_to_integer(ARG1_OP, LOCAL2_OP); + + /* Revision 1 supports 2 Functions beyond the standard query */ + acpigen_write_if_lequal_op_int(LOCAL2_OP, 1); + acpigen_write_return_singleton_buffer(0x07); + acpigen_pop_len(); /* If */ + + /* Other revisions support no additional functions */ + acpigen_write_return_singleton_buffer(0); +} + +static void usb4_mux_cb_get_mux_state(void *arg) +{ + /* + * // Read Mux Retimer info from EC RAM + * Return RFWU + */ + acpigen_write_return_namestr("RFWU"); +} + +static void usb4_mux_cb_set_mux_state(void *arg) +{ + /* + * // Get argument for on/off from Arg3[0] + * Local0 = DeRefOf (Arg3[0]) + */ + acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); + + /* + * // write the EC RAM for Retimer Upgrade + * RFWU = LOCAL0 + */ + acpigen_write_name_byte("RFWU", LOCAL0_OP); + + /* Return (Zero) */ + acpigen_write_return_integer(0); +} + +static void (*usb4_mux_callbacks[3])(void *) = { + usb4_mux_cb_standard_query, /* Function 0 */ + usb4_mux_cb_get_mux_state, /* Function 1 */ + usb4_mux_cb_set_mux_state, /* Function 2 */ +}; + +static void usb4_mux_fill_ssdt(const struct device *dev) +{ + const char *scope = acpi_device_scope(dev); + + if (!scope) + return; + + /* Write the _DSM that toggles ack with provided GPIO. */ + acpigen_write_scope(scope); + acpigen_write_dsm(INTEL_USB4_MUX_RETIMER_DSM_UUID, usb4_mux_callbacks, + ARRAY_SIZE(usb4_mux_callbacks), NULL); + acpigen_pop_len(); /* Scope */ + + printk(BIOS_INFO, "%s: %s at %s\n", acpi_device_path(dev), dev->chip_ops->name, + dev_path(dev)); +} + +static struct device_operations usb4_mux_dev_ops = { + .read_resources = noop_read_resources, + .set_resources = noop_set_resources, + .acpi_fill_ssdt = usb4_mux_fill_ssdt, +}; + +static void usb4_mux_retimer_enable(struct device *dev) +{ + dev->ops = &usb4_mux_dev_ops; +} + +struct chip_operations drivers_intel_usb4_mux_ops = { + CHIP_NAME("Intel USB4 Mux Retimer Upgrade") + .enable_dev = usb4_mux_retimer_enable +}; diff --git a/src/ec/google/chromeec/acpi/emem.asl b/src/ec/google/chromeec/acpi/emem.asl index 2a556ed..ee50796 100644 --- a/src/ec/google/chromeec/acpi/emem.asl +++ b/src/ec/google/chromeec/acpi/emem.asl @@ -18,7 +18,7 @@ FAN0, 16, // Fan Speed 0 Offset (0x24), BTVR, 8, // Battery structure version -Offset (0x30), +RFWU, 8, // Retimer FW Update LIDS, 1, // Lid Switch State PBTN, 1, // Power Button Pressed WPDI, 1, // Write Protect Disabled diff --git a/src/mainboard/google/volteer/Kconfig b/src/mainboard/google/volteer/Kconfig index c776ba1..5e185a7 100644 --- a/src/mainboard/google/volteer/Kconfig +++ b/src/mainboard/google/volteer/Kconfig @@ -12,6 +12,7 @@ select DRIVERS_INTEL_USB4_RETIMER select DRIVERS_I2C_MAX98373 select DRIVERS_INTEL_SOUNDWIRE + select DRIVERS_INTEL_USB4_MUX_RETIMER select DRIVERS_SPI_ACPI select DRIVERS_SOUNDWIRE_ALC5682 select DRIVERS_SOUNDWIRE_MAX98373
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, John Zhao, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48630
to look at the new patch set (#2).
Change subject: WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction ......................................................................
WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and in a specific mode. Expanding the current DSM to allow for the use of an EC RAM Byte to get the current state of each port and wether or not it has a retimer. It also allows Kernel to issue a state for the retimer to be put into for firmware updates.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c M src/ec/google/chromeec/acpi/emem.asl 2 files changed, 32 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/2
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, John Zhao, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48630
to look at the new patch set (#3).
Change subject: WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction ......................................................................
WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and in a specific mode. Expanding the current DSM to allow for the use of an EC RAM Byte to get the current state of each port and wether or not it has a retimer. It also allows Kernel to issue a state for the retimer to be put into for firmware updates.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c M src/ec/google/chromeec/acpi/emem.asl 2 files changed, 33 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/3
John Zhao has uploaded a new patch set (#4) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction ......................................................................
WIP: drivers/intel/usb4/iretimer: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and in a specific mode. Expanding the current DSM to allow for the use of an EC RAM Byte to get the current state of each port and wether or not it has a retimer. It also allows Kernel to issue a state for the retimer to be put into for firmware updates.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c M src/ec/google/chromeec/acpi/emem.asl 2 files changed, 39 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/4
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4/: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 6:
This change is ready for review.
Brandon Breitenstein has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4/: Enable retimer FW upgrade mux interaction ......................................................................
Set Ready For Review
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4/: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 6:
(6 comments)
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@7 PS6, Line 7: drivers/intel/usb4/ Please remove the trailing /.
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: Along with kernel and EC update, Please add references to these changes.
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: TEST=Along with kernel and EC update, the Retimer firmware update had : been validated under device attached and no device attached scenarios. If you added the validation command/procedure, that would be great.
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: had : been is
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... PS6, Line 111: // Remove?
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... PS6, Line 117: * // write the EC RAM for Retimer Upgrade Ditto.
John Zhao has uploaded a new patch set (#7) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c 1 file changed, 38 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/7
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
(6 comments)
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@7 PS6, Line 7: drivers/intel/usb4/
Please remove the trailing /.
Ack
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: Along with kernel and EC update,
Please add references to these changes.
EC and kernel patches are work-in-progress.
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: had : been
is
Done
https://review.coreboot.org/c/coreboot/+/48630/6//COMMIT_MSG@16 PS6, Line 16: TEST=Along with kernel and EC update, the Retimer firmware update had : been validated under device attached and no device attached scenarios.
If you added the validation command/procedure, that would be great.
I was referred the following command "cat /sys/bus/thunderbolt/devices/0-0/generation" would trigger for verification. Since kernel patches are still WIP, it seems no need to add here.
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... PS6, Line 111: //
Remove?
Ack
https://review.coreboot.org/c/coreboot/+/48630/6/src/drivers/intel/usb4/reti... PS6, Line 117: * // write the EC RAM for Retimer Upgrade
Ditto.
Ack
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
do you have some pointers to the kernel & EC patches?
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
Patch Set 7:
do you have some pointers to the kernel & EC patches?
EC patch: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594492 Sorry, not sure whether kernel patches had been upstream or not.
Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
Patch Set 7:
Patch Set 7:
do you have some pointers to the kernel & EC patches?
EC patch: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594492 Sorry, not sure whether kernel patches had been upstream or not.
I am working on all the required kernel changes to get the USB4 Retimer FW update done. I am hoping to have these patches ready early/mid next week.
Attention is currently required from: John Zhao, Brandon Breitenstein. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/3c34ed9c_65d32f67 PS6, Line 108: const char *RFWU = "\_SB_.PCI0.LPCB.EC0_.RFWU"; What about a __weak function to retrieve the ACPI path to this RFWU byte as it's been defined? something like `const char *mainboard_retimer_fw_update_path(void)` ?
for chromeos, since it's related to the EC, we could define a non-weak version of the function somewhere in ec/google/chromeec
Thoughts?
Attention is currently required from: John Zhao, Brandon Breitenstein. Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
(2 comments)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/6883e343_ea1c2502 PS7, Line 33: 07 This needs to be changed to 1f, as 2 more functions are supported on top the first 3 (which is indicated by 0x7). Kernel will check for a minimum of 0x1f to be able to support retimer fw update.
https://review.coreboot.org/c/coreboot/+/48630/comment/e1550651_1e7ac761 PS7, Line 111: // Get argument for on/off from Arg3[0] This needs to be changed, as we set new retimer mux info here.
Attention is currently required from: Tim Wawrzynczak, John Zhao, Brandon Breitenstein. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 7:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/c2722be4_5035b270 PS6, Line 108: const char *RFWU = "\_SB_.PCI0.LPCB.EC0_.RFWU";
What about a __weak function to retrieve the ACPI path to this RFWU byte as it's been defined? somet […]
Would the following definitions be ok?
../src/ec/google/chromeec/ec.h const char *mainboard_retimer_fw_update_path(void);
../src/ec/google/chromeec/ec_acpi.c const char *mainboard_retimer_fw_update_path(void) { return "\_SB_.PCI0.LPCB.EC0_.RFWU"; }
Attention is currently required from: Tim Wawrzynczak, John Zhao, Rajmohan Mani. Brandon Breitenstein has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 8:
(2 comments)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/9044e48b_1442180a PS7, Line 33: 07
This needs to be changed to 1f, as 2 more functions are supported on top the first 3 (which is indic […]
Done
https://review.coreboot.org/c/coreboot/+/48630/comment/1664cfa8_3bfe8514 PS7, Line 111: // Get argument for on/off from Arg3[0]
This needs to be changed, as we set new retimer mux info here.
Done
Attention is currently required from: Tim Wawrzynczak, John Zhao, Rajmohan Mani. Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Tim Wawrzynczak, Duncan Laurie, John Zhao, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48630
to look at the new patch set (#9).
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c 1 file changed, 41 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/9
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 9:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/f491f4b5_fe5ef9af PS6, Line 108: const char *RFWU = "\_SB_.PCI0.LPCB.EC0_.RFWU";
Would the following definitions be ok? […]
Sure, that works. The function prototype should go in a new file `drivers/intel/usb4/retimer/retimer.h` instead of ec.h though, as it's specific to this driver.
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has uploaded a new patch set (#10) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 53 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/10
Attention is currently required from: John Zhao, Rajmohan Mani. build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 10:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/7c446962_6042eef9 PS10, Line 95: __weak const char *mainboard_retimer_fw_update_path(void); Using weak declarations can have unintended link defects
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has uploaded a new patch set (#11) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 56 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/11
Attention is currently required from: John Zhao, Rajmohan Mani. build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 11:
(2 comments)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/676c7011_aa77433c PS11, Line 178: return NULL; code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/48630/comment/0393f21a_ff618ee8 PS11, Line 178: return NULL; please, no spaces at the start of a line
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 11:
(2 comments)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/d9ebbc22_eec9b075 PS11, Line 178: return NULL;
please, no spaces at the start of a line
done
https://review.coreboot.org/c/coreboot/+/48630/comment/bba42a8e_456470d3 PS11, Line 178: return NULL;
code indent should use tabs where possible
done
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has uploaded a new patch set (#12) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 56 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/12
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 12:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/ce3b5b42_8fe86233 PS10, Line 95: __weak const char *mainboard_retimer_fw_update_path(void);
Using weak declarations can have unintended link defects
done
Attention is currently required from: Tim Wawrzynczak, John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 12:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/bdaecb88_4a25b8cf PS6, Line 108: const char *RFWU = "\_SB_.PCI0.LPCB.EC0_.RFWU";
Sure, that works. […]
Done
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 12: Code-Review+1
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/5cfbf344_ce594f89 PS12, Line 40: 2 Are these new Functions still used for Revision 1? Then please change this number to 4
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. John Zhao has uploaded a new patch set (#13) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 57 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/13
Attention is currently required from: Tim Wawrzynczak, Brandon Breitenstein, Rajmohan Mani. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 13:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/a6bf9d5e_7eed1266 PS12, Line 40: 2
Are these new Functions still used for Revision 1? Then please change this number to 4
Ack
Attention is currently required from: John Zhao, Tim Wawrzynczak, Brandon Breitenstein, Rajmohan Mani. Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 13:
(2 comments)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/27d112a8_8e9df9fa PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0); I think we should put this entire function in the EC code, this way if the EC either doesn't implement this (empty weak function for a non-chrome design) or uses a different interface it can be supported easier.
https://review.coreboot.org/c/coreboot/+/48630/comment/e04532b3_16da20d6 PS13, Line 176: mainboard since this is intended to come from EC code, perhaps prefix with "ec_" instead of "mainboard_".
Attention is currently required from: John Zhao, Tim Wawrzynczak, Brandon Breitenstein, Rajmohan Mani. John Zhao has uploaded a new patch set (#14) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 57 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/14
Attention is currently required from: Duncan Laurie, John Zhao, Tim Wawrzynczak, Brandon Breitenstein, Rajmohan Mani. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 14:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/ab8066c5_2045e397 PS13, Line 176: mainboard
since this is intended to come from EC code, perhaps prefix with "ec_" instead of "mainboard_".
Done
Attention is currently required from: Duncan Laurie, John Zhao, Tim Wawrzynczak, Brandon Breitenstein. Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 14:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/579a6d40_47569356 PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0);
I think we should put this entire function in the EC code, this way if the EC either doesn't impleme […]
In kernel, in my current implementation, the USB4 SW CM accesses these DSM methods using ACPI handle to the TDM0 device (via ACPI_HANDLE(&sw->tb->nhi->pdev->dev)). If this were to be moved to EC code, the implementation in kernel has to be changed. Currently USB4 SW CM does not have any information about the EC device and I am not sure if that's possible to use the EC device from within USB4 SW CM. This is also something that we aligned earlier on the implementation details around USB4 retimer FW update. Would be nice if we can stick with this existing design. Kernel checks for a minimum support for all these 5 functions (0x1F) via query_fn. In designs where it is not supported, we can simply return 0, so kernel does not do anything special about this.
Attention is currently required from: John Zhao, Tim Wawrzynczak, Rajmohan Mani, Brandon Breitenstein. Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 14:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/7977b275_e92618a7 PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0);
In kernel, in my current implementation, the USB4 SW CM accesses these DSM methods using ACPI handle […]
Sorry I just meant move the coreboot code here that is generating the ACPI code to ec/google/chromeec, not the behavior itself.
Attention is currently required from: Duncan Laurie, John Zhao, Tim Wawrzynczak, Brandon Breitenstein. Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 14:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/45674899_9ee32606 PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0);
Sorry I just meant move the coreboot code here that is generating the ACPI code to ec/google/chromee […]
Great. Thanks Duncan. I thought you meant the code to be moved into EC firmware itself.
Attention is currently required from: Duncan Laurie, John Zhao, Tim Wawrzynczak, Brandon Breitenstein. John Zhao has uploaded a new patch set (#15) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 45 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/15
Attention is currently required from: Duncan Laurie, John Zhao, Tim Wawrzynczak, Rajmohan Mani, Brandon Breitenstein. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 15:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/920f0f71_db277eb6 PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0);
Great. Thanks Duncan. […]
Updated with the added ec_retimer_fw_update function declaration and its default implementation in CB:49257(ec_acpi.c). Please help to provide a Kconfig name (like MAINBOARD_HAS_RETIMER???) for CB:49257, then CB:49257 will be further updated with corresponding mainboard Kconfig setting.
Attention is currently required from: John Zhao, Tim Wawrzynczak, Rajmohan Mani, Brandon Breitenstein. Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 15:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/8f68153c_5b5fff49 PS13, Line 109: const char *RFWU = mainboard_retimer_fw_update_path(); : : /* : * Get information to set retimer info from Arg3[0] : * Local0 = DeRefOf (Arg3[0]) : */ : acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); : : /* : * Write the EC RAM for Retimer Upgrade : * RFWU = LOCAL0 : */ : acpigen_write_store(); : acpigen_emit_byte(LOCAL0_OP); : acpigen_emit_namestring(RFWU); : : /* Return (Zero) */ : acpigen_write_return_integer(0);
Updated with the added ec_retimer_fw_update function declaration and its default implementation in C […]
We may not need a Kconfig for it, the code should be unused unless the retimer device is included.
Attention is currently required from: John Zhao, Brandon Breitenstein, Rajmohan Mani. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 16:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/ebaba7b2_0ee9480f PS16, Line 99: if RFWU is NULL, probably should have `acpigen_return_byte(0)` , e.g.
``` if (!RFWU) acpigen_write_return_byte(0); else acpigen_write_return_namestr(RFWU); ```
Attention is currently required from: John Zhao, Tim Wawrzynczak, Brandon Breitenstein. Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 16:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/0446f731_dd5094ad PS16, Line 99:
if RFWU is NULL, probably should have `acpigen_return_byte(0)` , e.g. […]
Under what conditions RFWU will be NULL?
As long as this will result in an error, that is detected by kernel, this should be fine.
Attention is currently required from: John Zhao, Tim Wawrzynczak, Rajmohan Mani, Brandon Breitenstein. Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 16:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/cba740d9_d60f5024 PS16, Line 99:
Under what conditions RFWU will be NULL? […]
A non-chrome platform would end up using the default weak function and return null. Passing NULL to acpigen_write_return_namestr() should result in invalid AML as it will skip the return value entirely (check in acpigen_emit_namestring) so probably best to handle with returning 0.
Attention is currently required from: Duncan Laurie, Tim Wawrzynczak, John Zhao, Rajmohan Mani, Brandon Breitenstein. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 16:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/384c10d5_9437d555 PS16, Line 99:
A non-chrome platform would end up using the default weak function and return null. […]
Pending Raj's response to return 0 or -1.
Attention is currently required from: John Zhao, Duncan Laurie, Tim Wawrzynczak, Brandon Breitenstein. Rajmohan Mani has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 16:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/fa1b3b4a_c448cdaa PS16, Line 99:
Pending Raj's response to return 0 or -1.
Returning both 0 and 255/-1 is not picked up the kernel as an error. The initial query the kernel makes is Get TCSS mux info and 255 is defined as an invalid mux. So it should be okay if we return 255 here, if RFWU is NULL.
Attention is currently required from: John Zhao, Duncan Laurie, Tim Wawrzynczak, Brandon Breitenstein. John Zhao has uploaded a new patch set (#17) to the change originally created by Brandon Breitenstein. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 49 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/48630/17
Attention is currently required from: Duncan Laurie, Tim Wawrzynczak, John Zhao, Rajmohan Mani, Brandon Breitenstein. John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 17:
(1 comment)
File src/drivers/intel/usb4/retimer/retimer.c:
https://review.coreboot.org/c/coreboot/+/48630/comment/dbc3f252_ebff8295 PS16, Line 99:
Returning both 0 and 255/-1 is not picked up the kernel as an error. […]
done
Attention is currently required from: Duncan Laurie, John Zhao, Rajmohan Mani, Brandon Breitenstein. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
Patch Set 17: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48630 )
Change subject: drivers/intel/usb4: Enable retimer FW upgrade mux interaction ......................................................................
drivers/intel/usb4: Enable retimer FW upgrade mux interaction
In order to update the BB retimers for usb4/tbt they need to be turned on and into TBT mode. Expand the current DSM to allow for the use of an EC RAM byte RFWU to get the current state of each port and whether or not it has a retimer. It also allows Kernel to issue state transitions for the retimer to be put into TBT mode for firmware update.
BUG=b:162528867 TEST=Along with work in progress kernel and EC patches, the Retimer firmware update is verified under device attached and no device attached scenarios.
Change-Id: I768cfb56790049c231173b0ea0f8e08fe6b64b93 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48630 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/drivers/intel/usb4/retimer/retimer.c A src/drivers/intel/usb4/retimer/retimer.h 2 files changed, 49 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/drivers/intel/usb4/retimer/retimer.c b/src/drivers/intel/usb4/retimer/retimer.c index 7a693ff..f884ac60 100644 --- a/src/drivers/intel/usb4/retimer/retimer.c +++ b/src/drivers/intel/usb4/retimer/retimer.c @@ -8,6 +8,7 @@ #include <gpio.h> #include <string.h> #include "chip.h" +#include "retimer.h"
/* Unique ID for the retimer _DSM. */ #define INTEL_USB4_RETIMER_DSM_UUID "61788900-C470-42BB-80F0-23A313864593" @@ -19,6 +20,8 @@ * 0: Query command implemented * 1: Query force power enable state * 2: Set force power state + * 3: Get Retimer FW Update EC Ram value + * 4: Set Retimer FW Update EC Ram value * Arg3: A package containing parameters for the function specified * by the UUID, revision ID and function index. */ @@ -28,15 +31,15 @@ /* * ToInteger (Arg1, Local2) * If (Local2 == 1) { - * Return(Buffer() {0x07}) + * Return(Buffer() {0x1f}) * } * Return (Buffer() {0x01}) */ acpigen_write_to_integer(ARG1_OP, LOCAL2_OP);
- /* Revision 1 supports 2 Functions beyond the standard query */ + /* Revision 1 supports 4 Functions beyond the standard query */ acpigen_write_if_lequal_op_int(LOCAL2_OP, 1); - acpigen_write_return_singleton_buffer(0x07); + acpigen_write_return_singleton_buffer(0x1f); acpigen_pop_len(); /* If */
/* Other revisions support no additional functions */ @@ -48,7 +51,7 @@ struct acpi_gpio *power_gpio = arg;
/* - * // Read power gpio into Local0 + * Read power gpio into Local0 * Store (_SB.PCI0.GTXS (power_gpio), Local0) * Return (Local0) */ @@ -61,7 +64,7 @@ struct acpi_gpio *power_gpio = arg;
/* - * // Get argument for on/off from Arg3[0] + * Get information to set to retimer info from Arg3[0] * Local0 = DeRefOf (Arg3[0]) */ acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP); @@ -90,10 +93,32 @@ acpigen_write_return_integer(0); }
-static void (*usb4_retimer_callbacks[3])(void *) = { +static void usb4_retimer_cb_get_retimer_info(void *arg) +{ + const char *RFWU = ec_retimer_fw_update_path(); + + /* + * Read Mux Retimer info from EC RAM + * Return RFWU if RFWU is not NULL. Otherwise return -1 to + * inform kernel about error. + */ + if (!RFWU) + acpigen_write_return_byte(-1); + else + acpigen_write_return_namestr(RFWU); +} + +static void usb4_retimer_cb_set_retimer_info(void *arg) +{ + ec_retimer_fw_update(arg); +} + +static void (*usb4_retimer_callbacks[5])(void *) = { usb4_retimer_cb_standard_query, /* Function 0 */ usb4_retimer_cb_get_power_state, /* Function 1 */ usb4_retimer_cb_set_power_state, /* Function 2 */ + usb4_retimer_cb_get_retimer_info, /* Function 3 */ + usb4_retimer_cb_set_retimer_info, /* Function 4 */ };
static void usb4_retimer_fill_ssdt(const struct device *dev) @@ -134,3 +159,12 @@ CHIP_NAME("Intel USB4 Retimer") .enable_dev = usb4_retimer_enable }; + +__weak const char *ec_retimer_fw_update_path(void) +{ + return NULL; +} + +__weak void ec_retimer_fw_update(void *arg) +{ +} diff --git a/src/drivers/intel/usb4/retimer/retimer.h b/src/drivers/intel/usb4/retimer/retimer.h new file mode 100644 index 0000000..4c4044a --- /dev/null +++ b/src/drivers/intel/usb4/retimer/retimer.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _DRIVERS_INTEL_USB4_RETIMER_H_ +#define _DRIVERS_INTEL_USB4_RETIMER_H_ + +const char *ec_retimer_fw_update_path(void); +void ec_retimer_fw_update(void *arg); + +#endif /* _DRIVERS_INTEL_USB4_RETIMER_H_ */