]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: Correct command TRB 4th dword initialization
authorBin Meng <bmeng.cn@gmail.com>
Wed, 19 Jul 2017 13:49:54 +0000 (21:49 +0800)
committerMarek Vasut <marex@denx.de>
Fri, 28 Jul 2017 21:34:15 +0000 (23:34 +0200)
In xhci_queue_command(), when the command is not 'reset endpoint',
'stop endpoint' or 'set TR dequeue pointer', endpoint ID should not
be encoded in the TRB.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
drivers/usb/host/xhci-ring.c

index 2675a8f6491538050a62040255fd6cfe267962fe..579e6707eb35a11067458da2f8cf643048b18df8 100644 (file)
@@ -280,8 +280,15 @@ void xhci_queue_command(struct xhci_ctrl *ctrl, u8 *ptr, u32 slot_id,
        fields[0] = lower_32_bits(val_64);
        fields[1] = upper_32_bits(val_64);
        fields[2] = 0;
-       fields[3] = TRB_TYPE(cmd) | EP_ID_FOR_TRB(ep_index) |
-                   SLOT_ID_FOR_TRB(slot_id) | ctrl->cmd_ring->cycle_state;
+       fields[3] = TRB_TYPE(cmd) | SLOT_ID_FOR_TRB(slot_id) |
+                   ctrl->cmd_ring->cycle_state;
+
+       /*
+        * Only 'reset endpoint', 'stop endpoint' and 'set TR dequeue pointer'
+        * commands need endpoint id encoded.
+        */
+       if (cmd >= TRB_RESET_EP && cmd <= TRB_SET_DEQ)
+               fields[3] |= EP_ID_FOR_TRB(ep_index);
 
        queue_trb(ctrl, ctrl->cmd_ring, false, fields);