cdnsp-gadget.c (14d34d2dbbe2d9144a65bae1549202d1717062e2) | cdnsp-gadget.c (10076de33b5ed5b1e049593a611d2fd9eba60565) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Cadence CDNSP DRD Driver. 4 * 5 * Copyright (C) 2020 Cadence. 6 * 7 * Author: Pawel Laszczak <pawell@cadence.com> 8 * --- 713 unchanged lines hidden (view full) --- 722 cdnsp_ring_cmd_db(pdev); 723 ret = cdnsp_wait_for_cmd_compl(pdev); 724 725 /* 726 * After Reset Device command all not default endpoints 727 * are in Disabled state. 728 */ 729 for (i = 1; i < CDNSP_ENDPOINTS_NUM; ++i) | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Cadence CDNSP DRD Driver. 4 * 5 * Copyright (C) 2020 Cadence. 6 * 7 * Author: Pawel Laszczak <pawell@cadence.com> 8 * --- 713 unchanged lines hidden (view full) --- 722 cdnsp_ring_cmd_db(pdev); 723 ret = cdnsp_wait_for_cmd_compl(pdev); 724 725 /* 726 * After Reset Device command all not default endpoints 727 * are in Disabled state. 728 */ 729 for (i = 1; i < CDNSP_ENDPOINTS_NUM; ++i) |
730 pdev->eps[i].ep_state |= EP_STOPPED; | 730 pdev->eps[i].ep_state |= EP_STOPPED | EP_UNCONFIGURED; |
731 732 trace_cdnsp_handle_cmd_reset_dev(slot_ctx); 733 734 if (ret) 735 dev_err(pdev->dev, "Reset device failed with error code %d", 736 ret); 737 738 return ret; --- 198 unchanged lines hidden (view full) --- 937 int ret; 938 939 if (!ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT || 940 !desc->wMaxPacketSize) 941 return -EINVAL; 942 943 pep = to_cdnsp_ep(ep); 944 pdev = pep->pdev; | 731 732 trace_cdnsp_handle_cmd_reset_dev(slot_ctx); 733 734 if (ret) 735 dev_err(pdev->dev, "Reset device failed with error code %d", 736 ret); 737 738 return ret; --- 198 unchanged lines hidden (view full) --- 937 int ret; 938 939 if (!ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT || 940 !desc->wMaxPacketSize) 941 return -EINVAL; 942 943 pep = to_cdnsp_ep(ep); 944 pdev = pep->pdev; |
945 pep->ep_state &= ~EP_UNCONFIGURED; |
|
945 946 if (dev_WARN_ONCE(pdev->dev, pep->ep_state & EP_ENABLED, 947 "%s is already enabled\n", pep->name)) 948 return 0; 949 950 spin_lock_irqsave(&pdev->lock, flags); 951 952 added_ctxs = cdnsp_get_endpoint_flag(desc); --- 65 unchanged lines hidden (view full) --- 1018 spin_lock_irqsave(&pdev->lock, flags); 1019 1020 if (!(pep->ep_state & EP_ENABLED)) { 1021 dev_err(pdev->dev, "%s is already disabled\n", pep->name); 1022 ret = -EINVAL; 1023 goto finish; 1024 } 1025 | 946 947 if (dev_WARN_ONCE(pdev->dev, pep->ep_state & EP_ENABLED, 948 "%s is already enabled\n", pep->name)) 949 return 0; 950 951 spin_lock_irqsave(&pdev->lock, flags); 952 953 added_ctxs = cdnsp_get_endpoint_flag(desc); --- 65 unchanged lines hidden (view full) --- 1019 spin_lock_irqsave(&pdev->lock, flags); 1020 1021 if (!(pep->ep_state & EP_ENABLED)) { 1022 dev_err(pdev->dev, "%s is already disabled\n", pep->name); 1023 ret = -EINVAL; 1024 goto finish; 1025 } 1026 |
1026 cdnsp_cmd_stop_ep(pdev, pep); | |
1027 pep->ep_state |= EP_DIS_IN_RROGRESS; | 1027 pep->ep_state |= EP_DIS_IN_RROGRESS; |
1028 cdnsp_cmd_flush_ep(pdev, pep); | |
1029 | 1028 |
1029 /* Endpoint was unconfigured by Reset Device command. */ 1030 if (!(pep->ep_state & EP_UNCONFIGURED)) { 1031 cdnsp_cmd_stop_ep(pdev, pep); 1032 cdnsp_cmd_flush_ep(pdev, pep); 1033 } 1034 |
|
1030 /* Remove all queued USB requests. */ 1031 while (!list_empty(&pep->pending_list)) { 1032 preq = next_request(&pep->pending_list); 1033 cdnsp_ep_dequeue(pep, preq); 1034 } 1035 1036 cdnsp_invalidate_ep_events(pdev, pep); 1037 1038 pep->ep_state &= ~EP_DIS_IN_RROGRESS; 1039 drop_flag = cdnsp_get_endpoint_flag(pep->endpoint.desc); 1040 ctrl_ctx = cdnsp_get_input_control_ctx(&pdev->in_ctx); 1041 ctrl_ctx->drop_flags = cpu_to_le32(drop_flag); 1042 ctrl_ctx->add_flags = 0; 1043 1044 cdnsp_endpoint_zero(pdev, pep); 1045 | 1035 /* Remove all queued USB requests. */ 1036 while (!list_empty(&pep->pending_list)) { 1037 preq = next_request(&pep->pending_list); 1038 cdnsp_ep_dequeue(pep, preq); 1039 } 1040 1041 cdnsp_invalidate_ep_events(pdev, pep); 1042 1043 pep->ep_state &= ~EP_DIS_IN_RROGRESS; 1044 drop_flag = cdnsp_get_endpoint_flag(pep->endpoint.desc); 1045 ctrl_ctx = cdnsp_get_input_control_ctx(&pdev->in_ctx); 1046 ctrl_ctx->drop_flags = cpu_to_le32(drop_flag); 1047 ctrl_ctx->add_flags = 0; 1048 1049 cdnsp_endpoint_zero(pdev, pep); 1050 |
1046 ret = cdnsp_update_eps_configuration(pdev, pep); | 1051 if (!(pep->ep_state & EP_UNCONFIGURED)) 1052 ret = cdnsp_update_eps_configuration(pdev, pep); 1053 |
1047 cdnsp_free_endpoint_rings(pdev, pep); 1048 | 1054 cdnsp_free_endpoint_rings(pdev, pep); 1055 |
1049 pep->ep_state &= ~EP_ENABLED; | 1056 pep->ep_state &= ~(EP_ENABLED | EP_UNCONFIGURED); |
1050 pep->ep_state |= EP_STOPPED; 1051 1052finish: 1053 trace_cdnsp_ep_disable_end(pep, 0); 1054 spin_unlock_irqrestore(&pdev->lock, flags); 1055 1056 return ret; 1057} --- 956 unchanged lines hidden --- | 1057 pep->ep_state |= EP_STOPPED; 1058 1059finish: 1060 trace_cdnsp_ep_disable_end(pep, 0); 1061 spin_unlock_irqrestore(&pdev->lock, flags); 1062 1063 return ret; 1064} --- 956 unchanged lines hidden --- |