From patchwork Mon Apr 12 07:22:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12197025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B226C433B4 for ; Mon, 12 Apr 2021 07:37:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 428596120B for ; Mon, 12 Apr 2021 07:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbhDLHhW (ORCPT ); Mon, 12 Apr 2021 03:37:22 -0400 Received: from mail-db8eur05on2081.outbound.protection.outlook.com ([40.107.20.81]:18880 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230034AbhDLHhV (ORCPT ); Mon, 12 Apr 2021 03:37:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tx7yJn4GMaIsfeYbLNL7u+93w5ChA7gC8DeY1WAbEMyyTuRUVnWJlnqCaYW+Z/Yw2UTfXi0TvSCJW5Jpn1H6I/STSHv3ub/tITuO0Q77CTM/ob8D5TyJP0pziq59MJ1cGn/ddn3ODjUiY7/xd8Y5R+GDNWq0WI6gjkSvSAHoF8Ypqjf8/XJ8VFzTSDispNrnJ1rJzHpqdY/LAQbCWn41FNw+lqdtKFunHoxz41vOm0ttnTnNjuToEtrh50G/9y4JYvY9OR7vl6EPM9BGfTrg1IOe7FBagTtgSuUQY7MAWToFTKx/srOkXBToZPyvs9PnMbZ3rjhpGRMQd2wfZ3eeMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fq6ClAOK36DdmhaLzz064GfYkFeLaBKo860BeWqfV60=; b=bpir+qpRrd+Dx0j3bb4MAbdim1ztwhzHxSh7+aUP1A2mMr4CqEb8C6jksSPdbxXBUqPhvC9ZAYASR+1x4cCx/FhBWDqRMmm3lZTjOHK5hSoOJ0A3W/DoGzIaGyL2c34uOpUywAxtMhfeYIKCMxahN269RaqlLZbKL3Ty7AC+biVO1g6WWhNCipScHMrldZ/5gAb51ln2X1IePRd7nEhdDm6zdvi2UdeKchwJlsv49XPKbqXfsSoRqrIt6ko7wn18qV1ELX06D7jGZL9nJgqgiXAlE3Zni9DRmHBJcoJysuI8cjCjgU0bTvftrmweWYWX4Anoa1HmjbbICSKztSOZhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fq6ClAOK36DdmhaLzz064GfYkFeLaBKo860BeWqfV60=; b=BsF/FWCgZKrHCAl2BqMftfEVOrXeizMs3166m54XFAmW/G8d9crf5jnKGPZCs4NqI8ZA1pET3C4onS41U3kd8+wUcLtsGdK0E2DCDVT0VSDI/3mwkEgYcNLV5MMtkWtVCufisV2yZFwaWUcSGYUTJ2i2Ka1lIHFHGxGTQHV1aEc= Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB6784.eurprd04.prod.outlook.com (2603:10a6:803:13e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 07:37:01 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::801f:563a:65e:8d12]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::801f:563a:65e:8d12%6]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 07:37:01 +0000 From: Li Jun To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu, mathias.nyman@intel.com Cc: peter.chen@kernel.org, jun.li@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 1/2] usb: host: move EH SINGLE_STEP_SET_FEATURE implementation to core Date: Mon, 12 Apr 2021 15:22:13 +0800 Message-Id: <1618212134-20416-1-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HKAPR03CA0006.apcprd03.prod.outlook.com (2603:1096:203:c8::11) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HKAPR03CA0006.apcprd03.prod.outlook.com (2603:1096:203:c8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4042.8 via Frontend Transport; Mon, 12 Apr 2021 07:36:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b938d6e-0a23-41a9-7282-08d8fd85c29e X-MS-TrafficTypeDiagnostic: VI1PR04MB6784: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:132; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gHiYoPJIqhh3yF27hM8kU5NjhqARCWlBgCFSvZMUiKy4qnGEBySIJ1bI6+7UIwGAe9MJoVuBobt3T7+X8aLSFT6ZqHf1qKG2ASb7V2KWyaES/WUxIjiENRsYLVPma8qG/rB0IfdwWnhUVqOUIwQR9X6oKI0rwvcVPzIXS5v86ydSwp29FPYc4Lg+Ipv+fCsjrOwsOUOw7L0CrR0VT3RzioAvBSaHVF4bCPq/vUVj1PFs3aD9UuQRhsODOqp5oqJvuDC8kF9umew5CzoWtrsijs3/xxE+GjNNlZ6XYKt2+ferpir48mfwCCYTIQ4X8U7vaSkkqd1bav2nPIWB7F9VPs5DhIIYN7ZUVN6/QAn04nt/ToPS1WmQ7wThPMjkJDSAg4pUnHNv3x9GrDsITP65aqEFQCYKtGnNbAdJlRzLe6c1Txx6vNz2zXmMdyXllLN/P2CLdvNl4DptIjOEH6F7LCv7rgNlk+GZWOhPVBrww0iVuYnkPbIQ4uPOeqjrQYpOENcVDPNQwTYzKZSSdBKD9YpLt8vr5DheT4f1K2HLD6qLiVcflF4ni5dgEGr6ftLLbu6fiuFJb8oFtTtWLd6AF6W7BF+RZtBaSs/qLwhE1ZJahkeRbCYkP+rY3px/44NqICVlXGkz+WEW0EpJUDpwhbZfHX4A8/gKiJwz5H+2Q3YWQtLdXs1nN2XA9STed9/M X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(376002)(136003)(366004)(39860400002)(346002)(66556008)(2616005)(2906002)(26005)(956004)(316002)(6486002)(6506007)(66946007)(83380400001)(66476007)(4326008)(30864003)(52116002)(186003)(5660300002)(69590400012)(8936002)(6666004)(8676002)(6512007)(36756003)(478600001)(16526019)(38350700002)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0a0azTJLjhEcTz2cO4kGoD6ZTQALyjH5oLskGxeH/EZkwtE8xWnmSX8RDKm3rXIS+GK99D41A3X7NW7hxABvYwRTuBdTuQrk0+nhFjU2tbFTiL7DtAlJ4rbk1FoWj6kAmwzrkOI5/CBDeEB6+tYxyWdkzdTPPmYx5DSTQGRsI3t+Zyy/fAnUdQ1lWfiyPDWyVeIsMRmthMcTMM0FqgOYtcC1dApPwnZ8RqSi7qHtjgzg1vO0dv9Kgg6K+qBitRcGPgayv2KfjFh4A9XyNC9GJOum4XJPVrO8UNkuKMWZzJQw22x4uwHNmX3fOgeSO1Csw+qaKS3ZiMhUnJaPI07qsf0DmVhXYx+2DA562cw4rh/MlOhDS1HljptfwdwyHRKBfTVFoSzLi7QZpFDc7OvkzSfBXBmrGN5YeN8DeJTkuY8zugBlyqMZ3CdwiW+TKR8Lf9FECG1cN8rb3hHLsWtJCdC7OGgKIqHeZazUkoGG5vdIn+UX2btYGHtZr0/+PbGWiIcKCwdAohdOGdvgs8YSx8ehnuLRBbXdDfn/fe2H2+6OrV51e3r/mbKOOFnFfTPw2hunrE7YTIUCSghIUyZHSTRNsb9lKwHHGEGfS+gUlO+8fJ8LsO4/Lf/pRNHjWv5M0dgBsI6/QbQeLUJfkH8zhXRFNTuCp0Q3LoBX2gSuSvy6UfkP0gO7MgUFV/tBySfCjhSppQgmGwXF3PkfYM7pTsqEfKbsCZuujMRtO1HWEo9OHba2cawD6tBgh2iZzsub3A5Z2KPSPLpVhrDp8NRf+NJN2LJ6Fd48Vn5kQLoZd/QLcsgtNZkw7QUIrIim374OzCqNXo80AwLn9g8kOB2VEt4laZDx+MXqFwjdzLFlOCKZ7uYDPGOehN4ETRtUZGxKA82eQrjfXIlSQUPaX/R80EwGaSafLKzPP8e8zVivvhcI3dSY/Qj1B5yLiuxu7nZFzwwub9aYnVguMZn4MDpJ3V978fHu4aiLMevx8aDDNErvUsPOEYzf7PlL6XNuh/+baiqt04r5B+nWWHdmqT0ThC7v38hb++H4fqZN7tHZNKZ1brhuF7WwdcAQFYLpvq+Mo5wDgQ2FcCoKyJ76kxwmvbbieFWF2l54CIknA0YkxBkcF+cK3JWxcDp2MsaqbwraBOmuo3to4WA2WNYxk1rItGXYV6+aHff+SmboTcOqY6Ns9h/SfFuH3iD42WZv6oq0+LPIFK+19avGC5v+ALtlO0GXTHjd+zR8ASz7V7Mywu6zCo5r9cX1jmCC5vu1AR9WFVk3AMSDfedDj9a6k6H76zbg5epmcUfUxrPNaMdGR1NReJIiUVCri0NwCdBxPubG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b938d6e-0a23-41a9-7282-08d8fd85c29e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 07:37:01.4084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4rae1imlBJ6lTTsREzL4qEmIlAJGsobbSDun1GeA86N/J4PHNLF5jGNGjSCD467P X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6784 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Peter Chen It is needed at USB Certification test for Embedded Host 2.0, and the detail is at CH6.4.1.1 of On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification. Since other USB 2.0 capable host like XHCI also need it, so move it to HCD core. Signed-off-by: Peter Chen Signed-off-by: Jun Li --- drivers/usb/core/hcd.c | 134 ++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci-hcd.c | 4 ++ drivers/usb/host/ehci-hub.c | 139 ------------------------------------ drivers/usb/host/ehci-q.c | 2 +- include/linux/usb/hcd.h | 13 +++- 5 files changed, 151 insertions(+), 141 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6119fb41d736..d7eb9f179ca6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2110,6 +2110,140 @@ int usb_hcd_get_frame_number (struct usb_device *udev) return hcd->driver->get_frame_number (hcd); } +/*-------------------------------------------------------------------------*/ +#ifdef CONFIG_USB_HCD_TEST_MODE + +static void usb_ehset_completion(struct urb *urb) +{ + struct completion *done = urb->context; + + complete(done); +} +/* + * Allocate and initialize a control URB. This request will be used by the + * EHSET SINGLE_STEP_SET_FEATURE test in which the DATA and STATUS stages + * of the GetDescriptor request are sent 15 seconds after the SETUP stage. + * Return NULL if failed. + */ +static struct urb *request_single_step_set_feature_urb( + struct usb_device *udev, + void *dr, + void *buf, + struct completion *done) +{ + struct urb *urb; + struct usb_hcd *hcd = bus_to_hcd(udev->bus); + struct usb_host_endpoint *ep; + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) + return NULL; + + urb->pipe = usb_rcvctrlpipe(udev, 0); + ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out) + [usb_pipeendpoint(urb->pipe)]; + if (!ep) { + usb_free_urb(urb); + return NULL; + } + + urb->ep = ep; + urb->dev = udev; + urb->setup_packet = (void *)dr; + urb->transfer_buffer = buf; + urb->transfer_buffer_length = USB_DT_DEVICE_SIZE; + urb->complete = usb_ehset_completion; + urb->status = -EINPROGRESS; + urb->actual_length = 0; + urb->transfer_flags = URB_DIR_IN; + usb_get_urb(urb); + atomic_inc(&urb->use_count); + atomic_inc(&urb->dev->urbnum); + urb->setup_dma = dma_map_single( + hcd->self.sysdev, + urb->setup_packet, + sizeof(struct usb_ctrlrequest), + DMA_TO_DEVICE); + urb->transfer_dma = dma_map_single( + hcd->self.sysdev, + urb->transfer_buffer, + urb->transfer_buffer_length, + DMA_FROM_DEVICE); + urb->context = done; + return urb; +} + +int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) +{ + int retval = -ENOMEM; + struct usb_ctrlrequest *dr; + struct urb *urb; + struct usb_device *udev; + struct usb_device_descriptor *buf; + DECLARE_COMPLETION_ONSTACK(done); + + /* Obtain udev of the rhub's child port */ + udev = usb_hub_find_child(hcd->self.root_hub, port); + if (!udev) { + dev_err(hcd->self.controller, "No device attached to the RootHub\n"); + return -ENODEV; + } + buf = kmalloc(USB_DT_DEVICE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); + if (!dr) { + kfree(buf); + return -ENOMEM; + } + + /* Fill Setup packet for GetDescriptor */ + dr->bRequestType = USB_DIR_IN; + dr->bRequest = USB_REQ_GET_DESCRIPTOR; + dr->wValue = cpu_to_le16(USB_DT_DEVICE << 8); + dr->wIndex = 0; + dr->wLength = cpu_to_le16(USB_DT_DEVICE_SIZE); + urb = request_single_step_set_feature_urb(udev, dr, buf, &done); + if (!urb) + goto cleanup; + + /* Submit just the SETUP stage */ + retval = hcd->driver->submit_single_step_set_feature(hcd, urb, 1); + if (retval) + goto out1; + if (!wait_for_completion_timeout(&done, msecs_to_jiffies(2000))) { + usb_kill_urb(urb); + retval = -ETIMEDOUT; + dev_err(hcd->self.controller, + "%s SETUP stage timed out on ep0\n", __func__); + goto out1; + } + msleep(15 * 1000); + + /* Complete remaining DATA and STATUS stages using the same URB */ + urb->status = -EINPROGRESS; + usb_get_urb(urb); + atomic_inc(&urb->use_count); + atomic_inc(&urb->dev->urbnum); + retval = hcd->driver->submit_single_step_set_feature(hcd, urb, 0); + if (!retval && !wait_for_completion_timeout(&done, + msecs_to_jiffies(2000))) { + usb_kill_urb(urb); + retval = -ETIMEDOUT; + dev_err(hcd->self.controller, + "%s IN stage timed out on ep0\n", __func__); + } +out1: + usb_free_urb(urb); +cleanup: + kfree(dr); + kfree(buf); + return retval; +} +EXPORT_SYMBOL_GPL(ehset_single_step_set_feature); +#endif /* CONFIG_USB_HCD_TEST_MODE */ + /*-------------------------------------------------------------------------*/ #ifdef CONFIG_PM diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 94b5e64ae9a2..35eec0c0edcd 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1238,6 +1238,10 @@ static const struct hc_driver ehci_hc_driver = { * device support */ .free_dev = ehci_remove_device, +#ifdef CONFIG_USB_HCD_TEST_MODE + /* EH SINGLE_STEP_SET_FEATURE test support */ + .submit_single_step_set_feature = ehci_submit_single_step_set_feature, +#endif }; void ehci_init_driver(struct hc_driver *drv, diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 159cc27b1a36..c4f6a2559a98 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -726,145 +726,6 @@ ehci_hub_descriptor ( desc->wHubCharacteristics = cpu_to_le16(temp); } -/*-------------------------------------------------------------------------*/ -#ifdef CONFIG_USB_HCD_TEST_MODE - -#define EHSET_TEST_SINGLE_STEP_SET_FEATURE 0x06 - -static void usb_ehset_completion(struct urb *urb) -{ - struct completion *done = urb->context; - - complete(done); -} -static int submit_single_step_set_feature( - struct usb_hcd *hcd, - struct urb *urb, - int is_setup -); - -/* - * Allocate and initialize a control URB. This request will be used by the - * EHSET SINGLE_STEP_SET_FEATURE test in which the DATA and STATUS stages - * of the GetDescriptor request are sent 15 seconds after the SETUP stage. - * Return NULL if failed. - */ -static struct urb *request_single_step_set_feature_urb( - struct usb_device *udev, - void *dr, - void *buf, - struct completion *done -) { - struct urb *urb; - struct usb_hcd *hcd = bus_to_hcd(udev->bus); - struct usb_host_endpoint *ep; - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) - return NULL; - - urb->pipe = usb_rcvctrlpipe(udev, 0); - ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out) - [usb_pipeendpoint(urb->pipe)]; - if (!ep) { - usb_free_urb(urb); - return NULL; - } - - urb->ep = ep; - urb->dev = udev; - urb->setup_packet = (void *)dr; - urb->transfer_buffer = buf; - urb->transfer_buffer_length = USB_DT_DEVICE_SIZE; - urb->complete = usb_ehset_completion; - urb->status = -EINPROGRESS; - urb->actual_length = 0; - urb->transfer_flags = URB_DIR_IN; - usb_get_urb(urb); - atomic_inc(&urb->use_count); - atomic_inc(&urb->dev->urbnum); - urb->setup_dma = dma_map_single( - hcd->self.sysdev, - urb->setup_packet, - sizeof(struct usb_ctrlrequest), - DMA_TO_DEVICE); - urb->transfer_dma = dma_map_single( - hcd->self.sysdev, - urb->transfer_buffer, - urb->transfer_buffer_length, - DMA_FROM_DEVICE); - urb->context = done; - return urb; -} - -static int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) -{ - int retval = -ENOMEM; - struct usb_ctrlrequest *dr; - struct urb *urb; - struct usb_device *udev; - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - struct usb_device_descriptor *buf; - DECLARE_COMPLETION_ONSTACK(done); - - /* Obtain udev of the rhub's child port */ - udev = usb_hub_find_child(hcd->self.root_hub, port); - if (!udev) { - ehci_err(ehci, "No device attached to the RootHub\n"); - return -ENODEV; - } - buf = kmalloc(USB_DT_DEVICE_SIZE, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); - if (!dr) { - kfree(buf); - return -ENOMEM; - } - - /* Fill Setup packet for GetDescriptor */ - dr->bRequestType = USB_DIR_IN; - dr->bRequest = USB_REQ_GET_DESCRIPTOR; - dr->wValue = cpu_to_le16(USB_DT_DEVICE << 8); - dr->wIndex = 0; - dr->wLength = cpu_to_le16(USB_DT_DEVICE_SIZE); - urb = request_single_step_set_feature_urb(udev, dr, buf, &done); - if (!urb) - goto cleanup; - - /* Submit just the SETUP stage */ - retval = submit_single_step_set_feature(hcd, urb, 1); - if (retval) - goto out1; - if (!wait_for_completion_timeout(&done, msecs_to_jiffies(2000))) { - usb_kill_urb(urb); - retval = -ETIMEDOUT; - ehci_err(ehci, "%s SETUP stage timed out on ep0\n", __func__); - goto out1; - } - msleep(15 * 1000); - - /* Complete remaining DATA and STATUS stages using the same URB */ - urb->status = -EINPROGRESS; - usb_get_urb(urb); - atomic_inc(&urb->use_count); - atomic_inc(&urb->dev->urbnum); - retval = submit_single_step_set_feature(hcd, urb, 0); - if (!retval && !wait_for_completion_timeout(&done, - msecs_to_jiffies(2000))) { - usb_kill_urb(urb); - retval = -ETIMEDOUT; - ehci_err(ehci, "%s IN stage timed out on ep0\n", __func__); - } -out1: - usb_free_urb(urb); -cleanup: - kfree(dr); - kfree(buf); - return retval; -} -#endif /* CONFIG_USB_HCD_TEST_MODE */ /*-------------------------------------------------------------------------*/ int ehci_hub_control( diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index a826715ae9bd..2cbf4f85bff3 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -1165,7 +1165,7 @@ submit_async ( * performed; TRUE - SETUP and FALSE - IN+STATUS * Returns 0 if success */ -static int submit_single_step_set_feature( +static int ehci_submit_single_step_set_feature( struct usb_hcd *hcd, struct urb *urb, int is_setup diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 96281cd50ff6..22c5d1c0acf3 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -409,7 +409,10 @@ struct hc_driver { int (*find_raw_port_number)(struct usb_hcd *, int); /* Call for power on/off the port if necessary */ int (*port_power)(struct usb_hcd *hcd, int portnum, bool enable); - + /* Call for SINGLE_STEP_SET_FEATURE Test for USB2 EH certification */ +#define EHSET_TEST_SINGLE_STEP_SET_FEATURE 0x06 + int (*submit_single_step_set_feature)(struct usb_hcd *, + struct urb *, int); }; static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd) @@ -474,6 +477,14 @@ int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr, struct platform_device; extern void usb_hcd_platform_shutdown(struct platform_device *dev); +#ifdef CONFIG_USB_HCD_TEST_MODE +extern int ehset_single_step_set_feature(struct usb_hcd *hcd, int port); +#else +static inline int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) +{ + return 0; +} +#endif /* CONFIG_USB_HCD_TEST_MODE */ #ifdef CONFIG_USB_PCI struct pci_dev; From patchwork Mon Apr 12 07:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12197027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35AF1C433ED for ; Mon, 12 Apr 2021 07:37:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEB6861243 for ; Mon, 12 Apr 2021 07:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236853AbhDLHh0 (ORCPT ); Mon, 12 Apr 2021 03:37:26 -0400 Received: from mail-vi1eur05on2066.outbound.protection.outlook.com ([40.107.21.66]:35168 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236843AbhDLHhZ (ORCPT ); Mon, 12 Apr 2021 03:37:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ECQSQ5NMrcCCslUJ7KOEr98i4gHMzCDJ2R+aM3DRlUbVDCfJ4zdDuYQmiNzDLNUUhxKjqCgJmnUZnFoUQbyZEodmm8yw+a8nH6BmsCc0uKrNrjntBtHNhX89iaXdBKs3eWGSG/AcKopRc/PzjKUkxf7SqRPktgXpdWh3wQE1/k9aWJaFCmKcGthrcCuYwXi7uCYV32bhlsjRL/uuZxg/nrbc1tEHJ4HWS6r0Rp239iB2Q/XQJOfuxzzVE7pJ0CvbD26XcVYC01VMA66v09Ru7W52+I1cJBhceIOaWsjo0CdO71B+jyQAPNKSdDC/W8sxlgDhqDbacI5aMspz8T/+eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mhXYAqMqxBpTk88sILZ1iJ2zCY0W1/71emEmMheo+L0=; b=l1u+avpmituT787q9JGx9+08C5v1EeVaAH4vuCS0Zl7cvQe0Htds6MtWVoejlaBUAu+zAKSRoFud+Wn4lUGaWhvYnaZlUC2bSc7gNBjYUQgy41kvVhPF3x/B+FTF609xEo2HQHFWNALz3cG244haeR4CimnH8/Q7dNlktcPKLIA/DOIZfS+0eAIaf3OD0MILqhMx4kP8UdrfuSc6VfMBR2CvpgBleqCsjgf/M0fSBvPljTvsVRkyKEQEdp+B+0Dg7iLeVmJLKP8cn1/rklr5i/GZ13LDAd+kFMTBTUv9oS4Ukm9Z5A4oOsqq9vDM+is78aUAdOR/ifgLA/URrENUDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mhXYAqMqxBpTk88sILZ1iJ2zCY0W1/71emEmMheo+L0=; b=SDClL92jcR0rTzPSEAggDM6g2ZZd+/80ZDt8PN928sanXxgcVeq3b5Bseg3fjB8fn1aNKLkU7fAouFvd505hSsN2FvmEs3gUISFMLIgYKurZ9nLWYkRTyega+Iu9KZssz+WuEkXodpgOLXqs0FYtaCnmTMuomR/imo9xuP8B6v8= Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Mon, 12 Apr 2021 07:37:04 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::801f:563a:65e:8d12]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::801f:563a:65e:8d12%6]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 07:37:04 +0000 From: Li Jun To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu, mathias.nyman@intel.com Cc: peter.chen@kernel.org, jun.li@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 2/2] usb: host: xhci: add EH SINGLE_STEP_SET_FEATURE Test for USB2 Date: Mon, 12 Apr 2021 15:22:14 +0800 Message-Id: <1618212134-20416-2-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618212134-20416-1-git-send-email-jun.li@nxp.com> References: <1618212134-20416-1-git-send-email-jun.li@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HKAPR03CA0006.apcprd03.prod.outlook.com (2603:1096:203:c8::11) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HKAPR03CA0006.apcprd03.prod.outlook.com (2603:1096:203:c8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4042.8 via Frontend Transport; Mon, 12 Apr 2021 07:37:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 479c8625-ee28-401b-e61d-08d8fd85c46d X-MS-TrafficTypeDiagnostic: VI1PR04MB5935: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2QC+PhAQQ8GTRi8y1fW+JgZLiTSFkwSG8OQ/tpERkzMeoCxQHuP62FRxT2azH33gLk5OMXRFQY3g+G0eayLW7DA7nX5bV4DlS7tOp7wyMpwLMRbXuemQBd4AXGh0942J/75iYufKdvpwzTAwV0gf4w/mljjESonGowFKqddBqoREknibPqMUDvAqYgRv3UAALRIxvMHELMhv4BKDc/RPiiXJS2XU0UXvQdwDwZSQqhtdUyZZdSE8jsYwksY2R0eFfMYz3gRVZhmdiydYos8DIRA9ByFXZ7KphWj/OpX8u7a4awdAB5kW9dVGGEHpMJke5FmmP9LISAPBqpFlbha7laWn5i7ItJ+tl/FWsOUP1vju8RHTMT0jsymuu6YdagmTz3Vu2jspBPNZG00/GlIavU/iKgGnbsvuKk+IgyVpa7gvNH5e+2UbGLhAG3WUrunD8Noy64ozMgF2KBbWPjGLXhNOxCfIscA0x8zzn5mt4iwstyJA+G76xSYSU+cSP8Ha1C3ab3MjNRw3QZQfO2EUxWeGiV0Q/eqcdKy9xjvMySV5YinjqavikLcz/OSagzUctVQinrTsCDi98xsePsXNgLNN7+xGdtNy9wpWdC8oD+YyG2gHrxFRpb3kwY7/Tjn9A12S6+2hCkJS5P9hGy7rRgjhqvg6Y71lvpKCVk6sAlf4hP58xf7DRWw1k+9odaps X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(396003)(346002)(376002)(366004)(316002)(69590400012)(8936002)(38350700002)(8676002)(38100700002)(6512007)(4326008)(36756003)(5660300002)(66946007)(478600001)(16526019)(86362001)(186003)(66476007)(66556008)(52116002)(6506007)(83380400001)(6666004)(26005)(2616005)(956004)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OW6sJcdvS8fSXstlwByrAkQwr293xvJFmCpnNhF6yDp2r16X9uQBVqFpPCBegerkGVqlmIXtP6v7jDPIA8IepZgQIoj/1V51H5e4vDCgmbmV2VVlSxtvRL5Tu7BDN9v5R8jiSOkU4/HjgiZ4eRjAXgtPTN4T61PhHCqUrR8vzrbZR3vOeHHx33F3CkM4demrHNXCHwJAKfonUfBSQg2C70423a6HeaAt/OEpAxzyGGkM1h8lBaOY8gZmRX2tB5tw/pfQ2pX6EvZZM8xYOCVNE5c1a6BUzUZB6HnhE8tABdwnJjPhIzWBJAWO+Dav7VzJgXJlCrwCIn1A1xleaO/ncaGmvYkZ2wz0cA9m8KGU9Fdv3o8SPfiRUqyNf1a87U5uzQcZ9NnPiv6xrz9SZS02vFpLU/KEzcU7F2LiZyq0kWIfoPbBDF8g/cpPvAF6nc8TEicnncmbAVDHFeY5lbOEwKe/EnBtTOXeIpyb/nQgZLxUwp0LVJ9bp4JVQfVzWYZwfiuiB78ypM81A3cxuxUcWJqpWT22exV1ii1XSMMpfbqF8Hmnc9Je4zJVAWr1N2z1h8JmrxbOyGT4NrQ6uiw1dR/hNQW0jDw+mp+rjnf6lmA+NvCcea2KLy0XVXmVXjOVNZ+vqr8ts5elf4DG0wjwMMayhAKNAkRqPuOBWq2hz7oceSLvx5tC+ZYql3wkRveMCW5RQyGaxASMNY/W+MNJ4RwWSvWAOffmlV8xzMrNLR5eCP1j1OqPPi+Ltk5b2dB643SsSF/fqBHAtvmcAa3mJklI6wfnf/OlvR/p9zyiKzqSSCce3ZsVap5Hku5JwBWK2XAa0dauqe+nA1bGlshHZglmX08FJx8N+nWwDewzCUI+4jr+PP0hfF7rXVqooogJXEpLOjC8xmnGsXvTNIvl/jPKsuZAzHlp9RuzwtR18dPt/rOHeK69K9vWF8UafzdjooN2e6nwj5kKUFdQ93UNdVtRTE4R632yd/kKq0v6yv/wxt7MaKQEvRcmHmXN2iesm56x9gse2B4N+0Fo2NpchRFlt9KrWImtKmA0zabjRZXhvmjYTuVOKqq6hhiZvdbNvDUWB+fO9yMWMpG4tdpRr6CjnIJvsVH67d7OR+aRIxSpt/EP9hJY9+RdU+I8FT+yvd8EpFy5pC4B9Cx10tIzjnJ1z0kuMUiWvd222Y7zBUqFBxCuH8TXOneWTierNdU35tToBdwolxC4mq0TIiIRgzncmCYJ0+u7jLf+AomZ1EEu0i7aIMK+45MPkFO0rMyRFDs3b+ODVb5q8J/4HoAf/fevL7nR+cQMxK4mycRavO+i+MZrdlLgKy51zqtDLJEj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 479c8625-ee28-401b-e61d-08d8fd85c46d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 07:37:04.4357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cvRvVVAzGDDsy3//USqrFCUQikUzLjQMQjXRw16gbnODwDIjgdFkZSf+i8EOQco8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5935 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Peter Chen This function is similar with EHCI's, but implemented using XHCI. The USB2 host needs to send SETUP packet first, then wait 15 seconds before DATA (IN) + STATUS stage. Signed-off-by: Peter Chen Signed-off-by: Jun Li --- drivers/usb/host/xhci-hub.c | 10 +++ drivers/usb/host/xhci-ring.c | 123 +++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.c | 1 + drivers/usb/host/xhci.h | 10 +++ 4 files changed, 144 insertions(+) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index e9b18fc17617..c64ee95cc89b 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1511,6 +1511,16 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, /* 4.19.6 Port Test Modes (USB2 Test Mode) */ if (hcd->speed != HCD_USB2) goto error; + +#ifdef CONFIG_USB_HCD_TEST_MODE + if (test_mode == EHSET_TEST_SINGLE_STEP_SET_FEATURE) { + spin_unlock_irqrestore(&xhci->lock, flags); + retval = ehset_single_step_set_feature(hcd, + wIndex + 1); + spin_lock_irqsave(&xhci->lock, flags); + break; + } +#endif if (test_mode > USB_TEST_FORCE_ENABLE || test_mode < USB_TEST_J) goto error; diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1eee60ac518f..8b63ee7fb299 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -3797,6 +3797,129 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, return 0; } +#ifdef CONFIG_USB_HCD_TEST_MODE +/* + * This function prepare TRBs and submits them for the + * SINGLE_STEP_SET_FEATURE Test. + * This is done in two parts: first SETUP req for GetDesc is sent then + * 15 seconds later, the IN stage for GetDesc starts to req data from dev + * + * is_setup : argument decides which of the two stage needs to be + * performed; TRUE - SETUP and FALSE - IN+STATUS + * Returns 0 if success + */ +int xhci_submit_single_step_set_feature(struct usb_hcd *hcd, + struct urb *urb, int is_setup) +{ + int slot_id; + unsigned int ep_index; + struct xhci_ring *ep_ring; + int ret; + struct usb_ctrlrequest *setup; + struct xhci_generic_trb *start_trb; + int start_cycle; + u32 field, length_field, remainder; + struct urb_priv *urb_priv; + struct xhci_td *td; + struct xhci_hcd *xhci = hcd_to_xhci(hcd); + + /* urb_priv will be free after transcation has completed */ + urb_priv = kzalloc(sizeof(struct urb_priv) + + sizeof(struct xhci_td), GFP_KERNEL); + if (!urb_priv) + return -ENOMEM; + + td = &urb_priv->td[0]; + urb_priv->num_tds = 1; + urb_priv->num_tds_done = 0; + urb->hcpriv = urb_priv; + + ep_ring = xhci_urb_to_transfer_ring(xhci, urb); + if (!ep_ring) { + ret = -EINVAL; + goto free_priv; + } + + slot_id = urb->dev->slot_id; + ep_index = xhci_get_endpoint_index(&urb->ep->desc); + + setup = (struct usb_ctrlrequest *) urb->setup_packet; + if (is_setup) { + ret = prepare_transfer(xhci, xhci->devs[slot_id], + ep_index, urb->stream_id, + 1, urb, 0, GFP_KERNEL); + if (ret < 0) + goto free_priv; + + start_trb = &ep_ring->enqueue->generic; + start_cycle = ep_ring->cycle_state; + /* Save the DMA address of the last TRB in the TD */ + td->last_trb = ep_ring->enqueue; + field = TRB_IOC | TRB_IDT | TRB_TYPE(TRB_SETUP) | start_cycle; + /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ + if ((xhci->hci_version >= 0x100) || + (xhci->quirks & XHCI_MTK_HOST)) + field |= TRB_TX_TYPE(TRB_DATA_IN); + + queue_trb(xhci, ep_ring, false, + setup->bRequestType | setup->bRequest << 8 | + le16_to_cpu(setup->wValue) << 16, + le16_to_cpu(setup->wIndex) | + le16_to_cpu(setup->wLength) << 16, + TRB_LEN(8) | TRB_INTR_TARGET(0), + /* Immediate data in pointer */ + field); + giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, + start_cycle, start_trb); + return 0; + } + + ret = prepare_transfer(xhci, xhci->devs[slot_id], + ep_index, urb->stream_id, + 2, urb, 0, GFP_KERNEL); + if (ret < 0) + goto free_priv; + + start_trb = &ep_ring->enqueue->generic; + start_cycle = ep_ring->cycle_state; + field = TRB_ISP | TRB_TYPE(TRB_DATA); + + remainder = xhci_td_remainder(xhci, 0, + urb->transfer_buffer_length, + urb->transfer_buffer_length, + urb, 1); + + length_field = TRB_LEN(urb->transfer_buffer_length) | + TRB_TD_SIZE(remainder) | + TRB_INTR_TARGET(0); + + if (urb->transfer_buffer_length > 0) { + field |= TRB_DIR_IN; + queue_trb(xhci, ep_ring, true, + lower_32_bits(urb->transfer_dma), + upper_32_bits(urb->transfer_dma), + length_field, + field | ep_ring->cycle_state); + } + + td->last_trb = ep_ring->enqueue; + field = TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state; + queue_trb(xhci, ep_ring, false, + 0, + 0, + TRB_INTR_TARGET(0), + field); + + giveback_first_trb(xhci, slot_id, ep_index, 0, + start_cycle, start_trb); + + return 0; +free_priv: + xhci_urb_free_priv(urb_priv); + return ret; +} +#endif /* CONFIG_USB_HCD_TEST_MODE */ + /* * The transfer burst count field of the isochronous TRB defines the number of * bursts that are required to move all packets in this TD. Only SuperSpeed diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5d9fc3cd07a5..13d95418db70 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5414,6 +5414,7 @@ static const struct hc_driver xhci_hc_driver = { .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, .find_raw_port_number = xhci_find_raw_port_number, .clear_tt_buffer_complete = xhci_clear_tt_buffer_complete, + .submit_single_step_set_feature = xhci_submit_single_step_set_feature, }; void xhci_init_driver(struct hc_driver *drv, diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2595a8f057c4..f93fc8f59af6 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2165,6 +2165,16 @@ int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd); void xhci_hc_died(struct xhci_hcd *xhci); +#ifdef CONFIG_USB_HCD_TEST_MODE +int xhci_submit_single_step_set_feature(struct usb_hcd *hcd, + struct urb *urb, int is_setup); +#else +static inline int xhci_submit_single_step_set_feature(struct usb_hcd *hcd, + struct urb *urb, int is_setup) +{ + return 0; +} +#endif #ifdef CONFIG_PM int xhci_bus_suspend(struct usb_hcd *hcd);