From patchwork Mon Jan 25 13:43:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370235 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3994359jam; Mon, 25 Jan 2021 05:29:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzd180xY8at6BUnlf5F9q9/VGWsPhEhbmU+Mrzjoyc5J9CONXpcerhSJ6k+elu3QYfoSKc X-Received: by 2002:a17:906:fcce:: with SMTP id qx14mr375418ejb.220.1611581364339; Mon, 25 Jan 2021 05:29:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581364; cv=pass; d=google.com; s=arc-20160816; b=c1AwGneNz5BcPOJ0T38WggEGjdq0661l2jkjs8Jxeu+N8CJm7oScdsTGSBSoiPmbEX XqL3JCVeAgTi67e01IX3vrMQQuM93DH5+zElhdo6F53RUwPb1uiZdy5eJR7C7930/HDG 3o1qhV/75P23LuMevfQpWS3dSUdIf8kTEOS0Giw85d1GFJ/D14EsG7XIeG8jB/gldwd5 1VDwfJKuVLZtnHJInhfGHpTQF4V1RRoZimpajnyfHx8Mk8FJxSL6v/O6v6qLeJEE70hL 9VjcuUT2dwWmyRYjwwEgv0TvTPoDHdUOz/JvUfYrtCfmvyMK2NCGyLL3AJLEi45ZHhv7 8EsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=UKVpgQ4Bo9sJjlRsiYRc/5M8GFtKiECdAQwuldkO/lcpvvV2EDPvdhMmll2DUJykVp KxhQtXHCyhGOyLXO3z+yXj+8CWjl8et2jl9kw4Q4BoCGvJT1437O9sgATXlqdKce+83L GblqSeCxDU3lkA03auMzlUkfDPFNjpNwfYX4NpXwSRMcUZQQsYIoYluHGPmdXDdtpC+R 1ndwG3ISfoH7FPQVJz/psfxa1OnCeefDDOnsJzpJk6qJH0W364d3f4onPjUwKq17F/rw oUREBaHB1hY5OS6yJI+wOQYv3UgZyV4Ju7cBiLqp1wrKpUlbu2skOMzMMfWQ6VvqPmqS BQpg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XkRnJ3xR; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 59si7473651edb.71.2021.01.25.05.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:29:24 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XkRnJ3xR; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D0A70827DA; Mon, 25 Jan 2021 14:27:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="XkRnJ3xR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3EB46826B2; Mon, 25 Jan 2021 14:15:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::60e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E759282642 for ; Mon, 25 Jan 2021 14:15:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z7JoQujDozF0a0UnkJTGmC1k3p8fC8KKjPoJcQVhbG8+lgJVoa68fMb14jdNvsxZu7nsDTapYkxzHTzjgRwIwiZ8Ryr43E0uT/i17JtBJJrvn5yOl+bV2y/sYv3I0rp3lhD7e/LB7iT5GWI/ytI2HasuZotQLage6rlthtDMLOegIwwJg5l9rHf6a81w+Ys7LDWF/MEbh8Cd/Uz6MJisqfAAMC6XTFQNmM+Nk6b2QG2BRULW5PV/Hx1fNN9coDHKdhf1AOQ0e9t4ssua/1ArFTnL2JvteLvvNAzFopAHA/0RlNNYuRLnhbT/8UzxzObL8Ad/vEzkAmROqlX9PTktdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=IUxQeyIhKiEbLqlKqMjQhEWUrV34b8D9aItF/JQJWO3uZU+H6rO2qP6TEXsnI7KpoidJA47cs/LEend70cehB8HPQgb81llcMlVDQrtmd76ozUqajGqJF48l5/IPhy/eUfwz3zu4yjEK9u3b9+Lxp4kC7poeFws9R2INsVaFYsEB4E9lKAgngKV0m+/oqDvvYaKXh0lTVeKbkOa1hsgG3DlG8QoHja62nSzG2t79PMGkDmC2oBVpYyIOLlU/Use/vGptaxGNt4kwstMkB7t1u39/YdmfKITBrSo5Cz5nZqXs71G+pPiTRGTNh4eqnpHgW9jGNBib12MDH+QbGDYVMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yQprzLSuqsM+6vGDJp0UlvUhKO69OpVdyZkeSM+I248=; b=XkRnJ3xRm1BgDj7qp+QF3jUt6BFQdYUQhEc8O4gIRTk6y8KqCoO47y1OGIaDAW6LdCQy/QWIa/xPSY+sNzd5r0/e0X/31fBm/jNBiG0+NrF+AO4/Pt5XlNK+nq5mCQNaPU9VSA532mgHzZqX8mmyOH0KgqqxT9bygiqotGclzOI= Authentication-Results: denx.de; dkim=none (message not signed) header.d=none;denx.de; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DBBPR04MB7930.eurprd04.prod.outlook.com (2603:10a6:10:1ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.17; Mon, 25 Jan 2021 13:15:17 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0%9]) with mapi id 15.20.3784.019; Mon, 25 Jan 2021 13:15:17 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, lukma@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Li Jun , Ye Li , Peter Chen , "faqiang . zhu" , Peng Fan Subject: [PATCH V2 14/17] usb: composite: force gadget to be USB2 for HS only function Date: Mon, 25 Jan 2021 21:43:57 +0800 Message-Id: <20210125134400.780-15-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210125134400.780-1-peng.fan@nxp.com> References: <20210125134400.780-1-peng.fan@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Mon, 25 Jan 2021 13:15:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 17275a32-5fde-48c5-7972-08d8c13341e2 X-MS-TrafficTypeDiagnostic: DBBPR04MB7930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1J/E2ReB/x++E0LMc/kXTSUuvlP0CaR7HIL3UG6MiapJc5GQn9cQKRVjyJ/vzkjuBFVaFrQ1ADS3PEc+ByDfXsiAiTyQY3xfTk5175EBcswzrHAiv3JWHYDP/UFvZno/JkUlXPMdpABM3ZNu6buiSKzDCQIYcRQt8ySFN1mC6v0EEdcHaBy5CKZPu7S2GbGjAUtFKP0GXe7dyiXcpojRxdfEdLNwrK/omqgjCN3dM7n3doIT9rB3y7NvOLc5agUT1rTZSEbUz09lURjKpoINvogP6n2t1U9awB1+NJKKDLdNHqcFbdIJ54UUfv3ARBrDsiuJyoxi92GtaWdyKQM6Ms1wQQJaFMFh9CuYzPk3XP4iPvHQjJP1Z6lU9K44Pamxru1gQHvw8mrhnX544O7JIg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(346002)(39860400002)(376002)(136003)(2906002)(66476007)(66556008)(8936002)(186003)(4326008)(16526019)(8676002)(478600001)(66946007)(5660300002)(6666004)(9686003)(2616005)(36756003)(54906003)(1076003)(956004)(6512007)(6486002)(6506007)(86362001)(316002)(52116002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hlPOP6Bdo185FLufoQPrwB83w5IO4rEbDHDabIAIq5cZ6PgBNHS3LOiGiPNj4Os2sVYUuHi2zJu4TtD3vlVJkLIiXlAomeqxUJbZaWzeTFORe628KlXKA5Aw8l+4Z+z2T8dbg0jrP5zZ1N5/9T0XiJgSgXeNi2YgHqfAbsROXnczE5qHDjaYYiMQkPLhTA0DpV4ZUECeUJY2XizVzQuYseO4MaWgSmGTFCnc7vAJHKcA6Gh28nQnBDVxhxVE2r7I2hvrymFcHrfkF8S+tSJ4QxWTsU74Crb24ScB5JbQCJETNut5ueZGrYRD+venHPJzI5RHks1jK7JuLXhPYoyGF70n6xoW9rgreGcV4oN6fXDYY7KMRmh+6KuHpHBbCiwknA71RUt0yU0yNLnWVe9i2z8704iE4crQ2zYPf3+0rUqGz93ksurF1ih5QC8Z0YQOzoTguEp2U12qzfA61UMqDOw6hFspK3MiHAbXUeepxpyVKst6HpqcY0jvQKz3038SawtC6VcGzXW8sxV9s/oZ1cRQpdiv0WQQLMXQhh9ZmufPtPYckgIZw+w+P1jXR5Seuk0z2YDGNV9VoVhtDTtX19OgOf/ZjV5/UqRk7bfCS58/TEgy4DYd3dM0jO3iwYcJhuhe4jjhVIJH2mUabF4uD6qbyhIUJlvCMTCHQB4D7IN8+JdwTPfXQ92C1ADwaYP9Wtp0zvckpvJ8gJsaYfHgJsdsPiaMUtG1J1X+9bHwJFjfG05jpkR2qRmANMQnkCYiHodBwdGEvPenPq01dxnfEwljQKlBBx8YbHhoCqSO1lGOM+e5qvdWnalgFCc0x7UMT0cv7YCvV2BenyexryYrBgAWqL3f5BSPJ9YrldeBlszvZUe/funq6+ze4KONjvGG3EictCXBYUEfdsiFSFJPcIHfhpoEjrwxOLUwab0Z1bDg9GRWhEFDHIhvYXXMfSGTLGE2NpBLel4EyjYjFtZtmGgisweQCKO7J0jirX19gTI24E8z1ixq2jToIXVkN3fV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17275a32-5fde-48c5-7972-08d8c13341e2 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 13:15:17.0387 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WKMIxi/YaGvPBG09jhDjiGQIbUKfIDtRMXp5xcMERlWH2hRsbGU8+QnSSkp0s+/ZZ3rUYtSIcCpkZQ6k9+d1mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7930 X-Mailman-Approved-At: Mon, 25 Jan 2021 14:26:22 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Li Jun If one of functions is not super speed capable, we need force the udc to be high speed, this is an equivalent implementation of usb_gadget_udc_set_speed() in kernel but simple, which set the gadget max_speed to be high speed, so afterwards when start gadget duc can set the HW to be USB 2.0 mode. Reviewed-by: Ye Li Reviewed-by: Peter Chen Tested-by: faqiang.zhu Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1063c571d8..2a309e624e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -532,6 +532,19 @@ int usb_add_config(struct usb_composite_dev *cdev, } } + /* + * If one function of config is not super speed capable, + * force the gadget to be high speed so controller driver + * can init HW to be USB 2.0 + */ + if (gadget_is_superspeed(cdev->gadget)) { + list_for_each_entry(f, &config->functions, list) { + if (!f->ss_descriptors) + cdev->gadget->max_speed = + USB_SPEED_HIGH; + } + } + usb_ep_autoconfig_reset(cdev->gadget); os_desc_config = config;