From patchwork Mon Jan 25 13:43:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370222 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3992137jam; Mon, 25 Jan 2021 05:26:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXKXqvytIO5c80Ne8eDdVY9UQI+Rss9ILKvO69/VOdn3LjaGQ4rGirarOJVNd5Nq5T36tJ X-Received: by 2002:a50:ff11:: with SMTP id a17mr452195edu.63.1611581209701; Mon, 25 Jan 2021 05:26:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581209; cv=pass; d=google.com; s=arc-20160816; b=IelDPdgxffBp1aXfH1MEA9cqSinIIOjqiHiGxGijInYB8q0UoVp54rqS5phBgnSFZ/ rOLQP7Tphp8ZgpNbUce/ZchNsZIvqu/O8g+A863NiKZOCmREBIpQhjH7ANSPJ+Dx3Wod QKWUPvrRUheo2PqwsB0eHez5yySZ3bP4WbI/k2nCONs3PM99mY8sTJadnRsIKDLz4X4T pTZJbO92Pa4D55NClLEvIECLgoJk8UhBMEJRFUMyObup5iaZcfU59cexDI5shQUW3gRs wognhgAzTMHBW2enZJHpEvq4CiuvHeltDDACoUvAXNQmsJ5MbHWZ2gY9Rsd5QEtogy4V lF7w== 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=0vrWUjyfJfL5GNoteJflp9o+ejCHhKYInLq6pnuB3KU=; b=w5MvjaaJ6uTRgdcT4qvD5Xvp1gOYG/bz+OaTcVziXfivWFU8Hk0jCJ6hfXlbDne8fW AtI5kPqAIC9ABfa+NVvOV0eQEoKxIZXabznO4ZmcMeMTPQpjDBCEISCm11MwwY/e6q7S vgBmZFXCg/BwnnNWxitEvv9jupw0xGytsHrjJrl6YhUWUXFuJ/yDmN7a8Fd7Rd61CC01 QcrQxYgH2l7KH95S07R8U2cWM2+gCGqEhDFCxHqqM95F9tnFUu1hHlw0VOl5g7ughNH2 w69iHsKAx5Wi2WaqEz+bAs9tf8W9r69UzUEbinOHF0JPO4Su+4OgQgpV3yCOtIv8kFlH zutg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bkc1oFJr; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id o11si5950684ejn.707.2021.01.25.05.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:26:49 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bkc1oFJr; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 A19DC826E8; Mon, 25 Jan 2021 14:26:28 +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="bkc1oFJr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FC96826C4; Mon, 25 Jan 2021 14:14:36 +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-ve1eur02on062e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62e]) (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 72E278267A for ; Mon, 25 Jan 2021 14:14:33 +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=RiIG+sq4AkaVOKrxm/6BXTp374KnGwo71i/smS+XNbTIgxW32dlkI5AY7DCC7pE5zwFdH9Z/sCcMvApLngqBlQhbl0RE8gDUan3P6cQfOlnew55bcQPxOxYH1PBt1nJgbaMopzEQy+ibarpCGmYvYo4Xh9PrEIyxxs+FhEnkQnyvNFEZDdTUkMjXUb1zRbli9hrPrENTOSKbaZGjknoRnD9cJoELJV+MIp6VAN6Kh94yQLzObtEugnVe3Lt2bvLLSHktLWXO0wmGqM//RCfr/kSSjxf7kS6eCJngN3eQerkSLzi0YM5IxjP0weABJDQXlA96nS+tOwhU2K/Rd6xx2g== 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=0vrWUjyfJfL5GNoteJflp9o+ejCHhKYInLq6pnuB3KU=; b=ghbyQVqzsxZNfMgRcD+lR5CZN9z5QT09llCPTEAUyiQkK6xuK2OG0p4ata3JIuRTYqgQzem9yK9i8m9vuAJldfBCIiHGcdlza4423o4RB0tBaFPN88y3UrBh8fYs/+loF3/H1KIvAB4wdxQaKCzNv7U44oZmscBza2MhwCq+W78BvpIWN2KkDcAN5V5fjL94i8+28xove1r17np2ADstLJ/iGgUcDHZpMel7WizXmoVYvyJJ58QB3eaG6qTeF7tD2IHNICR8AvHYuKMnSNEJ6wFyfP0e26j17BPjB94X1rASfK3yFqctVM04gfhvJchsYjtxEnCqfbJyNtgxUDtXIQ== 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=0vrWUjyfJfL5GNoteJflp9o+ejCHhKYInLq6pnuB3KU=; b=bkc1oFJri5I6nkFFKwzELlPbR1sTUZ1Qt20gae64fnzGHx2CWCfG83Vv2nibpKdRoD17LJj7zVePmrlm/DEWK4qv7YPyFfzpHXpMG0ORTXl1QDY0ZV3tNtb04M60cGGV1HVGOQT8zZxh2nS5elVcc5Buea0BLXskTih+T9gwL0Q= 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:14:32 +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:14:32 +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, Ye Li , Sherry Sun , Peng Fan Subject: [PATCH V2 01/17] usb: gadget: Add ep_config call back to usb_gadget_ops Date: Mon, 25 Jan 2021 21:43:44 +0800 Message-Id: <20210125134400.780-2-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:14:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f6f0b01a-46f7-4e47-62e9-08d8c1332783 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vp8ePAuclTlT1UuhLWgf/eejCBf+fVhlUGhDKSJBUljGl3Q+ZLpAM/OVq+HO8awO7+H3RoqEQvIx0YNAMyyOn56QTe6yJgVozQJldIKuVz0iTcAs9S9RA7ZZhJvF6GZHbhS70A7wVVTP+nh0T/TOHobklYVj1fco85c2t34+8jzi2n1GuKEkXiMqloq/NKf87gbwqh1Pu1xzbZktnOXguwTOR3vQ/vKtcKUrXIgg1BZqySCSmoWJPD4szgNgiFVhuBPcMWzag5T6J8LEx5jTn0E4lQjBkgC5axleU0AYCjZZi3a/Nl3fwHlsymzbWIsxaeBw8sgg8tltL7t3AjEpx7sF3shejd/TL7Vc3cy9rfMAW4OdXOVzelR1FdWGGuXbsz3yNY4y7GSlpSCAKNSObg== 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: uVt+f/c9Ua1fDxuM/Qz0bgikdEsJO4fTk/awRLv3qjT1o+U+RT7vwIuFh+c4UzUfxQs8PJ6v0YszcdXDgypo5Ydyy7D4g/TGGH7doocKYIn1j/RHwbkF1XF3KYcpsMpQIofAYRPezyziJ9NF6NW1h4QtHBdchoaFQeRiMCcmUITOZPo0TjMTRG7U61+Ege455Fnxavk7QL8O5BRCcd4pSyVGSXzkBRxClvnr0kABCSx6zNSOP3DSviYBA4C1i55QpSB+ZEfhGY32pQCGclR5T394Jy5fa9szGq4BE/EKhd7PG43orc3f1kvzqATjoRNp+B+pbaJvMFyqcDsL0HVdeKeQckAroMrtoR9E9AM09Q7/WjdEYrGLCrRDdSGxaw07Jid68uc6Oxgfk4kaT26zEuxC7bgItG6Hb+Z6xZkKz8INPLLIgiq89ZvewDAstpWe987eFRazHmTRiaDunSG7AbA2HNHcuPDCzMuUCBVD4/4CewWiL73iF0W3PATKhStgE6udxuM1U616kIzYqvV+rHZSGZk/nRVNCLlSEWjlyabUe2b7xOmbr5AgilWBAq42yX3kvPQqEkbdB/GqOsODM1GWJjfw6FFIRFgHz3oqCziT+kPht7ZH5cXGg7xOilX29LiIEC/hvSv5fvLpER0WlrhQwXFGdoMQuQ2uWTENgUy17sKy7wxNnEuItumYB/1V11WA87fU5NAl8tMttxOzEInU1dR2FOPoHmLWg0EK74nucDy0cybZH/VV5JtiSUIThKRSQrcO6DbKYF9Uc7+azuYH+sBzln2RiM+tNbf6PQwiSlfFQohjsZKpo0sh7PwWJmGcnAX0aFI5GyX6LCCg2cV/Iii/tyQCTIZpywV7pI4HNhUXOqh6VtfrUZCJljIh+3t9QN3qAFQTEZU0d2QaqUYHEczVQ5yAAC1tga72CSYICwq9m/1z8vor7dTTr+dZ3qhMWAVuQi+oJEs7rvHQbYB7NHG26PlZAs63l58KkZLhMgnsAXq22OG+h/DLu3KO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6f0b01a-46f7-4e47-62e9-08d8c1332783 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:14:32.5958 (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: VroVeJzgvBN0I9qznrSzBOvoGJYAEJBpuoF7lsw8WEnCk5Xg09jbDofIBAPrSUEHp/XiQ26UvRHS/9eQl2skKQ== 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: Ye Li Since some new fields in usb_ep structure been moved to usb_ss_ep. The CDNS3 gadget driver should replies on this operation to bind the usb_ss_ep with the endpoint descriptor when function layer uses usb_ep_autoconfig to add endpoint descriptors to gadget. So that CDNS3 driver can know the EP information and configure the EP once the set configuration request is received. Signed-off-by: Sherry Sun Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/gadget/epautoconf.c | 4 ++++ include/linux/usb/gadget.h | 3 +++ 2 files changed, 7 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index e61fe5d114..3f8842976d 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -167,6 +167,10 @@ static int ep_matches( size = 64; put_unaligned(cpu_to_le16(size), &desc->wMaxPacketSize); } + + if (gadget->ops->ep_conf) + return gadget->ops->ep_conf(gadget, ep, desc); + return 1; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 06292ddeb6..8d54b91734 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -470,6 +470,9 @@ struct usb_gadget_ops { struct usb_ep *(*match_ep)(struct usb_gadget *, struct usb_endpoint_descriptor *, struct usb_ss_ep_comp_descriptor *); + int (*ep_conf)(struct usb_gadget *, + struct usb_ep *, + struct usb_endpoint_descriptor *); void (*udc_set_speed)(struct usb_gadget *gadget, enum usb_device_speed); }; From patchwork Mon Jan 25 13:43:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370223 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3992326jam; Mon, 25 Jan 2021 05:27:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0m29fu3Wch7PhXE0PjVH3vZOPJYLNzI0Qb6cE7Csb2h8/70dGmGT0WnmFmxXIoyUAtr2L X-Received: by 2002:a17:906:ca52:: with SMTP id jx18mr364468ejb.385.1611581224321; Mon, 25 Jan 2021 05:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581224; cv=pass; d=google.com; s=arc-20160816; b=Q3xdLP/5hfnAjlLFJjCO6wArYhYIOi3WcWTY0JFCOLp1bucgEz9cghi8U9nez7EZKC d2xRdI2WmesGvAB7X6IeEbqLmvKEqQaTGCx4XGkKLChB2MIVgU3fcZr+v02igxKyAFla TcWgTLm9AVUtZoz6Vgn9I6vn57rez/UylXWMl8SRKAkndUqAUU9kreiiNnl9LXhOSGNO rBk/bX4s2cKvCMKFZGx3ae0fZQV9IeNTu45Bt7sOzp8574CiHoh2P9Koj6PHrGInlhCa 3nUJQpxbtYHLbckWHm+U5n/PrP7nQbpGRu7MA75rScTePODEtDb8DWcolr+Q6HmQoGqE sPXA== 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=g+O4Z6/061KpMVfVlB+EQAM81GFEf6hKde88htQBKCM=; b=vhpKjxyzAf8PAEuyeGlT+S2sg2VLMFcRu3nASZ1y9bC3KjtK3viCexkSWD3N31VFMN tUHqepF6EpkpLaCcJ2EjD9RuGr0FvCG/Y8+DHQjHRnzlijylY/D3NkM5D8o0tlRRARoQ GcuMCxQOGtXlL60DCHsomCvNCTIEKw82L/bcB/bMcjUGN4/NpDn0SeXQLuEV+/wSy7wO Biw14GQE6Wrz30ruKGpwvhyP8rcTrDLLhLhzXxlR12przdD+GwtIg6m+CPYP3BVMKxE2 SZeLpSHzcfcR5z6hria/g6ECpzPHW8HAZbAawBQyThkOq9z50jdLxeMrugce3rEtnX2x 8cog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=og2beh5t; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id kw25si5199258ejc.150.2021.01.25.05.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=og2beh5t; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 82AFB826C8; Mon, 25 Jan 2021 14:26:31 +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="og2beh5t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1573682679; Mon, 25 Jan 2021 14:14:39 +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-ve1eur02on060f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::60f]) (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 74FD5826B1 for ; Mon, 25 Jan 2021 14:14:36 +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=LArCa7ejmUrabYNaUs/AJLZ7IIx4aZHS7iC61DdI1Rw4L2VpT9tLR7yb/OEYQi+g3HJMeFYOI9q3ZQHSbKncL0zl+Eah9NZD0DxoMv3+lOj9pLncq5fSazYSKiS+BylBKSZReEdDxXmaAQ7SmfKFKYDk9f70V1UQeh46Ttlc79JTnaDA+nVmdmg9z1YWD6suTkNxIGuhnzLbHYWzY3Z5O8QiZdY1GxIM4Q1Cd/qoOC9Itth8N1cP4a4J1IWZSLgYKqWW5pBL7NoxLvekWN4U/bD5sUifhHBuWg+exr4UlvEcRbxBjBidZZgYBltE2e7zY4Ijc8GU2LGGyaHInAzrSQ== 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=g+O4Z6/061KpMVfVlB+EQAM81GFEf6hKde88htQBKCM=; b=bJ/k6P1+2gpcUWufkIks6rboQdW7vf+/7aJrElt0L12yuPb++nYWVQo9XnP+AiLdN6CnZbLqOWNPN3OtocXpBsL+g9vzXU2K12VaVTvv6rEvNRiah2EP52WEp91ymcQM55s+72qRk0EYr6LBbCQ0Fd8qSMRsHI3G/m7m878z8QJ9AnEoTOGV4r9hikdX6wAatJK/LaJjHi3QVHk+YR1JkTusK1IklhE1yIXpZpJ8YoGwvZNDb9VKl1Hw3xJu/1rby0ZWD2z8/gTpfb2VrA1vZGVQr2n/E+zs/biia1jpln33Shh3L8MkcVAKHp/oK6rIwPi7scc5N/0o1H4bYn84fw== 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=g+O4Z6/061KpMVfVlB+EQAM81GFEf6hKde88htQBKCM=; b=og2beh5tc+8Qes20ikHCg+p3cvZNXx6r0lusee/2VCCngTfgOVDBr6O0WmnbMoSSoBuCwJn50VeD1TkVLu/mlT+wvkiS8XBpeT2aUsIdauen26+flhEjy6BnlHsSq/1LX4MedNmeoQZDTt0uvdZC5DmKURQAQ+nmtVgdh9UGZvw= 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:14:35 +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:14:35 +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 , Peng Fan Subject: [PATCH V2 02/17] usb: gadget: don't change ep name for dwc3 while ep autoconfig Date: Mon, 25 Jan 2021 21:43:45 +0800 Message-Id: <20210125134400.780-3-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:14:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c3fbcc0e-3830-4f64-8089-08d8c133294a X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZhpkY8tt1j1MaN6DvYulLE6OXh426KoosaO4Ec9+xXrIOMhX+a1uCM442G4Osqp3cN8Hy93694hTy0ugKxg+YNtT82/FBestsgFxso+mAO3IW1wWeGlGD2lUunW8qt/nF7RpQ5XmbtSGp1XhkOJruRPEx07dB1T1SwoqmFESkGSFLJk17rXQQOOKuzwvh2D0xGc87gPuM4BKOe/WVFbHGFKfYFlx4X9FA5FRSUUoYfUwaRCWYrGIB8KRqHzIpHVKCWHW10jfnKr/FG6l7YiXpYukkCrG4TnLpcZro/FH1bewqICzqYpR63vQEvZI6OAYRScsEYAGiZZB1ENmNLeb2CdUBQr5Hf4NIOFW/6jPBXNQWuNoSn87SvJgE7UGH9lVB/DJeBhPU8YFTCCu7rTv3g== 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)(8676002)(4744005)(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: 1P1KwMOdRloF/+ohgmBIbAqiEBoAVc/ZdIIC6UttfUKhC6WFbADvCxT2jigjpUWQX68kWtrV+tLkWLOAsbIDur4/3MOYuzSE7h4u0s0uaWE+uzihncreKPG4eXHBoT/tafboJumRAePuPGg+9pkMVXm0FxmwTUTPUUwbiEpxEoCKchba/RslwmZ94O6M70WhDLAiqqGUrc68G0Kh6lPHiuyMc2/6UDzRXgsK0jvlzhc41PvK1xgVwSrv5LsbwOsxPCibOuq7fqS2fti1lKpwQLNCzzt1epOqT+nYBQ/jD4zsxCd0AYa3352RTGgCJa2lth7KD+7JU3znKUjkb4eSev2FOwdtqghwbIqauWkw63gI9UZx0chVql8P/heUedO+4eyaLli+ZuU1bvfdfddoSBA8+zaHEEsGPb6HU7aF+cZeHHzRGKy6i5d5U3zks8DUtYD5BairStAwDZYUKy8cnoejg8S2K4BgDbk6N/PJtCce33yqEjeFQcieWaxzwJGz+a1Hwb8GNmRYNIEYBVceoZWqEAG5Zem5DHTefrE3wHSmXckfOIOy72/f89UbMKYCis/4LNAgtwaY6FnxG/TyYjSrvUc7d9tRSa3pD3sxIsaKmUFaxAmty8tE0lJr/Psb7Jht9w6V4WhSR/sxiOzJtBLOQToTHtuVi58angRF8vYIknM/9bHq7wDMIXr9iNxegTS8u/Rboftgh58V2gBE6FnEkkcq00FUwSVzxrsv/HTN1xivX0XG61hHGVCL97QEQT444GqH5+bv+sHhzB5ObED3anIlK/JE2wXNkyQpaeSvjK6Am18YlaK00T+c5Sr3H8MWP+0V6x7uYU5cFSU0vpEQSnMBq52m5bjMJwavFXeoetUXSRiKibuEvb8KJ9kly2JLivWO4u/YrClvU7O+GCXD9hlDXtrJiElfy0yQPa2KxZatddUzsDy4zjG++Q/mTuT8BFgUX8+hY0X03eyqCYkiFW3kR9sDPlky2/SYi9P6rg/IQGMq1gCyrdpbaph1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3fbcc0e-3830-4f64-8089-08d8c133294a 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:14:35.7424 (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: /n8GodbjODipRUT5IkNrvePTCG7icEOvMRXKGjPC2Ktx6k5r9PObfU8GeE0uxjxZTwCW/BHrbBdMMqxaJr9qHQ== 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 As the SDP protocol use the predefined ep num for communication, we can't change its name hence reset its ep num while do ep autoconfig, this is only apply for SPL. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/epautoconf.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 3f8842976d..7da334f5d3 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -262,6 +262,7 @@ struct usb_ep *usb_ep_autoconfig( ep = find_ep(gadget, "ep1-bulk"); if (ep && ep_matches(gadget, ep, desc)) return ep; +#ifndef CONFIG_SPL_BUILD } else if (gadget_is_dwc3(gadget)) { const char *name = NULL; /* @@ -284,6 +285,7 @@ struct usb_ep *usb_ep_autoconfig( ep = find_ep(gadget, name); if (ep && ep_matches(gadget, ep, desc)) return ep; +#endif } if (gadget->ops->match_ep) From patchwork Mon Jan 25 13:43:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370224 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3992519jam; Mon, 25 Jan 2021 05:27:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYXC2eEIU2R5IxgAYt+JXQp43caFdZAzZSxMzC6tgx7gEtflIEMYi1HycCM2CY37Jcu+uc X-Received: by 2002:aa7:db1a:: with SMTP id t26mr474439eds.25.1611581239177; Mon, 25 Jan 2021 05:27:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581239; cv=pass; d=google.com; s=arc-20160816; b=eDM9ogCBXssD4nKvF4ae2dsKYg0dHZp5NYdH5fXa5/Rp2tJi1oG/KgHkWjTDk56dmg HD6LYkUcpThamqNFisFDT9G/R70k8UsEho0rogZIz2pua3lnnw44Dld75Oia/xO51vZb d8yNSoxhFVC6d8riNhEJHl/wUsP7u5LEACpq3nCBYBaM6/6LRIWtxrlI7BItX8MMfuLl o4gh6z4GB25uIdNfzGiszLMG7M2wRu58JcOFMSbRKyTswpTXjNByI4cNDnEAAsNWA0wW kKJDWSGEchw0yOVRXky5+E4C6t9DhMagBqvfcDr4BmwihSQ4JOB7C8WnLmHPvvuzoMjJ Jmfw== 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=C3kN8UVs7NkJBkzyDtHEFIywoCCPoZ3tryN8+Ofcai0=; b=pprJkPP5KyYf+ewvb9zxwYIISnswKt3x/fnUO8d301DdrT2ZGnZJPJodv6yqrqOHhN JJkfxscZQD3ZaVxOQCb48vNFQMYq1JYZJYXrppiTv8DdAP4upC0NRvANmfvlRTuDCgJ5 olfx0ta+85J4tFkLKeT0KTt0325f5R6buSVnHvzUWuORdqSArsVDXGcqFq3LeeIvLpan /G3ZrT5kQNcpPb87JS4dyRS77uXrziqPXkH77I2/tZJkI4UAT1iovYfrxy6UkUV3nM3E UqbBGZTWn56GJdXwbadyU3VEzKv4MTWQjaBuOwBLZyJAvXcYfHTLp4Y+hVSgpOox/IgX ZbFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=sKYfqsJc; 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 dk25si7079471edb.583.2021.01.25.05.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:27:19 -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=sKYfqsJc; 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 AF2C282709; Mon, 25 Jan 2021 14:26:34 +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="sKYfqsJc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C53982679; Mon, 25 Jan 2021 14:14:43 +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-ve1eur02on0619.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::619]) (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 D07EB8267A for ; Mon, 25 Jan 2021 14:14:39 +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=PlbHh0eGASmPkzmMM2jp+iWhGXNh8VhAZEu9HrkvW2kt0vuNy/Hl/EgKxy1EAbekDp0iM9MSNV6UUDQETPnckSpTwn2NKS7C03tWInFy5AiRLqyE+aLSP7+0qFKgvA1BTTUBSWZAoWkIfuiUAjeGcZ+HLVQIhB6mTxaazK9Mbdx841X2MyG4UOmam9qpqjYz/J8iSBDn1PodujoOXDYcJ7wyDK+y22b3XnaFwfKjd9LHw+PcbuZFCTH6qhCw0aaGFtNJpfZSqqnAprqhcn1ET3CV0vLecYxsWvucYGEib6OGEuSqMT+MaQEGtNljlWdE7aUyGCZ2VmyNNuetHqlCoQ== 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=C3kN8UVs7NkJBkzyDtHEFIywoCCPoZ3tryN8+Ofcai0=; b=hU03di8ZzPfNFJMf/2qRC6pEAv75YejCPrvJz4Q8rpsi30ai/O9KorkAonF/V3CEduQ+3jjEgFWT6A5M/05Lopmi3NFO+xLw8ghG33IltGwFUwvH3RwpCYXefZ26b9HPv3hpc8naE0SnYxa0JF1leeD8DaQRFizP4lSAsPR2VSyT1eNZrjJY61bgbm6zTkAdF8xMlCw3C0/ciL0LmECJvPde2h8+GSawn04rymKXG0hxEIXPQY1OXa8oCxm46h6BeFP4WuKHrMWMDoRoiyXkEEKAirof2bZGhDkwQCkrsurJ/9Lh2YimnTH5amk/xjKGYxUsh0EIQYMogs1coNYTmQ== 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=C3kN8UVs7NkJBkzyDtHEFIywoCCPoZ3tryN8+Ofcai0=; b=sKYfqsJcStpWpFH29zbO2B9dNyASrqaRmPOVlt0VZkWOHpPHWTl7HXOEvc4Vw1TufVaaXqd0x4Ej/LufjmDRyQwCa+W7MzX+1JFeVZp+g3dvqkBJ3oUZkMFh5OLqVsorWB8OaIWYZj8kWsuL2DJbBOFVgMc3FlbxvWX2xP1LZaE= 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:14:38 +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:14:38 +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 , Peng Fan Subject: [PATCH V2 03/17] usb: gadget: OS String support Date: Mon, 25 Jan 2021 21:43:46 +0800 Message-Id: <20210125134400.780-4-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:14:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7793be70-3071-4212-8b6c-08d8c1332b34 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:849; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P/h3VTOpohE8livAcL/BLjFK3ZDwifiVGAv01hFpEAeqqvRvd9TIouhfYEjW6Z16Hd6W/wD4FElWUcrn63ofrA4uUA/kYw9udpC21MQTxhCxBTGZ0FXs854XShSy60id8D/pXDpjoL3i/rPg76/l7EaRpg/UpGkoHijvVtPpIG3MEWdKlXoNwfbT/LsTrSGOsgdIRAI+fjeQ3qUb34kZnsQ/vP5DDWScAj5MVi1CMXiAcqaybJFhMKQm0u4JwuVcYJ2tA1jSXc/AfLPOGaBqbgPQx0G51DijZMqXGapQArsigPhuglsBZfazb01qKWoUw+zfFDp4CCcf+nogu4NNWEhoTNbp+jmjvpUuX7isHc2UVjd7Rfw/lUV+gPLu8k0QnUM727NPOlJaIEy/v8EAyDbjHb96b1bDlaxKGKfyX+CcqoL+lA51aVT3lxqn99Z53WgfndH7d8uwxvHpLSVQ5g== 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)(966005)(478600001)(45080400002)(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: =?utf-8?q?4qq7ErjwF/J9kRZTR1PC73oCPaS?= =?utf-8?q?6OTX3uy4wwRsQDbwS9g4E1jL5otEq6kh5fS2DHPi+wiSHw3OjpcFWeTS?= =?utf-8?q?877lksHRoOmCUU8KAdwmZmONMYNj4JVcM/o1zNjb5xClXxSEoCgbrclf?= =?utf-8?q?eVFjAO2aN1rFG0LJ8H25QBF5idWBoggOCimoGGNol9koJcdDyOM2/cso?= =?utf-8?q?BWjAh+Tj0GbI5h1q1dlhAxN2wX6fq9aEnlTHjvO8IckAt09rs/T9yER5?= =?utf-8?q?//0uy3o9YwxEwspjngs3H7P1e4gDZwcvojHCYUgP9Giv7qBpEzy1Hvd6?= =?utf-8?q?/Y3tWOGLq8rO64V33tV/uNqIlAj5CBAMekMNaihibM0VEs7t1ys8BkoS?= =?utf-8?q?9ePj4Pp3oi+sjRw75XXcv0IDLoJ1fReHFOID2IRGKq/TDm+1Z/n19SjR?= =?utf-8?q?LUpEw1XZEwK+AkvpPM4joB3D2uIw6kE6GygTfRLEu7mI2szG6DRzBpuO?= =?utf-8?q?1DB12gPJpHlhBaxmupyk+PU7N2nFO7C/23yBQ4Fqe/AjEthy/pVn5isI?= =?utf-8?q?FWbMLAxahLS7uslw2q7eGEqz7yNGFn8twIBDnjOknG2Z5QwTQmyQ36GP?= =?utf-8?q?oMGb1muFLaU/Rl5fCDRlb/2A08LTNvVd2pa/JYHc4bBHqcaQc4w4ZGKR?= =?utf-8?q?HSD3kcuTk/kMO4olAy/jiiJNJjwVJLwVPXhTqvh9RTsvYpgVv2WlHUt6?= =?utf-8?q?7SxUfPd7z13uknBwUFtgz3qma9qZXtBoe5/uKiZtXV36UFaApU5XiqNV?= =?utf-8?q?qp3T0qfh4fQLgVQS0AaeftaDdn1RcZhcREFKAjiek4DS/qKiiq1EHyrY?= =?utf-8?q?aI0wEPo3elA4IAdm/vE+Lgua2LH9pMHw11hn0cfiUGirKrWnr52B3SS7?= =?utf-8?q?yH+e0JZ4OO5hYa9i8m3rAjMYH+lS5vZ1ZAHBtYQ7Z+0SNWrTY1Vw/ZTi?= =?utf-8?q?w6OG+JrUwOe1g8YlAyAwGrD7P+v9+CBVLNeEhXkHvK9sTRNgZUSkmloB?= =?utf-8?q?e4cSpffDZEzDNXt34ynPs+a9RcKxVr5AEfyFf0dUzEsCi?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7793be70-3071-4212-8b6c-08d8c1332b34 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:14:38.8790 (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: 2HGjqv4Vki8en6R4Q5bhZ8Aghp7SnUrvBVX3f+aagCKNFwYdkmOGDf9iwm9Svxch4we+rW8hjvty1EsG/JpdKA== 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 This is a porting patch from linux kernel: 19824d5eeece ("usb: gadget: OS String support"), original commit log see below: "There is a custom (non-USB IF) extension to the USB standard: http://msdn.microsoft.com/library/windows/hardware/gg463182 They grant permission to use the specification - there is "Microsoft OS Descriptor Specification License Agreement" under the link mentioned above, and its Section 2 "Grant of License", letter (b) reads: "Patent license. Microsoft hereby grants to You a nonexclusive, royalty-free, nontransferable, worldwide license under Microsoft鈥檚 patents embodied solely within the Specification and that are owned or licensable by Microsoft to make, use, import, offer to sell, sell and distribute directly or indirectly to Your Licensees Your Implementation. You may sublicense this patent license to Your Licensees under the same terms and conditions." The said extension is maintained by Microsoft for Microsoft. Yet it is fairly common for various devices to use it, and a popular proprietary operating system expects devices to provide "OS descriptors", so Linux-based USB gadgets whishing to be able to talk to a variety of operating systems should be able to provide the "OS descriptors". This patch adds optional support for gadgets whishing to expose the so called "OS String" under index 0xEE of language 0. The contents of the string is generated based on the qw_sign array and b_vendor_code. Interested gadgets need to set the cdev->use_os_string flag, fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code with a value of their choice. This patch does not however implement responding to any vendor-specific USB requests." Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 26 ++++++++++++++++++++++++++ include/linux/usb/composite.h | 10 ++++++++++ 2 files changed, 36 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 91ed7fcec5..63855af52e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -25,6 +25,22 @@ static inline void le16_add_cpu_packed(__le16_packed *var, u16 val) var->val = cpu_to_le16(le16_to_cpu(var->val) + val); } +/** + * struct usb_os_string - represents OS String to be reported by a gadget + * @bLength: total length of the entire descritor, always 0x12 + * @bDescriptorType: USB_DT_STRING + * @qwSignature: the OS String proper + * @bMS_VendorCode: code used by the host for subsequent requests + * @bPad: not used, must be zero + */ +struct usb_os_string { + __u8 bLength; + __u8 bDescriptorType; + __u8 qwSignature[OS_STRING_QW_SIGN_LEN]; + __u8 bMS_VendorCode; + __u8 bPad; +} __packed; + /** * usb_add_function() - add a function to a configuration * @config: the configuration @@ -577,6 +593,16 @@ static int get_string(struct usb_composite_dev *cdev, return s->bLength; } + if (cdev->use_os_string && language == 0 && id == OS_STRING_IDX) { + struct usb_os_string *b = buf; + b->bLength = sizeof(*b); + b->bDescriptorType = USB_DT_STRING; + memcpy(&b->qwSignature, cdev->qw_sign, sizeof(b->qwSignature)); + b->bMS_VendorCode = cdev->b_vendor_code; + b->bPad = 0; + return sizeof(*b); + } + /* * Otherwise, look up and return a specified string. String IDs * are device-scoped, so we look up each string table we're told diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a49a66f2f8..d4f2a49869 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -284,6 +284,8 @@ struct usb_composite_driver { extern int usb_composite_register(struct usb_composite_driver *); extern void usb_composite_unregister(struct usb_composite_driver *); +#define OS_STRING_QW_SIGN_LEN 14 +#define OS_STRING_IDX 0xEE /** * struct usb_composite_device - represents one composite usb gadget @@ -291,6 +293,9 @@ extern void usb_composite_unregister(struct usb_composite_driver *); * @req: used for control responses; buffer is pre-allocated * @bufsiz: size of buffer pre-allocated in @req * @config: the currently active configuration + * @qw_sign: qwSignature part of the OS string + * @b_vendor_code: bMS_VendorCode part of the OS string + * @use_os_string: false by default, interested gadgets set it * * One of these devices is allocated and initialized before the * associated device driver's bind() is called. @@ -324,6 +329,11 @@ struct usb_composite_dev { struct usb_configuration *config; + /* OS String is a custom (yet popular) extension to the USB standard. */ + u8 qw_sign[OS_STRING_QW_SIGN_LEN]; + u8 b_vendor_code; + unsigned int use_os_string:1; + /* private: */ /* internals */ unsigned int suspended:1; From patchwork Mon Jan 25 13:43:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370225 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3992758jam; Mon, 25 Jan 2021 05:27:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJypO3+cikrDpg6fEsk7btBqQ3Jzd0nggRbnpCcldfYqdB72l+oEF3bb3jnzKtWlsSePovLA X-Received: by 2002:a17:906:3ce:: with SMTP id c14mr353980eja.497.1611581255508; Mon, 25 Jan 2021 05:27:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581255; cv=pass; d=google.com; s=arc-20160816; b=BX1QSn2hltNgPblaIAdrAR4HAk9D8aO10pfVIWq/RhSvnHrM6XHALd9zRuaelMHCUE l6TBbxFo+HYbxxSIwX0PiB+mHjnZDvkXrJqhY49HW2sU5iYi+Xi8EykEnycqnIq14KPD Y3FK255s+WOtOTaFRHO0u1q9Nx0CWw/3PX7EBUM0g+lRuyaPzbmIFlCH5iRpyks/c/I0 d6rqkqTT01fI97mV/Zs6v8k5nQJOu/jYHTupm7PCbd27T/O7sa7Ght1ZA8XFgwKhadE+ rOuk/hABj4s3SqSUuRMHu4QNfw2B2oGGODh3HUYkUgLfChD6f+S2IKn9/k6mD/p5r9Qm NTsA== 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=qSzIFOAmLwBm07txlGSkMyvvanwWEjR+5MWyLOMY4/o=; b=xIYD41q+75rBDHHhQO+03ebdfprC6lnQrEt8EqyJNP45Gv0RkPLUAKIoIEjkBE7s2H DUZsaR2X4uK+7XKQo/kKXyff7SgtFe7glppMgi2OCImAC/9/40UsLrnTqbEy+Z8m/NFp +WW422inJ/eJek3wEASEBuXeUALfNwvr9sjHqu0PHmQNge3O7fUXmv9Vo/HINfQRdoAu pLKim4LTyfqI+JRAFhcO/up3Pvc4tPyKSc3fX3FXScl5gC+XCHBNf8Ovot6LeJi39b6p VJ+tjOEpF2HKfla1hrbCOYUXHXApUItMrYwi7kbdGv57mAgvYPw5NskjPazuB+7EwI/p wrxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=njB5ZC8j; 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 a16si5895983ejt.459.2021.01.25.05.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:27:35 -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=njB5ZC8j; 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 DF62782713; Mon, 25 Jan 2021 14:26:36 +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="njB5ZC8j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8425A8267A; Mon, 25 Jan 2021 14:14:46 +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 EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::629]) (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 81DC582642 for ; Mon, 25 Jan 2021 14:14:43 +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=oMqokSBOuyaNpmh60jrNaLdief0Z66p+QDnMH1WSUVfIInID16s66ZE6OL3AHZu1Epj0om6wqsLEpnXR7HAslxFKWVdiVS+C/2NNTVcQgU3J2AVLrBA18iLcbP3R4K5Cy35QS3ZM4tRGDuibLsGKGJAvY5oxvHvl9Ffs0Alyx7ss8HsEm1oTUQWvmeB6rYiCtSrMaxhgSLkEvOVEx8UrJc+ofKZaSnDnpX87GUhxYDcvA2F4BYdTgJIa1hYSqPVrf2V1/wSKmGmd9NKiDacvPVizfSLZthH91VOTDiDXwMZVInPp+7zSa4EKmcLmeLocZg5BtD2CzY5Do7mFqMBDxQ== 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=qSzIFOAmLwBm07txlGSkMyvvanwWEjR+5MWyLOMY4/o=; b=JfZmDH/EhsD4aUOCbvtpQ/HD+2eEYWKAAcMncCGOKY1AWIp6ns9ebcfjK35900zxyYcOID9ZOq0bC7kHzUIHLjr24afXH2cRxXgt76vk+0vKhElkw/Ptz8954FV2STrEKDcxWKm9lv++29JKUltZFmOdf4SDky6AnA2eYXELiJ2QFCpqpiGYAcN1bclMniZVupBw82jx3onCa9RpV34g/qTxs3BbY7In7T+bGIKieu6dCWWpfJVu9cWN3z1nm0sLeC0BK34uvbmq+hpCSQH7SwmhDmqSuFVZ96Z0mqLkAJeZewlaufTCpnNrnNk1U5YHk0x2TVL/uN5zqGE3M/ubAw== 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=qSzIFOAmLwBm07txlGSkMyvvanwWEjR+5MWyLOMY4/o=; b=njB5ZC8jkMf4MDPneyngs00OFPy37U9B7gJNXJRDAtvkLZqvo353qLEy0SXzwyzdXbtLiEeAfYn+mraaAp4P3ZO/8PLldTDK8y8WReOIGf2bqvfcX+YXCNMXKNdeMp2Q3nSjnmeDP/4/DfxxxqiIHGBTYo5iAsWSsvFX20cx8no= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:41 +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:14:41 +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 , Peng Fan Subject: [PATCH V2 04/17] usb: gadget: move utf8_to_utf16le to header file Date: Mon, 25 Jan 2021 21:43:47 +0800 Message-Id: <20210125134400.780-5-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:14:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b6f8ac53-b219-4638-e9e2-08d8c1332d01 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:466; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jxNut7FzBM4TTObuSLbcHZvrKlcpVH3m7d7aSr0DeL8XPLwuu3auSlIJ0UXFLUkqV3W3jm8jfukg3XJcv2NRsxafOMU2I+oYr5nsbqCj4r+8kU1rVSAUenY/HFpSWuPAgEkDoXDkR9saeihHMI1aAwAJzahjxDpgRm+23LdX1XwnZ0khycsdgpWt/Iz9KVEPKfDEujPoKDYU0r+kjyRZsNWGhwKK6+vIKJ0MjUoPXtwqNE2l0NBoPLm/sbo8zcIahedZu3O9oNqqKw6lHA0e2LA1WzatpvfooUcBRgx/Oc9S+iIY8nbdPTvojmxdaV6zItoRc14aQGHUdnMwMpXAuCT/kFKASo4y+HCxAvz4hPhr/Iyug40cOaRsOgYaa9/zrtz5U+FBGxwd1YHsCyjomg== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(26005)(316002)(6512007)(186003)(4326008)(54906003)(83380400001)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(6666004)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KiHt8H3jJAKnEvhoI4j3K0zNLbrbGqyPIHCrkrdfxynrXMO6dzjXCFzivk34YEXwgVS5TtQnXy/lAkcWnw6nV+mvk6np6yo5FpuwVMemgLVohbBxWiWLzUV+BYPngjl6Cjhu5h3mDYu21NgOKoLsO2xf1m/F25BwE/vCKD9aH39OB9JTvKH/R9V0neMwWBdyBQ8Z33oKi66tsmm2fjWCK5mjcNYaxR0I0O/3ZhuObn3L4oPXQeTPHcVsCz2tHHy6099Csbc3CBF0/uoh/bUsNqjBmtU+yGrNzU2+sKhZIViBewEVBQqbsC7XGyr2vkKaPFv1qF2XNhwTqRaQRtdHTSL6rEIlYftGiJTLAMVejcUrzOTY8DkKtvd60b/pPHmNSxmCi4E9FGdlf8T+o+oXeAUfaUNIXxWKn9vIXJpovx6OkdIyBNJiU6XIinwcQRa1G59wtlasUo9PznAbZDtYtMYAdf1TfAbFnVpABLOEKfa8TH+3jkbUkjMmNDTR+HeFU8tDkQ8TuEtLD29UPDVN6efpR4D7ZbVv7FE5xfpumLytzrim11DxORXQLQE583JhAioMLW8KxduQ9jY4d5kMqtLE6T6CZjYGB6zBvcNJheDG2tPsbs4JqLNWzy1Xz4XiJZBzoo5D4yRDi0yCCfklXS6JE7kxgDBvWK0imI9uxiQnLZi3ENzFSB5l2ij5y20peMC7fmEfPfbLcUYfHjg8+M8FnperAFwTPex5n13q0iQ4j9598MUXJYzZOBHV05PK642e/6qyWwB0eVFw2CyMKZ7zMNC1jlbmtrdtuK6oPihV0gJ9oznrbI8QZOLN/WUu50lLyrSvGndgeJwgp2SfA0YikY+YgJkfK+o7rvlFBXCQBWlIPLcHWDDpl+DfCgHqEvX7fJC6GS1f/+tzUwPeIiM9xza2AR0RJUcca+whUTChDGjk76r4Rf1a8G9v4g7gvkqxkdTBM447P4M8TTZ/ReINMUpM2durKqS++Z7yi0WYc5oaQ2Si201pDIiJ3RON X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6f8ac53-b219-4638-e9e2-08d8c1332d01 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:14:41.7817 (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: iSvkS0FPcRfTbloNmckWTvBzMe7rFRIV3UEHLE/X2TJaqstziuRnyBA048geRiw3eD7u9EEwwr7FSgYmpBEgKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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 As other users may use utf8_to_utf16le() to convert the utf8 to utf16 for usb, so move it to head file. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/usbstring.c | 74 +-------------------------------- include/linux/utf.h | 75 ++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 73 deletions(-) create mode 100644 include/linux/utf.h -- 2.28.0 diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 83cdd8a259..e2464ad923 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -10,79 +10,7 @@ #include #include #include - -#include - - -static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) -{ - int count = 0; - u8 c; - u16 uchar; - - /* - * this insists on correct encodings, though not minimal ones. - * BUT it currently rejects legit 4-byte UTF-8 code points, - * which need surrogate pairs. (Unicode 3.1 can use them.) - */ - while (len != 0 && (c = (u8) *s++) != 0) { - if ((c & 0x80)) { - /* - * 2-byte sequence: - * 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx - */ - if ((c & 0xe0) == 0xc0) { - uchar = (c & 0x1f) << 6; - - c = (u8) *s++; - if ((c & 0xc0) != 0x80) - goto fail; - c &= 0x3f; - uchar |= c; - - /* - * 3-byte sequence (most CJKV characters): - * zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx - */ - } else if ((c & 0xf0) == 0xe0) { - uchar = (c & 0x0f) << 12; - - c = (u8) *s++; - if ((c & 0xc0) != 0x80) - goto fail; - c &= 0x3f; - uchar |= c << 6; - - c = (u8) *s++; - if ((c & 0xc0) != 0x80) - goto fail; - c &= 0x3f; - uchar |= c; - - /* no bogus surrogates */ - if (0xd800 <= uchar && uchar <= 0xdfff) - goto fail; - - /* - * 4-byte sequence (surrogate pairs, currently rare): - * 11101110wwwwzzzzyy + 110111yyyyxxxxxx - * = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx - * (uuuuu = wwww + 1) - * FIXME accept the surrogate code points (only) - */ - } else - goto fail; - } else - uchar = c; - put_unaligned_le16(uchar, cp++); - count++; - len--; - } - return count; -fail: - return -1; -} - +#include /** * usb_gadget_get_string - fill out a string descriptor diff --git a/include/linux/utf.h b/include/linux/utf.h new file mode 100644 index 0000000000..e1f7d3bd1d --- /dev/null +++ b/include/linux/utf.h @@ -0,0 +1,75 @@ +#ifndef _LINUX_UTF_H +#define _LINUX_UTF_H + +#include + +static inline int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) +{ + int count = 0; + u8 c; + u16 uchar; + + /* + * this insists on correct encodings, though not minimal ones. + * BUT it currently rejects legit 4-byte UTF-8 code points, + * which need surrogate pairs. (Unicode 3.1 can use them.) + */ + while (len != 0 && (c = (u8) *s++) != 0) { + if ((c & 0x80)) { + /* + * 2-byte sequence: + * 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx + */ + if ((c & 0xe0) == 0xc0) { + uchar = (c & 0x1f) << 6; + + c = (u8) *s++; + if ((c & 0xc0) != 0x80) + goto fail; + c &= 0x3f; + uchar |= c; + + /* + * 3-byte sequence (most CJKV characters): + * zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx + */ + } else if ((c & 0xf0) == 0xe0) { + uchar = (c & 0x0f) << 12; + + c = (u8) *s++; + if ((c & 0xc0) != 0x80) + goto fail; + c &= 0x3f; + uchar |= c << 6; + + c = (u8) *s++; + if ((c & 0xc0) != 0x80) + goto fail; + c &= 0x3f; + uchar |= c; + + /* no bogus surrogates */ + if (0xd800 <= uchar && uchar <= 0xdfff) + goto fail; + + /* + * 4-byte sequence (surrogate pairs, currently rare): + * 11101110wwwwzzzzyy + 110111yyyyxxxxxx + * = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx + * (uuuuu = wwww + 1) + * FIXME accept the surrogate code points (only) + */ + } else + goto fail; + } else + uchar = c; + put_unaligned_le16(uchar, cp++); + count++; + len--; + } + return count; +fail: + return -1; +} + +#endif /* _LINUX_UTF_H */ From patchwork Mon Jan 25 13:43:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370226 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3992901jam; Mon, 25 Jan 2021 05:27:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2XpSk54b32/AdPkBYi7tdr0Px5CpdgqYpDoKzxWBBTvKw/nSVeQzM5HgZwqy19OosMYTN X-Received: by 2002:a50:f0cc:: with SMTP id a12mr447657edm.219.1611581265847; Mon, 25 Jan 2021 05:27:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581265; cv=pass; d=google.com; s=arc-20160816; b=XNgRjQoMQxApgwqoY6aMU4yIbRyFZCbn6cs5xDUhOVPqhy31pgZsQ1MoW8HkA3mgNY T4AsDzaEbxQNpKD7bG40wF89uSaegwlJbrSXhQpjgRw8u1qbWRhXbQGgYth3puLpo1CV LwjdRMLOawZ2Ycevcacz9vV+dWQNu/T/oBdUiMAFRsKiqDxOpZ3u7Ce6+EpZY5oKJpav r/mgvvnEQhxO9WHKmAI4lAsvpiMtCKIMokg4E2x2as2ll7Ifia/NOEo8AbKNmaPGolXl 0mlABt6L1JvtVTxoa49ttlzLou3xwvEtiw9+UDwkhmk7zLkXc/vXu7+ohfctagnLvG6z kF3w== 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=I8X2VRqTgGc71Zp4O0E2qz8o3EJCQ2iri0li8A46Lj8=; b=r7GsBe0JuyHV2H45VCRDCjZ9C+J960LD0IrsjBBuFIXBZaLQW0KbN+9ygHy2JFREWk z1eQO39CrE0k5RRblAdv48pvoPQbNIdzSCl1doxkhR4hDNI1WZ8zxMR+YeXvhQEj/pam 3dqSQfRr89+p0yjHXWFZ6yfES64dM/iUZHaTmFWeXhrQNKAoLPIVaPUGgkqlnnYOoVqT jjE4iAzMV8ikQ+wRo9DZFMmFa9NVhGFuWeEEQiEUWuo1XLc5//5RtJrixYZ6Ouxy+/vE ZTbvceQXPKG1WFli3IriP5lpr3IJIjYDSa+tn1T/IqmxIDnSZwSNO+xmOKGx3muUB2G2 4ZfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gfOUU7wV; 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 a42si7981215edf.469.2021.01.25.05.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:27:45 -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=gfOUU7wV; 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 38EFA82734; Mon, 25 Jan 2021 14:26:40 +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="gfOUU7wV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55C1D82679; Mon, 25 Jan 2021 14:14:49 +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 EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0625.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::625]) (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 189FF82686 for ; Mon, 25 Jan 2021 14:14:46 +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=Q05BxRofByVYG3Fp0gFFek1/tqHbdnLgQNxCJc/qrROduW5Afy+Xw4ay/heQ0IsMdWOetHeE8JM+oK4hURmoI3iIGQMKItks8uBlv9+DNK+PSI68GQrT4jrgt3zP7MwxsLUnwRe3amwydXUZqxdysV6+VPTZLvKteFiLpblsJaKnla+QbO8oaVC1/Bvymn9zO/GwNs1UIdG/nKSNab9P9yh7VgfFdFN1XEWShUqcFXohL1xaXaL65Q5X/NY2q3AfUdhwg6eL325HvLfjkDaZ7P4WGp5DhNLn2ykhWpvNT4AZtmWs67u5IHAodCZKX5ipLCM4vm2vsndD5sS/TlC7Cg== 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=I8X2VRqTgGc71Zp4O0E2qz8o3EJCQ2iri0li8A46Lj8=; b=WE4vE5K5LEc+r4A3d4rEW8k5GWo8mO1YiSnzgemuaDt7Kmj1+5tUAxgafy1HSVJrROg4pIdsPuwzA72ZzT6zeXK5BLZbAJU2xem5Aqv/gX6FLLkJya0clQme1+pdeQC2Ibecy8nCFGYXn9ObSrGXptvUm2LmiMbfL+M3WO/QB7sVIk5dF2IuC9Dm1CNDjavedt5f/927AcRAcBfxNyglSq7NhEUPxfEZDe3/Bm3vKtkD1CpW6gDVFHoCes7s2yQ2Y7ZLKOTEPsiczl0dywvPsEN2n3j6Csq0RcjpDYq0iQHA8UdWcOY5ulX0vFUnJhkggNkX28NiTdnHy1tVPsCLUw== 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=I8X2VRqTgGc71Zp4O0E2qz8o3EJCQ2iri0li8A46Lj8=; b=gfOUU7wVav/1EIiOhQQ5Yc8zX4OIv+nXpMQJi8SFF4klmFpubeBwDQnFOjY1keH41YsUhV7TLBNmngofmlLZiPQGo0dE8vg7AAqj+AdH8LGQ1Y/p986vsWhP9kNcEqzMO+f5fDEhTP+2/QqUpPj1Xayc1eiHbYdvwZLRvnzEvTA= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:45 +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:14:44 +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, Peng Fan Subject: [PATCH V2 05/17] usb: gadget: add Kconfig for OS descriptors Date: Mon, 25 Jan 2021 21:43:48 +0800 Message-Id: <20210125134400.780-6-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:14:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b7719e13-0b61-4690-1f08-08d8c1332e9b X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:390; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CJuclLXN9gjiOhv7bt9kKvxgqop7JvWd3d04IklcJgmmbyP/AbnFvu5YskpXH/2l1KBtOmcX33/2RPJgI6ZUYc6UvYn8WTML7rIyZUQVDNfYlsWMZTSa81Gt0mpWGW4vTQZbWY8/RzTd1Ri4GpDnIEnGvL6H9s1tzoVXe829GqO8UsL/eluj7k61LMTk4zYIT7wBiVpahXJ2zw77TTg7B9z33ayQ+yE8+YVJ7gfOiickbp0OKEi3E9d8qb/1Y8kw7/tlZm0kyH+2rfstmupOaAX8EhFociotuJFSZ9kE90M+Vj2qKFo8Ti+Ev2RZdYBoswCIJI3k7hCG9GpRfq8GuTiQJ/Ezg9FbkHQekgD5AQpBVvi28mwFYFI6voMAprUgLbbbJ0HDpDilVEx9ARnYV7D753IxgPQez2TSuOfElHMskqgl2tUByOUztjPbI4HfZBtkh3dsNDJVCs9bCmZxVg== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(4744005)(1076003)(26005)(316002)(6512007)(186003)(4326008)(478600001)(966005)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rYNiOdi28um3jkOCCgycHZI29/nB+AxjedtDAthdDXVAQ9VHhtqrBkpUq2Gw5TAgt8MMMF3S9QroZLs5KGAXyW8qFIWHYP9ti+4MOO5yWU7kznmUJBtuqLy233wyZQgAlhhlZt1H9vbIuFkHeEVHwFZTiaRdvXx2J1xc6e8NZ1h3bwcOVzzCTqv4E5bNiWr0qaxJckIFYNgFtmkJkceYFG4hLKSG38n2R5lW70xEIrizQ7L+7QibpFFGHWKVwoky3yAB8p+6KEwZerKlu0zcUvfadkMr6quujeq0fjjpNgFHM6yzAcktwqnGVK6TRLXIjfb/2VHB85nF6+jZvPt9ePkqQpTh1xahS0X3fMjTfqS48dFPB4zrrEoY+8tth9bldWHIIJlObZcgqKcr3PEtTOUbeLNanxgg4TOZQA8fWeYseBXbihYePde9Ce7MEmapQqUNSkXezgxAbRWjwpGTsW/Td9+42A19unobSqtOLEf0w/4F+ObSQsxkLxoA++ZYpGY8Ryu4ZGTbL38lQ9HkIEIRPajo/pWmOAoAT1SRrFsPaSx/WEiQ7rM2S25RtX7rBD1GzzVoqNEBeyB7/xpwRXLI7qrKgh3MejPLfyflmdcjOn1AnuVqRn9GIcUP/JANuuZYXHserGN2kXhGbptqg6qd/Tfm62ujGJ8pgDLQmFHBZXavkA+vawXUbftzQdZ8R/EejRiawcr+LpL6cLtqPQkdh46xR3Wc85AIcfNGPeZgwOIMX/tnNEQEtSd0C5EwZ0JRCSVntSM/dOiqEL44xpLcxf2fUK09HxD+bEeBD47zGGXLikup5EBA/mGYi2rEnMNYSxIrfoQcoMepPFv5K3TSzQa2teWrjm6S7HM0CD+0RjZ8rW44K/h6iIpa3haj/51oeNckqtFF3eHnyt/L7BnanUI/WUtw6tbtIhJ3RR/Hp2/KRw+LH/t3sB03udHVhrxEmWz4HwbKGHBpXsgnzpga69Vgv+Lxd3pHN/kbKYilCD1FmarrQk648yWaTihJ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7719e13-0b61-4690-1f08-08d8c1332e9b 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:14:44.8893 (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: 5Q+Iucrju0JgbH/Oga4OY7nEBzG+vD94HN6T9z8NPhBM7Mxk/wLHjOk2X5u5CnOcyPkYvPZ2hBEwa7mfmWpomw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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: Peng Fan Add Kconfig for OS descriptors Signed-off-by: Peng Fan --- drivers/usb/gadget/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 7c0df5c264..4a3b22e6de 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -98,6 +98,15 @@ config USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8 endif # USB_GADGET_DWC2_OTG +config USB_GADGET_OS_DESCRIPTORS + bool "USB OS Feature Descriptors support" + help + This is a porting patch from linux kernel: 37a3a533429e + ("usb: gadget: OS Feature Descriptors support"), the original commit + log see below: + There is a custom (non-USB IF) extension to the USB standard: + http://msdn.microsoft.com/library/windows/hardware/gg463182 + config CI_UDC bool "ChipIdea device controller" select USB_GADGET_DUALSPEED From patchwork Mon Jan 25 13:43:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370227 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993074jam; Mon, 25 Jan 2021 05:27:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJxkUAuy9uuduk9rcC1s7yi5HHgbjrzalEVZJarZGKtwjqDzNvtoPvdGqc0KKUB1r6HNyC X-Received: by 2002:a17:906:29d4:: with SMTP id y20mr372162eje.294.1611581277988; Mon, 25 Jan 2021 05:27:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581277; cv=pass; d=google.com; s=arc-20160816; b=XU10fellmrW8x36EbHO7txLvNH2ySh9s7PWQ0MUpI1iWtpgMlj/K7oTUli5MwnWEwg LXnjUhgCR3zMMWy6SXoOM7j18mTKwnuwBPjicSos+kpA7Uhal+XTIqAuLir9pmAEy9JA 0TbClmih/yA3+LIxKHN8zVhnIL7n3Q1XJfOKJDNrGEREcAfC0rHSjlakKT9YmVSX5Jeo NdPitXBU72KNFxK3td7ix+k5ZGdBJw9xFA1xKmoJCafj7tkhrUJiBXgo8ybIobQc+Od5 C3NMjBciqKUr9/j45r4Qm7z9G7ptg8lBmPYDm8/DzMd0M0UzYgyzOIR/gDTvhgkr8k5r FYQg== 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=I6G0h/1XIlqA3H4fInNm7RCe69ZZbHRmhuaDE7lXD3g=; b=RHY2zqZJpHbncgefaCnVJi+9rYaKem5N3HyrdIQl/Fn5aOYoiLo4lEO1hIUOK0Z9Rp /YsvnUiP+u611qxURJpXtCddT4bw9Jr4CDLXa0zPFufsqZlJ0wCHfjLsOhYFvfu1D5YJ fT7rIjmGQkkcvRlOviXjvFyYJmG2A8JLRdkIp9QMiH8s1H6kJ1gvITkiSaSunEb2j3hq Xom93Y0hwJavf7cXvCEshnvzDJtkZrgza7RH5qPp1pODyj53ZIbWCKO2T9P2dZfE0HjK Xo58MdYLFghzQYo5mOCDBhH1w2rH4KAvk3omSMDw+856crik6LmnXTLUj2uahsRhdiUE mf7Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=o8ItBRKD; 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 d3si7387570edy.581.2021.01.25.05.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:27:57 -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=o8ItBRKD; 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 55A148274E; Mon, 25 Jan 2021 14:26:43 +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="o8ItBRKD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 346BD8267A; Mon, 25 Jan 2021 14:14:54 +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 EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::61d]) (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 DD78482679 for ; Mon, 25 Jan 2021 14:14:49 +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=WJBMuDfKWoj2QLd7DEGHxGsVqCdT1bAgBAx4ngdkmKWgEFCzxdIV9xM7x60DL7l0PAVvJpHY0WVzZw/WUVVYjn825KbxrR/mBKfBhdR2d/ON82gSoBUdbYl7IrLZ1h4pzE53RzuLwUd0cvWVdx0gL7m5+ShKgSTf1rECPo6akW2N3U4EShDXu65BFfJAZ+rfbUF2WTsnkGOSRS0BvLE4DfQlOiWo5voPJhyMNJfEd7IKKPM5mMmvEspwZcx+HHJGvUvFdJKT3PpeHLTkfNYkmDJauqhN4xLSdQpBZswyWPkcTQ3APogHvmjkMrWdY2gkJZmqppS7K3ZNFsYQjkKzjQ== 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=I6G0h/1XIlqA3H4fInNm7RCe69ZZbHRmhuaDE7lXD3g=; b=Vbz/LbCClNQiYW8ptM6NkfN2UvudGsvAF13aL/6BA4aX3lyzmWG/2jZPGopIVmm1E7LP2CzyLFrSVd9kyeJEbFdI1BRCgNVwh3PeWvBHsPiHyNY9X4QiJCXabWRiQ7ipZRLPXL/FNFFJ4847kOMfcDxUXDKc3msxX+/X+w8S9ZBi6lBjs1wQWSQ4LCDRHdTrQZXQO+uongnh9vZz843w98qm8vBURiz2PhOQ7J8LOONLMuwb0Dqhj9Hj7fDpeuA9Pzuyft/8FFHev7M8I3s8tqUE/6QOVs5/9sLEB5XgVDim+qEkz+z4zoNMvdmlxLoodiJl0VQ9GOMjWQrKkLQAzw== 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=I6G0h/1XIlqA3H4fInNm7RCe69ZZbHRmhuaDE7lXD3g=; b=o8ItBRKDaOKDtNJ2Qcqg1XggQ3EuzUQO7VQAxJrs9KLumlPBe99xTjMwYKlj81oOStiZT8NytB3gQTNwOII8jwvgO4ZFqHe+FTBa7+X5gezQIX4C7135cvVWqtPD1VwSj2P3oLImIbEo9NnY7dOyIlBq9YyDyWnbwx7yDz1a+Zc= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:48 +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:14:48 +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 , Peng Fan Subject: [PATCH V2 06/17] usb: gadget: OS Feature Descriptors support Date: Mon, 25 Jan 2021 21:43:49 +0800 Message-Id: <20210125134400.780-7-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:14:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2d53bb0f-d7b8-4ce1-6e1d-08d8c13330a4 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HcDKWc+V5Taby/dsQTpnmroZtVqv1LFEhgf0qAd2v8oxa3WxZq9PXoT5+FojlCVKaw/szayzVKmcwSUyf4oTDQGDss1hrYyHWr7r3wH8IH7CTqMkguufkqi3Lbdc3iY7eOmrn660emPlPtonhgsQejb7jnIF2J23S4LF3IBDDnBle4ghZAUNaJI0xKpGXETx3ZiUcGQxK6Ln8OQCEIK99xWHWg2skiybsVR3XX9zcRwHegHd3ar0KHGHibMSRTDQeFDmNh1W1s2U1CRLp2axFYX9SreeOPzift+ruAm2/XwmWxU52av02NUYtYjZpaF9do2iY1iwnM9GpyelIfCIJ/kv0bAyAdQUpjfgt4gKZbEk4C8u5GoRrIPaBNohuZ0P6W5nZ0cO0Ll+cPOgTYVudr4TbajNfYZScJsqgLZugm+oeQHsmaPQvTaCRAuERyxaTFfQRlSJgp5rbtDfSz/49kJwW3ZIT/M48EqDIXtV3DfO5TrVN1FqmzI3X1LVrcfNNX6ffBV/7+6buxTptMut2Q== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(30864003)(26005)(316002)(6512007)(45080400002)(186003)(4326008)(54906003)(83380400001)(478600001)(966005)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?KqMXo8lty9+6SmxT6+uRRSs53e4?= =?utf-8?q?e++PQddvMSFYfRoTlAUCRbiMjGmnPEmNtiG8Jboc25mKqd4e+hZ4Q6/W?= =?utf-8?q?rnarD+XlVx23jLAizjEpUQJXYaneJqmWcVFi6jM2NOgBoyyAJgnllG9L?= =?utf-8?q?tE4n58wn94J8FGGjdQTQ9HSntz2jEIvcGX8dW8ePdC80r8mOKiW5i76X?= =?utf-8?q?/BjVcUAW7qdeciwHL5UXbKslodAqlwB7VHCVuWyhbvX/MPXGt8pAcY3r?= =?utf-8?q?+o34muHWTnXySyIz+1bgTqDG4DKwKU10IQHg2bTUYcKx+7WDXZYztf3A?= =?utf-8?q?5phQl0g33DCR11iPY2XGS63TxR8veWI/mORXn12qZ38eitdFI1Ml1fBA?= =?utf-8?q?W3Rrx/vUHQXMJ0tEYVuCDytT8/7NCWioGEfV+BKXAiOhSl8QIGH2ZVae?= =?utf-8?q?TIdDFf76wqjtx4gWQ7jY24yq6AbtsB0TG5VzY1cVrzv+CW/5uOv/hF4L?= =?utf-8?q?f+Ds648X14AxqvvVE55ua74/GFMf8eLfSO+YA4wGF6F1Pg4ZmLspJaF6?= =?utf-8?q?Ru9VKmIMn0HKP3oFMYszxNkDvUU/gEvBKot0gpJ5tvgPOeYrM/Kdq4r7?= =?utf-8?q?kthA9zsr9KgnuMfPzEK9dTOu7HaL9ikVjJfLmvEKbesFTqRKBwxI+Q/J?= =?utf-8?q?S6qc2Z7UN5m29kQ0s/UPnzvw7o4V9yQK1aiBp9TcjjjG4rbZ98rZICs5?= =?utf-8?q?MPtMpItV1W2P8zVWtr/G5IgUI5ZJNr+vNR14s7xkoL4Bo4/aj4qirVw4?= =?utf-8?q?C9jOk1csXgrZxcf7mh+ltM1DeTAf0gPmUpyexCDE/hNpISQcBggTNaYy?= =?utf-8?q?wDwYduRIt1xmHVAnUUZJLtHEzVLJss6ojhZG45NyKoWstfs/5JrYLeIp?= =?utf-8?q?3EAxdkRb3LrJtAFdtMJc8Bri4PLv4M6VXBcHT1TPIPqhJiOdNXsmfVtf?= =?utf-8?q?Bvs7uMSFnmDvImHGGaLqc7zpYdF0U+8C/EqQDFO1Q+aIbt0iXUsu4tJu?= =?utf-8?q?udh1kzYlLXEAlLBzgS75N7ek5sdEAWmL1smy0tXVpYDwi?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d53bb0f-d7b8-4ce1-6e1d-08d8c13330a4 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:14:48.1458 (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: KvGgCQijnpsNrcRuZg3KQr0a85zv0bxN+od3/Y0iiphV+xUEdDXiyMWqzlOxCLexDQqG6t5uZb9uTG5O/KXUHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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 This is a proting patch from linux kernel: 37a3a533429e ("usb: gadget: OS Feature Descriptors support"), the original commit log see below: There is a custom (non-USB IF) extension to the USB standard: http://msdn.microsoft.com/library/windows/hardware/gg463182 They grant permission to use the specification - there is "Microsoft OS Descriptor Specification License Agreement" under the link mentioned above, and its Section 2 "Grant of License", letter (b) reads: "Patent license. Microsoft hereby grants to You a nonexclusive, royalty-free, nontransferable, worldwide license under Microsoft鈥檚 patents embodied solely within the Specification and that are owned or licensable by Microsoft to make, use, import, offer to sell, sell and distribute directly or indirectly to Your Licensees Your Implementation. You may sublicense this patent license to Your Licensees under the same terms and conditions." The said extension is maintained by Microsoft for Microsoft. Yet it is fairly common for various devices to use it, and a popular proprietary operating system expects devices to provide "OS descriptors", so Linux-based USB gadgets whishing to be able to talk to a variety of operating systems should be able to provide the "OS descriptors". This patch adds optional support for gadgets whishing to expose the so called "OS Feature Descriptors", that is "Extended Compatibility ID" and "Extended Properties". Hosts which do request "OS descriptors" from gadgets do so during the enumeration phase and before the configuration is set with SET_CONFIGURATION. What is more, those hosts never ask for configurations at indices other than 0. Therefore, gadgets whishing to provide "OS descriptors" must designate one configuration to be used with this kind of hosts - this is what os_desc_config is added for in struct usb_composite_dev. There is an additional advantage to it: if a gadget provides "OS descriptors" and designates one configuration to be used with such non-USB-compliant hosts it can invoke "usb_add_config" in any order because the designated configuration will be reported to be at index 0 anyway. This patch also adds handling vendor-specific requests addressed at device or interface and related to handling "OS descriptors"." Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 252 ++++++++++++++++++++++++++++++++- drivers/usb/gadget/u_os_desc.h | 123 ++++++++++++++++ include/linux/usb/composite.h | 57 ++++++++ 3 files changed, 431 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/gadget/u_os_desc.h -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 63855af52e..a0c28dbe59 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -12,6 +12,7 @@ #include #include #include +#include "u_os_desc.h" #define USB_BUFSIZ 4096 @@ -244,6 +245,7 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value) u8 type = w_value >> 8; int hs = 0; struct usb_configuration *c; + struct list_head *pos; if (gadget_is_dualspeed(gadget)) { if (gadget->speed == USB_SPEED_HIGH) @@ -255,7 +257,20 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value) } w_value &= 0xff; - list_for_each_entry(c, &cdev->configs, list) { + + pos = &cdev->configs; + c = cdev->os_desc_config; + if (c) + goto check_config; + + while ((pos = pos->next) != &cdev->configs) { + c = list_entry(pos, typeof(*c), list); + + /* skip OS Descriptors config which is handled separately */ + if (c == cdev->os_desc_config) + continue; + +check_config: if (speed == USB_SPEED_HIGH) { if (!c->highspeed) continue; @@ -779,6 +794,156 @@ static int bos_desc(struct usb_composite_dev *cdev) return le16_to_cpu(bos->wTotalLength); } +static int count_ext_compat(struct usb_configuration *c) +{ + int i, res; + + res = 0; + for (i = 0; i < c->next_interface_id; ++i) { + struct usb_function *f; + int j; + + f = c->interface[i]; + for (j = 0; j < f->os_desc_n; ++j) { + struct usb_os_desc *d; + + if (i != f->os_desc_table[j].if_id) + continue; + d = f->os_desc_table[j].os_desc; + if (d && d->ext_compat_id) + ++res; + } + } + BUG_ON(res > 255); + return res; +} + +static void fill_ext_compat(struct usb_configuration *c, u8 *buf) +{ + int i, count; + + count = 16; + for (i = 0; i < c->next_interface_id; ++i) { + struct usb_function *f; + int j; + + f = c->interface[i]; + for (j = 0; j < f->os_desc_n; ++j) { + struct usb_os_desc *d; + + if (i != f->os_desc_table[j].if_id) + continue; + d = f->os_desc_table[j].os_desc; + if (d && d->ext_compat_id) { + *buf++ = i; + *buf++ = 0x01; + memcpy(buf, d->ext_compat_id, 16); + buf += 22; + } else { + ++buf; + *buf = 0x01; + buf += 23; + } + count += 24; + if (count >= 4096) + return; + } + } +} + +static int count_ext_prop(struct usb_configuration *c, int interface) +{ + struct usb_function *f; + int j; + + f = c->interface[interface]; + for (j = 0; j < f->os_desc_n; ++j) { + struct usb_os_desc *d; + + if (interface != f->os_desc_table[j].if_id) + continue; + d = f->os_desc_table[j].os_desc; + if (d && d->ext_compat_id) + return d->ext_prop_count; + } + return 0; +} + +static int len_ext_prop(struct usb_configuration *c, int interface) +{ + struct usb_function *f; + struct usb_os_desc *d; + int j, res; + + res = 10; /* header length */ + f = c->interface[interface]; + for (j = 0; j < f->os_desc_n; ++j) { + if (interface != f->os_desc_table[j].if_id) + continue; + d = f->os_desc_table[j].os_desc; + if (d) + return min(res + d->ext_prop_len, 4096); + } + return res; +} + +static int fill_ext_prop(struct usb_configuration *c, int interface, u8 *buf) +{ + struct usb_function *f; + struct usb_os_desc *d; + struct usb_os_desc_ext_prop *ext_prop; + int j, count, n, ret; + u8 *start = buf; + + f = c->interface[interface]; + for (j = 0; j < f->os_desc_n; ++j) { + if (interface != f->os_desc_table[j].if_id) + continue; + d = f->os_desc_table[j].os_desc; + if (d) + list_for_each_entry(ext_prop, &d->ext_prop, entry) { + /* 4kB minus header length */ + n = buf - start; + if (n >= 4086) + return 0; + + count = ext_prop->data_len + + ext_prop->name_len + 14; + if (count > 4086 - n) + return -EINVAL; + usb_ext_prop_put_size(buf, count); + usb_ext_prop_put_type(buf, ext_prop->type); + ret = usb_ext_prop_put_name(buf, ext_prop->name, + ext_prop->name_len); + if (ret < 0) + return ret; + switch (ext_prop->type) { + case USB_EXT_PROP_UNICODE: + case USB_EXT_PROP_UNICODE_ENV: + case USB_EXT_PROP_UNICODE_LINK: + usb_ext_prop_put_unicode(buf, ret, + ext_prop->data, + ext_prop->data_len); + break; + case USB_EXT_PROP_BINARY: + usb_ext_prop_put_binary(buf, ret, + ext_prop->data, + ext_prop->data_len); + break; + case USB_EXT_PROP_LE32: + /* not implemented */ + case USB_EXT_PROP_BE32: + /* not implemented */ + default: + return -EINVAL; + } + buf += count; + } + } + + return 0; +} + /* * The setup() callback implements all the ep0 functionality that's * not handled lower down, in hardware or the hardware driver(like @@ -935,6 +1100,91 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) break; default: unknown: + /* + * OS descriptors handling + */ + if (CONFIG_IS_ENABLED(USB_GADGET_OS_DESCRIPTORS) && cdev->use_os_string && + cdev->os_desc_config && (ctrl->bRequestType & USB_TYPE_VENDOR) && + ctrl->bRequest == cdev->b_vendor_code) { + struct usb_configuration *os_desc_cfg; + u8 *buf; + int interface; + int count = 0; + + buf = req->buf; + os_desc_cfg = cdev->os_desc_config; + memset(buf, 0, w_length); + buf[5] = 0x01; + switch (ctrl->bRequestType & USB_RECIP_MASK) { + case USB_RECIP_DEVICE: + if (w_index != 0x4 || (w_value >> 8)) + break; + buf[6] = w_index; + if (w_length == 0x10) { + /* Number of ext compat interfaces */ + count = count_ext_compat(os_desc_cfg); + buf[8] = count; + count *= 24; /* 24 B/ext compat desc */ + count += 16; /* header */ + put_unaligned_le32(count, buf); + value = w_length; + } else { + /* "extended compatibility ID"s */ + count = count_ext_compat(os_desc_cfg); + buf[8] = count; + count *= 24; /* 24 B/ext compat desc */ + count += 16; /* header */ + put_unaligned_le32(count, buf); + buf += 16; + fill_ext_compat(os_desc_cfg, buf); + value = w_length; + } + break; + case USB_RECIP_INTERFACE: + if (w_index != 0x5 || (w_value >> 8)) + break; + interface = w_value & 0xFF; + buf[6] = w_index; + if (w_length == 0x0A) { + count = count_ext_prop(os_desc_cfg, + interface); + put_unaligned_le16(count, buf + 8); + count = len_ext_prop(os_desc_cfg, + interface); + put_unaligned_le32(count, buf); + + value = w_length; + } else { + count = count_ext_prop(os_desc_cfg, + interface); + put_unaligned_le16(count, buf + 8); + count = len_ext_prop(os_desc_cfg, + interface); + put_unaligned_le32(count, buf); + buf += 10; + value = fill_ext_prop(os_desc_cfg, + interface, buf); + if (value < 0) + return value; + + value = w_length; + } + break; + } + + if (value >= 0) { + req->length = value; + req->zero = value < w_length; + value = usb_ep_queue(gadget->ep0, req, GFP_KERNEL); + if (value < 0) { + debug("ep_queue --> %d\n", value); + req->status = 0; + composite_setup_complete(gadget->ep0, req); + } + } + return value; + } + debug("non-core control req%02x.%02x v%04x i%04x l%d\n", ctrl->bRequestType, ctrl->bRequest, w_value, w_index, w_length); diff --git a/drivers/usb/gadget/u_os_desc.h b/drivers/usb/gadget/u_os_desc.h new file mode 100644 index 0000000000..4dab4814a3 --- /dev/null +++ b/drivers/usb/gadget/u_os_desc.h @@ -0,0 +1,123 @@ +/* + * u_os_desc.h + * + * Utility definitions for "OS Descriptors" support + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Author: Andrzej Pietrasiewicz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __U_OS_DESC_H__ +#define __U_OS_DESC_H__ + +#include + +#define USB_EXT_PROP_DW_SIZE 0 +#define USB_EXT_PROP_DW_PROPERTY_DATA_TYPE 4 +#define USB_EXT_PROP_W_PROPERTY_NAME_LENGTH 8 +#define USB_EXT_PROP_B_PROPERTY_NAME 10 +#define USB_EXT_PROP_DW_PROPERTY_DATA_LENGTH 10 +#define USB_EXT_PROP_B_PROPERTY_DATA 14 + +#define USB_EXT_PROP_RESERVED 0 +#define USB_EXT_PROP_UNICODE 1 +#define USB_EXT_PROP_UNICODE_ENV 2 +#define USB_EXT_PROP_BINARY 3 +#define USB_EXT_PROP_LE32 4 +#define USB_EXT_PROP_BE32 5 +#define USB_EXT_PROP_UNICODE_LINK 6 +#define USB_EXT_PROP_UNICODE_MULTI 7 + +static inline u8 *__usb_ext_prop_ptr(u8 *buf, size_t offset) +{ + return buf + offset; +} + +static inline u8 *usb_ext_prop_size_ptr(u8 *buf) +{ + return __usb_ext_prop_ptr(buf, USB_EXT_PROP_DW_SIZE); +} + +static inline u8 *usb_ext_prop_type_ptr(u8 *buf) +{ + return __usb_ext_prop_ptr(buf, USB_EXT_PROP_DW_PROPERTY_DATA_TYPE); +} + +static inline u8 *usb_ext_prop_name_len_ptr(u8 *buf) +{ + return __usb_ext_prop_ptr(buf, USB_EXT_PROP_W_PROPERTY_NAME_LENGTH); +} + +static inline u8 *usb_ext_prop_name_ptr(u8 *buf) +{ + return __usb_ext_prop_ptr(buf, USB_EXT_PROP_B_PROPERTY_NAME); +} + +static inline u8 *usb_ext_prop_data_len_ptr(u8 *buf, size_t off) +{ + return __usb_ext_prop_ptr(buf, + USB_EXT_PROP_DW_PROPERTY_DATA_LENGTH + off); +} + +static inline u8 *usb_ext_prop_data_ptr(u8 *buf, size_t off) +{ + return __usb_ext_prop_ptr(buf, USB_EXT_PROP_B_PROPERTY_DATA + off); +} + +static inline void usb_ext_prop_put_size(u8 *buf, int dw_size) +{ + put_unaligned_le32(dw_size, usb_ext_prop_size_ptr(buf)); +} + +static inline void usb_ext_prop_put_type(u8 *buf, int type) +{ + put_unaligned_le32(type, usb_ext_prop_type_ptr(buf)); +} + +static inline int usb_ext_prop_put_name(u8 *buf, const char *name, int pnl) +{ + int result; + + put_unaligned_le16(pnl, usb_ext_prop_name_len_ptr(buf)); + memset(usb_ext_prop_name_ptr(buf), 0, 2 * strlen(name)); + result = utf8_to_utf16le(name, (__le16 *)usb_ext_prop_name_ptr(buf), + strlen(name)); + if (result < 0) + return result; + + put_unaligned_le16(0, &buf[USB_EXT_PROP_B_PROPERTY_NAME + pnl - 2]); + + return pnl; +} + +static inline void usb_ext_prop_put_binary(u8 *buf, int pnl, const char *data, + int data_len) +{ + put_unaligned_le32(data_len, usb_ext_prop_data_len_ptr(buf, pnl)); + memcpy(usb_ext_prop_data_ptr(buf, pnl), data, data_len); +} + +static inline int usb_ext_prop_put_unicode(u8 *buf, int pnl, const char *string, + int data_len) +{ + int result; + put_unaligned_le32(data_len, usb_ext_prop_data_len_ptr(buf, pnl)); + memset(usb_ext_prop_data_ptr(buf, pnl), 0, 2 * (data_len >> 1)); + result = utf8_to_utf16le(string, (__le16 *) usb_ext_prop_data_ptr(buf, pnl), + data_len >> 1); + if (result < 0) + return result; + + put_unaligned_le16(0, + &buf[USB_EXT_PROP_B_PROPERTY_DATA + pnl + data_len - 2]); + + return data_len; +} + +#endif /* __U_OS_DESC_H__ */ diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index d4f2a49869..d75a0bc4c4 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -37,6 +37,53 @@ struct usb_configuration; +/** + * struct usb_os_desc_ext_prop - describes one "Extended Property" + * @entry: used to keep a list of extended properties + * @type: Extended Property type + * @name_len: Extended Property unicode name length, including terminating '\0' + * @name: Extended Property name + * @data_len: Length of Extended Property blob (for unicode store double len) + * @data: Extended Property blob + */ +struct usb_os_desc_ext_prop { + struct list_head entry; + u8 type; + int name_len; + char *name; + int data_len; + char *data; +}; + +/** + * struct usb_os_desc - describes OS descriptors associated with one interface + * @ext_compat_id: 16 bytes of "Compatible ID" and "Subcompatible ID" + * @ext_prop: Extended Properties list + * @ext_prop_len: Total length of Extended Properties blobs + * @ext_prop_count: Number of Extended Properties + */ +struct usb_os_desc { + char *ext_compat_id; + struct list_head ext_prop; + int ext_prop_len; + int ext_prop_count; +}; + +/** + * struct usb_os_desc_table - describes OS descriptors associated with one + * interface of a usb_function + * @if_id: Interface id + * @os_desc: "Extended Compatibility ID" and "Extended Properties" of the + * interface + * + * Each interface can have at most one "Extended Compatibility ID" and a + * number of "Extended Properties". + */ +struct usb_os_desc_table { + int if_id; + struct usb_os_desc *os_desc; +}; + /** * struct usb_function - describes one function of a configuration * @name: For diagnostics, identifies the function. @@ -50,6 +97,10 @@ struct usb_configuration; * the function will not be available at high speed. * @config: assigned when @usb_add_function() is called; this is the * configuration with which this function is associated. + * @os_desc_table: Table of (interface id, os descriptors) pairs. The function + * can expose more than one interface. If an interface is a member of + * an IAD, only the first interface of IAD has its entry in the table. + * @os_desc_n: Number of entries in os_desc_table * @bind: Before the gadget can register, all of its functions bind() to the * available resources including string and interface identifiers used * in interface or class descriptors; endpoints; I/O buffers; and so on. @@ -98,6 +149,9 @@ struct usb_function { struct usb_configuration *config; + struct usb_os_desc_table *os_desc_table; + unsigned os_desc_n; + /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if * we can't restructure things to avoid mismatching. @@ -292,10 +346,12 @@ extern void usb_composite_unregister(struct usb_composite_driver *); * @gadget: read-only, abstracts the gadget's usb peripheral controller * @req: used for control responses; buffer is pre-allocated * @bufsiz: size of buffer pre-allocated in @req + * @os_desc_req: used for OS descriptors responses; buffer is pre-allocated * @config: the currently active configuration * @qw_sign: qwSignature part of the OS string * @b_vendor_code: bMS_VendorCode part of the OS string * @use_os_string: false by default, interested gadgets set it + * @os_desc_config: the configuration to be used with OS descriptors * * One of these devices is allocated and initialized before the * associated device driver's bind() is called. @@ -332,6 +388,7 @@ struct usb_composite_dev { /* OS String is a custom (yet popular) extension to the USB standard. */ u8 qw_sign[OS_STRING_QW_SIGN_LEN]; u8 b_vendor_code; + struct usb_configuration *os_desc_config; unsigned int use_os_string:1; /* private: */ From patchwork Mon Jan 25 13:43:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370228 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993232jam; Mon, 25 Jan 2021 05:28:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFvX+J8ptsnBiBs3yhXGTSNbCGBPZEt1h3vnxOU0MDi43kTgd+lhOFs/jk8NcH/3mfDZqp X-Received: by 2002:a50:b765:: with SMTP id g92mr431758ede.317.1611581288929; Mon, 25 Jan 2021 05:28:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581288; cv=pass; d=google.com; s=arc-20160816; b=imjOv7gEL0IAIF+xNobHAuHWGuWAh7NXCnTa3qoT6oCWpkZ5s56BjO38iv4yAGpWi3 JwES17/uLBdjwzRGXiKTiH4v5/FjUrdmH0zCVcyV52Dk009j73sgk4ph6ZgHOGjleett a8GQaSSD0ImoBqFp/eCBITL5Kj1WKoMuY1skvGR8KzXJ5AZ1o3Wd98kLh7wL8GUuiUJ3 x4GqXTamTNHkUnF6buatumBEFLWpSGOCh6BPOXpCvNC3ofnJMZiVP3DrF2L7kU7Zrb3J MCzYhwkCVuUCfD4btUGq+2lPoVK3/gUGavU/vRAtumFkZWUN9PV1B+vUPHK3J/Uo+jVM 87sA== 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=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=GXofP+En4GFxKdzguK/GorLhOWH5HEwagAoRKgHnJNQ9YuH7s2KTddr9FsNNoEY2wn uPFQOec2bLiasSbTZdBMsQMJSJYbEY0nDEnlRdcgm072lK1ZKmbaV4gYh54cFqfAyJDx 72QX9U3/vfCxJKoFI1/dw2f9mIQXpZfyFG2uvojidg167e5pZsFBPQaD+AUY7kB9KJrE jU+hJMhVKqoopI6DkqSFH6tn/3tk5i074an903mfxY4YarnlNMi7gZ0OB8VcOwwdEq6n XPbUGs8cBphSp1fIS9YQ+BYqBYgxaXfqcp7jVUzxOZUv3XBWcErCI1pGuaK0b/5izyXG MPow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=siDbWyjN; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id lz7si3702606ejb.725.2021.01.25.05.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:08 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=siDbWyjN; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 0A1DE8275B; Mon, 25 Jan 2021 14:26:46 +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="siDbWyjN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 365D882679; Mon, 25 Jan 2021 14:14:55 +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 EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::629]) (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 55A6682686 for ; Mon, 25 Jan 2021 14:14:52 +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=G+XwR1U0TBNI+zDyxUGH/6hHEOLI9K1HVXFgFnEVNSifGzRSgw4JLgbpAqJfw4ALLMvvnLcERTta786jdLiFE/6RqWHY0WxciCKCjTZ/5cT8pthmeWShH1kg0AIsQK332Mtj1IQ4FMkdXF0IisDEtKD5SBWTOlyDySfI4WiXSsuPo8xBFk3VbMNqz9/aFlgtzJV8pus4Clg12xDtFYuaFcmCguHzQeWK4Gv3f5/nc6OqqqK4I1TjjTVFSwa2OLa4IC5fDT4L9e/yQWljSrQGYXk3oLmqK1dUQ4FrtFZ0x4WD3V/8J85Ev9bpAIOBzDEa/6/E5/Z2VW029ieO3XodrA== 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=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=Ge4XZRqfu5MhYdyEjciTOlP2Bhy4FMluDtrZ9f9qgiOZul2tvKpFg5gWx/4Nwfwqy8qptm5FIG2hE4a9WLvzZ04VsKubzYtPt9mdBROmIvO1eKzLGOXIVudB4ZA9UVkru6OIp9f8H4t0r4cG8bhS0b40e06+KpS9sJvxV5WnY+JoTAyOxWCjTdBitV4a4TIg3IsckSH3FQTe6mLlKvp+tn6awGYV/L3W6HE2Tm0cun5DqYsrOUsSGZXjfhPgOTbmUrHOZ+Ma7Oq3DU654OpZaY2nVtOuzLx9bScqxSFcDS9GQ50Al6s0ANga2xeGznJkYkiUNHZrJh43UK183PrQhw== 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=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=siDbWyjNB5Hwgmv4PDOZ5lyKyUztSrCxu/WUrDTrEdQLMaMQ3qsJGtfShBa1fu5w7p/Vy5g+Cld+dAK5/sVLJM73qX85BP99Rgx4sQIDN1vIb9qqLI4Km9vF2NeRFHebYKpooROjzc3gnEiFIhXvY+DsL1dV6Be5tMsRK/0zJho= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:51 +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:14:51 +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 , Peng Fan Subject: [PATCH V2 07/17] usb: gadget: add WCID support for mfgtool Date: Mon, 25 Jan 2021 21:43:50 +0800 Message-Id: <20210125134400.780-8-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:14:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 50f169e1-2f85-428c-3719-08d8c13332a3 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PYodykMqF5pPoHtFP/P63DuCyZiz8hLKUVWuBQV2ZYwspty9dc3cHwCBkbxzy0EDtVr9zpdoodhsdRC1JB1d5oTTYeXsObWEJ+LblFhtHAaN+LlLHIymaxw3ewZluDxUAMqFv4XgWirRjw4jgthotN4QqeiSi7pdkBTExEeRQuDRYKAtvLRpnLLhEA7JL83LBJBHQUrTJpLbUnAOMzcR4iiipr+cK9biY6Iby25VNZmQK/kTzGy9D5pibxDC2VRBcLDPWXwiaqyMsu8d1fxiXGsYJXisEj9feF7hrgBK7yeaxcEXPCdQij2JNu7RWQWtuh/1u9c9Zllo7EjaXn8X6pgKhVmF6JKMFd8zmTvDeT/qDHasTzRTHA6Gz7iwAYbf/ITIda68EhkOAobVg+0wCg== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(26005)(316002)(6512007)(45080400002)(186003)(4326008)(54906003)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(6666004)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: O2dVWpivPAuxBRZrh8FgI3lFQJLYGg3P/3zP+d9451eRKwMyEx+XMnCF5RpdmSgHDvkFEtJIFlssckK/fr9JBYIbs7ufAGIii54JvzCCbESM7YV8mePfuC9a6HY3uf3RPExTZYywUfmtU4HU0gCSd4JmHK4h7vPXoe54ZA42dMEe1m89ah1kQnXyupkGOyA24Pz2joreaeUDsHnHLFDQXoJmraS7xFSeHa4kmpGGizxKIoEx4FA6QY9EH0Bhljtu19md1y4uGpPmAeuHQDH+EK5gmkoctcVV6ENB/B5F3oWrEQXCTXgFAewY6zPoDMetrwAJfhcnRw7eOo/efIGDCVoOV6CnAApi3LT2+Ql+Yrudi85y6Z0EVrSAUNQQccybCPoIxt4vJlKRwVIXa440tavqb//tVKSebtoLOUgVwcVIUqh9M8vO/lie5w1xgNWmfpJyzQNMd4MNn8s++cCfG3HSyuhT0mXIguHDW7eRr+Z4r14RxdLSCvyi8B8a+dA2ekBTHrbIvlOUzpCL0brcu20LLpxpuJuH0W8ioAG+pMiHNJ7uBmyys8OvpZ8LtRPRIFDHIp8XbMkVSVcwgPxM7ZNtubWbjk0pJxhi7ttWkdcJuJwlbeHu/Dp6v/GhPzQGeaJaFcHpQMIZ/OtGY/8Q/WaT9EuFwzmJ0CYjEbIUQ9Vs8MPKA62PvmktxOHD0O3AZZ2VAHR4z4hRbdkSIxKTSjdIaHVa60wtPUYmxsmYtiFrar3biyXLforEQnmJ0/t2bCpzpGMrziRcc3rGcI8nfl0YUtT8Aijw8bfooIy0m6Obuo7nVTEa49oj6lt1rmEL4Id9Jz1L28rMGrG4A3epfm/UEzVl6lrLoObtOU2xUj5n3OpRNS0+HJ7Wt0t9PjUt57gVGz0z3f6jwZ8i69qTW2HQKXkQL8/08W5VpPcpmavja029x0mhyBc+dZBAB/N5aWYeI7ezVmklGnZnibDnA66Ld2TiOOXz5rSQcY4/WXRmoc3ONmebkyslayCsxyV3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50f169e1-2f85-428c-3719-08d8c13332a3 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:14:51.2364 (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: OwT1T43QsUTYikkiHNx4BYQ5FU9AjTaXuHmCCu5kNvQTQarff1SbY5n4Hv8Heb4OhBGKyPXEVdMMJKq/bpGE7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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 Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a0c28dbe59..cd61bfec38 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -20,6 +20,10 @@ typedef struct { __le16 val; } __packed __le16_packed; static struct usb_composite_driver *composite; +static struct usb_configuration *os_desc_config; + +/* Microsoft OS String Descriptor */ +static char qw_sign_buf[OS_STRING_QW_SIGN_LEN / 2] = {'M', 'S', 'F', 'T', '1', '0', '0'}; static inline void le16_add_cpu_packed(__le16_packed *var, u16 val) { @@ -395,6 +399,10 @@ static int set_config(struct usb_composite_dev *cdev, goto done; cdev->config = c; + if (cdev->use_os_string) { + cdev->os_desc_config = c; + os_desc_config = c; + } /* Initialize all interfaces by setting them to altsetting zero. */ for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) { @@ -1358,6 +1366,18 @@ static int composite_bind(struct usb_gadget *gadget) sizeof(struct usb_device_descriptor)); cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; + if (cdev->use_os_string) { + /* TODO: Do we want to pass this via platform? */ + cdev->b_vendor_code = 0x40; + + /* Microsoft OS String Descriptor */ + utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign, + OS_STRING_QW_SIGN_LEN / 2); + + if (os_desc_config) + cdev->os_desc_config = os_desc_config; + } + debug("%s: ready\n", composite->name); return 0; From patchwork Mon Jan 25 13:43:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370229 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993419jam; Mon, 25 Jan 2021 05:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDMUpSiiZLzIN51wwgoqCJd9wKKm6cbPl88MqpVChdhGbmOrqai0Jd9P8D36zSCNs+9BQO X-Received: by 2002:a17:906:7d4f:: with SMTP id l15mr352219ejp.95.1611581299288; Mon, 25 Jan 2021 05:28:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581299; cv=pass; d=google.com; s=arc-20160816; b=lLuqdZYCk7nbnZDXM8g/gjQ5HVekOeW1faPqwQgHO2orYanBplvuCcgh5b/XYWD3Xc IVX9tYN2o7W1RKz2OLaUX8LiO2ChaYnqQvB4cL0sX3MFhnow8vnLfsci9Ur/+WwIaf81 PJrNLAZyuO5H9yEi7s7qE2flN016TsNLzdNjmQh4eP1mRP3PPgeSiUZ4+3OqFdqoSNuO 7oVcZn1fs07L+/xy78KXMAab3l9pO2zIxoDxt9c5i0U8BM10U7DYBJAPgA1JmJD+fQ7E HjIaxnGTEPwc2cXo+52L89pyz3bJx7QtoH7Rdmr1VSSJ8Ly2LYNsSihPtZWnKKU0Qzmq 0Oaw== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=z9Va99HxMYs3BAPRc1AewWOaMvfEC/1qJsVU+QM+Xy997jMEeFRTpDrvO7/87twMLI B5I7NVmD25nBwPUiqydFpRVcz5Zyg+V9JXsMP6aaSFoUWEF791B7Rf4uUgsEJORHCXq/ ZqCCYQtYGJwz8WXRUFgkaxqyLT9ZieJ7GM2UTpUjOn4Ax3w6QuYZrAaIbVr4oqXT+NwH ECosVfdtQOpaK2q37wPmIqeDLckX6l8ssf+dB3TNTME0rdm1WAzbCGoWw7tEpPYlo0Xr 3eMB/NrLq20NNaw7hJRdiiXxeIPHg/GryvS1GBBTygRpHXWSfOYwDFKqYPFpIBHiuPyd dj5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ocb7ApTk; 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 d92si7512602edd.33.2021.01.25.05.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:19 -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=ocb7ApTk; 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 E4FDB82721; Mon, 25 Jan 2021 14:26:48 +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="ocb7ApTk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B54FD8267A; Mon, 25 Jan 2021 14:15:00 +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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0623.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::623]) (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 D0420826B1 for ; Mon, 25 Jan 2021 14:14:57 +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=Jo+7tFc51lTDLcUKyGzgYiB7xQzYjrNEHrQFlvhUdWjNBBdu6EOdxmPtiDzbitx0Wneaq0YSP4KvHRB/N5rczhgjIYZNAvOKfG5JAa+SJ8/dOc4riyFKg511akcPDNVJVJ+mhS3FFkPPVHy4cia8lfvlE5WnHHO25HUeG2GS5VaKVkH2YoO8jWtOoAe+yN+Jux7QFIGd3XTNxWomlkx8O5/CWjev+mg+iCTC5LfF1l0ELoWNkfhAiFgvPPn7xNsVLEwgB829NN8nVb3k+YvQ1GZLosxH1lA1witIa56zU/Kb8EB7qfHqwvnwHuLs9XC+WsLAhctzmXlpl0sgfY3jag== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=B0JvmS+7uQxGl/mLuxnGIlAv1JFuWULOM7yMlzT0MvaLZuqYUJjd0nZSQSY3o0sztcFIZMSlf5YpEMubKzv20ugVBovBrj/8/wAB8LoXmwfLsR30mrClmF/ew/UhZwquZS5xWOly9iYtl05sxEzF8mipPkBtQx87OfpJPa0rWc3+zGtEZ6n7wPz1G7QKwpuRdQEjyboSpG53PvT0Nce5HBv/xDSIITMRz+JgbqhMNNUqqMvPF/i0IgFJ0M5e76CPx2jKruQEk390AkpVVtCHOQ8zu5aGJBNLP31RyMu2drGIKNI4Dj1ixa/hGpDZbwpDbOc4rieD2PIWiba2J635Yg== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=ocb7ApTkPyYCA1COfI9eViD4U1bS6cxAZSYmKWmyXZI+xr0wyU06PWBHGTXFdOOa5p1M4vLHS5dEX4pXEt87JezfONo42SGHVnNHcig9piFBVMZC+dEcKwKS+byAWGlFYPdZR9iUvOHFvNFex1sEjAcUUSVQFSi0aBpb9Ews7co= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:54 +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:14:54 +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 , Peng Fan Subject: [PATCH V2 08/17] usb: gadget: fastboot: add ext properties for WCID Date: Mon, 25 Jan 2021 21:43:51 +0800 Message-Id: <20210125134400.780-9-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:14:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b6e92547-f728-4891-3a42-08d8c1333476 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:330; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2OHGPgzO4qOQjYDf8lt54zA9jGwzIvkFguFRR9y/yeeslFJEMWZTIDcmbXfFKNUK3osirJANVqf6WNDN8UkDw1HVdwj6Rze5v57GferIKelsC/7JSogJ8aAaiMELLA8V7H9qDJYRU4/LpzQBPIePt2nJLOMbhtvyUFQUGsyBgng6Rt0J7kvv2yvavSdOzfMYi4SahClZTiS2H66M6rBorTU1+u5xWvTdgpM71N+NkLrIqPfxE4Gbn5sOPYJeUmUcbP1WDpsDIWHbPp+CZBYP3cjRwntGSVOTX5Xgk1hArbVf2Xw6sqT2hZjtUUC3c96b/AUAM7H9HfXtE9CRTRmhOWfCKoG53l+m6kRFrIVAyGoIEnSC5MbLzXN0jkvgxbb4mKYuDKpYCrxCHwy/lj0KKQ== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(26005)(316002)(6512007)(45080400002)(186003)(4326008)(54906003)(83380400001)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UDDBVUP3e7IouW2n2+XAaJ2w6O86zzlFQUjeALUXSHFF8IaTioP3mBuM8etBV3GTMCh5g5L1S0IAJnB9pzE8ROBec7QEUdvV8bKbRAopp96VFCuuGUjkhN43GWmdyxS6iypECn1aQ21N6/DafVpkufvRk8U6I9SCIyAJDi7i8ftP0OJg5W710/L7Y9tfO56u0Nyd3jgrc7GgVoQL3gdy143VZFL2Of1UHbHV9ZGAgkPZX8iGmNAvj45uaMjYsW7eWTr3qbGDwpkwxwl2e9H5DG0uNy3p0I0jPqPZETZNF20ZYcKpNsW/x4mcw0QaO6Wn1d9tgHSe8Z42g+nRO1/5IPL281z7ppSw1Hkx+Stamd2bI3Byu/exqp9wlhxZslZERGsFisqH3GGwbGb5OE5GMh9QJl+LwlIWo88CD9mBuJnUczY8iTZS/xPxCtzNGeeiB98MbKniIkLScPVQ4FlVx6olZPsmwQkrt3cFAvhuzJLTbN8IKpgrCA8RVV3Cui2dAMH/uorb3eqcecyz2bGwZi8aL0mYFDVfqy/ZGKAJ4X89l7MhS1+WO1LmwraxGdEFBM4SKwevLojVKmiu1NH6ZiH3Ilba27gC4UIschzI/H1BsOkcRaim+ECNa8aUeSZQZEffXKz7/rC/ElbDz2RLYvMk+jHfPW08EgIj1WCCnuk0zqDsS6u887tQsO4KHwHx+s//wYDhQH7zbsJxFH53dK8mPNRxdvWJiFUeIDKYjRdf0SrdhnmBXNKye1XhcSb7Z4FyOZcRS8LUsBSfiznDxTy87FADPRpD8ky6U2+PgL8qgbXe4sYyCRdMjRBPwVPJkVKBcGmg3XG6NCnPaJNfSgJzDuWmCqhwrwLxR0Nu+br3/y0VXAweLap35NMh08QMjw7gD2uhUySghH7tsZBIDbU1oL/zq8jZGqC003/yS8j8RKC2sqsUUPkK8dO7xjxu4gupo9SFQpiOnCMwwHaajhIciqh0DUA2ttqYEbVxPieZbdz5ctzTaONvQDvgr/3Z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6e92547-f728-4891-3a42-08d8c1333476 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:14:54.6608 (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: n+8Y0kMFvzMMPwJytF9Bng/w2Vg2VvDtDm2/3lYcb1RMraZwPQd4rml0minM+7pW8mmMYbfgTf1kE25avQWkBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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 device interface GUID for Microsoft Extended Properties Feature Descriptor. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/f_fastboot.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index d1d087e12b..e330456390 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -46,6 +46,25 @@ struct f_fastboot { struct usb_request *in_req, *out_req; }; +static char fb_ext_prop_name[] = "DeviceInterfaceGUID"; +static char fb_ext_prop_data[] = "{4866319A-F4D6-4374-93B9-DC2DEB361BA9}"; + +static struct usb_os_desc_ext_prop fb_ext_prop = { + .type = 1, /* NUL-terminated Unicode String (REG_SZ) */ + .name = fb_ext_prop_name, + .data = fb_ext_prop_data, +}; + +/* 16 bytes of "Compatible ID" and "Subcompatible ID" */ +static char fb_cid[16] = {'W', 'I', 'N', 'U', 'S', 'B'}; +static struct usb_os_desc fb_os_desc = { + .ext_compat_id = fb_cid, +}; + +static struct usb_os_desc_table fb_os_desc_table = { + .os_desc = &fb_os_desc, +}; + static inline struct f_fastboot *func_to_fastboot(struct usb_function *f) { return container_of(f, struct f_fastboot, usb_function); @@ -161,6 +180,19 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) return id; interface_desc.bInterfaceNumber = id; + /* Enable OS and Extended Properties Feature Descriptor */ + c->cdev->use_os_string = 1; + f->os_desc_table = &fb_os_desc_table; + f->os_desc_n = 1; + f->os_desc_table->if_id = id; + INIT_LIST_HEAD(&fb_os_desc.ext_prop); + fb_ext_prop.name_len = strlen(fb_ext_prop.name) * 2 + 2; + fb_os_desc.ext_prop_len = 10 + fb_ext_prop.name_len; + fb_os_desc.ext_prop_count = 1; + fb_ext_prop.data_len = strlen(fb_ext_prop.data) * 2 + 2; + fb_os_desc.ext_prop_len += fb_ext_prop.data_len + 4; + list_add_tail(&fb_ext_prop.entry, &fb_os_desc.ext_prop); + id = usb_string_id(c->cdev); if (id < 0) return id; @@ -196,6 +228,8 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) static void fastboot_unbind(struct usb_configuration *c, struct usb_function *f) { + f->os_desc_table = NULL; + list_del(&fb_os_desc.ext_prop); memset(fastboot_func, 0, sizeof(*fastboot_func)); } From patchwork Mon Jan 25 13:43:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370230 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993614jam; Mon, 25 Jan 2021 05:28:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEAcycv3KsWEN3g6Dvu9rMAUy2mIrZ5ZetOPcz6qaDk6n75iGrwvmdRRhzQej55b1Yv/z3 X-Received: by 2002:a05:6402:312e:: with SMTP id dd14mr473254edb.366.1611581310013; Mon, 25 Jan 2021 05:28:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581310; cv=pass; d=google.com; s=arc-20160816; b=IGu2oX0wenVlL6yS4pViCpDkkZ4efFakY2gS4ALxT7yzerTKr1+zg1pixqS4Y23NYJ AF7ac9OoUytY1Jukhh64LT0x0J1csOspcbgUFOdh3HodI9VKEMMg1b6qSTmezpJFHB0G nwAmDNs5wY9jw2Yg4AbKpbHtYIp/KFZsPiqD9FpZZ4d/SWA9vCZJNS5skou5yur++IFZ NZaoma47Pym9Ccewb6/IHtEALW05ebRGK/uOl+ue9JKQn2UUWDJHrWzUhb4pg9pPy7NU aQmpSqGFWHKA+uz8SY5HQecomaV4EH67vMkuErqc3ree119oDpXt3b7p9CjciQbbyeEa /6gw== 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=QkVEgdVyCftZh4BTI1gfLcAwFCZC2nYOaPWDpc9PPbE=; b=bOS2Yaf46gyPAsydepOFXxOAofB6R+34DdGjUytbewfqKPUbAy2iNrJcTZCWNbBsfu /TEmAgBovNrJ73L9X3MSLRP7fJiSK70l1UidAeSWBaI0YayuHIsZojktTm6G9/KOlI+p Q6h072cyjfUrSgnKDek4tQ5O5PVAuEjkBWALw5GCkEwYvyz/YQ12X2j5CS3vV3jbljQr I26YSxiV3k327hhV5xmgfTSJbs3R9uMT1FTq5yBS/YhMtAabvrZKC1AQEar3mQ7T+fd3 H9ECbndbGPh2EOykxNdzC0tFpGwckB2WkrAna3p2hJiClrgRPmK0bBPdMGqXhIXl4TCM KFNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=je9r2YhY; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id w20si6041377ejc.188.2021.01.25.05.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=je9r2YhY; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 3FEC382775; Mon, 25 Jan 2021 14:26:52 +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="je9r2YhY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F1DAA82686; Mon, 25 Jan 2021 14:15:03 +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 EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0610.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::610]) (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 1E9D982642 for ; Mon, 25 Jan 2021 14:15: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=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b6uZF3QuaVFDToN3jswa/xbL9busnpCze75tTZ9NEy6WnofMmX5RolzhJeXzS6Odco8Ksaf7B6KxQpHN0H4nU2kJ2CZuLrfIrUdKEH0Dhza1vTxRxPDGCUwD8GAjs2TN3Ibf+zutPFTtaTqALHTDdpV8AoDHACF4CVGbWB4yv4/fLiCM1QvuAHjBrvLxqLKI2bCqbhKIErgnvDoHclE7B33Em0mM/ImIwEKeMl8qySfSqqY57SGDZCDgG9Uaxvb10/0lzfNfjOclcIAfAjFS59L1Lke+iTl1HP2p6S1ZuXdOyUMgS1z1zbT7wcghAa+1/vRFBn5E6TQgdaGfnj53fg== 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=QkVEgdVyCftZh4BTI1gfLcAwFCZC2nYOaPWDpc9PPbE=; b=dKuL0+r6DVoabzJyofuvljh1jCNJTL5Q+WhWQKIL2vPw3Ct1Pg6VeVOAe3Aa4XgPAsA2Ndm+QB48gpZ6f21FKwgrj/4uYizbUJuBem4K0GXGHgenjJ5hIU5QVfEevJgIjqxauMVH/VIQIGuJgyfnaUgfPc9PhIdQ8h/FzgyHeiAH3ND7pUmj134J7fzYWCOGulbaN7J4f9MN2ruOL0dTtBk4VA2J4yUg7skfpdDU/sTpqNwPKdVSehB7i0dZJ91fDFZvCeaXDWqTanU/2xSwP+e2/crRP2fOY7jpTR7kVyDF+ZKd6gmS8pJ1hLTyRLAD+WcSd+GKKPSjEuodu8KEaA== 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=QkVEgdVyCftZh4BTI1gfLcAwFCZC2nYOaPWDpc9PPbE=; b=je9r2YhYresGhEUhL/gStk+2cY3OJyDAQ2K+zgUlpZ1mBnrJg3TjsfEVsisIrvmkgnKGK4Y4yQwUblDOaN104Rsnne+QMtB6aOlcKv0pJsQsv9YNgdUO5c+q/kXWEOhVjyJrsImoTo0GcGoWSC0R0HF//9dJ2kiH/vcBTIEfl1s= 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 DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:58 +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:14:58 +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, Jun Li , Ye Li , Peter Chen , Peng Fan Subject: [PATCH V2 09/17] usb: gadget: set correct usb_configuration for os_desc_config Date: Mon, 25 Jan 2021 21:43:52 +0800 Message-Id: <20210125134400.780-10-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:14:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c70ade0d-3ede-488d-d087-08d8c13336c0 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:569; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rz8+M021cVSJ3o26XA9EAaIyW8ue+IYK1PfhWlm07DVxfMVufLH3NPCwbwdEeCwLo9mwR5s92fiXJf9NhnR8CaG54FVABLieJNq7pSWlRQQCmvMfOp8tJlowUrw/IIeA2SqwSXKWoy2gOI8oRa7gppJkEv/sxKCYvnoYUovywEn/XE1f0AedoKmExU+oq+OCKGNENBqg8xpC527G0cqptb4s/ESSlqZp/X4jrwPh1WpiUvgSoRSow4Jf3whv6Mtqsbj9OCtBabyorF0hDKOtcqgHtuXeyJk5Dz3oHtlsoX0VpzliDxu/5+5L0pRVLSscXhl3kp6K5CBWGFN+QWbdEnIs2+JdKcOv/mWMkNboK4uX+l7ChC7rC9qgduLQQdov4uB9rOAOzsgE6g+Dy85JsA== 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)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(26005)(316002)(6512007)(45080400002)(186003)(4326008)(54906003)(83380400001)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(6666004)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Rvg1ezr/3e+Zmr1YAvcoPXw70+EXMZGgkRqXL32aM/qdRy4dmaejgCpU5iX2aKUTTskhMCSB1alEkPrUqtxtTdutovwPTDpO4awP9xL2iowDmSGZ4vtmkGc6VTj8M5OcQoFT+gSCqxU5t3qu5LTKrk2nuSXdNdp3pJ9iwOPUI3vNjlAYEUbY3eU+8O1AeaPybT7K5P3+8kKLUpgvlFwXI1at3TWvDIQVD1FpGEPA6Z9s0MeBpL2YsQHtWB1d0TbmXPe2aUog87eNEmgfUJfsAVTyjeF0FDDuJUZTW2BmLOZNBXk28jRpkbChXdEc46OLCN209LfaBpjTFgGjabgQhiSXXO+x4L+cJL6bNNHn0NGMGgFtJmV/g4HEXrZC7mM5g6nJ811BVBin86hVpslc0gQoNspVTBdcipqc/dtc/A8vvi8ERLDkq9NK4TB+9TYc/kQ9d+B7ztVupowIIQl14Otua8neNs1P7r5g2yzfavllgTOR7pUAl7HsUobsaM4JB39obVd7IqSwZWBCAoOXt8Q+IB0qqYTBO45n4mRq6J4nDjbJQk3edcTZR7Z6vn/PSqcDDIsh8vYRiB96U/jFicLqJlinPcPfPQgP9rPMUncS7BJGNbkFWMtnbOi/X6KqPGGzN0XOlsAFKBd0hZIF5ec8K4KFdXKm+NBTr7bqoglYAMr+CCHQWtxb+DECyO/Fut8nY7fj9LCQLlTaWB6Y0rh5Xa419SwerYtEaPTZOWhJyMcjLyTDbcen7VhCMwMseqsYtsycUgb9vT0/5r2MhY+ceCYmhzz78TKm7xESS2d85mRcWXt582C/J85OyolnoKYhTABMGwaBtLWy0CqIPIpPZJqH6akgez3o72GA7IzDfSEpTiP8yDxto25zQ6RAaC6KWl32X5QXz8CcTntXf/ntTr+doNIKkhM1W0PVj2M51yQE/P82fa/F0EIjA3jMXlbeXvE6gYAnqUCzeoqePPD/VMaRFQG1J7HOWLbniWtCzyOsYx8UhngitAWJ/bH7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c70ade0d-3ede-488d-d087-08d8c13336c0 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:14:58.1482 (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: exgFVH1yex2gxGJznZxB+ibqhj9m3J/6ilNhqxRzGQCFk86HcCSs91OKN4XfME2VCw21MQLT7V2RYh3hkJqHog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 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: Jun Li The current way to set cdev->os_desc_config is wrong if user restart fastboot, as the old config is not used anymore and new allocated usb_configuration will be used, so set the os_desc_config while usb_add_config. Reviewed-by: Ye Li Signed-off-by: Li Jun Signed-off-by: Peter Chen Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index cd61bfec38..e6fdefd3d0 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -399,10 +399,6 @@ static int set_config(struct usb_composite_dev *cdev, goto done; cdev->config = c; - if (cdev->use_os_string) { - cdev->os_desc_config = c; - os_desc_config = c; - } /* Initialize all interfaces by setting them to altsetting zero. */ for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) { @@ -516,6 +512,9 @@ int usb_add_config(struct usb_composite_dev *cdev, usb_ep_autoconfig_reset(cdev->gadget); + if (os_desc_config) + cdev->os_desc_config = os_desc_config; + done: if (status) debug("added config '%s'/%u --> %d\n", config->label, @@ -1373,9 +1372,6 @@ static int composite_bind(struct usb_gadget *gadget) /* Microsoft OS String Descriptor */ utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign, OS_STRING_QW_SIGN_LEN / 2); - - if (os_desc_config) - cdev->os_desc_config = os_desc_config; } debug("%s: ready\n", composite->name); From patchwork Mon Jan 25 13:43:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370231 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993783jam; Mon, 25 Jan 2021 05:28:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm6g7i8XBQqci+gI/Bre/KXAjfqg8P1FYsO7x1/Co72mtjf7cyf+0K+r9+qOEB1bY7iK1a X-Received: by 2002:aa7:c60a:: with SMTP id h10mr430634edq.263.1611581320824; Mon, 25 Jan 2021 05:28:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581320; cv=pass; d=google.com; s=arc-20160816; b=fkwDtl5bORxHcy3ze5t66rrXH1IDtFoGA6jhVRFtnGEjL3CH44OSrJWEQ07pYniLUI vEcqlWWlo4T3Y+bLZ05oRqeI9DbQRZX/F6D1ZxbwiG6Ob9Ur0yiJMHTjl5Zl1p/vJ7dZ jT0Z88KJbCodj1UN/iFpM+weE06dGBImuBSkjElhlQ93lS3J6RNoP9ghkjI8jG2lyGSs h0rzZct7CGVkkJNVjshpBLnvUmP2lbGNVIxQoyNRKHmPjBuzfvtvcq8t9OIiUJ1tfn2/ 77iqmlPS1v0Kg0bsBEklbl1vQ2L2EQK/D1A+a5wLTLyzHrDLL6Xej3uOHSRkPqWpPzJY qucQ== 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=6lMFf8QqZUvxpQxOZf31xgXNB5z9sPeeZ9zMyrwn1r0=; b=YAbnjwrV959rC5/0Cui1EXmE278Ob1a80hmmnESJzokQYZPgu/9fX+k3/XqVVaI1Kt xXsj9XOhn/uPoLNHt8AZVA4al4nezo8+4MIOwQ4B2x80TWo5xAa8foknKqpRQx/N2Shn /XCyu17U96qeo2HPWfjj/HcgwgL5cYwCODaSaNfNOgnTiASeiaZVgGtgfrK5eYLr6/iN 73dnx0HKZ7DKkf/2dmJNWWszaiTVEsloJDq4Wh65UUrDrpiRDSwP4qaoBmLJpsnXG8N0 9TMttqNcsn5LKnpDxFA+EkdtKubZd4ZhoGsl5RNZyGz4aHU+Tz2g/fYGQGRrvzydkzwo uDXQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=UPINb1PW; 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 j17si5970555ejt.189.2021.01.25.05.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:40 -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=UPINb1PW; 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 128718279C; Mon, 25 Jan 2021 14:26:55 +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="UPINb1PW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C35382686; Mon, 25 Jan 2021 14:15:07 +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-ve1eur02on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::631]) (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 32B6E826C4 for ; Mon, 25 Jan 2021 14:15:02 +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=BEo3RHsctokvMX2td2IQv7MxmB8NLqRmn2eUIbAtpzE0EFCpJFDFKzN2rkuAjtWFcAMGe3uO0Wsn7UYsPq5YSJT6Wo5oiLwNsuu0u65agJgja+pp/kZHo9w9vHlkimwf51+PzdUf1T/sg5fC0O0Hyp9B8JHWh5bA1tKSVxW2+ri4fLTH2Wi5RJVHZzkdz26lpbA4iTxGWJxkpm3e5/zNKn1uGdC50JM5xDGSsfiXwk5INobL+PySkvSHgFLAXTpeSELEFAt2I7Dm77DZj7h+UNg/oo63dWOmeepwMS3yq+78UPXaD9NEv4dsiaey9ZUq4mQSQ5Dyjri6bqcKK373pw== 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=6lMFf8QqZUvxpQxOZf31xgXNB5z9sPeeZ9zMyrwn1r0=; b=P7xOYwl82fewx4TBssa2BYGtCociDEjurztVy4/dSP5HAu1omDTbg3toqY9Bnuo37ZgXrsGVv4ROC9ZXmy6dFZQ00vXvvnzlp+3S7ZZNsqSqe+QNALX8lDfDNOMy0gqa6oWE2y15rLOu5GERAlkCYX2mgAP1XCxn1ImurGOyG7omBl8+wIvEROACtPLNsr5U1NhuanI6+As+rGDGUYawj0nYAbo8lCsNgCJ8KIqN47sszMHWY8TtRmFtYlNzn9+HB6Bql0m2XD5GEJ/Og8wWOCq4uYvw/vgbXO82XL+NSbkyrYGslx56n8jaPZ8NkUsnYAPY8O6gsQgqeIJ26QUaEA== 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=6lMFf8QqZUvxpQxOZf31xgXNB5z9sPeeZ9zMyrwn1r0=; b=UPINb1PWqfpEcTcG9IQVKchd8mc/b1tUh0KbVKflmqZqzumxCgYuk9eEXec3E/TyC0vKPgC9nWG2Pig+4l+xsBGH0pWn5AlQ4q9UFKMbWXUC4CSrppufqEvm5GaWk7heMY36wunUYxorBujM0tT9T4YDmhPI6stUrQ96nEYsGM4= 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:01 +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:01 +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, Jun Li , Peng Fan Subject: [PATCH V2 10/17] usb: gadget: update os_desc_config when add config Date: Mon, 25 Jan 2021 21:43:53 +0800 Message-Id: <20210125134400.780-11-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:14:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fed17f0c-eab1-40f7-5a79-08d8c133388c X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NDuNMb3bI+44j5HDTZqZ2iS/bwihML1KCgXZKTaHjIksc9xrHGC20CRxdYCFZ4yfYXz44mZtVMeiFR5BW/oPDzm66MBRyD6rRDmyC4epGFQS/x69JcHcbgh0cmuDocafZreRdl+OWywGK0Kyokhar7I7O+gO2Wv4faVw/zrJCm1IlisohLqtIx32/WxqjR3kxSTF/1YoGYnEY2gOKC7J2ttUbDsbR+cJ+6sir6mWra0X7XkZlLzU9iDxQ7dC4szhspbxzMeFNsaFMYbtxNG9PJilpL4V3zGK8pfXxrLWzqUZ5tk0LaN7wRoS2EiL2iX/UHfhU0yjaWpujjaLLcPv5ysgIxPIUkweonRbhdXgtgaH+xAsCt4ZEnF70H9bxH0H7lIwPeKInGu0a2/hp2VvAQ== 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)(4744005)(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: ZIBZh/07iKMJkbEIwpzl6TUZXboVvhVJeSAiedygpUPsEl+/74L/MJabkIOiReVx0/SojTTyVVEYpmraRuw5HAdWz6A5C8fCwMo6SMoK5i4nuafBqVjxD647xnIXcH1R96Igf+7h+lpWnK7ZKMtevm/Wac73ZhHunXiEOKdlkXy6PI2uSIjOwZnoIy6Ze790YJONtm6XbR2ZRKyqyQLkoQzgX+KBcdvTiDnU3MqPsN6B9uapjA/pk9O9reRberc8LTtifVOiokBVpFTRFoC+6Nl1KPVzipghbhupFoSkhE7pgNxMuDQU+5HnpRPE6n8gpZOb55UMnEMfskAStDXlur5JKagjuJdEuiUrIubBpqZGtWUSWf4bnZLrL+sxe9v7GfBueFbRe7tJc3bV3OTMIKLH+wiW3cm2+4pV/NP49UCIMnQY/4xr556hPz1q9f0kJlT/nAEY/dvnIZsQxayZ946TvqiYfT17Us8EgTN6G58DCDiTRG+58YNMQKbcgGDCXtIIhcUyhk6d2G1F+buB4NKulVhzc16TyXicIv+/qqArnWNs8m3FU4DwE244n5poRCpltDz9Y3+Lll5CBKfnZISBQfWGM7J9PsTp2CALu8qwewS3W0lT8SLVLBEzq32mjtqMqtzTYnSSaBl9ckh89d4jNy7S9t4q/8eTNRa1SQ2QDQ9+kD+lHKrusweahv4bk39cQXdi8pjILP26jeq5fEXFKA1BvH9nN1iB4YbX5xE95K6X6LGEahr+Vi+TCcb3N1vBvJsZZ2AL24Klh4BOL4f3w2568qnbd7WRM6c5OWue/Ex0duzv119L0br5JEaVFi9kCJ1pmtRuBdPk5IFPSLw0Io1Gf4iYpB3SQgk8uMtgSo5m2DBXWMnMQ4dzbBfEzbbf+h6o87vso3DpiOvBVqK3NXrQl6oSO+zc+FbgkZpXfAUCZGCKa5KxVZHg2PCfji5Awc0MMwwoaxpPYUHD1udil3w71Xz3aDoHPZ+i5+VRnZFra2PpEKvXBGtp69sM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fed17f0c-eab1-40f7-5a79-08d8c133388c 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:01.2938 (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: j3b7GlyFh54o2879aYYwTK7BPPMrXZOBsnKaIdgd2DlabHloJrXbRa53/efKEmGsPzFBcrnxgRORKGa/v3QRkQ== 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: Jun Li Always use the new added config for os_desc_config to fix cdev-> os_desc_config may miss set in case we restart usb gadget driver. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index e6fdefd3d0..404da12754 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -512,8 +512,8 @@ int usb_add_config(struct usb_composite_dev *cdev, usb_ep_autoconfig_reset(cdev->gadget); - if (os_desc_config) - cdev->os_desc_config = os_desc_config; + os_desc_config = config; + cdev->os_desc_config = os_desc_config; done: if (status) From patchwork Mon Jan 25 13:43:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370232 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993912jam; Mon, 25 Jan 2021 05:28:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkWeWuFGe9dUGLnDGpz7rCKiH6SFZlNB7O1ZKzdLKETZUHZb9DO0HpH6Fjch6Du0oFrhlM X-Received: by 2002:a50:9ee9:: with SMTP id a96mr431767edf.343.1611581330787; Mon, 25 Jan 2021 05:28:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581330; cv=pass; d=google.com; s=arc-20160816; b=zWG8CtnbkY+6klyH++azEoeprMYNsh07IqA9QBjksKaYaRLrR6tBdGP2h4Tx0VNCF9 t67Bzu8BMt5OvHloDt+tQq4p+gXEJn8/xk8UVxsOkG/j3eANyCxKcJoY8esaGwG8OmYK Wwdxzk5L+2DyEIpXRmECxTNqpC1GFmz88e6CYdchUX7Cl2qV7f4gaqrzZRIDEOp5wj7b ZQHMYY9ATnxR6SncB863jUDsDREuVA/3gbRmqaLzxidXLNIrOlCIk09oixurgJHxeUBw YTQ9+WBpEStv+VKqe0WaEx56q+70p8gzJhhKn3HQQoHycUKwIZtvuT7NxlAhPQfJJpVf JWeQ== 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=25t/RNTpe4zOUqY8lHdRiplKnv+fKjRjhI0OurJ6ElE=; b=jXx7vSgHLwr9oNebRtDJfODezcAJeVchP1XsS+Um8jOSY31Rc7ZJ3Qvnb4jtLXK3LL 0tSo+NshsQBfBGroLJASfnK27VcHcvRn3qhPfWpWEl7/GbE6IY3jftbgxvdy4XyVEsmk Izi78cK/zI9iTcFQpTlzQRgZGV74NGV5XchC2V9E5CI4r45e8DQROT57nOOZDM8daRGi Lz7g4Eavbw03Cimq2BvTcjQZmf3kgC1Q8VX+jcctmwjfFRWHEnmNJ5/iGO8XO0LipRVi xfVTNKM2mQn71s5SF7+1gUKwrSuaMN63yDRTbIAm+EYICkOgyqkaq0wlboa/BHCl37rI 7nnQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cLdxglvO; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l14si7508483edb.407.2021.01.25.05.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:50 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cLdxglvO; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 A666182777; Mon, 25 Jan 2021 14:26:58 +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="cLdxglvO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F124D826B2; Mon, 25 Jan 2021 14:15:11 +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-ve1eur02on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::624]) (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 4718B82679 for ; Mon, 25 Jan 2021 14:15:06 +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=gg33xU4QBJZMbEwHc2YdqUn6lI6OVYqegEODI9SoIj6pvoGDz7D3GZ0BWQm4VtWkGV7J7JYOetuWF8VjbYQXjr7O+p7BA4QU6KqVBiNQxaGOKm+/xQwtlangp4JRvYJSuxCdaP5sdl+DT5tAo8Ni5ZUKsGt1YZOLhQ/EU/FYGnxc3BOGOOhgskT8FsGhu5EZVhOKMBQAf7JBx324arQHb5NaHE2NURBI6htd+E7ZQslR2Fa+L4aj5F+YUIdYXQh9W+8MWe/7r848pD5gFGGKNnr6FzODt6/+R1GO0dFmDxBrD+yp5g6DGgVGAgCKo+szf1CuxKJStFRDISsT55Xj5A== 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=25t/RNTpe4zOUqY8lHdRiplKnv+fKjRjhI0OurJ6ElE=; b=bpxbuS98UNTQaJInVkmtAvfj9JwmgWaMIYIU6v91FJg2hw7PyvcmwGSUjQgjSGT5PNJ7uwkeM2sAdgd65mcX43d1HVfEyF/gkReF8obU8Aqcwi1XGytYTvB3an/8ddO8c1HvgyU+2t9/ZJpsz0Q9xJ+u4yUbKlByaJWpA11mpVtdy7Wmy2K3aBCpZ2rFslUU0vvvgIQ80Ma0b30ZuT7t8HoJ8CegukwGdMRalY978kx4A07R3t6qpu4b4egF82yyu2Bs5M0rA8D57NgN8g6ajZ3uDo0HvEME7ar27x93j3z5gCUdUtqoQWkrR+eBIKZr+fq1Y3oeD2d5EaWHfWR4Pw== 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=25t/RNTpe4zOUqY8lHdRiplKnv+fKjRjhI0OurJ6ElE=; b=cLdxglvOCxTMPm0v8kpeH89TvKObfdLw8RVW2JYiBX4/xf1IzaGnpShBPbhVpLMZkJGyEr6XmUte5KQKZ1ApYmq/TiAbcAW5Sgz87XEnh3u06q95UaJjTRF55i/wxh5A+PElu1ZqlcrknKJ0iWITw85yZM8KNXMe1pULMadORUM= 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:05 +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:05 +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 11/17] usb: gadget: add super speed support Date: Mon, 25 Jan 2021 21:43:54 +0800 Message-Id: <20210125134400.780-12-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:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 15a9a445-fccd-45c2-42e1-08d8c1333ade X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:255; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9tenmYZ1aKXOboVNOho/bCEhg2KfdimLXIyasCGTnGpVWbsrZyIqAVhJaCnpPejDRTkZAjcBMQ5fl3PoG7gIVISSloDyBti1jIn2YcaGABVRP5Bo4N+MLSD7aqNTG0VMyu4csynti8WhPNIJfZPyDmCQCT5CwDKjjNm2AYDl+jI9E3sq+ByI+ELPDeuhpsbWXwnuYOMrUM1/k6qxDQwXVvDOwLLPfxwMvbjRRkNaxq1dNWGMTYONqRj3OjBhYPDxIPMXIJOd1OPrD7OpQtN/oAQcgt7cpuKtoJGNwbhF3g2/qLB8Ye0c5mopiyG5vxOsmN6sgTmFXUF7vNKG8nEM0afWvWoZV7WTDa9vPXSKGjKI06uVdmKywTvXPMYYJGTrY5qcmAlLGl7zSo81GcfurQ== 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)(19627235002)(6486002)(6506007)(86362001)(316002)(52116002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fQp6D5ZOHPXA7KrxCXE4coWVj5J+8m/ykSlVZvEZMRw9g/9flulp91FfNxuo3e2u+PbSJnw6o8lgSnUyJdgiPjw06YpqtPlP7dxkouWowOQMjeIC5rf+FTZ++BkOtXDip6JkoMjdi0qJ5c0d/5FLQO1LMHcjZAyQ86uW7UOx/pFaETUm5F+1ZIq7grKiAkOpvmWH6Y1bUAAPFA1frk3MeEcNP3V9rtwnAovvgefsbTnuygJPQUbCF+bnx1CZc3wfT5+S5V+Vi/SxBGGg3rEKaS8YBJJYu7c6+XLXG1IG8NlVBw+Ageu1W6mNaVRTmywEbxaVpzmjtKzWcirg3Bxe1luKKaoLXjO4d65ou1A8NmLNBkEtZV06IbuVuKfWcGHffb8Iqq9GQWCLwrNaoZYhnBRmwIYwhaYlu3FCybnOcmsj+l3cpQHw+Lgt9t3/qAyVJtZiGw8H8WQNGE68U2rNgPRqhtAvMbBq4Ym9w2uW/4kqPz2AlHMTorEu85MZZfB+qwXPZSjusEMxd3iMsv1oVgcfyB8h8DBlHIlxFiaRyDOq4yY/GpkDYF2wRZwgYQnXYblFgZnYVnrNJ4Y1/PzO1YLq53/WCUW9hc1XyU4gy/VFu/7rrc0MlPMKS9zrLXQQzbrq2+ILQSeiqwsccBfAsudRhdSXQn0Xwv8jU6L+g3P+TUGEieR4HFF1tX1F9AlHeekf3dOIsc3mUfX7T4O9NInnd8xsFnGnqE/+D7ZkdtLSAt5K/IzGmA1LcJfuk/wzakqBVlOsnhvuvobt+E9HCJfBMnJOWJiteHyW4HAnX3kv6YBMQOW0GRkJ4JLD9pjUgEji+1oWcap9o68+5MegeQ0xdwxigzTbTnaTWSje6qFK+u0ACusfa9713MOwuMZ+uFC3HVThtl0lPagTrqcwNztkJZGMIhTJoSlWLgYxV91IejgFnqGPgP+ExGjdjEnW5FWXdKpRRCNBm5idzJqJnb4//IF359p32RCicTBDFjYoGMdqkoK+uT3h+aKARLtP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15a9a445-fccd-45c2-42e1-08d8c1333ade 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:05.2970 (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: 2V1NufDY+yWIVyr4LPl+fD3E8KxDcpYgB5kK+bKx8ZCgry0OkaUNUq3iOE/GXRX23YkpQ63sW3x7rwlhsm11Rg== 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 This patch is to add usb gadget super speed support in common driver, including BOS descriptor and select the super speed descriptor from function driver. 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/composite.c | 85 ++++++++++++++++++++++++---------- include/linux/usb/composite.h | 4 ++ include/linux/usb/gadget.h | 6 +++ 3 files changed, 70 insertions(+), 25 deletions(-) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 404da12754..1063c571d8 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -88,6 +88,8 @@ int usb_add_function(struct usb_configuration *config, config->fullspeed = 1; if (!config->highspeed && function->hs_descriptors) config->highspeed = 1; + if (!config->superspeed && function->ss_descriptors) + config->superspeed = 1; done: if (value) @@ -223,7 +225,9 @@ static int config_buf(struct usb_configuration *config, /* add each function's descriptors */ list_for_each_entry(f, &config->functions, list) { - if (speed == USB_SPEED_HIGH) + if (speed == USB_SPEED_SUPER) + descriptors = f->ss_descriptors; + else if (speed == USB_SPEED_HIGH) descriptors = f->hs_descriptors; else descriptors = f->descriptors; @@ -251,7 +255,9 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value) struct usb_configuration *c; struct list_head *pos; - if (gadget_is_dualspeed(gadget)) { + if (gadget_is_superspeed(gadget)) { + speed = gadget->speed; + } else if (gadget_is_dualspeed(gadget)) { if (gadget->speed == USB_SPEED_HIGH) hs = 1; if (type == USB_DT_OTHER_SPEED_CONFIG) @@ -275,7 +281,10 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value) continue; check_config: - if (speed == USB_SPEED_HIGH) { + if (speed == USB_SPEED_SUPER) { + if (!c->superspeed) + continue; + } else if (speed == USB_SPEED_HIGH) { if (!c->highspeed) continue; } else { @@ -294,8 +303,12 @@ static int count_configs(struct usb_composite_dev *cdev, unsigned type) struct usb_gadget *gadget = cdev->gadget; unsigned count = 0; int hs = 0; + int ss = 0; struct usb_configuration *c; + if (gadget->speed == USB_SPEED_SUPER) + ss = 1; + if (gadget_is_dualspeed(gadget)) { if (gadget->speed == USB_SPEED_HIGH) hs = 1; @@ -304,7 +317,10 @@ static int count_configs(struct usb_composite_dev *cdev, unsigned type) } list_for_each_entry(c, &cdev->configs, list) { /* ignore configs that won't work at this speed */ - if (hs) { + if (ss) { + if (!c->superspeed) + continue; + } else if (hs) { if (!c->highspeed) continue; } else { @@ -388,6 +404,9 @@ static int set_config(struct usb_composite_dev *cdev, case USB_SPEED_HIGH: speed = "high"; break; + case USB_SPEED_SUPER: + speed = "super"; + break; default: speed = "?"; break; @@ -412,7 +431,9 @@ static int set_config(struct usb_composite_dev *cdev, * function's setup callback instead of the current * configuration's setup callback. */ - if (gadget->speed == USB_SPEED_HIGH) + if (gadget->speed == USB_SPEED_SUPER) + descriptors = f->ss_descriptors; + else if (gadget->speed == USB_SPEED_HIGH) descriptors = f->hs_descriptors; else descriptors = f->descriptors; @@ -492,8 +513,9 @@ int usb_add_config(struct usb_composite_dev *cdev, list_del(&config->list); config->cdev = NULL; } else { - debug("cfg %d/%p speeds:%s%s\n", + debug("cfg %d/%p speeds:%s%s%s\n", config->bConfigurationValue, config, + config->superspeed ? " super" : "", config->highspeed ? " high" : "", config->fullspeed ? (gadget_is_dualspeed(cdev->gadget) @@ -751,6 +773,7 @@ static void composite_setup_complete(struct usb_ep *ep, struct usb_request *req) static int bos_desc(struct usb_composite_dev *cdev) { struct usb_ext_cap_descriptor *usb_ext; + struct usb_dcd_config_params dcd_config_params; struct usb_bos_descriptor *bos = cdev->req->buf; bos->bLength = USB_DT_BOS_SIZE; @@ -794,9 +817,19 @@ static int bos_desc(struct usb_composite_dev *cdev) USB_HIGH_SPEED_OPERATION | USB_5GBPS_OPERATION); ss_cap->bFunctionalitySupport = USB_LOW_SPEED_OPERATION; - ss_cap->bU1devExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT; - ss_cap->bU2DevExitLat = - cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT); + + /* Get Controller configuration */ + if (cdev->gadget->ops->get_config_params) { + cdev->gadget->ops->get_config_params( + &dcd_config_params); + } else { + dcd_config_params.bU1devExitLat = + USB_DEFAULT_U1_DEV_EXIT_LAT; + dcd_config_params.bU2DevExitLat = + cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT); + } + ss_cap->bU1devExitLat = dcd_config_params.bU1devExitLat; + ss_cap->bU2DevExitLat = dcd_config_params.bU2DevExitLat; } return le16_to_cpu(bos->wTotalLength); } @@ -999,32 +1032,28 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) cdev->desc.bNumConfigurations = count_configs(cdev, USB_DT_DEVICE); - /* - * If the speed is Super speed, then the supported - * max packet size is 512 and it should be sent as - * exponent of 2. So, 9(2^9=512) should be filled in - * bMaxPacketSize0. Also fill USB version as 3.0 - * if speed is Super speed. - */ - if (cdev->gadget->speed == USB_SPEED_SUPER) { + cdev->desc.bMaxPacketSize0 = + cdev->gadget->ep0->maxpacket; + if (gadget->speed >= USB_SPEED_SUPER) { + cdev->desc.bcdUSB = cpu_to_le16(0x0310); cdev->desc.bMaxPacketSize0 = 9; - cdev->desc.bcdUSB = cpu_to_le16(0x0300); } else { - cdev->desc.bMaxPacketSize0 = - cdev->gadget->ep0->maxpacket; + cdev->desc.bcdUSB = cpu_to_le16(0x0200); } value = min(w_length, (u16) sizeof cdev->desc); memcpy(req->buf, &cdev->desc, value); break; case USB_DT_DEVICE_QUALIFIER: - if (!gadget_is_dualspeed(gadget)) + if (!gadget_is_dualspeed(gadget) || + gadget->speed >= USB_SPEED_SUPER) break; device_qual(cdev); value = min_t(int, w_length, sizeof(struct usb_qualifier_descriptor)); break; case USB_DT_OTHER_SPEED_CONFIG: - if (!gadget_is_dualspeed(gadget)) + if (!gadget_is_dualspeed(gadget) || + gadget->speed >= USB_SPEED_SUPER) break; case USB_DT_CONFIG: @@ -1039,10 +1068,16 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) value = min(w_length, (u16) value); break; case USB_DT_BOS: - if (gadget_is_superspeed(cdev->gadget)) + /* + * Super speed connection should support BOS, and + * USB compliance test (USB 2.0 Command Verifier) + * also issues this request, return for now for + * USB 2.0 connection. + */ + if (gadget->speed >= USB_SPEED_SUPER) { value = bos_desc(cdev); - if (value >= 0) value = min(w_length, (u16)value); + } break; default: goto unknown; @@ -1421,7 +1456,7 @@ composite_resume(struct usb_gadget *gadget) } static struct usb_gadget_driver composite_driver = { - .speed = USB_SPEED_HIGH, + .speed = USB_SPEED_SUPER, .bind = composite_bind, .unbind = composite_unbind, diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index d75a0bc4c4..935e5c0cbb 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -146,6 +146,7 @@ struct usb_function { struct usb_gadget_strings **strings; struct usb_descriptor_header **descriptors; struct usb_descriptor_header **hs_descriptors; + struct usb_descriptor_header **ss_descriptors; struct usb_configuration *config; @@ -279,6 +280,7 @@ struct usb_configuration { u8 next_interface_id; unsigned highspeed:1; unsigned fullspeed:1; + unsigned superspeed:1; struct usb_function *interface[MAX_CONFIG_INTERFACES]; }; @@ -292,6 +294,7 @@ int usb_add_config(struct usb_composite_dev *, * identifiers. * @strings: tables of strings, keyed by identifiers assigned during bind() * and language IDs provided in control requests + * @max_speed: Highest speed the driver supports. * @bind: (REQUIRED) Used to allocate resources that are shared across the * whole device, such as string IDs, and add its configurations using * @usb_add_config(). This may fail by returning a negative errno @@ -319,6 +322,7 @@ struct usb_composite_driver { const char *name; const struct usb_device_descriptor *dev; struct usb_gadget_strings **strings; + enum usb_device_speed max_speed; /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 8d54b91734..7e6d329e54 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -449,6 +449,11 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep) /*-------------------------------------------------------------------------*/ +struct usb_dcd_config_params { + __u8 bU1devExitLat; /* U1 Device exit Latency */ + __le16 bU2DevExitLat; /* U2 Device exit Latency */ +}; + struct usb_gadget; struct usb_gadget_driver; @@ -464,6 +469,7 @@ struct usb_gadget_ops { int (*pullup) (struct usb_gadget *, int is_on); int (*ioctl)(struct usb_gadget *, unsigned code, unsigned long param); + void (*get_config_params)(struct usb_dcd_config_params *); int (*udc_start)(struct usb_gadget *, struct usb_gadget_driver *); int (*udc_stop)(struct usb_gadget *); 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"); From patchwork Mon Jan 25 13:43:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370234 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994229jam; Mon, 25 Jan 2021 05:29:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJznk+VxFkUqpwAPLi9lrsDutma0ogVgUfH1fSxOrsy4pGLVIMzZN+cl3deYOfe10eDB/k5X X-Received: by 2002:a17:906:4694:: with SMTP id a20mr337873ejr.201.1611581354065; Mon, 25 Jan 2021 05:29:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581354; cv=pass; d=google.com; s=arc-20160816; b=c+m6Y0JhfOnZKJ2E+DwHk+EYl3X+muHHuNhU23QBxbVDYvzVi275f2x07gZS+AWMAz KYjt9U7UVHAnva2WDH9UDQvBtFcPD7npe/+OQghKWO9dmqGVvcdG43eG6gCd7gbbXyKL QZTqsSBcP+CcH9tNNiBh6A7c8Ln7muuDiYzecxjuLm+gnZVqvc/m6Sgts+pzB44rFi1J 4jW0BxYlTUJsQzMQ0AnCcEonkjnCwfJQq4MRp7EfsmBpeJkOfMNbc2MvVx5cjut23anJ hPDltI3kR/ffkhWtGpvDM7FwlOZ0kUrMZyCOgjrkoMjeZDJqnQ+RTpG9Ysv3ycM/qpxl G+BA== 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=vzhKSdJRW6xiMGBg87vBIfbCtfU+U7wYjLehtE+UybU=; b=k9rZfZ2mOqg1r2zXHZ73hMF2E4gIMOSvfxvAxFHBwq6B4K17ZPX/2PVRnKdGD0YyEx eyMQFcBDRhfvnoJAbqNM2Fpiju0WNoTwIunoE286rcHZRo81X+ULoFM4L1qiXarYKF1c szzQ7/Ztb/eZQ+J3JHgODKRxagO69GfkGVLbcQA0m4S0k47Kd1t5oFRAGXrqS6BR7IQ0 e+ZpBc098dLSwxKmfViADfABfOhynwylsySLsDe5yeLH2D1ByLjZ3fZWgS5s2GpeSapa Rn9Xf39kSduk+SvShS9bgjDyU5OZJCseoS19KW7dLHT+/8tDJ/bu5RvrQ56USlL0ooBC OEtQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="doXACZ/c"; 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 e6si7337716edv.446.2021.01.25.05.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:14 -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="doXACZ/c"; 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 A4B50827AE; Mon, 25 Jan 2021 14:27:05 +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="doXACZ/c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7B0182679; Mon, 25 Jan 2021 14:15:16 +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-ve1eur02on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62c]) (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 ABA9F826B2 for ; Mon, 25 Jan 2021 14:15:13 +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=Ucn+sSA0hnr1iEq+jqep3tf8k+jZyFMqgGCTKIdWPu3YEiL197Z+cn+F0bnEIWwXUWL94XRCkR7KXWO1hAoCi4hDg4dIkoqIzsomLOzsx1L0F0zvUa2qDYPQDYGadv8S6Mq7/Ka4mMH1bYFONj5bdn+xvIj9D8aiJ7WJ3xiYUYI9+icE6pBjIz9wpcdWo45lc5h3zj0Rhk/PghW7oyTKkdbG+Z4yNVEshiV48yYXeeN7BXWqR5TzYJtBGElG6EM7XhtHCDfIjfWHt9t7ywqjTexyklB2n/5MfxY7aDphlxudoqxFbZWyDBrVW9dOiwEElnOw4yUQPfgM/l30Nk9dyg== 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=vzhKSdJRW6xiMGBg87vBIfbCtfU+U7wYjLehtE+UybU=; b=HaPtVDBu08slHWGMMbakeW7OxzMlSINsu9JoVD95ExruB2pphMvM/IdQEaypp4gpZf6a5v2JPIAn7xDud8dagqenyHMlaUjD5zH24NOH7vc1gTjNnsw/qcKUwDU2hF+sQpDQKvzdSAqtdQ9nrRMTAi0imwm2qToobcNAfR4GtcvLvlSi9SYh+SHzYsonwYgcaRy4A65nHXak08v2bfXfGwcrvNKf/LVRXC/Irv7OwFT8IfA94zCNJslMG37Q3n4gd6re6aci9QsM6JB/1Wakf2yXa19DE2xRASs9YrLBhi4trc3zow1RnUy7tbWIRCX0eXxanttnxU5DiJ7GeSp3qA== 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=vzhKSdJRW6xiMGBg87vBIfbCtfU+U7wYjLehtE+UybU=; b=doXACZ/ca2pD5LQXUAs/jlheqwUwcKem+1QHgHpirR/x0c60YOlwb7fuOyae/wwAA23CuJR+Z9LjnWcG7FuVcxxIfOdR7SzsKKtFdc+BPvLWx5Erh+l/Td5qHX4dd6ima54SR75Ir8ICdR2kWaU59gRfvDfb394B61MMySc4ALk= 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:13 +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:13 +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 13/17] usb: gadget: dnl: set dnl to be super speed Date: Mon, 25 Jan 2021 21:43:56 +0800 Message-Id: <20210125134400.780-14-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:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 04419e5c-45ba-4492-291c-08d8c1333f8a X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:428; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yipK9g7b84RejV5nxcGknEidbRRvGpwLHe1v7VYFkiytpBKrlLyaHXMf9hkdOFeSawGQSjEiQgyVJvYoiy/NGRNFCSJurD+tZwZol/XUBTrF2/vR9LZmLghu1/x76QQHeBOjhTVQjXemmTlSkoS+sHK0LoTdSlHgU/7PhioQ7wfzsURHT9k6pxJFYzJfS8Phva3hUfLgmQBCd3WzYqPQxUygglSsDA4o2fm/0i+bw/VUW4xwmzIIZfLQ/lraqkQYT9QHtSDQgNNxljOSxNwUcNrSFQCdzSDE0Uvn3u2Rx7wOL0Dso95h5KeXg6BRCWRm+m34XY4DHewj3MFhTPhr34Usl5nEca3w2EsARcRqEmB78at0iIEEHKWi8cjZ9qIYBu2fApaXG7CpE0qiIwU+5Q== 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)(8676002)(4744005)(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: uHYYzuwdUoTNRwFYVyKG8U4yKIKZnMBFm+FSaXF+dc2c1Sh54P6/8KLn12Sm2by8xn8gw4WjXVX1cQ4CWvw6ymB9IRXR3BSZNYgNCZYUaQ1mo8AdobCtIybdeWBOmOSNeMrusfV88vZuO/DItoFub15m7SqoWCm2jLTQKeeMQ5Tp58GM/kLmXnYIU0FWftpTGMuYaCMo+xPRUdyja8AWD/zdFsMOQh7OSF5c/4rA6gYS6+xhhEQxAn0n04WYB5y2+nXXFVslxeB3oZmH8B14wzHF/yO7zQPl4T35US6ggckPZSovkYoeL3+0plSOX65XncPRa/iYJqtg4GqQwRMuv+wilhsG6D23fagwrECWdoiOXPLKJZE5MOdLCIeL8IOIsv/nWzaTEOXXFngWrcSNWdSoWKhqMQ5u2ZjS0H9Ux0MAbkQ+oN76afy6oo0xPWKHcOlMAaeUeXu2rzTT5cd53d1epdgj4Gnd4XZfFEL7bL4cbMAHUV3XjsLI/eCOp/EpZltgsSZk8s44fTTyNfduuWYycgrm47ZstqpQUNuT0ih/Cr2fEOP8zn//LtzZOvEoHbUfpijmhWvYhUB7PqHRYvFv/At/Mc2oZS0FuyHUrHVacOutS+04uDNTRJkEkbaPkRqk5QqWnUTrhpZpk/Em9yNb77V/vousv9bqZwdoEM1OkxTEP4anREq5svO/LyruaEPLV41e3UBavi7DJraHxadgKEY7IWZOPglG6Zd6iI2IoERkgBky2np+UJnp+Rlx0Ee7+NNiIuGCW/6FFW8Hxpb4OXumhub6ghaReJZ4hmxoiqNKKn0OGIaWb2JEVYPmtNvXMVVdoEMlM7R6+lx9IqX/dwm37A8161h1db4BerEqi1b0GzYQddmuKZ3wqFFjbbbxMMg3ARaLvyX+jNWvsneCUaOGWCF2yNhEmylfhOq2Pi9WOXy92rMJ6RpSz7OpsV8k50GFXc25okeQd76qPJjusiT4Ah3M/rAGH3KIN2gCi/wG5U7flB5gFo1LF1Rp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04419e5c-45ba-4492-291c-08d8c1333f8a 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:13.0085 (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: g5rlTvR4+Q9e8yy82kZNp4mltm22jDD1TWTwtaLa8EEDk4IpycrOlRwbKtxbcBSRUFj+OguHqMvlxio7jzMDcg== 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 Set its max_speed to be super speed. 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/g_dnl.c | 1 + 1 file changed, 1 insertion(+) -- 2.28.0 diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 86fdd16b01..afb7b74f30 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -286,6 +286,7 @@ static struct usb_composite_driver g_dnl_driver = { .name = NULL, .dev = &device_desc, .strings = g_dnl_composite_strings, + .max_speed = USB_SPEED_SUPER, .bind = g_dnl_bind, .unbind = g_dnl_unbind, From patchwork Mon Jan 25 13:43:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370235 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994359jam; Mon, 25 Jan 2021 05:29:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzd180xY8at6BUnlf5F9q9/VGWsPhEhbmU+Mrzjoyc5J9CONXpcerhSJ6k+elu3QYfoSKc X-Received: by 2002:a17:906:fcce:: with SMTP id qx14mr375418ejb.220.1611581364339; Mon, 25 Jan 2021 05:29:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581364; cv=pass; d=google.com; s=arc-20160816; b=c1AwGneNz5BcPOJ0T38WggEGjdq0661l2jkjs8Jxeu+N8CJm7oScdsTGSBSoiPmbEX XqL3JCVeAgTi67e01IX3vrMQQuM93DH5+zElhdo6F53RUwPb1uiZdy5eJR7C7930/HDG 3o1qhV/75P23LuMevfQpWS3dSUdIf8kTEOS0Giw85d1GFJ/D14EsG7XIeG8jB/gldwd5 1VDwfJKuVLZtnHJInhfGHpTQF4V1RRoZimpajnyfHx8Mk8FJxSL6v/O6v6qLeJEE70hL 9VjcuUT2dwWmyRYjwwEgv0TvTPoDHdUOz/JvUfYrtCfmvyMK2NCGyLL3AJLEi45ZHhv7 8EsA== 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=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=UKVpgQ4Bo9sJjlRsiYRc/5M8GFtKiECdAQwuldkO/lcpvvV2EDPvdhMmll2DUJykVp KxhQtXHCyhGOyLXO3z+yXj+8CWjl8et2jl9kw4Q4BoCGvJT1437O9sgATXlqdKce+83L GblqSeCxDU3lkA03auMzlUkfDPFNjpNwfYX4NpXwSRMcUZQQsYIoYluHGPmdXDdtpC+R 1ndwG3ISfoH7FPQVJz/psfxa1OnCeefDDOnsJzpJk6qJH0W364d3f4onPjUwKq17F/rw oUREBaHB1hY5OS6yJI+wOQYv3UgZyV4Ju7cBiLqp1wrKpUlbu2skOMzMMfWQ6VvqPmqS BQpg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XkRnJ3xR; 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 59si7473651edb.71.2021.01.25.05.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:24 -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=XkRnJ3xR; 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 D0A70827DA; Mon, 25 Jan 2021 14:27:08 +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="XkRnJ3xR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3EB46826B2; Mon, 25 Jan 2021 14:15:21 +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 E759282642 for ; Mon, 25 Jan 2021 14:15:17 +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=Z7JoQujDozF0a0UnkJTGmC1k3p8fC8KKjPoJcQVhbG8+lgJVoa68fMb14jdNvsxZu7nsDTapYkxzHTzjgRwIwiZ8Ryr43E0uT/i17JtBJJrvn5yOl+bV2y/sYv3I0rp3lhD7e/LB7iT5GWI/ytI2HasuZotQLage6rlthtDMLOegIwwJg5l9rHf6a81w+Ys7LDWF/MEbh8Cd/Uz6MJisqfAAMC6XTFQNmM+Nk6b2QG2BRULW5PV/Hx1fNN9coDHKdhf1AOQ0e9t4ssua/1ArFTnL2JvteLvvNAzFopAHA/0RlNNYuRLnhbT/8UzxzObL8Ad/vEzkAmROqlX9PTktdw== 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=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=IUxQeyIhKiEbLqlKqMjQhEWUrV34b8D9aItF/JQJWO3uZU+H6rO2qP6TEXsnI7KpoidJA47cs/LEend70cehB8HPQgb81llcMlVDQrtmd76ozUqajGqJF48l5/IPhy/eUfwz3zu4yjEK9u3b9+Lxp4kC7poeFws9R2INsVaFYsEB4E9lKAgngKV0m+/oqDvvYaKXh0lTVeKbkOa1hsgG3DlG8QoHja62nSzG2t79PMGkDmC2oBVpYyIOLlU/Use/vGptaxGNt4kwstMkB7t1u39/YdmfKITBrSo5Cz5nZqXs71G+pPiTRGTNh4eqnpHgW9jGNBib12MDH+QbGDYVMw== 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=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=XkRnJ3xRm1BgDj7qp+QF3jUt6BFQdYUQhEc8O4gIRTk6y8KqCoO47y1OGIaDAW6LdCQy/QWIa/xPSY+sNzd5r0/e0X/31fBm/jNBiG0+NrF+AO4/Pt5XlNK+nq5mCQNaPU9VSA532mgHzZqX8mmyOH0KgqqxT9bygiqotGclzOI= 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:17 +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:17 +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 14/17] usb: composite: force gadget to be USB2 for HS only function Date: Mon, 25 Jan 2021 21:43:57 +0800 Message-Id: <20210125134400.780-15-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:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 17275a32-5fde-48c5-7972-08d8c13341e2 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: 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: 1J/E2ReB/x++E0LMc/kXTSUuvlP0CaR7HIL3UG6MiapJc5GQn9cQKRVjyJ/vzkjuBFVaFrQ1ADS3PEc+ByDfXsiAiTyQY3xfTk5175EBcswzrHAiv3JWHYDP/UFvZno/JkUlXPMdpABM3ZNu6buiSKzDCQIYcRQt8ySFN1mC6v0EEdcHaBy5CKZPu7S2GbGjAUtFKP0GXe7dyiXcpojRxdfEdLNwrK/omqgjCN3dM7n3doIT9rB3y7NvOLc5agUT1rTZSEbUz09lURjKpoINvogP6n2t1U9awB1+NJKKDLdNHqcFbdIJ54UUfv3ARBrDsiuJyoxi92GtaWdyKQM6Ms1wQQJaFMFh9CuYzPk3XP4iPvHQjJP1Z6lU9K44Pamxru1gQHvw8mrhnX544O7JIg== 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)(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: hlPOP6Bdo185FLufoQPrwB83w5IO4rEbDHDabIAIq5cZ6PgBNHS3LOiGiPNj4Os2sVYUuHi2zJu4TtD3vlVJkLIiXlAomeqxUJbZaWzeTFORe628KlXKA5Aw8l+4Z+z2T8dbg0jrP5zZ1N5/9T0XiJgSgXeNi2YgHqfAbsROXnczE5qHDjaYYiMQkPLhTA0DpV4ZUECeUJY2XizVzQuYseO4MaWgSmGTFCnc7vAJHKcA6Gh28nQnBDVxhxVE2r7I2hvrymFcHrfkF8S+tSJ4QxWTsU74Crb24ScB5JbQCJETNut5ueZGrYRD+venHPJzI5RHks1jK7JuLXhPYoyGF70n6xoW9rgreGcV4oN6fXDYY7KMRmh+6KuHpHBbCiwknA71RUt0yU0yNLnWVe9i2z8704iE4crQ2zYPf3+0rUqGz93ksurF1ih5QC8Z0YQOzoTguEp2U12qzfA61UMqDOw6hFspK3MiHAbXUeepxpyVKst6HpqcY0jvQKz3038SawtC6VcGzXW8sxV9s/oZ1cRQpdiv0WQQLMXQhh9ZmufPtPYckgIZw+w+P1jXR5Seuk0z2YDGNV9VoVhtDTtX19OgOf/ZjV5/UqRk7bfCS58/TEgy4DYd3dM0jO3iwYcJhuhe4jjhVIJH2mUabF4uD6qbyhIUJlvCMTCHQB4D7IN8+JdwTPfXQ92C1ADwaYP9Wtp0zvckpvJ8gJsaYfHgJsdsPiaMUtG1J1X+9bHwJFjfG05jpkR2qRmANMQnkCYiHodBwdGEvPenPq01dxnfEwljQKlBBx8YbHhoCqSO1lGOM+e5qvdWnalgFCc0x7UMT0cv7YCvV2BenyexryYrBgAWqL3f5BSPJ9YrldeBlszvZUe/funq6+ze4KONjvGG3EictCXBYUEfdsiFSFJPcIHfhpoEjrwxOLUwab0Z1bDg9GRWhEFDHIhvYXXMfSGTLGE2NpBLel4EyjYjFtZtmGgisweQCKO7J0jirX19gTI24E8z1ixq2jToIXVkN3fV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17275a32-5fde-48c5-7972-08d8c13341e2 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:17.0387 (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: WKMIxi/YaGvPBG09jhDjiGQIbUKfIDtRMXp5xcMERlWH2hRsbGU8+QnSSkp0s+/ZZ3rUYtSIcCpkZQ6k9+d1mQ== 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 If one of functions is not super speed capable, we need force the udc to be high speed, this is an equivalent implementation of usb_gadget_udc_set_speed() in kernel but simple, which set the gadget max_speed to be high speed, so afterwards when start gadget duc can set the HW to be USB 2.0 mode. 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/composite.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1063c571d8..2a309e624e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -532,6 +532,19 @@ int usb_add_config(struct usb_composite_dev *cdev, } } + /* + * If one function of config is not super speed capable, + * force the gadget to be high speed so controller driver + * can init HW to be USB 2.0 + */ + if (gadget_is_superspeed(cdev->gadget)) { + list_for_each_entry(f, &config->functions, list) { + if (!f->ss_descriptors) + cdev->gadget->max_speed = + USB_SPEED_HIGH; + } + } + usb_ep_autoconfig_reset(cdev->gadget); os_desc_config = config; From patchwork Mon Jan 25 13:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370236 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994515jam; Mon, 25 Jan 2021 05:29:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJywJEljlj+mDZ3nr73p6SxoOUo2mZcz37qKS/Bn9LYS1ii8emYeZxqC4I/BK0hcsIeFWESe X-Received: by 2002:a17:906:ca0d:: with SMTP id jt13mr367850ejb.170.1611581374873; Mon, 25 Jan 2021 05:29:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581374; cv=pass; d=google.com; s=arc-20160816; b=hQVS6ZMwjRB70lj4czH3sDx5cHgGwIkhswTT/27z9cQlen4IAMGsjBl8VACFrh4qrT cyj3tWhboNNvRebc/mkUJGzvkxZuu+zUZaE4zQ2308mvv1+KtO2sO4FmwMRn0TBSHEr/ baTu7YDhy3S1RO5K8ihPgVvCygSDMOByUdc8f7UE2dG9u50dj9RmgU8AptBHPp4iM9X/ Z8NhivA7OzhkHtwkxiorwibRjj5sPV4KtG+GED7/2bGnIWzFg5i5Nfm9W9iDlB5UQB6W 2kLqGq8l1Zj9zFczJ6nkEBoHdf/SXeZPVb8+VVIWmFHkD2iVAbro6t33xa3CHCvEHl5a GEoA== 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=t0mAofHEPogoFDmoSCCwe4OrpBmaf8r2x2aSDAs9108=; b=YD4aVgLrHzLNRrLmqyU2x2fCth+QlfV7VAKQTCFu/DiRQ7SbrQ/Jg09aZ+LlN1PN6h YOywuXs1KuEfPZddza7qcZ2LKm7ZV9tcPEkZUN3g3Mr3022k1zctA49/vr8/OlXv6u0z ZijEfyHCv4bt5hrTHK5uQwCdJ/nc7foxHbylMotaYbwAlkw+8/SFVak6nO1noJDAitV7 TMTXVTkTQcUP3/wi/St1P7WF3G3vImce1ed9zsak5F4bTxisZ6MzZtcQQ8o5xPZ8o0/k xpkyxt7pWyrQFB2IlZpNDyz61p4A/PzdBTpVMWVfkrvDfBA0rEQ0skRFbToIqgrUGknx E6hw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=W87r7sbk; 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 q3si7485215edn.37.2021.01.25.05.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:34 -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=W87r7sbk; 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 BEF1F826FB; Mon, 25 Jan 2021 14:27:12 +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="W87r7sbk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 23579826B1; Mon, 25 Jan 2021 14:15:25 +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-ve1eur02on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::624]) (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 C57C482642 for ; Mon, 25 Jan 2021 14:15:21 +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=VNxaWPJRCaJFWz9+9DXyqhg/s8QolukWY9L+5fdLP0zCLFX68en+KChZ4bzmVw8uNAzDLnPggmR83cg64wAFnBsA7ox57okET6BDXzA+kqynJfH9Mp6QefjjxzPPi0eflXvfY2D2N0ZQCOBzxPScKI1usI32Ykuf+0wvq4rTGrebeeINXqvSpcze5BPguja9YzjJchknri5wnzIqL0QW2nexJsTpkBUzmWhe5TJE1oKAlLi+/x0J0FGcQ53euMMYpz1IBXcuQnKUCg0dJYn745afMqQ9d/K0R0S6Yi3XdoWlOPoN1l6IXEpp01Z5qqjyJYmp5WtPzzA540xwE9XsJg== 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=t0mAofHEPogoFDmoSCCwe4OrpBmaf8r2x2aSDAs9108=; b=Fzk44KRZewgwJ8OJcCO55mUmXTpB/HUBy6lPlOmdaoDrMiKJOG6XBrvQQz1B4u8q3HEBVni0kRiYYTxMZRVBuXK/er9szx8z/YA0xNDrwsksziqDllw32WHNUhuYqA4+xnFbCjsPovcbfQCFNg0HJEka4TzqDCgEzP2bu/H1inFkbZ92KWeEml+hMmJHnKxAst0XE1XF/fwpzEEhyay3B+rcqT/cOWjUMR116TEc2L7o3XHHBAj6flO0yr1WzHIa+676xhvbbR5bhDY2mw2/9qVuDukjdKThqH3cqm6Xa2Ov4DfHkcue+dlrENQsfYzcfva6KPKwf0s3TW35HBomMg== 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=t0mAofHEPogoFDmoSCCwe4OrpBmaf8r2x2aSDAs9108=; b=W87r7sbk51MyZe31WDLQlb5oQiloLRQDkBq8KDmeDw/G6LOSPt9x12TTrg31PVB4CIrP3uSHgbSaRDOOtm4XiALe4HymPIOcpSJrqj4z+GcnFs381d/hZw9XuPk8zJOQNIWjr18udreK83N1S5s+fysq8M1SJrfQbdkD3ySmXyc= 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:21 +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:21 +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 15/17] usb: udc: ci: update speed handling Date: Mon, 25 Jan 2021 21:43:58 +0800 Message-Id: <20210125134400.780-16-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:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c24f78f1-f1c5-479d-c09a-08d8c1334447 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:747; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nI2k51/VJReFnMuSD3MLY3KZxT00TdVF8ZuTXyzJao81ms0yAHKLiTaddG18D+9KU1oNoIHvwaBQIdCer92UmK5VCRHUZjuv9yb3IiTjgsPNQ1N/DrR3EhW2p/2jQRc2xWz/UjPmLKdnJAlkeCcddqG0xCGK6QEt+cYow5MNEcnSWpQLrX2Zt355Iq1OiWjkzD9iMgQ7TKWLBwtUQk8VTul6YYjBDlk0NcLnIZKdIgekGHLaPgpuA7fR32onNdNiNqf+X6lZwpDl4zC+o2d+ewXu0fuvQIwavQPLNdhUj76zlsz3rj6PoZU+xC85Irld02aM0RmRoj49lapfVfOAAI4KWrsca/AbmQ8RpsPUTTP2FrQE/PXvgZZMTVR9TmuTp+wMJWDeB6fmviWdqoaMuQ== 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: vsEluDTsLwrnCkG1uYj5clAOC5tq+6CTPNDyyPAYFSo++r1TRnqs7BHLIOMGNTLgJYqWb+KP35gpVBUiSNtwRUWGNOw6W/VftbopYqLzDmt64Ks83s6atHXl5U3QPrvklMa6RCQGBVApQQdIvl06GUtP6dcUnhKvNGX5FY6+gF6vp6Q7N+3Flbag1QCD4Ej6z3lNZ9hTS6qmy3R+Q0zI6cDrXE4R17k4GrVnIl/NSdfscRpV1RkV3wMp1P1OsRAJM8N23Rg6AMZYkHXfnk0y9+EqNNlIs8iZ145TGg2wt0fmYLAt+HC5NmzyE6EVqot6wUhFhik9A/DzhSOXhLfbb3wYkXk5ED/3ahYOrOTra7AaXYSuWnS6vD1/RoFAkuDIYbZiUReS2XZ8QPxSxh36Cy9ta561PQ7Omr4SwbeeyAGBnx6lEUxcvedVxaL/6nQ7fcJbfICfNn8CltDn2JYOvMxjW7SkeQRG+VQ1SPlMjBEMUp7CcQUVF78GK4ADjl22lweJBgwCih+amqjt8sXAGMunXvSqT5m1DCaN8XfU3L4rf15vrafVH4BdkDnYus2EY4j6skkjDyNciZDvSZYhmn/x489UUpgUkDU43QImqEuM59T38hnucUtqo9qywtmGKwsWCLa714BEaXZOLGGQwaWadnmvFP1HE+0ghKixBdlu8PhNffqUOVIAu0+dzET/SYIO8PqYhhHzo+LDkK0ddEQ+V2VHUuF490k78kOvTxBfFCxZyxAfH5FJNB6zjVWrHz/99xw3BKB0xdL2BcZ8XjFg3JeqQvATrQ4k1ISkSIV0sXPiHxtyPneaE+ZUJNr8d7Ll/i094E8PBVugjzHCGcep/IpQjIRIcOppM5AyxX7QRlufYBjwfZWlBvQvzmUCAUvo0s8ULuIQvE8s0HPpP2XuUzDHPehPeylodnA7fBtpTH1kRj4R7Zv8fcBEcvtF6Ck+92IZS6VN56ZBSeaBFmttci+qG587mEaNPNLh34wqGCE88JzvpbG84pNhjwds X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c24f78f1-f1c5-479d-c09a-08d8c1334447 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:20.9939 (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: z4Hr5HJVowbM6lzZOfYN+F0iNLiNQcy4JeQ2D+trktG/IjGwVXoVMEQXqexgODCjn0lIzWEKf/vUWjrA/LD8Rw== 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 Remove the gadget driver speed check, and set its max_speed to be USB_SPEED_HIGH. 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/ci_udc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.28.0 diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c index cdb8f6fb3d..b64e4bb605 100644 --- a/drivers/usb/gadget/ci_udc.c +++ b/drivers/usb/gadget/ci_udc.c @@ -145,6 +145,7 @@ static struct ci_drv controller = { .name = "ci_udc", .ops = &ci_udc_ops, .is_dualspeed = 1, + .max_speed = USB_SPEED_HIGH, }, }; @@ -1015,8 +1016,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) return -EINVAL; if (!driver->bind || !driver->setup || !driver->disconnect) return -EINVAL; - if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH) - return -EINVAL; #if CONFIG_IS_ENABLED(DM_USB) ret = usb_setup_ehci_gadget(&controller.ctrl); From patchwork Mon Jan 25 13:43:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370237 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994653jam; Mon, 25 Jan 2021 05:29:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhEbKQAbyV1uE/+SUGRYhYASzLaJsVzO0Fboz56asjgybfF2bJ6WmkHnD23OmP+o8B4WHA X-Received: by 2002:a17:907:77d2:: with SMTP id kz18mr381185ejc.2.1611581384972; Mon, 25 Jan 2021 05:29:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581384; cv=pass; d=google.com; s=arc-20160816; b=NUiIzRcY9mDX5U2raTbXD/k7OeuhaY4UZfaAmeGRhRHB78ojl8/PQNuoOBjbtQ5jFj 2QyetEnVZrIahQeDSinj25eKtkdGP41OrE/sILVlgY87JCiulGqFsALoFc7HperoyKIX Gm1Z/gL3Hm0jJU1DEeEbBQDOSaO0XomICo0VochDSTvClfmUY/oGt9TkCmiKxkSGfE2q i5t1KWeLQdGfWn9v3Z0ZL1jWuX45Cz6r/jhwECI1s8p88VHh24tXm4A1dI0bwAbcGmCL PIfR8domQfVd53126Z9WO7rVrTF2ESrxTk/NhyNwKgAXaBT32PPyDFdFyD3uAfUdPkgJ HB0Q== 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=ow5DkjysPi0X3lFMPlCEPhI+ZWbvBlZZ6kriWqHbQoM=; b=t/IbYZK/LIA9++1PKWfq08dya5vzOZ5IfhNI30ebIASuPhzpprNJglXkrrXV7vrX8G vGrLXUC8inLaadR1Y29OKG+7II7OmVRPqeUO/VdTy/e8SYqy0jO9vtwUnrKNyQbqvaFn WB177UHm1ys8hEBv7iuJyfNKIUdD2Lb8cfLchh+u10nefDstQWZX0WdKM5gIXHtWs+X9 IcZBxKupXoD8Zz9QGiLrH3TcXCc/i1j5vVuxlSAagFKSc09m+GuHfFsIrUBK+lIsowKn UK6b4ReogcdBYv1e+5gQkdbGAwYVAt/W3BYcarMq4aI+r35/HtIJZ9G8FIa97HTTrG3E YaeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cUBewglJ; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id i18si7143573edx.293.2021.01.25.05.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cUBewglJ; 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 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 B3BC3827C7; Mon, 25 Jan 2021 14:27:14 +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="cUBewglJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A24C82686; Mon, 25 Jan 2021 14:15:30 +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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0614.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::614]) (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 3245082642 for ; Mon, 25 Jan 2021 14:15:27 +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=J3V7ohaveLt1VITTKKo4eLnmSqaN9G47hFKdVc8BZZbPD2n7QQyOOpvWdULo97WHqwRGvcSh0IrMkAguryEqFloXFx4GrU6igf75BSUgchcRl46UbJsgnRPp6ZY5ng2s19Z3J/e4GhVVGe6b3nC9+d9OUESDgauRL/jZjdGCqEbcd0kCLdlDaF3HOl4dbO9WYvfET6kvkhDuxageUA+CxgoHmzPz13fQ0w7RSakqmfmNGtjj3GNqRoaV51Sh4pY+goboa6+CanPmpksRKkrr5hhSYX6NtmPSwq0JLB2txc7g4e2CPyrpfW5OsEfErW4c0ozAImWsxPJxSuWFh27s3w== 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=ow5DkjysPi0X3lFMPlCEPhI+ZWbvBlZZ6kriWqHbQoM=; b=eEgLkmxUnFquenHrA1MGv98D3fLFXJGtO9+x/p7XRalTr4G24qPYPhVSWPWEzWPHJ0i9uYghNnZDCpYBJmdZA4Dy+d/kIbY9tyPWxtv3KpoeM09tyByEfFWR4gXhQ4206KLQxNNIjCIf76PB17aV2Od8tW2V2NxPjLpGB0Qayz/6gCsI6LAbtf6QvPPlVH3CcrkDd+QKIfEqzV++/VaZ8tvh1XR/u8dA2iI5rj/hpTrSje4aJu81QirLHhF/BzE4JHTQojOXaXT30qABb/lxFcKJgCQxOvoq2ncpZPQgGD0yLhM/NPFyGUFiXnA7SaIQheEiCq9T2TVJFkbtqkFkgw== 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=ow5DkjysPi0X3lFMPlCEPhI+ZWbvBlZZ6kriWqHbQoM=; b=cUBewglJfSpAFkDyWiv6Ljd4E+weVIdDglw8cb0dev97et3vkTMEejOe6mDIAA5dvl58R+bv3vYZtd7PnNFOwwgCc5RlMOVUa8PTpAwMtFr3ZD4kfRzLsrgSyO/RbGkjOMoRKFg9QLfO92+RSLpsBIwSNZNeuJdSoXR1otyTXMQ= 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:24 +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:24 +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 , Peter Chen , Peng Fan Subject: [PATCH V2 16/17] usb: gadget: fastboot: use correct max packet size Date: Mon, 25 Jan 2021 21:43:59 +0800 Message-Id: <20210125134400.780-17-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:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d322f7ed-a50a-48ff-61dc-08d8c1334658 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CMn84pT8N3tM0YPi+pblCntQRqRjajZz02DDF1LUqORqrcpA1iabf7JBAfYRBJw1aJsbkxkcikrjPIOKu2EIppU6XiGL1IIbd4DmmsNSvuzRKxZSh0kBoWGi4HeXcZdReGiOL/MsV5JaOreQWgjf2rcsarEBbWiP31ENMtKofdLrGg02B6JHhPfNVIHJ/mvAiqE26x/WYww8KHtehktYGU45V2D42CQ0h5Oc4DHxmKdQWbEsrTIMLiG234aip2zb0YOJ0ADbYoUpYKDvo3VD5GNQFTUxAv3ZaNAzYi9lnNnlwSNdYGvt8yjLSZ5DNdlSWY5B2P1+mEQOPmgOs0VcdDMRjemVkrDVymAUztZHUg5GPFFWCsQloTBv5GaBcuAgAWmCh9v52SmKWEeLBo/qBA== 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)(4744005)(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: Q3Z9SHbEuGdHQbHfXjtfuqoz3YOOMiOa7RBe0T1K5Igm01IZgZo5aTM6lxufonVBE1OInziPvW99DSAL1Hb3nOMpsvQ+VkdzHJ+eCcEP53qL3w6UwfpKaqBDmo1VdgvW8pRj/cAg9EfCKkA98cGho2oJ4YVgmKeQFfp396DNCUX3Lhs6Vy6NPtLHsKVCeq2Y4POOTSH7vv4kA8Yc+QchV2Soc5yTyqTGgqzkotdnsyzCwoen87VBe683wRIks/bXOX77kBx99n2ECdqDHGvNSqAZ88lkCYw8eB68tGRFVbcR5i/QZG1oPJyet1KE+J3G9hco0fRzSjDrQw0crd+hMRPgsyFpQPdLiBcU0elH3Sba76dDckZ9sbmWWN+UdRTpCTpvHT/IKk/YCHLnv302E5lG3EKBWewhwC0Ess82EnxzViB6AbLA0XD2lygk3lTTuT0eZ2e9fY03ny5CRLOfmM5uR0y2YlZ1n2EDUg4Xwy1o2FQ+QreYxewZ+XazwbHmKAq3RqFRJ41UY8GH3e/WuPanDOyTAOVejwE0oSpDygS0bjt/pIDXuorfELdMq5lL7kC0CQ2sr6Q7GSWXP0NMMOJwdczhnK7BCnf++yJYAISNapdxHsf7iQr57fxqZNQbz/azW/kRAGM1B/Gz6Kjsl5/bYw0OTiNEt7wH0pQ+l+99V+3hhCwTZMOAGkiz3D6I9sQVH/U0CnKKeN7sJYCv+K0wL/sLxh/UCB/FNxQNgHTcZvh+HDk/m+Z9SzZzLTMd67cD6xcSKd+uvVta7rlb4/WPM8Zu8cGN/ms2RjD8QYCa5OlazgO4vJF6TLH4ldgHqWlWPYu12/2wOpd2OGpnAwPagbFJLXaIzy4gv6wC/RAbDguM88qOVs2jGeVZzJNJX4MznuPOU4LmvsYZ3oouUiBj6xsvc7DBbZKYXvlNM8nfoEMGEVBXvdN2a8gBM9qC77m2NpJfcI57XFttmuwfxlYogdoKT3wBManJ69pz1VLqKaZHt/yh3YaXz8Fwy1ZV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d322f7ed-a50a-48ff-61dc-08d8c1334658 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:24.5653 (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: /Om3mkQ4Qe69MXk5yLaX+CSgjJ/4InVM1VdSux5t4Pjp1Ghtk7zyIX4naqlXt2O4K0kWN/aECMBKXzvy1nK14w== 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 Change to use wMaxPacketSize of current speed EP desc for request length wrap up. Reviewed-by: Peter Chen Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/f_fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0 diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index c2abdd66a8..2ef75a1388 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep) { int rx_remain = fastboot_data_remaining(); unsigned int rem; - unsigned int maxpacket = ep->maxpacket; + unsigned int maxpacket = usb_endpoint_maxp(ep->desc); if (rx_remain <= 0) return 0; From patchwork Mon Jan 25 13:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370238 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994783jam; Mon, 25 Jan 2021 05:29:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeapff8OX6PC5CsiLyyL32dt51bVd7aFMLPDMmWE17o7dHANEK3hFaI22VqjhXz7e6TuFI X-Received: by 2002:a05:6402:26c9:: with SMTP id x9mr436190edd.365.1611581395732; Mon, 25 Jan 2021 05:29:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581395; cv=pass; d=google.com; s=arc-20160816; b=QrzGKEisZNlrfcHlUxzfu7KO+qo+crzdEGW/M1Qn59GUS5eYsWGCPYbO6un32wITDE rBwNZKWDVLse/i5COVLk5MuiDIrBKhtSJLCDeqwcviwkaK0KATYb8lj0/ylls9hkX+vY mgHo4wVXbGlYiKXlCYvEwxHEUvl1FkyNwDt3ggGHw41VXMG0/L6CuHtocQCgTbDflJjk YQiQopty+F8WTALWalRgmETLOCPHTyhW5+5z7WzB+TsDWHULQdYOXqUgRZ37OfeF2XmJ iGLJDiKgOICEG8n6zskitKbhYcUXi5/ltDLmrhNyRnnHHsKFFSvLxXHZ+HHuATQTBj+s Y0NQ== 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=TjOKymEQyGAHq1OhZE9tT3EvckpU62HT9F0LFxHcQzM=; b=oD3wTfQh3Ja0BDd+iFixJpfCkqXszLcCIH4nsmf1aacFsJSjPV/mirPJ1uOnyJQIuh G5i4HH+XPGajueqLT5zEtxxNXm67ZsZanjvx+/TW5X64+nOyLpPJrzeV1TIlfo7Xhe9Z LWylyqFXCDqUZbH6DeN+N+U64YgX+u9MAnHX4nBskt7Wpb0a2a5ZR8TbNLf0JsJFZ2JO 9U+VMHaIZQH7Mr2CK0R56U9otScK0ssK9kBGdNo62aHAkgQzqZC0gRJQ8Vhp6WeqgZMS 5UHTJlhtrFpBBNIN+U8tKk06TGC973UuxQJAXN0UjuXah6q2dpkZpSV0s2kuVaq+XoWK PJzw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Gs+VxDlO; 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 y11si7553093edo.40.2021.01.25.05.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:55 -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=Gs+VxDlO; 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 E4A37827E2; Mon, 25 Jan 2021 14:27:16 +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="Gs+VxDlO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 05DAA82679; Mon, 25 Jan 2021 14:15:32 +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-ve1eur02on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::629]) (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 4145E826B1 for ; Mon, 25 Jan 2021 14:15:29 +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=bYzm3wR0+rzfClZvecV9MjN1UUIkOwbnVCiX/daIZoqJgoxJ/XQ/4Gtl2i5Ip0kQIyXcNEOa27DrwZq2/bcPU8BwVKgZgq6TnQohNlOOasmLEXtayI7F2yovKOJW2jyvtxoz7K1pUNiBppsKnl3Y4BmmoYMKuGCLIrCZgjGI83gc+YVfSbkLIUvjflhavzADeguPPP5J7HI2lhqfRJzAS6gR6ETW1/C1+wwzHDA64EK2PMXsnxz/N1kRIGmlIV3S4Z0Ebro9Ddk6A1PimxIkt8Q7SH9m9ErVCcFXpIw8nrFdG8Y+JBZt+/wUeIMn/ls/PPgjldSpzLxST36SeG+NuQ== 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=TjOKymEQyGAHq1OhZE9tT3EvckpU62HT9F0LFxHcQzM=; b=bJLm9qvI7fgplnKLIr8grXqgkUnB8do3mRllmHnb6FSDw5wXiDcSo8mrogpiuv+DoLntba1s1ldGde8sOIP3mToo3zT6keko1zVdAzO1tNz3kj2ou4uGoLwpfF1LbnGuqfRHIAHtRKQY1BcnwLL5BHP5tWmYUIVbH2lUoTqSTLIyq+y5e+ahD2nz9lKS5yDKJ78YbyBOTv2A5wNA6Hi49Kkia+cVHxMOBYGP5WQbiuO0GvkF5CzV7P/kZJ78QJd82pOYvg9R5/T/YFd5t80FvKQgxftTIF65sEywI1w4VHTOlpaWeQkCj2b6Pdozt3qzXkSxckJ6hHrm0TwtaPux4A== 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=TjOKymEQyGAHq1OhZE9tT3EvckpU62HT9F0LFxHcQzM=; b=Gs+VxDlOCVM4y/OJT/SlOPFtmhthZEXIPKn0ByMYm6ESCzDe+Nbf7Pv+TqD3MBZZJmG5wVMdnGgXauoziNm9E1AOXV1TBF4ViQgqated+xEaLC4xxA7sLD/nieDK6D2ZjIExcFpB7dwbcVwWdlCten1kWycLdOno5Nuaan9Fzzc= 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:28 +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:28 +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 , Peter Chen , Peng Fan Subject: [PATCH V2 17/17] usb: gaget: ci: set ep's desc when enable ep Date: Mon, 25 Jan 2021 21:44:00 +0800 Message-Id: <20210125134400.780-18-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:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 41eeeedb-bc71-409e-ca0c-08d8c1334879 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XSOSwOR0vaN8uLrCZiz7xbTzl7R/f7058I2ulxHfTnwgptmXfg+TA3HPl1RvVomZkdzGC+YYarRCZu1kxGTY1t3I1yTnxX2W9PvmZ94WrHb2yPY9N+Fy8rzDDiGVhJHpFZlWBZviZ0+jWgP8asTKJdeA4uYFH6dXf8wpCpbhs5Uuv6KHuYulrp+x8clF8rTU+tR+fli4Fzr+YWhw90ea3JHfIKKonxX7JM+45V+EOTamqTHPJUQNOAYWVwL9pN4lyCwV7u/lc7jSeHauwd8/CzgtLgWnFeCrZI0ZQD52YWBYn2hVnDgPv/4N/fzorZgxw4sP/nUqXxEbAT3Hh55n5fdA+wMsWr37pOAr2qJ+9DMzLQPVBshsyOE+gHEOGjffxyYtILIIKbetBQha2AijcQ== 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)(8676002)(4744005)(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: t4375elkUYcIiu+eI+l6q4uiBc4MqLH8pU+qp5SRwo/RYWj3HRjbMuVDgz1bIYRD1BNDZZOj3RJPn6rDQRK/m71lH6/O6JWH1+t3sX7IVbyIJ++lCQK1jrPDLk+T3AAdltQYJskYzk3ivZYydf+ueBRzOHSnXU8KB5G07bGHCr5Yei+yROlRhp+HCz258QnVLxvHdfAkgtTBnvhPf31/Oc3gJTMWxaULcscDq8zu7saaAIwtgt5qesqdBt6HQ/Rl5f4q4BnSrIYjg9WjaHilRVb9VVJk2QXedU3QSNKSNkrZXiMUhlA/HpdrhglxHSu71mJc4pnf+xzKATdxx2JjrUpMpzjKmExFKb5qarCZ4MrGb9anMIk7bsJ3DTVXsshy76F0zNotJwd3sfSUq22HZFgUJXf5QRcgY5dNpYbkU2GJFXNdfT0OK10Kr14H+SD5bLXjCQPe1uMilSzb4tmNX5pooCAJsTxsobo/GtNL06bWP9ntUQLIBu3R11qrLj97SiB+KqwOkCrXoraomszi3Hw983sQGj6QwC9pPoVFTj1TEHDJPi12D1gQp5XUsDI/yX6NKO/N5kzA9okdKAzdwWT8ICnsw0Di7i1qhw3AMR6zbd2vEJSUOYAHXjNpLAtj+ndIRJCr9MjThCayVhYurBB8DW/Qko3FybcVsQ9JU3Q8m2tXSLYNGPVAesk+GuAVPAEbkYVzMitvwiYms/lLP5Lb0SSy4fWkeqLPDYGGtjdhboTXnDOogtYxSpOGKN7fEAGsNOqAd+jSxkJWe5xXaR6IJIfJY3fv2Dca7N+lQIcW7Y5AZk8HzcukP3JgI9v1BDWU7qEqpB255umFKvgUgH/cC6auCWWXJMNoxliDtknMptpKXjIcdNStQiV5NyAZGRLJZCrZ5ko1F3Z06GGNc39CPqmrNlMJPj3mWEoedL0lsMJrZIEVVG2bYWH8/YonvXMKlbpWsws2V4H/DkjA8eSf9aXGQURXaXheFbQ+ydR0GJ3HjhyYI+zeeEyBmUEb X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41eeeedb-bc71-409e-ca0c-08d8c1334879 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:28.0127 (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: kIHhQLKj0Q+fiRdywiOzBKZ/pW6Mxgi71m4bjaYUdF+uIzDCHiZtrNsvz46CtSw2wISc/aQg4NHEAJ/Gqh46yQ== 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 As we need standard usb_ep's desc, so set it when enable ep. Reviewed-by: Peter Chen Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/ci_udc.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c index b64e4bb605..226a9e6d67 100644 --- a/drivers/usb/gadget/ci_udc.c +++ b/drivers/usb/gadget/ci_udc.c @@ -336,6 +336,7 @@ static int ci_ep_enable(struct usb_ep *ep, num = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; in = (desc->bEndpointAddress & USB_DIR_IN) != 0; ci_ep->desc = desc; + ep->desc = desc; if (num) { int max = get_unaligned_le16(&desc->wMaxPacketSize); @@ -358,6 +359,7 @@ static int ci_ep_disable(struct usb_ep *ep) struct ci_ep *ci_ep = container_of(ep, struct ci_ep, ep); ci_ep->desc = NULL; + ep->desc = NULL; return 0; }