Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a89c4b58 authored by Pawel Laszczak's avatar Pawel Laszczak Committed by Greg Kroah-Hartman
Browse files

usb: cdns3: Fix issue for clear halt endpoint



commit b3fa25de31fb7e9afebe9599b8ff32eda13d7c94 upstream.

Path fixes bug which occurs during resetting endpoint in
__cdns3_gadget_ep_clear_halt function. During resetting endpoint
controller will change HW/DMA owned TRB. It set Abort flag in
trb->control and will change trb->length field. If driver want
to use the aborted trb it must update the changed field in
TRB.

Fixes: 7733f6c3 ("usb: cdns3: Add Cadence USB3 DRD Driver")
cc: <stable@vger.kernel.org>
Acked-by: default avatarPeter Chen <peter.chen@kernel.org>
Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20220329084605.4022-1-pawell@cadence.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87b41b04
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2166,6 +2166,7 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
	struct usb_request *request;
	struct cdns3_request *priv_req;
	struct cdns3_trb *trb = NULL;
	struct cdns3_trb trb_tmp;
	int ret;
	int val;

@@ -2175,9 +2176,11 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
	if (request) {
		priv_req = to_cdns3_request(request);
		trb = priv_req->trb;
		if (trb)
		if (trb) {
			trb_tmp = *trb;
			trb->control = trb->control ^ TRB_CYCLE;
		}
	}

	writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);

@@ -2191,7 +2194,8 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)

	if (request) {
		if (trb)
			trb->control = trb->control ^ TRB_CYCLE;
			*trb = trb_tmp;

		cdns3_rearm_transfer(priv_ep, 1);
	}