aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/xhci_devconf.c
diff options
context:
space:
mode:
authorYidi Lin <yidi.lin@mediatek.com>2015-05-07 15:36:04 +0800
committerPatrick Georgi <pgeorgi@google.com>2015-06-03 11:11:59 +0200
commitd42ee150a0330f22986ad7237c9e70cebd9d995c (patch)
tree67e64639a41e020e1d7377a579085b3d59e2137b /payloads/libpayload/drivers/usb/xhci_devconf.c
parent08e30134900c1c8f169668e8b5b2b90254996c9a (diff)
libpayload: usb: Support MTK xHCI host controller
1. There is a mis-understanding to calculate the value of TD Size in Normal TRB. For MTK's xHCI controller it defines a number of packets that remain to be transferred for a TD after processing all Max packets in all previous TRBs, that means don't include the current TRB's. 2. To minimize the scheduling effort for synchronous endpoints in xHC, the MTK architecture defines some extra SW scheduling parameters for HW. According to these parameters provided by SW, the xHC can easily decide whether a synchronous endpoint should be scheduled in a specific uFrame. The extra SW scheduling parameters are put into reserved DWs in Slot and Endpoint Context. But in coreboot synchronous transfer can be ignored, so only two fields are set to a default value 1 to support bulk and interrupt transfers, and others are set to zero. 3. For control transfer, it is better to read back doorbell register or add a memory barrier after ringing the doorbell to flush posted write. Otherwise the first command will be aborted on MTK's xHCI controller. 4. Before send commands to a port, the Port Power in PORTSC register should be set to 1 on MTK's xHCI so a hook function of enable_port in generic_hub_ops_t struct is provided. Change-Id: Ie8878b50c048907ebf939b3f6657535a54877fde Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 738609c11f16264c6e6429d478b2040cb391fe41 Original-Change-Id: Id9156892699e2e42a166c77fbf6690049abe953b Original-Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Original-Reviewed-on: https://chromium-review.googlesource.com/265362 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Commit-Queue: Yidi Lin <yidi.lin@mediatek.com> Original-Tested-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-on: http://review.coreboot.org/10389 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload/drivers/usb/xhci_devconf.c')
-rw-r--r--payloads/libpayload/drivers/usb/xhci_devconf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/xhci_devconf.c b/payloads/libpayload/drivers/usb/xhci_devconf.c
index 012f610287..5b5bb5e800 100644
--- a/payloads/libpayload/drivers/usb/xhci_devconf.c
+++ b/payloads/libpayload/drivers/usb/xhci_devconf.c
@@ -313,6 +313,16 @@ xhci_finish_ep_config(const endpoint_t *const ep, inputctx_t *const ic)
EC_SET(AVRTRB, epctx, avrtrb);
EC_SET(MXESIT, epctx, EC_GET(MPS, epctx) * EC_GET(MBS, epctx));
+ if (IS_ENABLED(CONFIG_LP_USB_XHCI_MTK_QUIRK)) {
+ /* The MTK xHCI defines some extra SW parameters which are
+ * put into reserved DWs in Slot and Endpoint Contexts for
+ * synchronous endpoints. But for non-isochronous transfers,
+ * it is enough to set the following two fields to 1, and others
+ * are set to 0.
+ */
+ EC_SET(BPKTS, epctx, 1);
+ EC_SET(BBM, epctx, 1);
+ }
return 0;
}