libpayload: drivers/usb: add a USB pre-poll hook
This adds a hook so that a payload can optionally perform USB service functions in conjunction with regular USB port status polling. In particular, this allows depthcharge to control the state of an external USB mux. Some SoCs like Tiger Lake have a USB mux for Type-C ports that must be kept in sync with the state of the port as reported by the TCPC. This can be achieved by hooking into the poll routine to refresh the state of the USB mux. BUG=b:149883933 TEST=booted into recovery from Type-C flash drive on volteer Change-Id: Ic6c23756f64b891b3c5683cd650c605b8630b0fb Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42072 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
a4e2e0550c
commit
eaa219b5bb
|
@ -86,6 +86,10 @@ usb_poll (void)
|
||||||
{
|
{
|
||||||
if (usb_hcs == 0)
|
if (usb_hcs == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (usb_poll_prepare)
|
||||||
|
usb_poll_prepare();
|
||||||
|
|
||||||
hci_t *controller = usb_hcs;
|
hci_t *controller = usb_hcs;
|
||||||
while (controller != NULL) {
|
while (controller != NULL) {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -344,6 +344,13 @@ static inline void usb_debug(const char *fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To be implemented by libpayload-client. It's called by the USB
|
||||||
|
* stack just before iterating over known devices to poll them for
|
||||||
|
* status change.
|
||||||
|
*/
|
||||||
|
void __attribute__((weak)) usb_poll_prepare (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be implemented by libpayload-client. It's called by the USB stack
|
* To be implemented by libpayload-client. It's called by the USB stack
|
||||||
* when a new USB device is found which isn't claimed by a built in driver,
|
* when a new USB device is found which isn't claimed by a built in driver,
|
||||||
|
|
Loading…
Reference in New Issue