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>
This commit is contained in:
parent
3a7db27f45
commit
297d27b8bb
|
@ -8,6 +8,7 @@
|
||||||
#include <gpio.h>
|
#include <gpio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
#include "retimer.h"
|
||||||
|
|
||||||
/* Unique ID for the retimer _DSM. */
|
/* Unique ID for the retimer _DSM. */
|
||||||
#define INTEL_USB4_RETIMER_DSM_UUID "61788900-C470-42BB-80F0-23A313864593"
|
#define INTEL_USB4_RETIMER_DSM_UUID "61788900-C470-42BB-80F0-23A313864593"
|
||||||
|
@ -19,6 +20,8 @@
|
||||||
* 0: Query command implemented
|
* 0: Query command implemented
|
||||||
* 1: Query force power enable state
|
* 1: Query force power enable state
|
||||||
* 2: Set force power 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
|
* Arg3: A package containing parameters for the function specified
|
||||||
* by the UUID, revision ID and function index.
|
* by the UUID, revision ID and function index.
|
||||||
*/
|
*/
|
||||||
|
@ -28,15 +31,15 @@ static void usb4_retimer_cb_standard_query(void *arg)
|
||||||
/*
|
/*
|
||||||
* ToInteger (Arg1, Local2)
|
* ToInteger (Arg1, Local2)
|
||||||
* If (Local2 == 1) {
|
* If (Local2 == 1) {
|
||||||
* Return(Buffer() {0x07})
|
* Return(Buffer() {0x1f})
|
||||||
* }
|
* }
|
||||||
* Return (Buffer() {0x01})
|
* Return (Buffer() {0x01})
|
||||||
*/
|
*/
|
||||||
acpigen_write_to_integer(ARG1_OP, LOCAL2_OP);
|
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_if_lequal_op_int(LOCAL2_OP, 1);
|
||||||
acpigen_write_return_singleton_buffer(0x07);
|
acpigen_write_return_singleton_buffer(0x1f);
|
||||||
acpigen_pop_len(); /* If */
|
acpigen_pop_len(); /* If */
|
||||||
|
|
||||||
/* Other revisions support no additional functions */
|
/* Other revisions support no additional functions */
|
||||||
|
@ -48,7 +51,7 @@ static void usb4_retimer_cb_get_power_state(void *arg)
|
||||||
struct acpi_gpio *power_gpio = arg;
|
struct acpi_gpio *power_gpio = arg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* // Read power gpio into Local0
|
* Read power gpio into Local0
|
||||||
* Store (\_SB.PCI0.GTXS (power_gpio), Local0)
|
* Store (\_SB.PCI0.GTXS (power_gpio), Local0)
|
||||||
* Return (Local0)
|
* Return (Local0)
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +64,7 @@ static void usb4_retimer_cb_set_power_state(void *arg)
|
||||||
struct acpi_gpio *power_gpio = arg;
|
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])
|
* Local0 = DeRefOf (Arg3[0])
|
||||||
*/
|
*/
|
||||||
acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP);
|
acpigen_get_package_op_element(ARG3_OP, 0, LOCAL0_OP);
|
||||||
|
@ -90,10 +93,32 @@ static void usb4_retimer_cb_set_power_state(void *arg)
|
||||||
acpigen_write_return_integer(0);
|
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_standard_query, /* Function 0 */
|
||||||
usb4_retimer_cb_get_power_state, /* Function 1 */
|
usb4_retimer_cb_get_power_state, /* Function 1 */
|
||||||
usb4_retimer_cb_set_power_state, /* Function 2 */
|
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)
|
static void usb4_retimer_fill_ssdt(const struct device *dev)
|
||||||
|
@ -134,3 +159,12 @@ struct chip_operations drivers_intel_usb4_retimer_ops = {
|
||||||
CHIP_NAME("Intel USB4 Retimer")
|
CHIP_NAME("Intel USB4 Retimer")
|
||||||
.enable_dev = usb4_retimer_enable
|
.enable_dev = usb4_retimer_enable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__weak const char *ec_retimer_fw_update_path(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void ec_retimer_fw_update(void *arg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -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_ */
|
Loading…
Reference in New Issue