Commit b25264f2 authored by Pawel Laszczak's avatar Pawel Laszczak Committed by Greg Kroah-Hartman

usb: cdnsp: Fix issue with Clear Feature Halt Endpoint

During handling Clear Halt Endpoint Feature request, driver invokes
Reset Endpoint command. Because this command has some issue with
transition endpoint from Running to Idle state the driver must
stop the endpoint by using Stop Endpoint command.

cc: <stable@vger.kernel.org>
Fixes: 3d829045 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Reviewed-by: default avatarPeter Chen <peter.chen@kernel.org>
Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20221110063005.370656-1-pawell@cadence.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3aa07f72
...@@ -600,11 +600,11 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev, ...@@ -600,11 +600,11 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev,
trace_cdnsp_ep_halt(value ? "Set" : "Clear"); trace_cdnsp_ep_halt(value ? "Set" : "Clear");
if (value) { ret = cdnsp_cmd_stop_ep(pdev, pep);
ret = cdnsp_cmd_stop_ep(pdev, pep); if (ret)
if (ret) return ret;
return ret;
if (value) {
if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_STOPPED) { if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_STOPPED) {
cdnsp_queue_halt_endpoint(pdev, pep->idx); cdnsp_queue_halt_endpoint(pdev, pep->idx);
cdnsp_ring_cmd_db(pdev); cdnsp_ring_cmd_db(pdev);
...@@ -613,10 +613,6 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev, ...@@ -613,10 +613,6 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev,
pep->ep_state |= EP_HALTED; pep->ep_state |= EP_HALTED;
} else { } else {
/*
* In device mode driver can call reset endpoint command
* from any endpoint state.
*/
cdnsp_queue_reset_ep(pdev, pep->idx); cdnsp_queue_reset_ep(pdev, pep->idx);
cdnsp_ring_cmd_db(pdev); cdnsp_ring_cmd_db(pdev);
ret = cdnsp_wait_for_cmd_compl(pdev); ret = cdnsp_wait_for_cmd_compl(pdev);
......
...@@ -2076,7 +2076,8 @@ int cdnsp_cmd_stop_ep(struct cdnsp_device *pdev, struct cdnsp_ep *pep) ...@@ -2076,7 +2076,8 @@ int cdnsp_cmd_stop_ep(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
u32 ep_state = GET_EP_CTX_STATE(pep->out_ctx); u32 ep_state = GET_EP_CTX_STATE(pep->out_ctx);
int ret = 0; int ret = 0;
if (ep_state == EP_STATE_STOPPED || ep_state == EP_STATE_DISABLED) { if (ep_state == EP_STATE_STOPPED || ep_state == EP_STATE_DISABLED ||
ep_state == EP_STATE_HALTED) {
trace_cdnsp_ep_stopped_or_disabled(pep->out_ctx); trace_cdnsp_ep_stopped_or_disabled(pep->out_ctx);
goto ep_stopped; goto ep_stopped;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment