From patchwork Wed Sep 16 13:25:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312427 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp441723ilg; Wed, 16 Sep 2020 05:59:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrQSCQ06ybYTZnlgQAe29n2fHuG+YfVVnfwlaRadlSc0l/hgDlinaT/XG+F0fQCPoi1fra X-Received: by 2002:a17:906:a88a:: with SMTP id ha10mr26783480ejb.532.1600261194535; Wed, 16 Sep 2020 05:59:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261194; cv=pass; d=google.com; s=arc-20160816; b=pY6p5c4aadQHwlljeRDt5X0Sdr37/kosPlNrBzTRwh1w75CJtaNFLrGKR8MF/ezEBb bj6tDBgg6EOOFyUeNs716uiDY/z5RkMQi19y0MXJAr/T07O75VRiTJIfuYQsN6ynHfvZ 0UbOGNnyNj5btVAr1AnPEKW0iblHlvDnLJe6hPRVmoSACoqUSGoAsh9b5TkEitc4UI6l tJg6wP/nGHt6pTDadX3J3PAYJvStW7zJvG5HuiMnwuRAFbu7DXN8EPx4+IjIxxdPJz6z gZNaE9s38W9xfsxN6uJQsJEyT09ovHEIfw3XcEBZz+3FkEOau5h/8cJpW9CgmbQ+MIOI XeHg== 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=Zp193+3RB57o9hUfd1/fUExdtvNb887dHv2nbyydk1HXaPefRDSy3D2w9UBg/ql4WC /KujCy4Zm7XZiGMPbKR4HHiU4pQMZaHhSUP6le1YB+NFFovDqI97cI6MZeDfnS7E9oWk PPaS+B8gcyzkTtVLHfaLeCDFv0dIchSj35MNzCGI7xx/CgFL2SIp0+nqi8oAFMJO29m4 tFma5Z/85T5Rqb6+k0LIVXmb958Zf0sevlvceeT/Z1IxbSxWCQDIooYFZI36AL1p4uGI u3SYodxDrMZZSegiaWYuTQ2wyKrsQsH42Nwc4EBsZ/zQkdE/PwxKsrtiSaB2DTrwOHHj t4Tw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=kB90vujQ; 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 a1si11671805eju.696.2020.09.16.05.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:59:54 -0700 (PDT) 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=kB90vujQ; 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 7D40F8232F; Wed, 16 Sep 2020 14:59:47 +0200 (CEST) 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="kB90vujQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 225BE8232F; Wed, 16 Sep 2020 14:59:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::60d]) (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 64A7D8231E for ; Wed, 16 Sep 2020 14:59:41 +0200 (CEST) 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=WNvlItG2n+35nXswU9BvjLrr5YmRLlG9qjyyuLQX2cCc1eE1xE0bC7AS++tYEZCvdWvKvvZxBA72sjy2EjYSWNhC+MBAMQ4CMW56x7zTdtBa0eywavYMFXfNJi+lTZDwyk0hW4qmcOXnE2rcRGpmVgQ2SHspGNvk+fCsYpxgUUYuBhxTfnSQIw6N2Enoa37owe2G2MhgxpbnF1EmgqjMswmWKUST50AjLDf2SwKb/cvchfXG3WCYhImgxwIUV/0/My1933gawae+ESu9ddr96y0borbp86z1RkGxxEibKB8rY+iJVVf3LHPCFQ0+EOW8G26JnkpiEX2IHca4GO1a5w== 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=k02xDlutyHuWXRPZv29/AtyxnyDrslMv+x8LMUyYU09bpMOnF1JSepOZDYf9bl2ASVirNNECY4UqLxiEIlfw6ICta3h7KylDw/Itvj0Gewq74mpapcjB9ro/969rMr1xhTp4/7x4qK52+++kRLYrNX0e+zI6Y83Swj4QX7osV+u5eH0CLfCtBUEFn2KYTyCA19k2vSD8X5eyHeGBUjIM/mJDJ6pujLgmUQzX2LxVdXANM086XC88why7TG9p5/3VuGEIOya1XmExxjo6Ls7ibvZCb2BE8Go57epOYvJ5J3l8+2YqkUPQtshVOZHcv4/zo7k8NKMBJXkxsUH4ZD8Bvw== 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=kB90vujQWtwhsPNF7PdHbqp6eKMLd+uA+dpQibs/QjcNrmHUjtqYCg70KQCywPUTa1lwdh+QDVmy86NPzzmWcFaerAr5lCJTr3SAl8LLxMlUFdXQOKOrM5H013WBlljk1Ly79LZct0olf+kWE2xpGcyeIEwDKSINaaQFfy2vQjU= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:39 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:39 +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 01/16] usb: gadget: Add ep_config call back to usb_gadget_ops Date: Wed, 16 Sep 2020 21:25:22 +0800 Message-Id: <20200916132537.8313-2-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:37 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5b044415-c186-4246-b930-08d85a405f2f X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: m0pxeIk9Z4obJ6FhYlyfOZIa8A0umiVzgRs/OndD3bkHCa65M3t8Z/Mc3Rl4ZfQMuCecHqw2Zzk+jQHeyq6SPAI3T+KzRvtwojz4zHTaz5WKIZXAWmFuHlUS3WFXCvEzdpE/By8lb+FqE5AF1Zkz3xOrFnvKxzycRAJERU1q1RpQ+p8eNY3eS4Pu/9ael3u/50/oaV8DC0ZYli/t2JfOUpB9fk9bEH2pEGODNpO6f5paFjFXYYuXssrgQcMXeeOqKmnwbz51nZEwnH94A8vDg6rA9wjUXfSxL6w1aD49mDg180VxQzMXpx2dBDf7ixxbRljwkz3O7Hj85yp7XfRJPA== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WNc5tgToUSKMbd1jX2FR8zvfX7EWEdeOzu7J5YZxI1OxO0XrdWr7NjFyBXeVu94grleOqQ2xho5GNnKJfg2ixfWQhcoMBict70SmQO/bV2xWaUTRcBNWTVIq/MBYDkM3rcChX3OnfL1X9K4a2KgfHjuD+VeIytMQfTHwAGMCUyZ5byCXwu5rYz9yZVBPIDqOMoPBE2CJZ7I+wL2GVtkCa4yvZNWgSjce7q3bijFWnrTunBF6LAE0cX7YWb3VG3rAebOLDfoOkQhr4IFQ5tshp/DWEvwryPlu4MbwgrDA3zkrhU+jiMXpBzao5uN+hXmdJfQkvcKq5k63Nl0Nj7BZFTnPZkb69SYLQx60zTA0UgCHpcb5txLx3GQvbtDqyU36VJLfAJX8GbCOQCyUBw4dJF6J9gOHrYjyBF0YuV9CN4U9PtWn7R4zr5aRiFmKmtWIlqYwKo8YePbEiYgzTKORsr76KwS5mGLi8+vJB+8mBJnCXGWxADGvwfifBk1QSHbrYxG9QycG5fOzDNoXeQQkKx67+p8Ugpazwmf9PTiMQC0kuxa5pB9VCn3hkA/KDJYpsTwihebUDbaU7pG6Vp+RCDUQGkCgWER7+k2xGQiftQZEryJY4cgj17/4j7pihRNxZPqBZjwCyMCjW6LPoYw6nA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b044415-c186-4246-b930-08d85a405f2f X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:39.6673 (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: oSI4uPkiLwHeeq0jRKMiJoSQg5aPtVICp3pb36dAzaSjVqDBYv6CMkiHDQEcmArQGkBWQlXEvv75Um/phQA3tQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312428 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp441930ilg; Wed, 16 Sep 2020 06:00:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCbTNR9HD+IBBpVjOxxqo46JqAXeyHddf7AWYfPeSYYG+Bp3glqTFf+4VUnUJwRoWWczuI X-Received: by 2002:a05:6402:1779:: with SMTP id da25mr26793313edb.75.1600261207646; Wed, 16 Sep 2020 06:00:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261207; cv=pass; d=google.com; s=arc-20160816; b=aCFiF7etMpUR7HbJG76KOUlg4zd0h21bgtkxkaad+NIVVXbAgzJOYXOTg5zmG2zW54 MnxpFb87w0DB64CRYrID82EOaSEPVD8PCraEbxkqiexlelOoVTmQ2w6UbtQgEYiGw8Rd c3IWZhqPN5Js2921ef/bl+xCMxhIj1g5Mt5KFQLtLwkX425hv5+4VjFeEL/H8NwHOLtP 3cmS6vLjHytF+XRHSDRcV/0KxYo1wWEcuUqT6V8EoEDUeQ3FoszjTxakgR7CJzS3NooS tczunJaokn+NeO5qIQ064OYkH1bq1cZAozyKr6VeHaQ9t4uXfXQh6mSKXvV87erW2rbv 4A3g== 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=CvjXj7aKXtSh8sjlmEa6QFY/DglPEIViAP9q7NM9da/LKtbabpj0p1Cz/+SaPdckNa uv+4lt+awwpKmvXoPuX00xDg5CbAGwSfIDg78pvAtH+6blWlUexMRGjn6fPLf2v9X9Na Sdro2jjSnhM/zL4CN5e1klweKFg/EiFK6TE8YX1WngcIT5QZ6fudBWX/qPhqWuTnZh1x 1IBysZJp4DNNFGdai6hvGrA6vH5evH/YU+ABSpw9yZ6pzF7u8orPZhylDOYbcFFmLx4A D4VKvxVtReE5p8GQT6a9R+ybSy4SHYFK4bDwzDpuH/+4Mg1J7jjDFp6Xx1I9bjwODn0V 3xpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=shQtbbV7; 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 p2si11607610ejw.176.2020.09.16.06.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:00:07 -0700 (PDT) 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=shQtbbV7; 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 4FF838234E; Wed, 16 Sep 2020 14:59:50 +0200 (CEST) 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="shQtbbV7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0B95B82337; Wed, 16 Sep 2020 14:59:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0603.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::603]) (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 260548231E for ; Wed, 16 Sep 2020 14:59:44 +0200 (CEST) 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=WZzVpqMGjmHHgwCD519G32ZNzKXPvu6X/OGwj7ZVi03Ku4MFMikcX/ZSZM4TXtqMa+SI+WM1w0BWspNS9QCBO0XnwikYTVmx7Go/ygQ4tUheTzRj/89YgOnxQuqU762MXEQRWwWpl4W4jp6Bf2Lkc4J6UnU+WsetsiBBzQzt0f8Ao/v1BOCMitiyJlSmWU59Jc6h2tVFp2fMrYC0JDR0cSNy4yx2f9rFUgWWv5+tDobqk7kfJ+DFIGWBzaKwnsa1nL9kSYBESq1B6AabY9jSwIYMyC5mft1/7sMa9KeFuDjM9CIOU+HVfV3XH6NARtIk+ZPRNgnRYgAahqs+AxpCBQ== 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=BiP7ul52RNtPa5kF/kpxs+IyEzW2RSGhx3r5EzBWYwPXl5FD8Pwh9zxA920gpQP5DWns90y6SFerN0GRe5sO9hdTkG1GsY6652IA8GOK46kMZRc2jIstl9a29U361RKoY6vBfSMvvYdT4oXvhwKuyDkETF4wKKC5P2I8ZbnmQwfXx5s1o6FVtvs6WO5omluBq3jKbPamRRfVStGPBAP8OH09SAuF5N5gYWODonuN5a3/KzkUXm3/5ubsAy5fq+vJMMyzcGz2uu8oAK4P24f+QDjoS4tYuM+59DXFQRIRBhPOGkCLChg6ftrXAo79XnN+ZUhbTcckFyVKPotRRsaGJg== 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=shQtbbV7e2z7LQa5Nfb1zBkZ1QZnbgo0Alzf6YM6Li4wIMij9D4MYFqimDDsZFYV5jYd6t3gpSRgYSzmCcoJDq7o2HSziNhbngjQpnPyRR4I6UrRjb4SB2pguHAaHSV/KPrL46njDggadwp3ua/QkX3M2pElMxJPapERolOHlgk= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:42 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:42 +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 02/16] usb: gadget: don't change ep name for dwc3 while ep autoconfig Date: Wed, 16 Sep 2020 21:25:23 +0800 Message-Id: <20200916132537.8313-3-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:40 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2cec6160-f03f-4325-2f30-08d85a4060c6 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: fw23KO/J11y7lT6ssvDCbxmuH2kWDjxdNviHxBdUdIvx/eQyVVhBHe2gxepFLq+TtalBWwmB5scB9K8ru9jm6yis3FvxoKFvea4wZhRzERiR85FNMALJIjpCrtdmu4VtYL3Tp6CePlP396nKq+dKja/cfjYG1hQS5scYqQD8C06LEhYL4/67EsGUxemguz/3W9nwTQhIYgegRR0gArwKAMEZoBnZ9efsyv7Awpg/Yj5Th9YvHNGtYrFcegvmJfSuQiPZMVReP43ux2fDufcr2RXVHzOFkJyxgV6gaJbdG+mec4sOR/ShDoug9r/Ge7UO 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(4744005)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hZGnYpD7Q4pCZvvZpJqpkq0S06Ir2fSzw1AFRL409FoBlaFCoy1ESw7SwrgVlU25MWFY58rk0QJ3JoRpfSfjI+HqyyGsBrnqPKuJ1SmQlDI6L2WOaoLlKBDLsGrlk7s+7jSYRXU6nz6GXxeigRDlqLoSFuNZ+A53Fwfu1NNE7eRyo4rI+nGcuGMf8wA1CMWZ2CV7x0gE4WjPeYZyD8Bo8C8otYM5gn7SlAYWPylOtXJj6nkra7tiR9GMSzhqLNxm0mTF4gMbGX2VkvyxbrIlg+xhNLN3NC2NdJ5JSgL2PsXDcnO9I6v8VSMnmjjbxZI1Vexc2ySKU7HTqKgqVm1+CJHUKkMn1YGUaY9dMUwacc4INJOM2lbRKuDOmr5VNvYXvxZKVZ1l8YEIk0v0Xqehb1tFDvU2OPse59mf7e5e/9BDIUPqnyzt9XmTkRGnT2TTHUk0VhGWH3kLLoyMEQ3umFdc7gZRtC7Vvk7syr0Uv+vX8kc6X18OrkHVA092FCo6VIEulwIZSFgSM+roYRG1HziWegohGvDu8xx9Mj8lzEzeRRXXNmB7Tlx9wnpLPLYcF29nsXI+AbbEQds/6Ajx4BDeOdAqTR1hJvB8VDTtyBv+GFxGrS9aaZNHddcqzrSUzR+x0x1Vyhe6F6EaU6IydA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cec6160-f03f-4325-2f30-08d85a4060c6 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:42.5600 (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: E+tx6GM+vg0PtM9IcCaypvbbww5M9lvgTzU1VZxSDJDmL3UdBIW9kEeTXEZA275ezXb0mqtX/ajoLeKLzvn8Ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312430 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp442168ilg; Wed, 16 Sep 2020 06:00:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0Kb4ZgzW8RLpKu6rGH0aw1KRcZm0E2lDPT2S1LUDzhfYeCVFUf0RV9I8OWTE3bmt9yB1E X-Received: by 2002:a17:906:1b04:: with SMTP id o4mr26288883ejg.332.1600261222517; Wed, 16 Sep 2020 06:00:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261222; cv=pass; d=google.com; s=arc-20160816; b=gudNYWp45PaFkqwCT706Smzt80TWsLZgOWyCY55wzFZmRp0OzycCutY0LzxjeEpFPl Rc3sFthNMJuhsaoYsMXZQ7vSQxkQ1Lu3kZ9LfuQ+Yz8K+vSnRRopVPXDUB5qRbqth4FU TnHfp8cN+6wlxnFWGYRm35e0bvQj2It+bFra2hOT5Qw4h3nKYWP7g6XUOFpyxkqOeJ01 3Xy+n0Qp47SFGO714lwPAfMQrbJxpEXZL8CuCPsF8llT8kKGFBeuTI7zfPFX8tbNPRBh wKMzP8Y3H3KJjYROGjNJdhZOcbSqAPZyqxu5mA0jJQoetxWKSD4mPrwyr8PgwabgfQp8 g7mA== 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=B60Ix4zW4YsPRaUNEWXH06Qy+YHckM980lkxW33FsBA=; b=zDzv4Yd2779c+T5ubMHpu2tmkfPg4g4/E3sMzxcttOU1nNQXLkX91I4AJsy1kUdvXU V695aO7UEMBeeaB8Kkh9/du4ESwFVmMUOQupaA6bHhYIeHhn11DexDWpYSDBB55JgcpK KSmgUo+htYWABq6zb5JbPYpuqJUnTufk9NiLgykIGCHwHI5YNoTsL+tTRFLhw5MDlg8H LW0264A1I9RGcF+MoemyuOa0O3DhV33mgCy6lJZUAYgIE1GN7c0+sJ+EtA/bQp9OrKok ryOBGqERHQDNSz/puYX0nvam1HBlqp+Mo9Z8w4IpuNRZtgOAB8XsbWykla2X0gCEBGqp ZQZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=mg2ccySc; 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 d10si5377568edt.247.2020.09.16.06.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:00:22 -0700 (PDT) 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=mg2ccySc; 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 A5DD482344; Wed, 16 Sep 2020 14:59:53 +0200 (CEST) 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="mg2ccySc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FFE38234F; Wed, 16 Sep 2020 14:59:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0601.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::601]) (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 C565B82332 for ; Wed, 16 Sep 2020 14:59:46 +0200 (CEST) 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=NfdJQi+pF1MTM1/xS6FF5L0CW+D6SolTfIgnHuVz62YTGcHL6LvHccOws8qYlxuC5dk8TzlpXB8C9lYX9fo0ynxmHEvs1ex05N6PwXGjrXCFieQHx6EaCeZaG/tZ830ntr79KTTl1dG4jd1zZYnLBFpJNn/VCeXLpAFE4PQuWFwK0ibL2LX9ZA95Fn6J9i6e/vFoWYvjbMAc+MGwM6QpZWtvqmzwTQ6pNegG8SK2nlqu61bX0gWzs/NKunVrGW+RrgjcdYQWyewhHQySFgsxu6EErPqa1MzNs3q5t33co9SOJ2Vaqy+m8n4btD/CQ7NISheCIFBXT12D9VwfHCHn6w== 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=B60Ix4zW4YsPRaUNEWXH06Qy+YHckM980lkxW33FsBA=; b=TIQROBSJeSYa9DffPClp1UiSh9VFyeR9qUqk+6hYdliZH4H6x9b8JMALkEIgLkBaPOBQb7a4ClfYMTMCsQNyaybDAwXk77HFx3lYmgyjnOOBQgaPaEza5kJrU4uJyWpzlL6T0YbBlGeApg+D0YchjzYqx1jN1cULf9jZlPEXAwGOGz6LkxLgbOm6j56aYbQeBIG5B4aD3Btj0lZQVgWMXuqty39HYsys+hXTDbMqjg1jEFena6punGoO5RvGmb07OGUSQV263VUO/YfY4aJMAkKLbndC7jn+uZrZ01obxKF4JIolMf6EOihiQZoH0koniVPZi1763ES5IXaCSqDOzA== 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=B60Ix4zW4YsPRaUNEWXH06Qy+YHckM980lkxW33FsBA=; b=mg2ccySctzngbXbkMxygGFLL1NOlKq8oLCxRu6ng9p/6Kwn3RHAgc9ps5RwMCDq9+FWbf0FhkOCqUlzn47rJNdY+dLopN8KOK799SJoT1BpwJ10jlH/FQa6lxzqGdK8NX9Ly/pivKJRS14irVM6QxYG+iuXVcdSbtTvMGyxAX2Q= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:45 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:45 +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 03/16] usb: gadget: OS String support Date: Wed, 16 Sep 2020 21:25:24 +0800 Message-Id: <20200916132537.8313-4-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:43 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 254ba72f-91ab-4b79-abe2-08d85a40628e X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: w+hb9rj32eLthWHA1YlrQ0S5cg9qo+l1on07XH2juvud0n9GfJti/FTPzSoF9YCc5bAk/ogYWbbTzUVq+gpOJtqW3Llge58y2lbRPvD3+zeYK8XwkwrmHyZAVCH4i78U1BzBx/TTKTUlZE9p7auXFO+4VckKkZdlPNdvkZvf1DF+a4DTXHY+Md45kh7Ovi/9nh31bKLdM9LQpj9O4vhOTYErfEDn34U5A4b5N7zdnd3Hd6DKdgECO0XFtY5ZZngdgcNEMPnzHIi8iMXKpoUtzFWAYMStxH7nwixu+8jxsn2PEMCbJzs+Dwx/YSVQe0lmcCWRtoSURibMtjG/LzF0f3X33tvzaORKDN97/rPa7uLagzftDnW1UUY1+qiVp5aurtsn2rAsAd4HGbfxDLRSDg== 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)(366004)(376002)(136003)(39860400002)(396003)(45080400002)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002)(966005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JMUSP7Vkbipwg07jYf/H35st3me9U4abqkrc7NYKTzF9TaQkaFpNh1bSd9u5wB1gduN7dXRo5Cqt48rp48kWZ7lYNwT6zd++2wM+IQ05cpLlayI4MjmPA+UfF2uzkuAN1Ttuu646KjiXr5EtaIJv0pXhgine9+XBHxhANCYHLd6Z4pITdjLM0kO/qaomqRRjOOrnBQTwIkw35dTSIOA14VAe9ACRl3qBC0tQ13FyPAgnTdU5KM7a8V2Q05LLolV82LfSZtTOyh5lpSv8lZFsle1H9P4XVBYpXE5xQLs1ASvFVn4SgOlYjLzVVytSRW3Qmjm40Fq10OHLGL/MTULEiNwiMcMoohEAuQtgGIfwrfkcbo8CPQtzzMEvq2ft/v06Tq55ezRI6fpTwYkuHPQNOiXE6kHTryBpwKCY65EquTgzNObtYjOLEmAOti2hfQfa28CCuGPH8EsvMuYzzQHsYHDp/+FWlM4ytFcFFAiaFlBXcMJpVtkbo7G/j+4/1KOdJiioFPD+WZA/gCR69L3iuILvw9+QR7ffa430XVav6QPylkDq7Sc61MRL4jifADTUCYmkzZ7aLsccnjAn1kcZ3+uRlzpSrkt9YJTkhJd3psx63ku1D+A1EpoCeXg3mxmtrmVHTOZtYpU8oORvLq2eYQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 254ba72f-91ab-4b79-abe2-08d85a40628e X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:45.3148 (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: qT4NFbEtGtb/r4rLUVz7n0kotDefr7pLbvkcG5IbVUumjzxnJDxTqBy0ZLoMVrIUyxmjoG3BTditz3Psv+Gpow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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’s 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 Wed Sep 16 13:25:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312431 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp442405ilg; Wed, 16 Sep 2020 06:00:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLXJG1L8OnE4Ce65zSBdSQR7Sf2/5Ey1HLXNv6qIZUuVH5DFjZQTHLjSCo3j80JXfqEnMT X-Received: by 2002:ac2:4250:: with SMTP id m16mr7360071lfl.565.1600261235740; Wed, 16 Sep 2020 06:00:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261235; cv=pass; d=google.com; s=arc-20160816; b=DJsWMQx4ipLWB+pB/RqhrHhPkjrBWoEQEFttI4w59K4WCF0o0ec7Oh6/3+W9EXFMWi HLWFn29u1pzRfKa2fdDdK0DQ5QU0WAVcHBGNVVdfkFPFQRQhZmaBVCbrRMb9lpMsOCTO 8IMSKDrpmoZeNKNcwGgMlHNgB80saMBFbKzXltMxeengmggx7D/kuRnBa0uDDJpjuVC1 ixgKReWTLiHC9SSuweNWEY3puEuhIIaeNYc4zmPfOiYSq5Ep4ssB25hizReLeVKZQ8P6 AJ3IBM8zWQr7vFfVMLDDUxeN77j5b/A9LI3OvKtu52yaSgnSRJ1e3Jx5S0lJFTiLWlE3 Idqg== 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=f/ceLMUi/h6kY1VUQZMFVwQZwjME8ImiGZcfhL7lXRmIX1/JNXPUQXU30V8ItOYRj7 H1mBdCXlO8PjfKPbDueMIRD0iypoEKABi2fytIrutkLDF+DgwELI0f87k8JoFvSRGjhx dm2LhB52Z7QqzNcAp4CzgSRsy64IaOIVCalNPb98aMi4iSz8AUyw7QZOwT1M/Kwx/L4G s77a/qQ0nqDw9bs/PNAGVpv8gIqhBpcz/w1WwaxT+bNC4YMhLoj0h++CKSLaZpgdhMHZ r+vE/sA6s64/uCz0gvzTvV9rvy9aID1PJrJv9zlJCIhgEb2ECQzOjcOokm80smh5UY9E IcrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=RX+E8Cga; 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 j131si2922462lfj.224.2020.09.16.06.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:00:35 -0700 (PDT) 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=RX+E8Cga; 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 64FF782359; Wed, 16 Sep 2020 14:59:55 +0200 (CEST) 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="RX+E8Cga"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0644882356; Wed, 16 Sep 2020 14:59:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::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 7BB4882344 for ; Wed, 16 Sep 2020 14:59:49 +0200 (CEST) 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=if7Fd1WanHvGuviV7U6z443FfwGxEZLmTshQCc3c1Jzg7+pQ9p4GD6wtOjKoodmkSIVfxvySb3baPeYSGx7iWdC2tuumfsOghoXoer+xLErD7wZPOuvfFJ67JxFqwVY1jTqxe1SdqGQZU78Ja2MZZyH4KYcV0cHaYR6kYPYw4+jqmvuEzDXEBcqiEWkYw12Z+fAz2dwwaEI6fJ/N/dux3Xv9w9asBq1oeBs9LRxqviV22atZclQpB//7+O8auiQckrqcU0zS6GDNl5lzKfnVuyFR4It3RnrKc8GySy4w/sC53fVDdAK0Hg4/hZKGosD6Sx8QY5Zy57+mMJDhc06S5A== 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=bT91I7TxXY0S/pyhZoV5dzbgx1oFyUA4jmuX7DV9c2t6Lh0oX71QqP5gjXHRs2Wkd9We8UHXfLByoaGusxnfbXYw4vIt/JfbBDMQgzODnX5LTqJftrxvEld3rqpR0TQDoEhRc6eTH/0SmhRQcPKqcwuzAcQf9IRhh90qglBE+bssCHjULd08HZAoD/hojMTA6bO/aDSTrppaFYovKVvLhPMK8Jk9diBiqEXYr7uNFAEG/1BhAozuCGx6vvPStlR1GvT2k2SrOgMGqQSizw+Sk4E+nM+lIsPjxYs0AbBTjI5729kh4NkHQJHlzEQwgn9aKCX0Lgat2NQTTrBYP3Yc+A== 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=RX+E8Cgag/ssxi07LJBM6fjzJJBm2Y/sOD54qb9kvIKFHck4E0TEeT5ujIev3eKEiKppeQFjN+uWkE1tgca+s4PBfAhLbU4b5rq6eQiLeC8TuECBBcdfE5293aU4aFWEKt46ueksgTxNYv2PxRr7YDmEsqp7ZrKF4VxT4DLE99I= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:48 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59: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 04/16] usb: gadget: move utf8_to_utf16le to header file Date: Wed, 16 Sep 2020 21:25:25 +0800 Message-Id: <20200916132537.8313-5-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:45 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 146037ee-5d6e-4abd-814a-08d85a406426 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: gTT4vQrFodAC4KAzCMsJC3A5qtz1bCpj5/RF45Ykrz8dlJ0sPbsfjnBJCrpQrrfQLoAjRH1HYu4oYkQJ5mC/lDXRNpQXbfNzgh43d8Ot7xVMaxbZrHMvPqFzv/BQbTgLJqzYC0lsl4hmyXtr5gyvY09Eh96iTqBAEChvx4aFXjxKSHbAitbhv3YDcJn7JceT1G5VZuOfE2qtyD8u7PYKTyFgc1WWulCH2mFAnwCsAudJLWZQMk4JqYnhx7kOaD/dKWHosAiCXtxmSZpMf0xdRhreakuncksIf+mWnBjwJNX9J4/NuI17KHQz67UDGDA1ciIVv293m0W4kSEcN1CAkQ== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: MZaxMa6xfBBwadkCezO53o0Ebrm/XYlFgluIhmWVZNPwR6zPuPAYk4ZJpWZzOQDVxsaCh3b1lq6YLxuVE8l0seuDm60Xmir34K1ZKAHjA5RICVTEqSHiQbidNTPcFTMNgmz6a8FS9oN5HqMUOLMqZaXxnJsfOlL5VVpviqGJVuwWbkLUD2SDjtovHXz8t8JGd+DJr9vTkNObMFbeWa6+yWdiw7QF7MChq/jULrhMTZlTfNwNh+3UXmKH8z04HQra4J+gNPz5zTgOmyn7+CMQRmB8Uo16G/N6K3+Xe5zWw+NRUY6kglRg5HTJ9ddHQ2ADEvUwNMlEtyRDkhqRXa7l9tmvTPQYH0JbW/KCaOuV0OwHxgR2Fd/B9t3PiO9gzKjIPNR/fGnUr+CwKqGbFvy2ZilLb/572I3NOZtn3umstGqul1PS7vLL7gDWui36RSzJ8XfU3KMNw9iScE9Uy9RUELYekylwf+70L0rGibBVNn+3M9OHWK64X61xCe95RWBHyyWN+hvh87sq9bHTG3iYMOskzvrsS5usJCq736ZZfpzz3KUp8MbNgczHbU6R88GTSjoSJB123feOLd6O3GADhfL6JOqp2IjrsaV2KdVvVAbNoEr17znzzn4dotQSttEqRROjhC5PxFiN1T/BKmE8OA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 146037ee-5d6e-4abd-814a-08d85a406426 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:47.9995 (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: /+bEc/DbaO6crAJjWc0qh/zqg5b0BfBQ203Dod6GmfjLIJ2sdmuQxuRtBpRt952gb/BqcinFalLAPOcf55opDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312433 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp442681ilg; Wed, 16 Sep 2020 06:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPNfocRCto2fCKjCq/VtZOLecXbnxc8Jj93kxwFs/UqQFv7SjzISNq8BDDmtDRPRJ3aqad X-Received: by 2002:a19:42c4:: with SMTP id p187mr8646786lfa.149.1600261252921; Wed, 16 Sep 2020 06:00:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261252; cv=pass; d=google.com; s=arc-20160816; b=wa0k5Ft21dSncsayI5guLNuDfKAEsArrrJL4aXD0lVQMm5n6tkwsIzcnjjOu+UYzcF 2ICcNS0ZKIEuqpp5B+9c4hoU8EkjRbeiC4B/GoqL8QtUC3i4e0XkCf+x31xV014qqwJN mcUbODA/28SZwB+CxHe4BTblLZoUGh70nE/bQ6MA32Ik1CDFUxFe+Vr9iPAqtd8zAyo8 YfC8CwJ2tVwWswatiPKz+6s9MulKMlhnt7ngJbX4WcO13IFGWJLubq7aaF3RhRdApdkk Suko6ET93zFi5G5CoWgNzieWzdaBhF6SOD6P9sW283c/aIcGnGTyJqlTFwu40igfdrOX l/hw== 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=ilk0h5KtGgVDsrsuI6Eu+UypGz/VziUmS6YKeZoLS5Q=; b=Vh+xmFoQcareiYiKvf4GXFv0cixqOa7KfYaMDxmUZewCh8a7QX6UN/3ogl5ruB6hb8 4VJykjIPalDOBmfAT17Wfp0k1N7RIVanN13FFtNT3oFdKSridXFMvYI43Ui/MpguYymq Zd0Uh1dwJJGq8+IfVCBnZFQ5UnI0dADH1YFqiqV7z/nbJzuPVLK/rsnyVVBJVp15ddit Zl6d0zVYZ5XNfH3r++qZTBtnih4450DoKvh9MaOmf1HS7XTpWH+PZwh+wSNxChmcB8xG F2ZKXNoY8v7oAg1njwgv7fXBndkzzbUsQPaPx1tdmE/qrfLL+snfPec9B6w0CvW6MBBs uOOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bI07HHb6; 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 w21si11783144edv.485.2020.09.16.06.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:00:52 -0700 (PDT) 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=bI07HHb6; 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 3254C82363; Wed, 16 Sep 2020 14:59:59 +0200 (CEST) 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="bI07HHb6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 337D982363; Wed, 16 Sep 2020 14:59:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0609.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::609]) (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 C0AAE82348 for ; Wed, 16 Sep 2020 14:59:52 +0200 (CEST) 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=nJqNchZBIVC7n9wR1E69osTobXpuVWAxSolZYmnKWp1STm2Bo42x5c6/R0OuQiMP7WXPIU1X7CP484c2+pVFk4w2xeNnjFMsZS/YFcWn8Ktef3lKtDwoElHaWU9byxLFDhbKBaePd0ahht73s+uuHvTmnFU7yzacBfmYt3iex7m0LqQX14Gz7JyRG5pjjwLshNrVhqpJ9Oq+ztVstLGbaEumtLvtFOjOFhWWCcZZEJWJXJB4O2DqsyvhlmU2qsvrzw3jtrOUXfcMvYyct2MhlAisppCDN8FSgEWywffV2r8n3SiMWafCWNFb8DR7yPPmKYYf+Ix8XDMwQS8z/cfofQ== 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=ilk0h5KtGgVDsrsuI6Eu+UypGz/VziUmS6YKeZoLS5Q=; b=fepzCMZ2g50plAkzgnTjGxzzBjgm41NyBmiuYb/b0mig9uHBzeu8J6g9KqakbyrLdXSNi5xpWBFWmymEc4lcH8BYHbKIA090pjk0icIzM3tI9NQ/axbYr1YT4QDAy3CD/IMoOijj+t5G4PHApIo6K2ddTsv+3Ip1m1Zm1FAqcDRFf/rI5f7w9j6Thaako+oVAPORiqClQAwZw7Yk++GC6hMeALacbUDnrFxza4tf0q73jjDfA2NThBbqBoc8XwIwfeYcRoss1X4aThSi6wYwJp10/69/xjFLJiWabpE3xOxPfsSo16hSp9ZIcPlJU6QwkpQYd2AsfZOV/LNGBh0YXA== 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=ilk0h5KtGgVDsrsuI6Eu+UypGz/VziUmS6YKeZoLS5Q=; b=bI07HHb6I7QAMsoFLU0i4U2qSf1VEFEaaSu/wE0e/yyel+5/v2j/uCqP1fpI2JAPheKlPcqwuwp3fQ+jYJk1MtzjWrBPiJ2aaeo09Mc7JK6aFfMXHoTInVTRp93+Gzsv1Fs7Uk92zni/eToQa3PL2LRMc4XtUYwknIKbuVFXZTo= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:51 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59: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 05/16] usb: gadget: OS Feature Descriptors support Date: Wed, 16 Sep 2020 21:25:26 +0800 Message-Id: <20200916132537.8313-6-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:48 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 61fe4389-f427-4993-f2e9-08d85a4065be X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: rYpnh50gw4am3Jv25JSaQG+yhwi0dYV5HB06yTPqMp4dm5kdE+5pbtwkD3vgjVZHypSSHeyg+N549ai0SWozQntSITmb3xmKSeLZxb0i+fBHFPPvLsg+92eD5+nVK7HfLgtFKDI59ZZpi9F4oMP1EJ4UmY5MnQ4BfUQBn+NlznpGoo3XZ3xPxUJ25Gcbpme6RBXheXovbOisELWCkEHnBg4DkTNtxLDPpmCJBvZn7oi8p9V56+bv/bv8tt8bt4zykPa6tjOKGISruRvolz4ZxXCwTItkpyX/7d/IDEi5XFryusNVHn3g9JZyAiePY05B8RyAPhsDKNfdohvrjZEf8yUAwwTvvkRPjUaVlybWJq8wpXFUfwyiImyr7Iz2Gz7R8QXU38lgeh7r1FzVABbdakmpwtZctgNjjY1ikKdyGwb2vsOJ4UYO/kUV0iul8/njaieBmi4rL894z/2pltzMfg== 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)(366004)(376002)(136003)(39860400002)(396003)(45080400002)(30864003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002)(966005)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: D0vtxXPoBaAT7ZBNXXdZHRZsj3TCjDI7tEJpjgnVfrYehZKLU53R7ewkkCqkSIw4ZOrVx72IhHsPSLZHSmO33X9R5IwtoGNDqTyRLxzjze8uxtCOWBOVYkJhbKW8pwRpt+dyPXrbl1bMG6821J5pf/4/vqBhX94dJZBq5WmSnxf2Vgb7khMPYoSDJF/nJOg9WvtUrKQgsGhEpDn/7pnKcPmDeBgjcEyb4mTEM2iZ9V1jnsaBrTYaX2CIvklguyD0KWHVfXkG87F1dHDpLoeKyp8v8d68pvTxbulCNu5YL5HMBlbBdqSUt8D/Gb43aaTyJU5wg0nGiqEehZH5HivqSOwbrod6lZnjdq/1iQO6vYjTWUdZmzxDlDCJ32bDNHzXC99u4wsuOoTw/m8oW6ZzZLV/jbg1VVqHPW8LrhohdHF8LwM7Xklbt1VHbdfust+exyxK8Nw7APo8Pb3cwYF2xe13EErT/JuC2hBvz2MHzh9BRQ4YhxvbFCZ8XWXQyBc+qB/SGpC/aUN3X/fOOvxCmM8Zxke8wMny4IByHbJo3QeHnl2E9cSS+3zJBzfBlyY1mqMIkMrK1wAhFlSnA2m4RWcHnlMKk7BaG3q9LFOB9ywRlktsp0sp18NGnWlCbvz2EJ9r2uSXDTQm1VihO4DGGA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61fe4389-f427-4993-f2e9-08d85a4065be X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:50.9022 (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: MgzNlrdbfZP7YzzyelJOLagsmdTtZsDTc8mML1cR2tOFa50jlmZNl3P0ND+WEOND1Yn69aFLk4UyESFcyn4jTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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’s 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..0fdc1302ae 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 (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 Wed Sep 16 13:25:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312434 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp442998ilg; Wed, 16 Sep 2020 06:01:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVd2oqr1r8mOc+6R7KT1vOoSv2hEj1/KCPZbNeXu7lmkRyhKZM3mCCF2e4xgYiTlrSMF+s X-Received: by 2002:aa7:d34b:: with SMTP id m11mr27774171edr.178.1600261267930; Wed, 16 Sep 2020 06:01:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261267; cv=pass; d=google.com; s=arc-20160816; b=MAehQHBcoQ90K0iXBqh46UujhiClEDdvuPrZi4qOURT8yLEKEgtX7xCfmTj1Ti3a1U XFQpHbCS1p5thqHhMW58Gf+ytmTFGltigCPEEIpqNbQhxrGhPOXKCwy08dVwTkgoMVBX kV//5AaT2S5SUfbf4x6YNIkAz1J71/QB+TxUEqwA2fXIskPxM1NjuzUU/N07J9e3vp5p Uwn+9IJ0LjAiWCSpQGw97AubQvIyTyHZDO5IzHqXAwZ/bT9jyoS+IYQJD9LrasN7Is/u ei7u/CUYjBJX+1pxdUD4ksfundJn0ydBXfWqvfbJLl97xDsmo72F77t+vNSEjjdZPchx F5eg== 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=aiyaRpcyzOI7y/JYB8uEH6FS8D11+h58xvMS08eF+1g=; b=U6MIIJliRR8ayIk9nbk8O031wDvKqwh3oBn0q/7JlY3oc5kxyJ7hQNRFwZTynQ8i4S PGKwABYv3n4nH0iYtxnvhtDNA1ZwL8Ag2WIwHc85xaZAQxEQdqDNK2ncRtWdGFyBztAi 6Kn/MsZsXYEnqN5yUtDz64JMOyvaZdyDF0fyxPn/fFsYmXDqXw1AkybymBVCTz1P4LzB eR7tmQBh91/xx0L+tavg+z6h5mHUg0TI64wQHHfXKQEA5svZc3BR2CiUpVPZ7WJMlBuv GU9ZyjMro1rloS4fhgIFwRvUbWamDyOYvVfJ9lgCNYukQOxXQv5tgT9fXpeWiTD+h8vo 9TYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=VfWaNBZ1; 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 e12si11303745ejb.104.2020.09.16.06.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:01:07 -0700 (PDT) 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=VfWaNBZ1; 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 DACDB82362; Wed, 16 Sep 2020 15:00:06 +0200 (CEST) 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="VfWaNBZ1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ECEB782366; Wed, 16 Sep 2020 14:59:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0612.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::612]) (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 F20BB82353 for ; Wed, 16 Sep 2020 14:59:54 +0200 (CEST) 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=Y4NsMaRpsKoOkGayPyFVl8V9HjjxpR1mt6DV4p2AtAKXXoHkBs/InVLo+32CNn1cWkPWN1L2wmMfJRMsvkIfzB/D1UxZljinfCRmvsF1Uks4DwFRj1u+jyF1Z0NZfGSML1lxnHuO+rHLPECN/8gBftDvANEcTAb54Teq81ZWogrfB3KCtXqs6+pV6t+q3RMocQDFnVTYJaJwmYzGa86v8IcRt5zWckN806ai4grhV65T3F8fyqpCazdQ32LqJ4FjCuAPCF30f32YtFka+nqgIO7sd/2qvLRHhRjM2+nX4+i+oOz74PUXJo5eIqkuthvil7NawZtc8HgxqnWwIOamag== 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=aiyaRpcyzOI7y/JYB8uEH6FS8D11+h58xvMS08eF+1g=; b=HtzMiMU6327ic56DKyEINGHDtvR3NZWwIqeeCxlfmENA9Ur+MxVW6XgzsTeh59YGBF0yUUnjXcBJ+CEHWub73evlR6FJWWtDBNcLByXVCp7SOALZatVdURp4c9bsXK+Yle2jzW9KvkROTtnBBVRSJQ0YUIqr3brLS/yHph8z8owOq4B0wmIkzoEHiVptMa9rX/NzeW/yS6iz5ZNJKW6XldN8Eh9pw1ZVCiwntCYrwB17ZXMEW9Rwo+UdL7v+Zm7kfUpYYn68ZKALSeVOfS4yM9AiO23FGJrgr+sO72LQZstJscE7w6n3z19Eiy3pqOVW0XwMb0zdCNYpWqvy/g7E1A== 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=aiyaRpcyzOI7y/JYB8uEH6FS8D11+h58xvMS08eF+1g=; b=VfWaNBZ1omKont/s3W6mrsDdTwrrqImZrvjrnG7FM5jhzA+kY8R0d0QcEpnTjhvTiC/4gUfMwEGgZU+hd6CICvf4A81zEIcrXGLYVIGHvip7ihr4ZM9MjAQlrTtKn9Q8zxS1Io4udq3AZ6Ylnve6+1cYgBOy69gGCu6bAnU7s8o= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:53 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:53 +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 06/16] usb: gadget: add WCID support for mfgtool Date: Wed, 16 Sep 2020 21:25:27 +0800 Message-Id: <20200916132537.8313-7-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:51 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a7544f3d-49af-4dff-51c4-08d85a40677a X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: xlR5Micqwz07AYxuA000kv9hbUt1MpugnHmCLqHHZ460HolrCg67HqY/9QuKGdjc7hZSs6sQ458DZTh7UP+k95lqUhuv9BHwChHdRcuBX5//Rh3WRpKXukA7qbeOspEQH5Yx5MCnhhnGAV7sj1aIfxLHa+ICFPrkt6tWuMPVuLD7KWaYlOUcQ2dXeZNbJ2xy76RkENA4YDGJMcpWo4xVIiAbzzWOQ5fZy9VlUpRWjSg6ZKpNxXs4GZv3R8kRgOdeX7tloRicjzYcPh42dzOkfOr4Mv4kAeIivp66tJmH06TmOozdxjGxx43n64t4UL9weAjikGVyvl/DpBjmdEQgjw== 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)(366004)(376002)(136003)(39860400002)(396003)(45080400002)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: q1ECrJEOWEknWG3SCSw6n4+KOqNIIJR52u/PJ7rGsg4tVT95v//fcqPAjCdnNwEGjsaODTzAFoXOiHnISQBUMr4MLiMkj5snFUydoLpuXoKxnUMRRq0byTH9w0xEkJtOiIlHr+fl1xb6s/4HTLeXX7iF/yGgfgEVxhEuTGL5ctgFEi4VR6EoAKe6P2j1vf/guUdPhEdDoNip8J/P9XK6XHmQNllE1xTJKjx/EzFBxEtpFn9qLS4Pt8WxrCiTUU1zhD5rYz97/cIGweqJYqQMT6P6W1p961MZ+QIBHswG6bEywQ6FkyNrzyBwxx8wq9frFeokMbYRLejoKSYyIvh7C95IZosXz9SzzYa5M8Bge6inQFg8ugFBplLzCcwT1PIps93IQ38e3v4kN8mnhBwS5BCgQvQi0tvYprGBxHCsOSCB+Egavi/QrwC/F2uPcxP47qGfDRk5K79tC1GS9wZWGjsRdw7SUpM/ExVNLbRDtKJk2wVpvgT8DtzfYm8UjlE1Bj3JCbGFYW1RZy0s27PzZYdNjOBo/Sou10CcehMXB0z19VdgrDTSV6OoQwFXA+nxATElp2OHDiKs364ErXatUEw9tCdTlpPv3Zg0n2xt2CBmDStrc6TW/XF2ipH1St5DGoRW6nKM4ZIlV+Ag+Kc8zg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7544f3d-49af-4dff-51c4-08d85a40677a X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:53.5680 (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: JFHQr6xHCFhaUTFXKXAfwQzTpT0nVpzvszqqLGFN/dcbBvf4e/Eg8twfxf3UUOt4blugWoHJc0Dm15yMBtsqtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 0fdc1302ae..411cd33be5 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 Wed Sep 16 13:25:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312435 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp443275ilg; Wed, 16 Sep 2020 06:01:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNqvkqAQOYeD5ZA8VNPLmiey2IimdA18qYIjUmOfaeo03wc59LiH2H63Us9R59W6vJ9Dsh X-Received: by 2002:a17:906:4c51:: with SMTP id d17mr25024354ejw.28.1600261283155; Wed, 16 Sep 2020 06:01:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261283; cv=pass; d=google.com; s=arc-20160816; b=iQXgrOiDfeqKoM00XqrvfFMoE3v4HE4Fo9NAFtFXOInW29tBFW+9Wkp6iuRafWyJOf OhB55lw+SAQb9+3LpfkdaqrEasD6sfWcuPbwFz0GTkPLtW4NIZTmx7dlKOBXHC4kRV7Y de76nJncMgzauS+LAZy75gT8+zOlk/9bvaaNombH6Bm3Lt+iIlKnDlDvChYlrFZU212S 9TtEUy8YRPAPf/aQ/9VHIrKs5APrLLTG+0TrnnS1OXNcM+Ln+8+Flq2cJ4nxWlqATLwQ BToJ0CHhJjXXeGfT579JQRsp3ABZJAC1na4FhL+XTxwoWCEpwHZYCDZVYealYN0jT3fK jXog== 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=yRvbA3zlUz4/+MITroVy7YRalFL7BNev2js4cPoDHi3Qctmk2hdp/KrsOE2RpKA1DS 54XwqIGvYcAwrVnK27uWPgsCFALmrlVgwl1IFkOu5jTDr4fhM67oKWz1WVoRCHN4g4W6 0q9R12MpF2KRkqW1i68gykchrGVQhMylmBUT4ADnoDXwN+8c7kOsECtkMFqLdUH4KUbm nfShgCegbYWqyls9zZrx0ePpswjEjj4zt/vGvhwvdbgqeVQ6laiEV6jBtnwJLC8m2PMk y4hujtsaYZBtesloVcc+OW+l9HRKA/ZKgFAgvym/1xS6OytW33Xvuzp1MIoNyZGRxa+w BKZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bF+xIaZ2; 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 s18si11836329eji.430.2020.09.16.06.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:01:23 -0700 (PDT) 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=bF+xIaZ2; 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 D19728232F; Wed, 16 Sep 2020 15:00:20 +0200 (CEST) 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="bF+xIaZ2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C68382364; Wed, 16 Sep 2020 15:00:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::604]) (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 DFF1A8233E for ; Wed, 16 Sep 2020 14:59:57 +0200 (CEST) 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=c0g5keWTGD0BI2TRe2ckOOu9W+ReHjFHpxChMSjbRlt3S7+PsCYPNgSwf7Y6rpaz4JhvXJLTlGc9JUCP+eHc+Bwy5Va79gYSKq5w5zeMj+16qoY/VWDxdYpmM1uq2gTfwdHzEPMLkjeMNtpM9wrVcqNI12I4/C5l1GdIkeZAsPFFpMdpLSKxY7aIok18skBb9Ugu7TZyLhe8jApifd+cuG3I4bG/wT68vFHSf8oy7tqcegJbXPz4PZoxvLeXwcho5Cce7SYW769LzGxvJ1KeO4VInHQLEMI5/cP92V70IGHUI7qxDqgTwPxCHmZYP/72PKWl7V9lBdPvSC2d2fIEOQ== 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=Rl+PknmZ/jiiTJJof4j3jF6mIO+Lcws/mkobaLp66UUaCwz57JBRGXeDWJ/75HbZPvF45Hl+DRWe8MrEAODndaraT3Ga1pS5biDMYHr8w02obH9Gbow0nbXTm+LG2qhBSEvboXz4oFLQySzpp/thJk2/EY7/FCmvTLqZdYGcHuUTkBtL/0EPz/OGEF3RB0KsaYti6E0OeFDDnoGfgk72MXYzVGljPiYgV0jPFB+8Dx6Vr77wDhrwFLR9qwz6q+k58asjA0BjmKLsyDxANO469jnFMhH1l0pOjSNR2JOz7QNWTAduiyEP1jqEM1FxNjdkEIE35oPN/qGgd1EuIRBTdw== 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=bF+xIaZ2p2TmoaekRP2ncktUdSTnCHPUClAewvSfAsYR7xitsylDK86oyN+tDT6wieg6pStlJhdeSdmtpdqlsRyt6XyimMemuLH8LfkTaeYCD7yVphORvbBOcAQMflz+fPV1h49lbSZgPiwwRuO38ZUL7XWKOzwp/kb9AX+tfoI= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:56 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:56 +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 07/16] usb: gadget: fastboot: add ext properties for WCID Date: Wed, 16 Sep 2020 21:25:28 +0800 Message-Id: <20200916132537.8313-8-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:53 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 422f6254-c4db-4087-ad48-08d85a40691c X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: D5Zd7hO9mVubQfFNOtnkX2kJRvY0gtV6/56n2yQOQmp0JDb6PE2k9F9vep0cBkPfCm58HvuMioxFpseNalEpsdmSNgO2aMODg3JsY6I3VvyTINxd87/U7FkUUIAjCC4fa/8ynURaHtcS3eh2HAHI7QlofIHdc4Rm85G9nz0KAHEXuR5ZU3ctbZfTPPVaEp2EuPfdLfypcNT1NU5wEFqptoy71S0a3Kynks/m3AC2f32DobTVMS+uMq9K1SZhG4LaWXGCxszl0jtR4x84I/G9R75ZGrzn8b8vfaBBDDPC5wCGwZJT4NuBod7vg5Zuyf2k93VqFxtF2Aj/pUsdO1rHOA== 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)(366004)(376002)(136003)(39860400002)(396003)(45080400002)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3dQA/uhojEEHGhRgxyNHObmZEseggAfIvWMvYZj3BV/BF86tgJcG83pgBqGYlWeheugrySwWuUJGdX32Nvwcle5BlwlRZnYYoE3CZim91htOKrXrLiHBf6sIHD2bASi0n9+Hg63HdJMfC73ssithpWMYIaJ+LbqCR924e0WbI9Zc5TYKkIphy8tFsfbBknlfZqlR2yCRxUcbpPjYQOY9NeoPliRWItJPabdppRl0tWggfg6o8CNPDnqjbOpsZhk0F19L/yP+8ZHZWOsol+zLxfg8xzs2QeTK7ZqVvO2XrtljdnoBmePQP3QhMHPLWGTJzpa+++3c+XqP/eipHTMG65HM2mNlZJEt0kxrjPPJ2yn2Qi7BbNnq3USM0Er/zOfKZEsvYuDZ305LSmdtnks0QaImjjairo3R/wClzkJaaER7xldYfE3h8XPpgVNrJxY5HZLxgAaOmgyFYaRzIuQvnlgcgHVEUFl+YMHn/OKQkLrIbRjnZXFB8cIPsipxBtnh0owGyzw5htt4jiOL+sbqsBuVEhfuhFa3gA9Upp4StT38kCATaZ7QsGVzG6KtqgQuEejUWtGqTQ8CI7ehuRSA538rJbXV7xoA6UdZwwIvyPtCbZOFzB4ZSkUXy1UItBUD/hD3zHVkGlRELcE0xxKejg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 422f6254-c4db-4087-ad48-08d85a40691c X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:56.3357 (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: 124pnQDX1ERn6REggzg+w52epz4fbU0nqBXrho2B+i+ETb7bJU6i+rISk+sbG4hX9DYW3bNSmRlliybQmOAhNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312438 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp443780ilg; Wed, 16 Sep 2020 06:01:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ6qcJkJI6y5IEpOs7Ju7MpSaF6rGkE7Z2oOIDPj+rp8nsLM/RVVRK4IlxCJf3LY3xar7A X-Received: by 2002:a17:906:6993:: with SMTP id i19mr24362335ejr.26.1600261309370; Wed, 16 Sep 2020 06:01:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261309; cv=pass; d=google.com; s=arc-20160816; b=QktyWqk+CFHZRdWTJkomLo7w3A1PoOv9B4NOj4r8YMdPQy0bfLY8b57xfCMEi6Zh8k Bh4WM+H+XsDSvN2Wljx4qToQkmjKdgnyOBuNqSi9IY8GcwIA8BpmOYPu/Gh9+guSm6px I5MgBiSNntMog5avfsF+LH6O8AYxa/TdanI+t3xETIh25S9OHOOdoHuFodKsr4vSFxDw Xon/oeZCnmcBuplGJphjxvGBTZ7dMHr7emAbrcvUiI07K9iSlMSMCE1lunpoxCbaZcan TXmyIhuFZeffX2DTaAILLhWifc4AZJlox81MrqsUnVuCabD/42OvBozUtMT7UbCJPCdP Besw== 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=xJ+2eE6HdDeQe8eJSQdlgr7r59p348khGVRu63l4dMA=; b=jk88u5cIQo0/kdVjIJd+1kCaTto4fcpCs6jA8YMIoP2wfvOoBipEG4Rv62ez7j3S+z 0z0sFEWLemI0vrqVU/0E+ql+pv1UcEUpJISFgSvl0d1P2dcSYW1tEe3lVZOfqXouOjSV Xt+M/hUPev4Av/Mg5erZ6ZaI+Wto7TuVZnsCm1n39C+zcFk3ySMMYs3bDSNRPSYteyiJ dtRtyaWNXSIOoebblqqvTlkNPnrgkGj4i9bpwdJVl++shjJvsfQYE90FVpSD4Va3PbyT FcKX2skVQk4v07pb2/yFgBqkgs2b8NcTQxDFaOIbL0gfwObuZ5pPOkI017mWNLWG/cSy qtIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=HbR+CBs8; 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 f11si11657615edq.528.2020.09.16.06.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:01:49 -0700 (PDT) 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=HbR+CBs8; 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 A4F7A82385; Wed, 16 Sep 2020 15:00:25 +0200 (CEST) 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="HbR+CBs8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C874882374; Wed, 16 Sep 2020 15:00:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20608.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::608]) (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 06D8982348 for ; Wed, 16 Sep 2020 15:00:01 +0200 (CEST) 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=XT+Gj8r3/GSRSJSiTSVFdczYUQZfpPcXw7YnAlqL36pnE3OhmC9kkG1eZoMgv+byPi6Lkfu1fNmauKvVxGf1u6ODjgAA1KJ1AChLFurgUsKMYsNhYsMIMtwJxTLkxd4fU07zAlEtuVyrNUK37f1UFC+/+UsXLdz8Ty7xC9oTxcRZjI+T0ywQQSU9zUFmf+lKsm4pCrANjgyk/Y+1v/2RKOtZ+S9D2tO5bYgFb9pXT3nFx3gAhZ3XgkJKbLoKNHRFM3dR/jKBBq8UF6hvBnl7OSI79buytBar3eO3LvRR/0ATFeP9Benc0pFw+HPGWA/+eLt3MqorRIpqIAJUEL6k8Q== 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=xJ+2eE6HdDeQe8eJSQdlgr7r59p348khGVRu63l4dMA=; b=ZvAhtLrkEjkvVVi7alSCb/ksngXngnNbSrnygBxyXWG0RIe8Ad/Z7QSoPSAOJ1so89cQClJW2BbR/IuflTNsNxxuAnGuEhyaSP1jeYj4SWWhnjcyKeupf3o3Al2ChNB9cVISd3JHy04hb4alJejZ7AcQmgqqxFK2GdiSYuUZZVB8joGc+ee9wUXQyKGHguoPniWHJk7lxRoGhzi2FqgAZyMclrfAer85k6MDoIrt3PRXjd+dLQE1QY3TAPsHU65gnc5LEFar8B+WyRvS2DFxoELBhT9y2Kee84fCuypZxVwkiyBUg1fYR1+gCHMCQ6X0m6I+/qGNJjmyeX0+PtMx6Q== 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=xJ+2eE6HdDeQe8eJSQdlgr7r59p348khGVRu63l4dMA=; b=HbR+CBs84ECTaRQYfAcIjyiiy25CscDgC2HvIP1VTqY/H+ns0HUzdH0dz2tSilbY1nTwvOxZjWmZ7shay/NP4J/THQQiTa8fLhCLyjDhxQnG9lLfmX4pbG5WHyrqKB/tUNGVdQugYxxagPgKMl0CZYaKqKElhD7sjJcMpoaR2Gk= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 12:59:59 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 12:59:59 +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 08/16] usb: gadget: set correct usb_configuration for os_desc_config Date: Wed, 16 Sep 2020 21:25:29 +0800 Message-Id: <20200916132537.8313-9-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:56 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 05a95009-651b-4da9-cd21-08d85a406b0e X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: 5WQ2dbxF5sCugwKjSs9aSV2yLB49mwZQ8qoXw/0qsvOHo0g0NkCAiqMZC321t6I16oZOUfmRteCKpPKwQXqv5o3uU2BRxLu/0QzQaQUdsp4ElJpRTkeKg8M9w9mOh3qEsAFLM8INZKq637Yz+5Dmb3EtVlShAqR/ThaIp+40xTTmRqqI8YtMlxMipjZF0JxkvJzq/FnJhM6tCEmQ9F8w3Ad9fHDWm7pDEg5+3qQOlAfoqkYQXbJWIIJG1iJ27UXtNpKbkR2owU7QMIfC2ePFMFDDetsKz8k8JVaZiFdmo0+pVD5Dfhr7B6dg1D/a5v7bnIzxXT425ZJbf2yiOOqlkg== 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)(366004)(376002)(136003)(39860400002)(396003)(45080400002)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: w5PwshD0XiLYHgOtYjIGFAFwKcBbJ43FvaSZAwbGMFZtM1pvbsihUzXOpF61pZ+UFfKaDFY2fzpblli0VNjGYS9aLocsjMbHiTMs9zTuLdD9otyt6JMZfTmSspjAiPV+HAADWxQhWHRTc58Rnpufqw/Pa5e62GlW2/hpmPnZyT2WqPW7Amvldy94YwxzENuAErrR53E1X6mItJBV9W9ip7PJp4spePSjzCl9041xTwIWEvpU5DYo8Z66OnGC7lNoGzfDxDYmuj9OSSTXd3QV5+90MY+R6fiAyQhr8H0HzgKOO6pNMG85BTIHpATwR8x501ZNI849u0SnXS/3aF+xFR3OgJk9FeWAOn55/+OIZJCoVndKuJI9W6VZms8GIl7rOEvSPrtUQjeRceNeT4VtVhFNoHbg7mzuee9cWiB0pYjyWszXqcfS8JUhnUba+H4gId1MEJcF9dmoVmnKA/9Oq7yJO5hZ++k/qQTtwrqNyq2S+dvDRzvcinR1MkPSmjC0WkzCGkObIt+un9m7tfcaPyPeEHJG5qWuHmNUf0a91PNKP7rQCVe02vxWHLqLWhzkZ0+issydxopC332/Uf9oNFeNSGKluvEp/xrD7WkkbarVwjWKUVg7EPcnczRm2en/U1v7xLIItH1xfyVokb3HLQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05a95009-651b-4da9-cd21-08d85a406b0e X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 12:59:59.5853 (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: mNResl9rmRz6UuP5eHuX+riNY2Wukw3BOmv6xPif1MEHmrLKt5jtNB1Z6uxo3zdAjkQo89Pjjp5VsHLwHIVriA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 411cd33be5..071b4b4a6f 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 Wed Sep 16 13:25:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312437 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp443544ilg; Wed, 16 Sep 2020 06:01:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtjTrF25+WYHAUyi7BgFpUxAcQhcDa9s056jzXIYADCVQE2EoKFFug4QBUFvHpMamqLnMD X-Received: by 2002:a05:6402:1b0f:: with SMTP id by15mr26720515edb.289.1600261297050; Wed, 16 Sep 2020 06:01:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261297; cv=pass; d=google.com; s=arc-20160816; b=ntrblAjBPASjuf4DC2r6e6B0HKbckOy55o8lLYqARjZ4ZeHDuHeodNbC/zDs2Xqyat d15XGE33+0i0OLhEevUxjvSbPSLjREk0D4GVPSMaaTtmQUdCxzUE+WdfHY3U4hqZgXT+ NZ30JDJp1opofyR3TRbfQAvDwrLwbvvCbxI3fRVlMHljbvVOUOmSWNSSowiJP054l39l HBaSwJjGzANF7IWwC655tQSHuPvwwb1vR/RKtNm8xfvj8AOvVRWH5rzhIQNL+lIWNxbL pp8cJ9kRzPC6QbCCrwFGQz8drej1aaEeoCj3sNfb1+A462OpRcGLEx5V8ZJSJ0HpkN6y 5qUw== 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=CrLk76EI5Q+bvz6TAZXroplm+h8pXsgtgtkphfxrCnA=; b=jlRPDEouyaw94+2LzsdideHSMW7zV8u6sqTPVT2U2cq/Ue7C2uosa9JN+3aWiUfUO2 5G5WiQem33FkSP+oHF2vY6rBXQrVkaZFT8UBlsnIlkc+gWIT4BI93y2QdjsPaUKUIC2M k/OM9fmD8xsuaRGWgr4aRup+1AAC94xM27a7Dxp9ubDybDcPtCAKKY3jz7Ngx+3Q7O4r 037mnZntFT82YlltEM4x1Ca5lUwkDqPgTmLYlMZe1wNqqiEPPEuca5MwGAnOtpLC4Umq zabTi5VQ9iF/5bDsp71cQoogClRD9XKFteWJiN3MTwukbpNK+ccDHF/SEqNapuVuCh4+ nKmA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=G3IMpVWc; 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 sd6si11512841ejb.207.2020.09.16.06.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:01:37 -0700 (PDT) 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=G3IMpVWc; 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 F139782374; Wed, 16 Sep 2020 15:00:22 +0200 (CEST) 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="G3IMpVWc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B121D8236C; Wed, 16 Sep 2020 15:00:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0618.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::618]) (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 1B0E68236D for ; Wed, 16 Sep 2020 15:00:04 +0200 (CEST) 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=Wy9fSRcfW7SY5BCeTV+l0hd5itmYqJmWvz3rdBhZOLMWzJ4B5g8OuCTXWDMMfxRO37aWjPXvEQlJH+x2cTheYhymCcC6FxhWePj77YIbiUI185xLyTl3mpSGaO6HBNQejVitAvJc4JCQT0aoli9qt9ykH70EbYJhwyAnKO32CFv7O7EIB6f5RA1PpIiTMdBnoosUkS+S4yd1mgrksL4+fHC55f4vRHY7iwXbs5DbzST8nQ+R+qlFwuML4VYABxAcYGXEHj+lCMhGu/LexP+islpz0mGczh4a0IkptF4wxq3mF27OI5ThvcGIhWhGm2NBhUflkcREmK9Otm6QxQwjUQ== 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=CrLk76EI5Q+bvz6TAZXroplm+h8pXsgtgtkphfxrCnA=; b=ghIJ2kMIRI0XNyPxIqKP0+S8y8gGyra9axKIEJ8uQTPUHaypspRUOxM6+oqgNMlQt+jU5HmkLPPAq+vuhNusOhdvFUgek8pmnQcKah5bFkms94OLbIxZFH/FMIZPC1JPot0N9XeLz/NCXIzLXwnZ2MLUUT1+Mk2UebN/PMOz3q5I5cwBfLpGOZBL16ObAfWv/w92mBlraiWpnj4pwiOnrz4/3IEkclEVy5/vUoug4GUNYtTEd/UfgZcxduTSrAPQosh/3CKpQx4HaKLJ/m+qvcUCmJ6ugqoQA0hCq5U6SB93bM6ODFGqfxNv+8/xi3mMw2bFOkHpCeYZTD2f8GjkQA== 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=CrLk76EI5Q+bvz6TAZXroplm+h8pXsgtgtkphfxrCnA=; b=G3IMpVWcmDIH22JWGbI+nmUUUD6To7Oe/X9AkM7MsXHy50t6+6NdXRLKJzu1sr5Qx/4FC31TUeElR36gzzEO/M7YjvKQXyk83zUclg7nFw2MAPNskILcrXhaOQLzKjRp5PmfYRq4uIgNLGxqbdFtD6vdFRiEGKAMfYJSSZnds+I= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:02 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:02 +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 09/16] usb: gadget: update os_desc_config when add config Date: Wed, 16 Sep 2020 21:25:30 +0800 Message-Id: <20200916132537.8313-10-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 12:59:59 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b1da6e02-838b-4d57-e3ca-08d85a406ca3 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: 5IM1aq/ZN4PsXVvMXzTKVXqmseytvrd1vsRqfGlFsHDF3RAEb9dgfNucm0L2/PVuQOPZF0Vn3Q+1N4gffLX4PtKyoYOORN1zsvD8gbBEC+iIav/OpEBzBrQ6Jp2C0yOAatSnXV7oPk26J1i5OzmPDr2c9upKaOEjjrnZ5209X41L47fezUpnIcRcvAkFKyQBqBJHoSukXO5pZIgmTWvPuydmrGVA3+M/r81R4N9NL5yk9iTtxgY8eT9EZr1lpkb9PA1HiYY/yBA8qfCGvgZC6S96ql1MLxM5NlZHgDiAnqL8DAbE3L5xyRnmxxNkARtAimGScVniAmL97zdv4HhDwg== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(4744005)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: u3wR2Fd38t/mJ7gbLnfwu9ARvLWXvQRwpeMVoUfN/YBo3oEmYo2lXLTLMhzAHukkSFLmcwfENimhJ2s6HQwJKhwSgKQ6WiPnxMxkh9UcjF7Uubq/N3H4XJ/unIF2qURqleNzEYul8ujL/BMDiPtc7n4V2//z0P6QEodPNgnTurCAACKkzBu1gb4oG/Q3bELaGn+D2rvZ0lI4npI5J8pB9+GR3qV8NwFLr4sWHQoyokphhUg/sa6KICrf0dnY4NSJenz0wXzS3W1XKptLvumSWL1ZFe2oiO8W2bkcMad7XipGef4SECYQDpCS3mtZqovNt6zVsvC0TSDTCDBzljOO+e8iFthGNo0iH1gIsjQEdHxQoAOt0Y1GZgSWwh1VQP5HFrP2CDxgIop76PQdN0rHIFT5bzbrsCehPKfwgbrSrEmvRxsN5GN2ROm4mKp+P6nWwrVjK/I0kcXIe/sLGYHGbKBDaXFGzDmnt0YkYrUN93XBXlza+6vlhnro4FI0mdV4GM8qGLlSmM+w/vNOkqMbBY48EBoXa7G+3INofgZFLN2V8E7mlHHgUMYxWbuEGWnaGY6kBWM3FclMHYK4csdTz5mGi7tI9klpfsDvlC+SMkFM+VlxalxO3gr+55AXfh/ThppLci/z8aOfm259jRwu/Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1da6e02-838b-4d57-e3ca-08d85a406ca3 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:02.3600 (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: Zwgb4nxhXT2vZ4l2DaYkFNijO9TEwZi1bdjbSYiTDsL0m2Cd5p/w1db7euKQ8cvkXeBwxLRs1H3QcF1XQZVf6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 071b4b4a6f..b453055838 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 Wed Sep 16 13:25:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312439 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp444033ilg; Wed, 16 Sep 2020 06:02:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsnIOwR82Y+ZFidE1ohcMc2/qpo+p3Gv1ptuRePLiYTw3uq4WAxX1ZpYsmmtl5toy4+C97 X-Received: by 2002:aa7:cb0e:: with SMTP id s14mr26949410edt.225.1600261322639; Wed, 16 Sep 2020 06:02:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261322; cv=pass; d=google.com; s=arc-20160816; b=pDRFEs8WkHpDBbGr8QUsBXU6wnN0bHzAqHclA+SFrMLgjs+qlPkFlyzNEs8xeA12C9 gj9mIq44dksDABWEB6MaDeDdlXXR5yEySqF6Zy4nGvwxAC9yJos/SN8kdxqHcLxDItA1 EQJfrLrdusQ5plf1Atl5S3BircNI0Lgfbx8HelnmNcxNdJt+QVHFDlC3j/wjm5gbr8no WiawTpN9fMDF7VzbjbC+kroGWc0VQxFhaeoHjK5YBlB7iS2ycxS+bF5XEo46Lnhjf4UV BGQkc/7f0j0/jFlwsWHQSP2CZ9MuqjNs+D+e8UphVKNSRZYqutSV7L5hZ4srk0ajrhuN Z/vQ== 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=O2D+oNQIREVqxxKbqflwvCn61TiBdZsDWAa0vxJLhXw=; b=JPoyXJaj8SHW/ZweecbEduD8Lq2+75BmDl96qzq+ORXe5MouzMtSqwKkFHOHQZeIhn x0VmO5G59xQXetB1yLugIeYMaWHNOA4w7kI+kHRdFG+m95TLdtTj//1yI6dGKAujN0Vp vVOtZi/zLDQzYGf/OLMnqPQnvaorh4iYgGRD/11l878DiidRw2Ko1iSNaNmRsmpRp8m8 axoFLjNLpyqGSY2ln54287/vxs7bHy5NIzKXhlr8w0irEGbUcxz1ja/u+StkraCNnsju qus0ZWBfPkQKfgHgH/gvlaxSIcaqe40SN5yvkN+z3+nTkseqhRKmdOTqG4xRAfqkQBUj ryqg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ZjdYFPGM; 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 jr18si11581864ejb.45.2020.09.16.06.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:02:02 -0700 (PDT) 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=ZjdYFPGM; 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 08D3A8236D; Wed, 16 Sep 2020 15:00:28 +0200 (CEST) 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="ZjdYFPGM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB62F82383; Wed, 16 Sep 2020 15:00:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20631.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::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 B3A4082366 for ; Wed, 16 Sep 2020 15:00:07 +0200 (CEST) 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=POlGlInv7XzgzivwwikRi6W4DMI5Kw52SWUmP+pTDAtPQoYH9P5DaatubdDDOFYmN+CyDFlXqbcmHQmbQRNJgiLm/9GLKJUXrumCSmF/cFb/actoZXRLFIGeJbSlB5vR4E/GSe/tw0ucRXLuLvyKHa7DcBkNEyTCWNWO1/FLnZPZGgYEGVMXqI0uiOoBPlNNV3GVrgeddPi2dQuc9hMpeprt4s8cc6QcA3FPYhrz5boYSQNue03STnDfbdf5vbbFbKpLlTTMK2uMJwMMYL2L0PIpSrTc2GNDC5QoKBj3I/mlaYGLQlIz6XLVpGT1W2M2WLztrIhAaiGwNDH1Pq5aRQ== 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=O2D+oNQIREVqxxKbqflwvCn61TiBdZsDWAa0vxJLhXw=; b=bEm3u20W2USTyE30ADNZBtxCA6R0gqu2yw4EfZEeuRZgdbtoSRY0zspL5p0rRfdxwsVPtSWzyzzIhZh5flWvziBu9kL/JIp9BB7wNhbYemX9xGmTu/OgrrnmdcR6SiipagBZmO0DBQHs0ALsSJP0HEhmzH9oUb0nvdZeVWaLNczna9HPfPbWhAkUA0f/6JiWUTFj4SbxIyqJxqkDSfJ/5OjTJnpauTA44YTeOR4IdgCPo9D25GCfQQxfsD+UcpRhAUJRsouDk/5/00MaTCjm2aYa1Fv2fusFAXh8epChH6SLm73gz6n3hFnBrSCaE31SPRBw+5FtzMDTveJbhw+p2Q== 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=O2D+oNQIREVqxxKbqflwvCn61TiBdZsDWAa0vxJLhXw=; b=ZjdYFPGMJJex/qHBWIJs2s1aiCGVVbWtjVvCXYdE4r+V3jr9DdxsRYB5Kr/vMTy4h4XpvSsYb/92zUprY9nSoqs8QpLL0HUM9B4T1PcMAQJV/Go00d/1s4nwTBOI6/l0RRxWoIznny+hB+2wex+IzGusF9tyObv/3IsMEEn4lEE= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:05 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00: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 10/16] usb: gadget: add super speed support Date: Wed, 16 Sep 2020 21:25:31 +0800 Message-Id: <20200916132537.8313-11-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:02 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 489e56be-3dab-45e2-8d18-08d85a406eb9 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: kapWMTdI21frinUUk5XqoRGVuIDcS9Pccehw16kUtQMUFYFGD/TbQ+kIfMb5H000l4thfxkd7TyoNy5P/v27oe9HTlhR/n3tA+/Z1yTGZNexQp3zcBa3HpZIBFd06VWxlPXTuUaIUzE5TtAe4IVJiVEqaME8qx2OGB93BXXodvTi4f0FEfaP31/zUYucLNyAzxWqawygMIZVEuyQVQ5BAoMG4b+6qU/G1vUZ/hK/FRbPVdPmkFCzIDEsoUZ6kUxAAurUWMa55tMUVHBzjt0YidEH5j03es4iEcwloFynXxGchWTIZb3dbpTwopagr+T4Bu2iymADylNZt0uQiMq/fw== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(19627235002)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZczhWnYnEHO99ov06Z8AX5Qg66KNaD79iQYjvN2qyx13dABTbaDbbs52V0YO9Q382gdETi/QVe3QG02ejOLzM1XuhqEDhLHAo96e27P91bXB58aejqA9XOrXgUasjCRFRncpCUJSGSXfBMr3mJ5UgoeSKKP9T3TJ0uCJUmP3HoY4PwVI1ZJLJy5U0m2MTkwYN+8w3EgLa91UT/JeHcNwFvO0zdfFzSp2G0pOB68Ev3htrQ5LmkjfFn7J4nvMxj7t4EzXRHx5FjR6FF4xe85/63ZPqLWAR/t/PQ10w/X7JlTeNtoEpv0vXviqnEcyeYflGuOAai0a0Zy9oBNRapbcskzY2VGsRbCsmjgxO29NLGr1nwEaA99thV1omr2cRJ1v5NXPGNkpRK1A43uf7rVEUP/CYsGjuysjvCIa/oRIZdv5rnCiQmQZubuhxFpAmI/NVKU5xPnMd6wihIDIH1PsVwtb3eHlHyTQ/uanZgTQy8wplO0zutkIdvzE6mPQoaGfbfwZxLnYsCi7IacDKKLYdm9zKRaRm3DE3/Iowdy6CQR/O/afP8ZOmx0znFoGoqVqHNBc3Cl95k62ypuqJwbh/MT7la9lCU2DXwW/54DgIK5fxHlzDL3pbfaoaH51263PmUxOJWqWmDyVlAMYGlrYnw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 489e56be-3dab-45e2-8d18-08d85a406eb9 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:05.8584 (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: Vnikr7WC9RlKl0eHZmdYoOhhNgpeurAfgbezfvj5BjxXRiNgJ/rIH6AVQ2VFn7paD4ITJQ7EldpKKZj386gPPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 b453055838..abb42db6bd 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 Wed Sep 16 13:25:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312441 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp444253ilg; Wed, 16 Sep 2020 06:02:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh+e6Y5kmqCDEcq7BWSeS9kcapsjHgbwKXyBDEmesxH1i+73cnzbJTQj+a3zBGTOhfgvIA X-Received: by 2002:a50:b946:: with SMTP id m64mr28110902ede.92.1600261334851; Wed, 16 Sep 2020 06:02:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261334; cv=pass; d=google.com; s=arc-20160816; b=yTqP6LBSEN0oCeYy3Un6cdDij7iTjfly/1zUCLsGr8P+yNA4DmNUYvCRcgoymlnKJb aHkt3Mibt2w09NGkRTDxSI05HfMWsQwW7nc0ZlRt/gmtgL2QK+13Hz/LLhBeOPAMpl9d ejikPLWTfaAi+HoewQIPksg6WY3RkAbORV1szeXU8xicCe5rQMpnwDmDt+zeOAJnYv+h A6pC7AKVGUeLbPOG+DI8kYt6l2NvOBKdubZbX97uLh4ejlF4d14OLLG14Y81HV9Y024B ANsZw30lvfdQbYf82O3jmEG/WKS0NsUMxTIZ/NZIYAdJXRSMo+j6KhEsrt8U1MibK7hu +Pww== 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=Sz1KzJ/G767Paim/lljgMUOW0PXJTxP5Z42QWeFUWRCmEpxfdl4YeyVuYM7hdaCtPP Yey+HsNX3J2Lkhie0KPtmpey331dSTPi3GI1bJNZk6+8ILfbGi/SVNy86dKBOsouRITf GSQMGRy+wpHXYBJW+8WsoXUCat0YqOHlVPhtUlwbLG0D9pZ+BjRkhcUqKDZSYZ5mpDsh 5+XGrhbfyKbn0BB07SlRMHtT8WyK6B8l4b9b4FhLG6p7cm+9pGU4Yx22nRlnF1mFTVsI 5714vbvbUagkpQxXAYXKYXzugkFYGza0R7kdJNSSypN2FilDzFusCHcIHjue6TlPMp8y Itug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nhzNFRrN; 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 yj16si12577559ejb.592.2020.09.16.06.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:02:14 -0700 (PDT) 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=nhzNFRrN; 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 7695B8238C; Wed, 16 Sep 2020 15:00:29 +0200 (CEST) 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="nhzNFRrN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 48AF382385; Wed, 16 Sep 2020 15:00:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED 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 CD61582376 for ; Wed, 16 Sep 2020 15:00:10 +0200 (CEST) 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=ZXhAPZn9K3E3+wZwXS/l8LjMttiRL3xtUORwmfloyt1juftGnUTQsMi4VNwO2WYyjXw2lbiqkK9fm7X4fRj9FCdz9LjaR6JxHmo0ONNcOLlafTP7+LEQq7HPeJXyR0/CG9D0tiED4/SDGk+pMZy9oZ6JjcH/bbb87/3S7+P4Hnq8VP9c5N7QcFgk5iW6Cx71VCI+c+prwbEDpluyyO0G9Bf2g4gjPms/Oj9GKxy+ku3YzZPGlLVo1j5NwVxAg6+XWIvoAKVFam1QCS0+zeHpJz9c1HaQKS+abueRJteMv6c/ikWgTAeolG1KR1zSQ/05z0ekzn444KTqc9r1EK1WTA== 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=SA0HOGOb/6o7gnwejl7px7mgIgVW4qhp1W5+qoRI+ob+I24ghUZTJz4dIqdwgWBL3CHFFQ2uMbRtqYlWMaknxRb1pKnvVK+U7r6HbPEZ6rBWaMbSTI04+7ktfCydsKRf+UsGFxX3kCqF4bmbZUWMxVMzzwdLj6Bs/2aFwMNXZPNREvIhOBv4HqOUO/DuyqU2l1PGH89zrNioz34Cdrv8cb0TfiaEbM08Mt/JAWYyLgM+4+lzT4BztRSXTCjDK0qclo1s7MXhzTuST4Mpyw2A4DboqsywF+NwuvM1X8d+oK6UX1b5IlbUTG5sCVJ4VMyRyNNyRdhOde5AhTUq314rKw== 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=nhzNFRrNTRPt72m41UO3ZgdDEF7Z3Fwvzq2rOmj0XmvR+MK7JAdOcd0O9ExzPZ1JcjzkgYqKzsvNqFiK1k4k5GIBt73E4w5mJEX73zhwxtEn9p+daGMXTidpWrKcsVIO0JmKmaiOrVTY7VIG/CVxPv2eJspygUGUz6BDoDIqhEQ= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:09 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00: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 11/16] usb: fastboot: add super speed support Date: Wed, 16 Sep 2020 21:25:32 +0800 Message-Id: <20200916132537.8313-12-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:06 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bfec8661-3663-462c-9ea6-08d85a4070cc X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: gY5y51FxktgoRROqr8RNANtZCsnqoO7SFRNdzD9vhTaeLenDkN4QQSLoFTojOTn8xb5DVDAX9PBWDwplJAxcwhVnRoQcTFPllSx9HOp8ogWIzgV79gtIXuS7sIpU+IPUj0wTYqGNxEXtffIGn0p/rbJcIeJWUwC4UvOs1UV6mDQtV+hnzNAzFUk3SJMryYyrA/Lu6rN8KHgz5UplT/kXaP8p9bfMxKfhwEqqoiWfrOLXTV4UYHna/bTyzLR+wiiGZzi8HZcsEfg7zeDPx2B7/hyykG8QvHn8hMZVyLPPBwntEW1WkMuGIPfW7xFIluSuNAdNtvCWXtYzL2dRCkHjgw== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wrdbR3kBmmFvCWqP0Cy31K/hA2P88k3JMIpPW2W2CjaS+14HlYDPmnOVg+uv2MIUi/6wol1yTvxrQDrlKzXin50vmkKhRmGiTIYBidmhwlQj+qdca4l/Sk4QyIMHvwA0Y6D8mgs7OJc0ktimVadL8wA3luv8hMhE71hF4mrvbhbY3FajaKGswdxkWMXoodxOp/UOQuGltWPwpQkiuQw6guVbjBWdD1FIvBNR43mrhy0UlRwesTETv/axz8KVdutaaLX+Qi/cwEEBsZ4qrffVj52M6ESjWdY4FJ8wQhwy+Z6pqEVoY2BwJ36pKJiU7upzpwrsZgzueAMSkJKj2h22830iZ1fWWUay4m6+cAEDIbg97jIJJUXovgUx3kOrcbADIrRWjeWjCh+utP/QUsV+aVbG/NWlk1TEkTwc+QyWl7e6iG3atbTSv6z09+MDjOfEfT3YRvfpuOodrTNBqvUYEAbnQJSYKaVuZEaO3SKHrzCD8iCsd/sYvqVXsTb2/SAN09KmAx35EYz8sM3+/9aK+iPaxybu/yw0pnvTQErEu50S96iZUZUja8yenCmeOvWdfyevqgxnMZ6GLJ7NlT4Dz6351m6y5i4jae6ghviG1Y8chJCDpSaL9WI7TOhsd9t/VsCnZs5mjlajdLJmojpjUQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bfec8661-3663-462c-9ea6-08d85a4070cc X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:09.2159 (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: kYIkQast2GOdy8wK0j/oiBcaGLTt4ud7GMUfwgfo80cnjxTfveEeKMT9EYNVARclk3ejz3Y8T4jVVN60jQtvEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312442 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp444492ilg; Wed, 16 Sep 2020 06:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuAy+RJZjAiQJr1QSAVub2MG5wQvthFf9EWD7Xn3NYJ3WCFClIxxgrb5184pFwVlhsBmR+ X-Received: by 2002:a50:9f6f:: with SMTP id b102mr27088323edf.272.1600261347388; Wed, 16 Sep 2020 06:02:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261347; cv=pass; d=google.com; s=arc-20160816; b=SSiTP1dOtg2Qew2kTBuSnyWzQlSn6olDfp2zYw6nBfjq4Um2lOJavA0McUY+0hMKT9 THCxjbz8rq7IoBC3Dsm3XmBFamTgeprbChAxN++KFHSW0KH9mtlu6B3SH+m1JSlTT1AD dlOiVbGISC+wlcGf2kjz3SL8/DGkf3v1mGDIAvQcUa+7c2lPQDwNXF1mIBJcX/arN7kL 9q7MwGJOHF+gJma2Evi59eHm1fv1Y+LjunN1W8MIUu9VmxWgYriDWaGfg6JxhHXr2jn5 9pcY4ggGD8KBIvYsCXuviuLFiJLKTJQSnsyQdTioDMWfOedu08fwGtkGfVbE9eYB75/u q3SQ== 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=UjmLpXf6s3uaIovWIDZMmqOr52EO85iHMS3PAqEGiXQLgGuZ2+icmUs2+WNKSxBI1I eKRQM2Fk30cMlBcB0s5q6UMiDtVEBFA0WHvnQM9LzNUvGt7UzjnQwnXo4PKkMgGJheHa v3sUaaDzM03sBiQwh3s0XbTL62zWUInYTy1FFYrRmaenPxVCfHbzh89kTo5rx0lDmo75 o3tfSjW5wa7GZ+uuBXlhlYcPnFBe/c1Uuheh94c2EgcpzqiGtCC4sN5bFQ4Iqcz/Cen7 Ag93qIxP2+XUSRkoNNcwMdZzHTY1VCvq6Lmb/SMVUys0UZUQTmE9GZr48Yq5wF3YC1xe ioVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=dIkcGo+R; 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 q21si11780131eds.392.2020.09.16.06.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:02:27 -0700 (PDT) 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=dIkcGo+R; 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 D09CD82399; Wed, 16 Sep 2020 15:00:31 +0200 (CEST) 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="dIkcGo+R"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 390ED8234E; Wed, 16 Sep 2020 15:00:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0609.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::609]) (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 4EACF82374 for ; Wed, 16 Sep 2020 15:00:14 +0200 (CEST) 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=JhCYb5m8qMeOp91pkmQb0tW3wdf3wSujrhJFWdxHCVw0Ob1zBmgQk86/1JWW0Pj3IawW+kz2V6JvLT9EF+dgG4OL9pNOO7y7irG0tDtcnLuY5qAmpxegwyXfpJVXN/67InKZGgkQq2Kl905aJg8lOEuEyovhd2j0Ig3+bqFcYw0p/ZG3xU9ynhqRWPu6JD8jsGsIbpNmk5bJnqS1K76ilyJbYC8wEORV07/pFtLWAqf6MsdkTqGMf+l0ytq18uDgRlpekqQImNLlAJyg0xhrZXKvDQOyq0g1+NHgYKoIEsTE8CjzRZUh1ZWnnqps/UDjxfPybI0gP+nnMy8dwUMHiw== 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=Idcv8sQiT/b19uaKFUx/oYMOTShZt+Wq0Pc0TLlqS+nZ2G09wnkBSdfL4+zIY2sX8m8Bfli6EkbLWELRLX9lnMRkeui5Hz83INrk2uvKFvW2yQZvWA6OGrYIcM/0vGCrpSoOcY9j3fYRpzEAp6Ku3uXp1nlb6nMaECHE0y2wEuRf5Y8fbrqYXFhXgfkHO3zWyhCMeCrofYfLXdIsnswqaUSj0BbfIGzDOO4yfnrNUp4WJxUMb028aTR+gvPC79ogYb5x46t3F8HzMwI38057PFbB/7odm0V7s8djnzthmxWcNyGoM7ZvHClqkbrTZsAYUB319WVoXBgxlkl+X/ENww== 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=dIkcGo+R2tgBCIMtdl+WsfLQ8P4DZztTqIyFIINl3C/dJT75JjsQJ6l2Hpg7MRjwTyMsJNH/9Rh1WHOpu3ROjxHU1rxWnRl5wB/WQ78/pU3wgf0oNfFCxqCbVF5ncviy8g0aPCUVhafVVi8uOhIrymrxy/7M/GZ70/ub3WTnbVo= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:12 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:12 +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 12/16] usb: gadget: dnl: set dnl to be super speed Date: Wed, 16 Sep 2020 21:25:33 +0800 Message-Id: <20200916132537.8313-13-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:09 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 227f2bf1-8210-42b9-ac7c-08d85a4072cf X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: hbO6R43oc8rcbxiL4Q+r/+pzJQ5b1JB8fE81zhQZpPvQwz/LJyXuckrjMgIKCp/aneP9RaB2gmyajXR6BcvGMFqz+ooZYn8Db7Y5P6wtkTgR8AqU2MNcUA3vSU14z862lPdEByXABdHZQ4qm0apnTJx1+eu8mmN0r5K1+hkhvU9TmZGeiqPPdLr+xBWGdWZvCgdy/aPGQ111rtpFhmJmkKtlCrN1BWlFv29/CQPHmjWWnLcVRXbPBWtKVbO7P5Ah7hjAQSggywrB0KhDXL6MXmOS7lI4a0GjNXdNCZ6cGI06CPL5dVEG+SQoqrjanhEk 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(4744005)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RiKUqCC6IpKN1ZdWJt5XCvEl1v2MQbvGQPAe21/DDToKGXTeaKvpwTt5vy37uNPhDptbSTvqT5wGcXf8a/P/ypk86O29kMxqvag0f/0kTydq9FEsype5Hsc8rY7R00tOv5cg8gaTXJVTxrHtw1W2/NHFpVKepYYLfZAIGVxxC7QV+29956u6SK6fYfMllgtUqwkFavM//HYoFrbpTYtRS8InypBVsDTPkArG1/Ah+iZ8TsWTQk/4J1g/tXnoWIyp0SqZcm7Mf9n0WqCEr866niFowoABLFBVfsJJur49fRYFrqw2XQIyIjZxb2RqZzRxnJ76QJFLFAY334srHrxUBjLMoUW9Y9jN4dWJRZhBoB9QVd3vguli6Rjs7f5EVzzmi1SOOkHU/5j0VHnvMUx4tMGnvIAV5TP8DTFKHW8gTf3zsfU3FIrxe/VnajTfb0Ml18u8Z9caeUFIqDPo4e8n0koBt7QPlaPhFlnaYgp9LyQyem0DX+CQGzMXdvPONYYS4zAGJOaftbYhQOb9H1Ls3mCAu08AgaT1GQHYNwqwmJvLXv/7HtjCs4ZUiY+hnTosYujWm8UySaTuWu2fE9UfvjJfbIjSvuPz7/EG3EyA/6CPkb5WJJQ0MPhgRTtCf53YVQuY9a8/miNwEjgXB+tNog== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 227f2bf1-8210-42b9-ac7c-08d85a4072cf X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:12.7432 (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: pmwv1VrZaLYwYj8k4mhX4VYnQ0gf0yG1+OXoTzndKjYkfy+IiTVsGcNkqbza0NxziQNgIbZAWqu/mdHbOJ16nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312443 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp444951ilg; Wed, 16 Sep 2020 06:02:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCUVJqucdrACjA+ndJq63e6UMJy4Y6xAk6wQboKilNZr/+D2JP0rs66l7ctldVwn7VQGMU X-Received: by 2002:a50:ce09:: with SMTP id y9mr26819262edi.91.1600261370354; Wed, 16 Sep 2020 06:02:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261370; cv=pass; d=google.com; s=arc-20160816; b=b6XjVR6vWly20j+BBvAx1eZq3ME7LZhneMMwKfjUS/GAJMwLgMO5AWtZi93MikF/+u zTWLOnGK0mC6dW+67FQeGjrwwe4zCUjTbHqa1S1XrLfV1iEQhZiJ+KBWSzknTkfl2tSE aE53Y6q0wMG2KHIeZAjk/OMcVk44/lZRuL1WGIV5P/R4fEEeFpxLu8MJdbcZ4dV1cYHl QNu++OkcbSgrjZK72fyMrc2flgz/El9qOmZaD67Gp9eN4TLaTCM4CozXwE4zph/RFM95 bayuxbEUyZ8xLCMCJpTJUPHYfFpWtCIIYVbIG1zKGyqNYTUrUEJEdwMavckEPa7+bdbi ojpQ== 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=0nADAi49+vECBO+tlgw5J//FXACn+qblsbw9+5KRweQ=; b=Yr+bnnLL2wNnNm9nRJ4UMIgvouoyGSy2FRm8EmBcW3xDHTsoODr9KPPURkDa1cwTRN F/FIqjfaDt5odV2CG0y+Edm8A1NMFZetGUayJLTFevdRvf8DLf/Ef3j0CwkOdvKJo9pA ZGsDqhJOCtblCT7oX7BHgCxG3t4MKEv9s6KO0hbYL70h9r0U+aPyFHBSvF8zHeFpcAwu fUy2gtH4xjVUR3QJhAEVaqDE8ndygTJqBU5aCyMtpBzlskz3QaflMgKqFAiZP/UZSTZU vPXvi9b63jUhUidfBbU2EDITg53MmeD7zbkfgLyKxbd6UlTP492QuOcyaKeWAtU3azpp N7Wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ks3tdkna; 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 z1si11015309edx.584.2020.09.16.06.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:02:50 -0700 (PDT) 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=ks3tdkna; 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 514C682337; Wed, 16 Sep 2020 15:00:38 +0200 (CEST) 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="ks3tdkna"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B16682374; Wed, 16 Sep 2020 15:00:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20621.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::621]) (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 BD2C882348 for ; Wed, 16 Sep 2020 15:00:17 +0200 (CEST) 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=Em1pJWUBo75+eIdIjL5VAuKuvaFhsTtmh9O6wkExSMhZr28iiR0HIHRBPXes6Eul8sSUku6hTuaSggM4i5h1yhLeIYwcqtppyRFXz1mnNZ9312WqMbuKUu9ofdP4J1W8ba36gAf700qTuyjlCTIxm99vtCBM+aaBOXZOlrgxGCEdjcsiHYIyLsG3YlK4xP3gTIQYfb19UOFfvUf76TeoCZUDxfyvPDeXr4aIg02rHFKWpT8e9VQqxYHQKip4MGFOTCi5NMZqtGNcquD2mMuq8bGNt5Nt2w5PyFw7F9lvz1Q06McdbfTy3kyv26KQsZ1OoLH0ybtLC6AisOaLuIAItg== 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=0nADAi49+vECBO+tlgw5J//FXACn+qblsbw9+5KRweQ=; b=BY4JWyGQDpg/9kGBHsHKrYfbqQRnE8nTg4BliYoOcOKCmFMz1KV7njfDfEzzBel8UOG7thRy1dfyfbEXEWDzVxbBcdITVQlNqnZCW9irnZQW3aHuL9iw3XpYRsG3iv4JpZZxBPG7H+1TNYKHB7sSZtWcdQd8zxaz+clIbrpeN0zxjB7+i+CNClZMLjAmJD4aIngGF+8+vOdUwUKLRzj/JSB8TZO25kHj1+82cXqOfWaN0XXfSx5LfJZaHcg5xQFr8VjSTmBnxlSNBlpfw8johCWqGETAzmq2O9Wd3wW4hvWA5ZjqKU5aJGQ40emIvT90/Kg4H5nXB6B0IBIhikRktw== 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=0nADAi49+vECBO+tlgw5J//FXACn+qblsbw9+5KRweQ=; b=ks3tdknax2gwatOEAGx8WqhnmQqA1PzfzhnTnUHr7+a7BNjiQcTYFgVUSVHHiQPOC5uqix42wM3NfhH/wEuxsX4EIdxHSfHHWC6Dm3rcKQntLOcDMZlcpoOpZK/52u7oKMyc6ogTAyOjHMBxDpDfX8TVd+rE13ew6S+egcVV4Hg= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:16 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:16 +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 13/16] usb: composite: force gadget to be USB2 for HS only function Date: Wed, 16 Sep 2020 21:25:34 +0800 Message-Id: <20200916132537.8313-14-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:13 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b3f3e179-a26a-4d95-62b6-08d85a4074e8 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: A7Wy/VjCp/OkBbp2T6ryAxXBViKgMa3kE7w16ng8w5ZGgxlEUwWuoSBOFZeEIkpQwZsd6gd/q/8zvHg2vlrCPFSwPoEdePwece6A2Bax9OLl2eDmsKunlqeitDWbQuFiu1MzTw6L09JLiCM2aPO96ouF4knbEypjcuemmBEuf4s1pvE9x0L+M9MIs3LH59nV/S798Zeu9SURFxjN7a8uQUdXW0cHYalNXHdzP3jtNTy3Hf2ZtIQg54iILb8vcWagNlKLr0h7CpbIP6GcPyrW3ro/lpuBLYM1KdELCv1t+JDKLwlEmpptEuktr9MIc39Z 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2ktGhYWeA7beE0KJ4549iRZtl9a+EaOA7mIKQciFfo3F48031KtNUBp5coaOFvPw01MajqJNQh+ZfnOxsC+Dwu+xhtBkOJlYYToHHNju1LBzPrn6ArK4iAIeoZDbAxzpmC46g5iVEREZGOTv/h69JhVP0CtF01lnam9qrv53XTshAHuQNLU4jwb1sCXeczM+KplOfLJUPJFMyrU9F/px60ECdTz9wtFGZESK5dFdmEzmwF+jCTEBCUl6lKZDBg4hrLgCc5jdkQyfqrdsVPUaZTgDVHRUTJBZrfZGIqxRxSGf/YCSUcjelnJkY9SUVUnTFLbt8OcPLEP/o1ZWrAsg4Z5DCgpZu2n2qed/OIcItx49Z4YMgIwC1bKbDc1c/HOiKNiuM02mjtv8qGiDmTQwUfJzjjCVxLISdCrge+AUWeZULDADObevHVfhM41w+cBgVKRWlzzwsQILOX2xa/pwv/t/lMLh9ufgz2uB5yTI88/1L8NDiAs7xl892xLFRHU7lLqHNVBzCJFfthfeYWO1pgLDU0m7DVJetsedi/lM7zgRtyvXlbD3g78hZMmE6tj/r9bLOMert5o5Ir46unr3GRiI42rj9ZVcMGgK0yPrvJUr/mvnAMYWZzLCgB/dLJzblulOT6fQTk9ec7BKwp5nng== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3f3e179-a26a-4d95-62b6-08d85a4074e8 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:16.2736 (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: ATCw15hyHrJACK1QvUNQcabWLCS1DtfFRU5w8wx+qXQFe6tHCyYWB7PKim1fsM0OikCNxUH3SkXL73GhYb+WwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 abb42db6bd..5e7f488cfb 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 Wed Sep 16 13:25:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312445 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp445191ilg; Wed, 16 Sep 2020 06:03:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR0q9DhQocgvoX+Cs7ItfEtix8TPRtCM/9mJ8ebvIdQJOXPyuBSEtcqjl2jp9TyjFlwPRs X-Received: by 2002:a17:906:aacb:: with SMTP id kt11mr25061544ejb.294.1600261383925; Wed, 16 Sep 2020 06:03:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261383; cv=pass; d=google.com; s=arc-20160816; b=fek1aMCISIoRYqPQ12a/DQ4yVeWXg9TeBQvGrKXaM0utFOXNoH1MmT4u/6033Va+cd AUsM9QHPBZBc9EhCk6cSGgSaMeJ2z2QUezw5s633lwNu0v+FXhWu9zmhrXCJDP16e1YE i8VLaq/OE/NnksViRu8KW0vIpaDynbwsi9Fp3KcGOz3WXuK+ULoGDJyv2s3SywfSot1d fUYCRZGzr+Ps5HCMtmH0ZWYhgtEJjuZ9VBbm8RIqgmm/uDcIDePLXr4G1sxIusCTp56y lqTwEmIETpTlRUfeP79RXNJro8Vn2RR+Z6/Lqb6VN3GGQ8T3svM2zLS/o9O+Dy8PR7Ci PLXg== 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=SAiYTZb5waOx5wrp/5so3UiezFl/oZfoKRAlxPgLkZ10CD/3JCqbbugp/tnApBR59N 8L8ig79RIGESLpHB2ar9Vw9hmLbUfJvfH4GpKu34b+x3Gi56b+k8Okx1iOaT1LvQyLgO 1EZoJ5t5xK35olyKcOg7BL1XG4nQiSsnHWzToC3XzQv9pFCjtuJ1OjNM/VBF3awSNBUZ D60jL7Ni5krVMBba8q1bFf8t0rHyixwInmNnAfT/8idBGbPoPs9Xman95DJ5eBJ/GZfG IjuyzJBD7PGtdvsTeTSZ4RGevBWITDG5fuuo6HVvt5uYFwkAw9aBXJo4gXXzjQ1gHjUZ SWdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YP8RfiEu; 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 k12si3524518eji.645.2020.09.16.06.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:03:03 -0700 (PDT) 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=YP8RfiEu; 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 250DD823A6; Wed, 16 Sep 2020 15:00:40 +0200 (CEST) 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="YP8RfiEu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE2558238D; Wed, 16 Sep 2020 15:00:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0604.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::604]) (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 3F2138233E for ; Wed, 16 Sep 2020 15:00:21 +0200 (CEST) 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=d3DoE17/ySh0RFJBtaN4QCmpxe3FicFvemLGjHJ/1GSA1XEmxvi9RX95Et1DfFWupS7TNl7S6UaUR+f9tTjtJdpwQGlhNhzX23WDz8fmFl7SjSlITzZCmA3epzN5YZRD7dDt2EWUj7B8SSHIFr4swzn8zfEh/P5M4jf0IRs4Bik04XP6Jml/0wrxT7QqDDPSFY4RXyb9R1W3aFDB1+f7szGQaWibjWZR2UzvTIT01Mnup9FExAFxG0vM9+kWwZsNv9nIVMpreBTNCmEim01UHQm2CBpQg76/bynavrafCBi/lyfu6/dT70p9RS1l2ghm7hgr8kHcgyYvN1xZ94s27g== 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=LxOmJjUs6V147+86L7/7WnEi8dDfmcSkfaPwONiGjhWNSqfjnNacSIy6HvVtekyXpLHOAC6bnb4ow5Fn/BkiWKhjAKhHkYioyKNbSa5OcWlu4fw77m9PZwy4ZdphiZBvIEIYu3rG5lCT/EJoiOqv4Mj64rIEQPS6uLBgx1YMYKKHZMIsfSQKXx18w9d1fYRer5T5SGBwhGWDXXJBw3QVqnH0gUD/wcYXKQXPqwxT0+tQU66+VSMavmhWEmWkMnom799fFl6wZI+6Ju1PdC2pl854bO0mcBc/74uypFspRShB5Pgzw7doFOK/gm+floobVEibWmQZ5xW4wHyJcy/Xwg== 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=YP8RfiEuBcJ0+yl7dam4YnCw+4vTL8c9g/WduUudU0nmtzkajmPIwunRHn+UGCu/+sItZnNO6y1uLk6gsQL5JFy5shuu/XMY9GQ3KRfqSQp3pgcOMJ1uQd9l/gGd7uqITecCa266thkYNsCzs+e5KsLKkj1NZdyg/FFRkTwEUIY= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:19 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:19 +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 14/16] usb: udc: ci: update speed handling Date: Wed, 16 Sep 2020 21:25:35 +0800 Message-Id: <20200916132537.8313-15-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:16 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 51c8cc28-f317-4158-b98c-08d85a4076ff X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: 0q8cwkSmh/xVKWKuY7J/5v33mgNoIJVbqM0vgHF7qWSMgbTAHhUr8gggOT+mNfnTSojKACJGZ9GdX9a8MwllIHeNTsSCCUBp8V86HDaUg+6r7Rk5tX7tJCETkTeu8+n7tSagbqa1X7hLtC6wgBvpg0zM4gBG2q9EK+gaO/jPqXQA9fO3RT3NQioX8q7Q1rc/QbB68c1D5pK8huuDE+9AyRG1jok6k2uoBzEOguqBAWhtUwlb5pBXRXv1T+D3Atf+O27h+GUbquGzkRraCT/dtSyEC9K/MokPjL9HbHcZ+y5Xe3Jv0yw+sO0htpbY0b/bTH2xuqRM2PDdw/oOKEtBTA== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: M61jCzLFFyeF6tyYtCE2ZBjYZng0/ii1KIwY8lsttnRsWsX1RYj1D5vqIDKVA/dMxUzz6LIqeMT6iGG95GyuNtrYaQWMDGikXvhkRpkadOIF2+dIg2u5TMd6BGg/iIBOQQw/NSRhvgcCmGnlTrvazZv60bHaGI30yf8zzlKB5y2OyfIUUDUWRir1ym4CEz3on/Jw+Dqn9QqaIeOrMhThpR/a3oZBnAUu5GToVHrx3mKEL0pTi4u05/j76oubQ1PweurrwDDQB8bgZZvYFBRj8EJqGebu/NbJCS6qEoYIz84AjISgf2eeMWLPiHOGMwAD+nRH/C4mzVJ8DYBUkYjBarV1q3jBgdw8LmyS0GkfA3D53bMdRnjHu4QbIGOqaO5ZYBA7cE2UZmk+1uV1ExE6Dd9Kj4CbPrcOov91iim9YSZ2l1qADD0vvUxZJvw0mGPh0WVnovOwNZpIFlkO7XfOH9jaR+mgw14EAFBy5GsRZ5Tlyr7e5OtfPSo6aEI5shiDOuVWSX3h1DeHV3gKNp0GL6TNOPoHz6p1HQ+tTp/0n8vGOWVhdO+BZ+U4f6c6qupsl5OXv3YGPJPxGzrGjjSC7e55JNXPv3A/OmwCHbPnIo43mAVEH6lDojh9FYbxmFtmhN0GA+lYEyq08SvClex+kw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51c8cc28-f317-4158-b98c-08d85a4076ff X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:19.7410 (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: qXiiMxoThidw7ENOSfcpIpQCR7rx4Gbc7rtRL9t8L1efKX1wSQbZHTkXIN0k5imo92JLQvM+M3TpuDf9wvKn1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312446 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp445480ilg; Wed, 16 Sep 2020 06:03:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY4Ds5186gCaUuSru5aY4CaClCc4CMlmj/GogVlnZucBg/ltrQMvsTAjw8n5+fl1KYvnlo X-Received: by 2002:aa7:dd01:: with SMTP id i1mr27817428edv.121.1600261401893; Wed, 16 Sep 2020 06:03:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261401; cv=pass; d=google.com; s=arc-20160816; b=mKeTLA4Ve2cIdCcYwFaDNVBH4epOj4d6vXVH/1kkNF3ZQDDopkquVIk5KQmUVS/34R zG4TDAAX8lfmk9xs1jexQqDgYSZmE+5la8EhB2tnoEfqLRv8zG4bXhojO33LxvUHj3El uOdFs0Z9aYanCUeZaATPOoSPfi5+OVuPM/KRIYUtC+HTuYai6Qu84x3VM9T4FBVKulRL 8DgO6oc8Ga7v9kqnXK4KEcdYDACz1nTevcfMtdL0fb6tXmugWBCsTRRgE36bfGpmlCGY lzosY3ATetIncLsiC7BL5NHXfIJJzTtgf0t57faRTJnKR83g++Ej6mopsW10tXjWLk4n vpOw== 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=GWgFlmhWpvKah3TNkQkSc8+F3n+vP12EppyMVpsrYSUYr8mdqLXmJZlp7B2LKCWi3f OI7VruUZdT/dkTrv0gaSGDYRJUEaxcgESzcUBNYvY5UFPYzVb1rbwWAaCN3j72Q1FFMM /dZNeAmCj/QQHT8NWKpynamLGokvz4am3mLNjFk+cRotoK+txd4oTeA7QJJlhWQKhJLO z+7VkpgIkPP5J+WEVTowDuNlS/CWmCselgra4Z3Z1wM9RWrq6LQc7w608kBg8Hacd5Xe e6i5MFov7QkuVzk0cnFO4YHMglxMYvTdVQlCEUr6HBXN8nd+PLheGJuf9z/l3+8vsZ95 n7Dg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gHS7xJne; 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 oq7si8080698ejb.650.2020.09.16.06.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:03:21 -0700 (PDT) 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=gHS7xJne; 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 B07AA823AC; Wed, 16 Sep 2020 15:00:42 +0200 (CEST) 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="gHS7xJne"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A646182380; Wed, 16 Sep 2020 15:00:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::61b]) (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 70A6B8236D for ; Wed, 16 Sep 2020 15:00:24 +0200 (CEST) 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=T2Fw7rm2qMoQxXwn/6aRwFUJUoCnHpReRRSC+VUNkymepQZlpvV2xMshxXvr/3na8cmfjNjXn056xKzkrnfWr63Eu/02kBVmtHplZpnavxS2MwmAYyEvfDyM2FFiQQQgRIsW0nLbO5nqFPXxYduXUZsaGvfr/Hv4/EjxvnLTp0qZHO2o/y5zFr5OBA5ok+izWRbYHqzymY6QQOpU/rKvcaQP2yY6lTFt1TL6/tlXFUIdn4t7M11OUaqT9hd5mbJjo/der4e5lwfLmGVSZn89u/zx95w7ZGPcdmAOi5PC4rJzov1W9VXReISQfJMzRBpQZ0zRmWWw/01fvA3/YbPy1A== 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=aCxMsVWjNkGRtI1qw3KvIsK8ecTOzhNYkJOQrU4aldc5BrmeP3e9ojUpSTp1IeFHkJ0ocNr2J532UAm+7sMnLjQaE2/aNMtOcO3TS+1nUAL/DpZwwv86fDtYrn+yx2lpX7MDUbCNeow7LMCTPLJkzFpzY7ppEnSbENCBneWGrvfMSvB8q6dhopwaKXzOK+8i3m4RSTx5eCACrJBwBKzAShL9+01dN6AUE/aa3Q2o/NnjR5AcT0PHPbjC+G1dvWc1zCDPlBKED1v1YEcjvPeKF3mOHShqpmSShNUxgfn4sZY88f6TdlK907OF64QiVpMb1cIZHGb8meSKDAJjvCUizw== 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=gHS7xJneO91y6IuHLdowil+bzRS+sK/cfbe97NtIok46y31k6AqYZInJPoKErAimHjA7fnbyQOBZuYjIIM4ozT8jEC3IgVAWNv7Mo0sJBOcjg6VrH+HNBjbIXZaPbyzoYWWJUuXx98agIqefkQXNzGDzC1OTWjDppdVgv3x6wmk= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:23 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:22 +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 15/16] usb: gadget: fastboot: use correct max packet size Date: Wed, 16 Sep 2020 21:25:36 +0800 Message-Id: <20200916132537.8313-16-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:20 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e9d4a9ba-1e61-489b-9e20-08d85a4078ce X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: IoHwAc1rMLzpbd+H0EHzbhXnvsVJjck43MwL7dzP3Zu7hRIQOAWC1RIE3SfAqZcfE0sQ0m7YWHkAgTDHSqu+UDV25c4HPkR84/6IuhWbAAxF5sMkiW00mH512mPKaV1MojdiclhQd04UI+ajZuVZxm2cO1FH4+WMtNzZVwhFGLcT+FYSBUBNyv3b12cYq19tRmPvq3vaX3RqwOueS/3lfcLQA+mjfSaks56RkJuo9bxh5u0GWZazk4MS0HxQckpt0MRYhDM7tBmrUXHCxss36xPitH6f7798Ny4zZOzJ+ZSdLSwC9JLnCZJmnzk1HjMQA2O2tGYnf4eimwmDlsaA7Q== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(4744005)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(83380400001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: u/cRqUN/7yyEmrbyCJEBhgysMnwk2tO6StcK2527YExqbZ4Q7HRPuz1dU1FbwMN45g2PD0BPrZ5vIScstW8tkZ4pjoXKR3BIAppP3EhIvmZDUTY69AZ19j3h6K7AB+pQU7B/taCYWlbE6SxWXHJDlRMo/t/hPwMjBareDYqvUBg6JnSb5U42mfJiLB448xBp6xHbd89q5owXEyrUm4m/6+W3tZhG/Rjdmd0CPbhx/xXE4d/A51oejKZVTR/XARihCzQT169HRLik++eM7ia9QGmjRrYkHMw0tOo6T4K2OvdEJ89GZdTzxIVkzFPayTEZVes6GdOfgswk/ZeSxg1MNY9VZDXFHNMcAzgttwdzAKBfJGNayfpeNWeiXUtwymzVoTF9W6QFJPoht0p5B7uRd+qjkw0YzhpW4FyTnzr18FlOaP75zOQGyYXOuSHwZT72piJZ5AIgOfi9QxPi0y4tdyMSlACVpytOVKAu071vdEi53myj3WzLKXfnVq2cb5j09xGYZlvtop1zbifMrM1Pd5nmJbB02PEtlQHoGzXjZXcl36V6Ns59Dssu7fAGEt1/ajJXC4O3QQKFmqTrvqYJaJw0U1IzYcnS/8sNDzZhJ7O/pB/jDPnAAU4p76jwznwvX+Qaj0k8MktUD3xgUGvj2w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9d4a9ba-1e61-489b-9e20-08d85a4078ce X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:22.8386 (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: qstZPJItCfonngAMJHko6y4nEruv0P/PqCWEg924k1GdDioQ6kKNxQILz8SmwivKBmp9AJNMMbzBNsYJYrQe0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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 Wed Sep 16 13:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312447 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp445580ilg; Wed, 16 Sep 2020 06:03:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyrqY24b2R5oWTVr6K0sf5Yc0V1HJV7iouDTqhheQBncBCvOFw9QQ5tfuxxMDa9L1VlIiT X-Received: by 2002:a17:906:1690:: with SMTP id s16mr24997478ejd.122.1600261408841; Wed, 16 Sep 2020 06:03:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600261408; cv=pass; d=google.com; s=arc-20160816; b=Ovbib1Xkxiy4USD+IkvnjlCgLxOjvbk1FaOF1Q9w345U6gKpPvTssdvpZ0VQ1JMKds WfbOOU29ViitK44C27AP6vnZOObbU7+xW2SkaC/zXbYFseXG9tICOcNZcGk9c99h3ZZL 1eJdL/fMkRxM2k+D0WhOJMrMpnmZvkvRoTuEQw9QIjhgz6ZgDRApquN6CH5+lW7elOFE eROR3aJLweksrcUP+Yo11wiahMU42p5kLeHpJORh7EVAGGkTzMyTSup1xrW2tV76wb7D ZCClP6rTXyskyp6QoC9kwEpRcpnzjHy3qTQpV5ixMCUYCXeKWY7CZ9LSoS+PyQVmEqyu 8yag== 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=S0cf9lVHUcaHiQAMfToJ2E78OvRFkGCI8oqnXHigONhWe2e+fQuFovCxUzscfU8QAU qpdD2CZd126dIHmMPRGxJ4ucynYp7mc/OyzzNehpbLn+qPLDA+5CFyc26DkQ7vL9Uubv qDfa1qxnB4stbIq9haW+d2coFbQyBJITscIdQT9rMQCHszH6DZnyt/aTNoy+OyG3DzTY dZrVKjAGP2azZx3+4BjulrDSxsLmTrAKD79/wq7D4L9dVnMHFpFV6XAg/wY8hUTKICSg udSBWqxhl757RK6IKPsEUaQ0MH8fUwSUfF0Pr7YLPOn7/pau8rA2z2f66xxg8g4gGMv1 YhlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EZRKQHgZ; 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 p22si11717177edq.579.2020.09.16.06.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:03:28 -0700 (PDT) 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=EZRKQHgZ; 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 64F9E823B5; Wed, 16 Sep 2020 15:00:44 +0200 (CEST) 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="EZRKQHgZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 03D558239F; Wed, 16 Sep 2020 15:00:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0609.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::609]) (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 5E72E82388 for ; Wed, 16 Sep 2020 15:00:27 +0200 (CEST) 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=JcjzLi22x4khawD3AifpipPYraPunaAEkzJEaem2rLnpbtq0OPKilzRLSzspVkFhLCer3OcrmD1hFH8A6mZlln3A7cYqMjHk31IFxnw2tuD3fLUlXFrSamx4DGy3Cmrtp8bGDcnr1eg4yOO7gSVFS9MF5TmwIyT1Bksxmr5Q7nA4J+xyMI4wKLMf9oF9ojNfkW+jHgOYu/2TARMN2RtijR0Oi7rBE27TGsCiA1ZfoiHc0YmmdDLRW2XURpwqmngUiczosF54Sp1CQi05NjjkqcAK6+vRRG5e0ZgHjTfC512naj4gmaeacc85pSXti3t5NFwReLUE0zDOiyOnSdgktg== 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=Pm0TBktudRW3yhn9j8TOcs9mk5y+qRS0QeZ44g0Q4RBwUeay6DX99jZXOc13jMhkjag2NRHDsliGVaEnNueusSdZBlSQX22lG8hF9GxN8ZpbWAD9SMDeRxRWCClqJB1t9jC7g6O/HSyuOhVpICsVQ+vLFb5AtY/FpqLHN6hDW8upgVLMfpSV75XZwxNIOjYNYW9KZDL0UGeXdgcf/Y9zG7FVnJRGY6ZdoPIuIrCTT+GqWHr+6zjBwMyJUs0g3r7cNauvvIP/gJFvR/54K04gsfBCHTQEjeEOM7zI8t5H+0vTcQOFK2bd2kQHAPrPw8fZetkE1rXlXL8beSO2FKsD5w== 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=EZRKQHgZtlbyO0HgQFgD/k+jPIQihxO9vAXbsMhRVvDritCndx5Y0ysUIv+NIVgd+UYCsE6IOhZFcbJojON6Sgu1ln3+1MxHhK8bELdmhuhcxcFvgj4/j9WDpCnhhDzze7LGLsbwq287WPTcV6FJWQcrkg4+nzzYpr4DP3Tvs60= 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 DB6PR0401MB2373.eurprd04.prod.outlook.com (2603:10a6:4:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Wed, 16 Sep 2020 13:00:26 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 13:00:26 +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 16/16] usb: gaget: ci: set ep's desc when enable ep Date: Wed, 16 Sep 2020 21:25:37 +0800 Message-Id: <20200916132537.8313-17-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com> References: <20200916132537.8313-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) 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 SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.5 via Frontend Transport; Wed, 16 Sep 2020 13:00:23 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 92b54660-4e44-419a-5689-08d85a407ab1 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2373: 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: 5kU3GP2B8RoGNFXaqsxEG20sQwz94O/R1VGzZYzyR8dIG/1ciMLmBLmUrQfm3PZNR24LLwlxQ/xKf1lBabPz8CQU14dMAefoKAjaebcxT55O8xHCJHGsopJs6+3zYr+qgeUrQGhYRAXAoPQQ1G9fB1PvSQjz4Hf4ry5R2RWbQH1f4SeO6a3neZjyKMCZRC3KJsE001wPRUDD2PLYtMIG+YH+Vjsp3LU5mB5COddkfSnnAxN4i3l1K45jt6LTcewoZOl0Nd3uFANIrLIUefaSmBQ6bQkF9gVkxph4IkpEZGgvvleyf8c4ehubB7AJa0ky/e1FV0+rszG7Clr5KbUbRg== 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)(366004)(376002)(136003)(39860400002)(396003)(54906003)(6666004)(9686003)(4744005)(1076003)(6512007)(5660300002)(478600001)(52116002)(36756003)(6506007)(66946007)(26005)(6486002)(16526019)(186003)(956004)(316002)(66556008)(66476007)(2616005)(86362001)(8936002)(2906002)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: piI2Eb9PuK214RPA/v1DDmUfP0+9yyIzc2xuWnfP19ntsG/dEQqe42Uf9AiwUem5P4RLvXzRWMt+sj5SAdtnkMu2/amSY/F6TylRkaaUBXIt1jBWZH2iSwUH488mFi9HyZfLguH+IMBfcoiLSAxgJ3zOYQ+IWD6G0tTQutvqU+tNIObpWptOpa3paYHcAxjFDeIB7ZLlAMp+pebaKPDfihKlrviI5JR1vtNKtV2AQMIbc2uQZZEd2NVVyhQpUHA0yldO9jtwZZiuNcgN0IOAEdwjC66PXcI51zP5XWL/RvD4FzY5/6N3pkYZpw8A+Iw32OEkkNSEAbFrfu9cDzpozCrnBnvXyjXvza30rGhBpf+2LBI/zwjhUm7+NeFFEytCeogLiBXLmh8wkvFbX4x3PNSHrFNAczV2V0Ws9+V+WDSgQYxBZUn/E308IgOdGwoE0wOgc3CGMFAAVwjnqxq97J0Z4YIpA2B80JzfxeRRxFa8BUOO+x9KfLRcdkzOGT8b7blmhWp43AWltdOF5spjRIOxRiOBd1vlkRi9GVffDOnHUwKiON4I+3NdQyZYR0u0PHCe5/DkRCpfL9B18G5tgDFBtB6Hptn8Cc6wWnBElY4M3sUBzrYnwOEBF1HED9O4/UVC9tE+HVW0ml5Nc3dhfw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92b54660-4e44-419a-5689-08d85a407ab1 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 13:00:26.0622 (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: 2jIjw6yCAcm3MkuEBOrfmXAmiQBigy1xx3baKcRh5OZEDkLdtCFTK+Gc5BjyJqKnPbCZ8Vhir3GBC0TpfOgUEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2373 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; }