From patchwork Wed Sep 16 12:57:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312394 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp415414ilg; Wed, 16 Sep 2020 05:33:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztPuKIfHn2J8C/BjfQn/zb0jJ9VZK8oLG+FQTh1O80KBabdAyKSPlnmna7prUTX9uyUaLh X-Received: by 2002:a17:906:a00d:: with SMTP id p13mr25948329ejy.535.1600259617325; Wed, 16 Sep 2020 05:33:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259617; cv=pass; d=google.com; s=arc-20160816; b=o916DJpLHNIMQw1FmjiGXRrM0LRFcGUazXLLRv1CWHKte2bX+oyjLXfGF/HaaPt3GL rfiY7pVT6eroO9yZMfvXhPZYNEHYT9m9jf6wdmQLwD67XQpyEB4sktrjWq464oA/jojG iK9lvQX2/FmkMnr6jt8YiiDiDPA5+YbvXC7pPlGfesZzaOCqDI3Yy+98AQEde7emaXsW ctzn3X0CdsnNDu8mx5PsoBn6jbdmuOhP3rEuwk+TvK9xliOcePwSM6V6BlDOF8ywiuq/ C5wzZLVt5YEm0Zi5rfK3W1J9Kf1n/oNGhT/QzfrLLxeOyperdUtUJM9RPng9dDrt5jTZ a+bQ== 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=MK0wiKOt+Tub8Zr/bGjaW5WybgGShPzgAwqIes3hZwQ=; b=KUAlQMvYdDt5K1FiRTF8X3NgT/k+WYqN+iIoi6C5+KAHKZY8mhXM1V9emrEYrsh5QK e+aKtYfHTe2dhqXJ5+582FcxPEWnWKOG5ZsmA0BmZb54tBgWpb9y4uzzrxwa+aw8RDdj u3fuhS6WLjwGLgLyfGM95K52UP6tcNn8CHBbHZBMuuEzUf/o7HzaQJfDWSNSY1vtz9Yp vRwfYvoJTM0fryNy6J+eygDH+psbbawGvOabpTTzm4dzZyCUkRff+WOthMRJ1IVn25In c9fc2+Et980GozcAMG9l1fZUXgVUAMYeukQM2+1qFpyC67q6YjlMZQt/guWK1Qiqc/Nw MaYw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YmZHzzXN; 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 l23si12187771ejb.172.2020.09.16.05.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:33: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=YmZHzzXN; 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 399CF82371; Wed, 16 Sep 2020 14:31:43 +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="YmZHzzXN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6124282361; Wed, 16 Sep 2020 14:31:35 +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-vi1eur05on20628.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::628]) (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 C4E3582334 for ; Wed, 16 Sep 2020 14:31:32 +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=aB3AitA6F6fAXsM0Sa3zgU8Zsegqu/z2ikWLn4z5KJoCLysN0hLR2NfwFytZJ0O2m30h01jWymcohJ4seRNUl6QFyVsObs4XbjAEnR6h6aTQq5x68BFGZg3WWx6iVnmzff/cLe6qdXFoPPAmLU8Z67iGszgHz6N1qtvW8ChHjShkmigbnE/q6jAvQKD+PwYNzLl0IrY/TNPwj9e04jB9xJSHTg5O0s7Su36vGiQ50XHwtKJ+eZCqyqukpK2qGePa2yJAzn5XlidWXKNNl3QUq70sjABk1H6cCrJToHgwXwqLZE9l/18566KC9HJT0xiEeOrJYwwqxK+jjDA61LjMgg== 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=MK0wiKOt+Tub8Zr/bGjaW5WybgGShPzgAwqIes3hZwQ=; b=L0GxDYPfCFm0EOZABhXse6hiqJqi+u2qyWBJMrkggUkfruFFlvpchUYHVveTpAQZ22iKkyB42MbWiI8M5sYguvtRYT8fDFnHfIwsa+s++tesIGer4Ut0MIQfuGXu4k0rs4YXt18oS83fDhi7x4ulLenoIKJ1xaXuKzppeASCKmdpswvmkrEpBMg+0bbRU013T3/jCuNULMf8hN3ZOE8vk/R8y3hMC6rjX5cnpu9+Ccv7wMS3xksFwtzmFzwW/hP0RLTtWxXyKsg6B4In7LjwZaNwkW1J7ifdBIM2E7X8p6mouoM4YGjQ3nC93iS1nob+6oD1X8DXcRDKo8ZB29MNNg== 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=MK0wiKOt+Tub8Zr/bGjaW5WybgGShPzgAwqIes3hZwQ=; b=YmZHzzXNWbYGfJZYzEK1rbw3/kdfGMIbhHtFhag630pPiIz41AttdjZ8dpwHiJsm4UL9iB4yp2kFErB7RDeQF7CwWdpwjHcNtNbYJDL8lu/hJTmFTUpq7Uw1wwY4V6k5C7cAi0jS3rXpSs1bb02PiooaJKEX53QuyozsnrI6loI= 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 DB3PR0402MB3915.eurprd04.prod.outlook.com (2603:10a6:8:e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.17; Wed, 16 Sep 2020 12:31:31 +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:31:31 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Ye Li , Peng Fan Subject: [PATCH 10/13] ehci-mx6: Add OTG ID detecting by GPIO Date: Wed, 16 Sep 2020 20:57:02 +0800 Message-Id: <20200916125705.4341-11-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916125705.4341-1-peng.fan@nxp.com> References: <20200916125705.4341-1-peng.fan@nxp.com> X-ClientProxiedBy: SGBP274CA0023.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::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 SGBP274CA0023.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.13 via Frontend Transport; Wed, 16 Sep 2020 12:31:29 +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: 958c9186-1dce-4ca0-b1ad-08d85a3c70d0 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HICH8xiy9pT+Ws7iA894i9jCpBOM70CC7Sk+pufyj1HkejmO2tOcgHFhFrirGgU9xC5b1t3d+k+bCnqfKWa+NATBQDZFH7LWN6lbFvfQHUVPP1JO+u/D0L9F3E/fEdM+8InKSvXem3H1+fY3IbHD50MDiEz3C9TOKLe0DZ3U1XCmKjMOiCJfaioOpHz9BnVAcuusl36Cq1ebsW7coBOZEr8sWvTl9U2cr45TPIBkYUPf+dyv2aeWLejVj+x3Ru26EP0+u97qJiNcK+eLrK7yk2qZAqwlFARPeld0vEIKPj1Y5K9nCZN6OtTAmrb269aJdI1BvwAoG9+a78VbtH+TJw== 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)(136003)(376002)(346002)(39860400002)(396003)(186003)(16526019)(6512007)(8936002)(54906003)(36756003)(6486002)(2906002)(1076003)(6506007)(478600001)(2616005)(956004)(5660300002)(6666004)(83380400001)(52116002)(316002)(86362001)(4326008)(26005)(66476007)(8676002)(9686003)(66946007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4vpq9rjjF/Kdkh7uNNMxt09mm+7OqlaA/mYNFrm9QfnWUxRzKbdajdsc1nU8DUIY0Nx7ogFPWAzfuNADE1WMtAVnj69qh4kh193vdswU7xIWAEbTT6yEeBknaUKReSOKTuOt41w4/Z612YNhRq3DXwkvPgwdYcwnClkignzZtTDYJT7RFtwiGrXY3yB25c1XBdKbPXXbZjvjq2a7io3So+ay8/XklD/r06HtQyQ9H5MFGuTyfxb3YN9sPl+FlV3co307hhVGW0AQtZo8dHctboNj4yKOVdSZ4Z9DlrOeUq1bvvd0PDgI5q4Qp8t3PJT/CWiBiDvydN37oheMY0p86iB0/YoA5NFKbC2/E7ghc0AWfV71mFxKOCFtt8o7bny7l5tqvWl4d5RQTr0B0/Ukk+ekNPUEf3bDQGKht+59iF7w5bgC0+gGqZDtRBh+XYyw1HSUp/UiH1VyLN8nvZPM3L9gyzYWNokOl34I0EMx36iLIKwFoMDHfj7AHuqOIoCYJUkX6qpaIT13gbRa3ijHW3q5ryyfLTIJrW99Wqzwr8hkCXZnFUVB0iTYVFzZXFFX4CXPWxk33S7KQG/iqTT+bzJ57EXpcRLnPCIAGEvYdHl5tPNrwuMap6ozWeW9gBqzHy9+N+Xqf3hfUVDqae2v4g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 958c9186-1dce-4ca0-b1ad-08d85a3c70d0 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:31:31.2476 (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: 2X+atQXuNXAd/yVEsaz3gebSlDXaFhyDaEKIptPKCiQZxoZIkKYvH+w4yoc+SAZdlLH1/PdeWGhyicvaR4HNqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3915 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 The i.MX7ulp EVK board uses GPIO to detect ID for USB OTG0, but when using DM USB driver, it is hard coded to use OTG ID pin. Add a board override function that when extcon property is provided, the function can check the GPIO to get ID. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index aa0c1c355d..555a810953 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -568,6 +568,25 @@ static const struct ehci_ops mx6_ehci_ops = { .init_after_reset = mx6_init_after_reset }; +/** + * board_ehci_usb_phy_mode - override usb phy mode + * @port: usb host/otg port + * + * Target board specific, override usb_phy_mode. + * When usb-otg is used as usb host port, iomux pad usb_otg_id can be + * left disconnected in this case usb_phy_mode will not be able to identify + * the phy mode that usb port is used. + * Machine file overrides board_usb_phy_mode. + * When the extcon property is set in DTB, machine must provide this function, otherwise + * it will default return HOST. + * + * Return: USB_INIT_DEVICE or USB_INIT_HOST + */ +int __weak board_ehci_usb_phy_mode(struct udevice *dev) +{ + return USB_INIT_HOST; +} + static int ehci_usb_phy_mode(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); @@ -634,6 +653,15 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); enum usb_dr_mode dr_mode; + const struct fdt_property *extcon; + + extcon = fdt_get_property(gd->fdt_blob, dev_of_offset(dev), + "extcon", NULL); + if (extcon) { + plat->init_type = board_ehci_usb_phy_mode(dev); + + return 0; + } dr_mode = usb_get_dr_mode(dev->node);