From patchwork Mon Jan 25 13:43:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370233 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994069jam; Mon, 25 Jan 2021 05:29:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyegU48uMsHQCzmWQc7C6h2AZifkYjEgEUCENLFZuaSubZv+kKKG5VVcBPAc91kKMabYJ6E X-Received: by 2002:a05:6402:1398:: with SMTP id b24mr460144edv.108.1611581342015; Mon, 25 Jan 2021 05:29:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581342; cv=pass; d=google.com; s=arc-20160816; b=s6cjR20qzPiSgW262Ah7pwg5rMG0UHjd2gzbgNlr3rMF/z+EvxLWxC2pIVwVxk5Hlq OLMzyAF+FjKadWOC8RDF24Zw4bkVkA9AtyeKkuxqRFhLMRN95eLduMoMu5xQ5Uv5/y6B 3Jp6U0VcfRm3INgU8+z/oeHQbYM4sQ1rr2gI+dCD964rCqNFEAbXRJGlCfieoOinzu9P 2A/+JpclmeJPp2p4hYY1xC25TdSbCOD7oOqDMDfymCDaYofS0jyrk694UKobiCEVQgbl z86Qg3Hmi24ostDraM9tZDthqEFDO8qbRXkJw5MYvGLir3zqysPwttXdHOm9xLIuLVSa +nKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GGcY5fas4ZNkqB729gyR3dYTrLg8Czozk7FXquHkhms=; b=y52nH+5FKaUg9qLd4OhrEnge9a7szCSFZ67YB+sji9uLmTk/qtGqjyO8YZ0jdpxzIr +GeMMxUPxO8LPgGWGLw/CxuH4zuHrsA+pUcbjPZ8A0AcvrPh9BLeh4+EW5+WHZmOWOlX JIxlBNunPMBo+mOKkiEvYMgyLAQ9CiRJe7LnpxQe0RuORJbr347nUNUzLelxhKxoSDLI Taml3kI1GUc7wUQStGODnkoF76wTSU3N4MxaPH7twepdwDym25aj4ZFnYS9jsvif3KRF zJjEF2/oUJm8Dmq1krWbKZa2pPDwzMi6TOrhpCWwL/oF3KoKBDGkaxtpKpE09ary74+7 vJOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=RNyloAt+; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r14si4600382edq.592.2021.01.25.05.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:02 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=RNyloAt+; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F1EC382795; Mon, 25 Jan 2021 14:27:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="RNyloAt+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 282C482686; Mon, 25 Jan 2021 14:15:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::60e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 068D682642 for ; Mon, 25 Jan 2021 14:15:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ThZbh7z8DbtklK1KuUjbo6WsqN4mahAbw3SC4pSGUgnCCUobcierhlX8FjHNVg4VsKlmbKTxG7pfgD/BkFWJsLSFYmA9emAIKxvLMf8Ka795eYRjzrHqcGRQzwWs1nLmfOUSf+JFTmmpG03CVTRxkIpp6QdQePmEN8lUQpuqlQ84tZU/xnVMA/EXYOLIUSkpI3RKUYneUlc8oW5HnS2QgqN0GCb9xY2slA7YuwuTEI4hgbaSQgU92DGZ/bGhIz05u0/9KU7EaBy4NBWro4a+D2GNiXP3u3OMPGxHbPzy4GhqelZKk7LeqwKltiC5c2bHAEtCrUVQmezT3fAWsQ1RIQ== 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=GGcY5fas4ZNkqB729gyR3dYTrLg8Czozk7FXquHkhms=; b=H9PYWnSZCIuw8rBRPmkwL3nMFR8KQ9sC/D2prD4PJvyfyEoStthiaQ6lF6bGS+Qtqj8pR0zrMVUq//ZnVdZ6R+D+BH8wJjeYXFTklLRnESiK6kqQWmAX/WEXdPQwtSxRvDKIAmaXV7m8ixz6E2qMlglYc0qMV0rp7v++dY6vm54W5zTBp8hDyeyRcvzqRC/CLTmfy7+8JUyM1NubcLtqBUT5HkBHduqa4NqZGnS+KXsYr5Nm1YsCQY4fJ9HmQRjzTk1aCYhzJjmhanGjLWrCCZcrrBFUOJ0sYz09t8V/e0g9oJ5MmOCHAJv1NwjbXmrtKraPYePIu8G/8SNmhSnCUw== 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=GGcY5fas4ZNkqB729gyR3dYTrLg8Czozk7FXquHkhms=; b=RNyloAt+xPALojWZXVvjhrERFMCLRvPnv/VsWUIA2G1K4P5Y8mnj0td1ECZSev6lagoJ1epcvSE4Y2B8pk+9nVkzacl+Y1neRYtzxo8VeQlZEgWy96c0YU7IW8HNT2NlHv7tfwkKIJcGHxRWMjaGobxQovMeWa/mEowDZJ/eRH0= Authentication-Results: denx.de; dkim=none (message not signed) header.d=none;denx.de; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DBBPR04MB7930.eurprd04.prod.outlook.com (2603:10a6:10:1ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.17; Mon, 25 Jan 2021 13:15:09 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0%9]) with mapi id 15.20.3784.019; Mon, 25 Jan 2021 13:15:09 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, lukma@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Li Jun , Ye Li , Peter Chen , "faqiang . zhu" , Peng Fan Subject: [PATCH V2 12/17] usb: fastboot: add super speed support Date: Mon, 25 Jan 2021 21:43:55 +0800 Message-Id: <20210125134400.780-13-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210125134400.780-1-peng.fan@nxp.com> References: <20210125134400.780-1-peng.fan@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Mon, 25 Jan 2021 13:15:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c4d00c47-fd6f-4bff-e0e7-08d8c1333d3f X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JUoECNV2plkGFn9erAsGfmP6sButYdCXPi7u/IHqCUUDrKUR+Fbrc4QrzG7Wr/b6L7VR/2e8bQhYbYr036Js6H+LDl/Vc624B8tdm7zE5vDMFgdJ+avWCJ0Y4UIl0pbfuyO33ABNurglY+UJ9aHiDQY2BhKnPYBpjJUeMfO+nNwSC8UntZSXPCxsizwZX8M334pqQYBkWU0lLUO6M5KYPz2gXJWzA2dKXd3IupzPm75259L0MipMbJB9Vy2rs76s+D52wqlnWdqo8X74X47J9vkWQFUXg9HGViWE4WvZhRTeTu05TVwzNWx/pb7y5RSLTHU9V7c4KLM4nD47nSivI/YglS41KUOCmF6e/3JnOg/hHvz0u4Vwb8KncyjhuIDTtmbrHLNHYxlPy93ownZOmg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(346002)(39860400002)(376002)(136003)(2906002)(66476007)(66556008)(8936002)(186003)(4326008)(16526019)(83380400001)(8676002)(478600001)(66946007)(5660300002)(6666004)(9686003)(2616005)(36756003)(54906003)(1076003)(956004)(6512007)(6486002)(6506007)(86362001)(316002)(52116002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: W0mVC/jvUAf9hUyvz++L46nJCTT3w3G9ZiYsLcSnyjMdezRXvHLdAtnUkBWwSoWIJBb4c0njqw4WYpnYIMRd5PXZ1fY/lSXaapbBMObXhFByvr5KLmNiu22i5tCCeM9/NA+K5cDMGITfaYL6ilhSgNJ6EUvbHwxIVOR6o8VOrKAuSB0nsskdh7PmLHOTjB+o/QfUectvxiPQtZk2ctmUuMYwvcewHiOPZaRlvmo2LkqruEjXYzIKMzTwtbTDLXfMU7ryzyGdZlnXiS1K1aEsaUlqy6L3p4jD1UBYjuouptITd44bBT2KSoqgOjsdf1HJ0oaU4pKe86sd2eXGYUOa4imhqhIM+HJp8/0ZH5Ey5NyRpJq2B6S7UW2cD/+dZYZAlBUNDkaYL+Bv0OaMGyFS37d/3ABba7CJT0p3BbUk0Ja5koWz1lD391W3WCkiK4aY2vMPLVOq9Nj4Xd2Krf/yprY6aSerd00h/tLSvSNQzu4Asiu7WLOcKOiTrOEZn/f+w2T7IL7GQh5SO3Bozo0IQ/KdK6dJg2PnP5HHZ/Iwx1HvtTWQh9P7S/N0T2qI/SSNNwALXmiQnoU/4zDBK+gHSYSSkrNhDCNKaRrLM/YBLZNnVNfuP7pHDGalmT9qKRnsT6PB26c37eiKyKz4VI2yg/nX16zlcbv+Fm+KDHpjBwPMILclgwQCNq/hsYhshz67Ej74EKOk3KI1HRx0CxycA2R6am0kGrpFHBblGgWw/eotjAAibOFv/dWIy5yaf8pb3p2qDo5cubkff1CHR9Z/OEnnLtK/W8anidBe0DElLVAGXfpajv4FX/z9H4x/KvUmEVHJu/QvD5UIRZIOVQapjem4+HWDfBqrmQZf+KjZ+Wu/cF2K5pOzs/cG4tS8ZvLXtkMNCuqqcHui1XqHNeEGOIMXZoUUQBGrOoj3+d4X5sJ9SMEg+i2eAjbTQrNSv5FUfBkxPO1vQKPDjVKLO4nTViytPZd0eo3UChcG1tKjDzxN/0+oAqwi63MqSjbTdezx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4d00c47-fd6f-4bff-e0e7-08d8c1333d3f X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 13:15:09.1612 (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: Pj635vR3+CCna+5aTU5WjqeUhxZ09ue5gu/fSE9dXYXy0/SmjenXtOUMZe/4485Ew6XV+TL4mkFL4kYMIqDeJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7930 X-Mailman-Approved-At: Mon, 25 Jan 2021 14:26:22 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Li Jun Add super speed EP config. Reviewed-by: Ye Li Reviewed-by: Peter Chen Tested-by: faqiang.zhu Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/f_fastboot.c | 47 ++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) -- 2.28.0 diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index e330456390..c2abdd66a8 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -128,10 +128,45 @@ static struct usb_descriptor_header *fb_hs_function[] = { NULL, }; +/* Super speed */ +static struct usb_endpoint_descriptor ss_ep_in = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + .bEndpointAddress = USB_DIR_IN, + .bmAttributes = USB_ENDPOINT_XFER_BULK, + .wMaxPacketSize = cpu_to_le16(1024), +}; + +static struct usb_endpoint_descriptor ss_ep_out = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + .bEndpointAddress = USB_DIR_OUT, + .bmAttributes = USB_ENDPOINT_XFER_BULK, + .wMaxPacketSize = cpu_to_le16(1024), +}; + +static struct usb_ss_ep_comp_descriptor fb_ss_bulk_comp_desc = { + .bLength = sizeof(fb_ss_bulk_comp_desc), + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, +}; + +static struct usb_descriptor_header *fb_ss_function[] = { + (struct usb_descriptor_header *)&interface_desc, + (struct usb_descriptor_header *)&ss_ep_in, + (struct usb_descriptor_header *)&fb_ss_bulk_comp_desc, + (struct usb_descriptor_header *)&ss_ep_out, + (struct usb_descriptor_header *)&fb_ss_bulk_comp_desc, + NULL, +}; + static struct usb_endpoint_descriptor * fb_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs, - struct usb_endpoint_descriptor *hs) + struct usb_endpoint_descriptor *hs, + struct usb_endpoint_descriptor *ss) { + if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER) + return ss; + if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) return hs; return fs; @@ -219,6 +254,12 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) f->hs_descriptors = fb_hs_function; } + if (gadget_is_superspeed(gadget)) { + ss_ep_in.bEndpointAddress = fs_ep_in.bEndpointAddress; + ss_ep_out.bEndpointAddress = fs_ep_out.bEndpointAddress; + f->ss_descriptors = fb_ss_function; + } + s = env_get("serial#"); if (s) g_dnl_set_serialnumber((char *)s); @@ -283,7 +324,7 @@ static int fastboot_set_alt(struct usb_function *f, debug("%s: func: %s intf: %d alt: %d\n", __func__, f->name, interface, alt); - d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out); + d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out, &ss_ep_out); ret = usb_ep_enable(f_fb->out_ep, d); if (ret) { puts("failed to enable out ep\n"); @@ -298,7 +339,7 @@ static int fastboot_set_alt(struct usb_function *f, } f_fb->out_req->complete = rx_handler_command; - d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in); + d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in, &ss_ep_in); ret = usb_ep_enable(f_fb->in_ep, d); if (ret) { puts("failed to enable in ep\n");