Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42072 )
Change subject: drivers/usb: add a USB pre-poll hook ......................................................................
Patch Set 1: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/42072/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/42072/1//COMMIT_MSG@10 PS1, Line 10: 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 hookink into the poll routine to : refresh the state of the USB mux.
This explains the problem to solve. But not why it's done in […]
I think the short answer is that the mux is controlled by the Chrome EC on the board, and the driver to communicate with that is in depthcharge. And I think the reason that driver is in depthcharge originally was that it was based off GPL code that couldn't be added to libpayload.
I agree that the general situation of these driver splits is far from great (also in other cases, like SPI flash and the whole libpayload_init_default_cbfs_media() mess) and it would be much better to have most of it in libpayload. But coreboot kinda forced this situation by insisting that libpayload can only be BSD code. We have CONFIG_LP_GPL now (which didn't exist back then) which could be used to move more GPL drivers into libpayload, but this is all tied up in 10 years worth of glue code and frameworks in depthcharge by now and I don't think anyone has time to migrate the world into another repository. So we are kinda stuck where we are with this.