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;