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;