From patchwork Wed Sep 16 12:56:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312379 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp412667ilg; Wed, 16 Sep 2020 05:31:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1dPRRieGf1his61vsyJ/3PZHA8hFLUiT9Y7IWVxxoKqqZItc8G5rvwDd+C8mwDuM4+utu X-Received: by 2002:a17:906:f157:: with SMTP id gw23mr24873364ejb.325.1600259491553; Wed, 16 Sep 2020 05:31:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259491; cv=pass; d=google.com; s=arc-20160816; b=qik8xktoRtlj5rxMmyiybKT+N6Mw1gANSQfqRUg05auS/DemnzqpGEsA16lN54iGtS nGSS0XY8pslIyZtRg2f1GHq4WAIGvlE2Fl5k7wbiLbPorKnt2Y4e0A/n+5gI+DK9TBPb DMcDpe10/NwHGjmktY40Y7018P+JS7Mnxyd2aVtpEMlwWVqtCNFHyhsOhnuS3JItp9pN +POkyDBBt9D1vA8DZguEO9tdiR1MaFj1FqBA+9hF2cEzcYu9ySTqHCAohPvsMQzZjqCQ jfJEkpFW9D6GaKEgqftUE1hTKS5uxmFMeadBCzbSxTzci/N6ugqTybEII4qZVhkJgwpP kpvQ== 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=cLdxzhUc2n5igzvDB6nnZlu8yeTCwNoyzE7pcDP6wac=; b=qmAzuwIZ3X7IEsPsICNlUeRrJuNAjH9CsFF2vAo1bHiss+23ZFbtYdNMQCfwIupiA6 KW5IRbwABDitHsov7g/tsAZZpTmEnuR41UxjWaCPB86r5Eehq9QlPAtreb6Ryw9UOB8X hXGRY1ftlwSpeEj6grN/5rScpCDaqJQ6SnNHqPqUkB5cEmcfBlewyLUOvRS2tSIHk35B YgvPDYxHNRe5uB1m/4fWlpg3u7NU0hO/S3GfAh9PSPg4yCn8RbV6sja/+JdhElDnixx/ S6qiSyoeJnbCob623HxqkQAf754QdlkVQU23QNYA7+8xW4Pa0aKEU5ALadM49teI5S8C aEGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OQuLEDvo; 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 s7si12560756edi.576.2020.09.16.05.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:31:31 -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=OQuLEDvo; 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 EBE0282294; Wed, 16 Sep 2020 14:31:18 +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="OQuLEDvo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F8F7822F8; Wed, 16 Sep 2020 14:31: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 EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::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 872F6821F8 for ; Wed, 16 Sep 2020 14:31:11 +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=WWVHh/ZGo8KXZ4S9GRvfLm/MRnCb51jypWf3POcODKMKbURPLt2WSwgalFzD7MbCnjZO5polwHtp0MrkWTU/nzfHkKkAgdu1p6zTrDn1r5uP6eySKxBZYKbbXW0TmzWg6xV5LkuHfuld3EqLZHGqxCbTJNSJx95IDX5D/6hrvnEkBAlz7EcZQm41HR3QyMJfSv3H8S4srgFiFMtNc48We5ITGx/RaG0lbpg10ecAEElzlm8ISDc4Jj/Rbw547lrmQbbqdek4om00yVgIxISw9fBu+PWeBbM7LNl5FfBOTj3Cpg1IlK+a0kaQbZDs/veqqFQoA7PB0iQduGlYz8tThw== 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=cLdxzhUc2n5igzvDB6nnZlu8yeTCwNoyzE7pcDP6wac=; b=brdeQksU4jqG96tmmgl9xBYBCDG/SHYa1g8sW4SkxUpU++T1zWD2fglZpNFCUjw5hL7aflkKDHcFUH33IMm290nSFG/1AWGf50PBBPMUpry5yYA4eDfjJxkEaF5iaW1Rymq6tVhzhL37jzbvZzA41G2aHl6si0BIFQSt3oQQXuYQdC3uc3H3LFuKV/1cYbTrjT9kt7HVwdxGh+WETkH6HZqqohg86xXRxssmCcDRHrN1eBvZNKxkYX1ZxoLV6CwdNLex9IlxIks149SkhcCIHf0FJktmlo0HMYXX+A+m190UDExI0NRzoQBTli/fYbI8OMr5k9vGpW4iazzbQTvt9Q== 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=cLdxzhUc2n5igzvDB6nnZlu8yeTCwNoyzE7pcDP6wac=; b=OQuLEDvolWY6H5MBx1wMtfcrFW2D/HyQMmLocbwvAWYC5QBdzibOUamryF6BhOBwOawLIWuXKLzbt9B6IbQWsv/cTdm34VkP4UMhKbdO0CoiM6CZU0XB0X6a8qQ3M8ewATrhUFkhfGYK5O5Uv9w3sXTcRUziXLMrNDTyGAey+4Q= 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 DB7PR04MB4762.eurprd04.prod.outlook.com (2603:10a6:10:16::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Wed, 16 Sep 2020 12:31:08 +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:08 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan , Ye Li Subject: [PATCH 01/13] usb: ehci-mx6: Add powerup_fixup implementation Date: Wed, 16 Sep 2020 20:56:53 +0800 Message-Id: <20200916125705.4341-2-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:05 +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: c4b62838-25bf-458e-ef67-08d85a3c62ff X-MS-TrafficTypeDiagnostic: DB7PR04MB4762: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5LB9Rqgljiou4ox3ir5/oAwb0wgdC552t7fuDo0unP2nMrQ3shX02pocfAis1HWn12AgEauprtC3nYWPgb4YFSh1axWBNXJzSWw5Wj5WF87VNC/EljEP4evyaIBkW8GoHixs84PivuzByuVULkBYMuPcGVbdJR2oGHwGWhVERhPA5D5Lsu1kjYrStdgmDQw2HvYZoAB1d5lnKlBlG1cVvgii6pNy3m/LP/ng/0AE+OuOzsc2nhUti0xLg+viUXnIhG86sQTygYkJrcXALwgRIW+ef4eKvPcWv71O7SwcfPgVvHYD6ZEQeqkcgNhpV25r755Ljcoxi7dSiMAVmlVmKA== 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)(396003)(376002)(136003)(346002)(366004)(39860400002)(66946007)(6486002)(8936002)(26005)(52116002)(54906003)(956004)(9686003)(2616005)(8676002)(66476007)(86362001)(66556008)(6512007)(316002)(478600001)(186003)(6666004)(2906002)(83380400001)(16526019)(36756003)(6506007)(4326008)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AZT8ot+sHRjgnNCtSZVdVQpck+D735shOkqY2dUjd6ebyE6yDNhlwDzIDEtFWWd7F8t1xbwNwQ2ztzKXKOfoSkujEr1XmeSKAdwTvxg6wPenHKTNzPCmQWggEoHHUL7IxBEEu2B9Ta7bj6L70p5wJ8F17qzGIczIpHI24lBipTz1nRY07bk0/LPorYEDqLvkBaxZzDw891OEKcA2UvMbyLWb45MXL+IGMVliJKQBcdOoRxFmF93NBqV7HPk2VFBACLsnHAQEgPdyLTUBABaxxhl86Q+bOeCHNoGYeOML3vBqYbOe9FGViWjOTgYIaY9B1N04EMeICXr8e6DUqmO7WsQDQ11svRPUF1qYMuTG2LmL48m0ZN576bKLIJaP1PUPg1mD30b7IS1RQbQkdGdlM5lJ4ZT9CVSKKpIPMMWKkHVdmpU8iY7PC1PDIIkxtqkPlnCAByAaqhzChcb35CRccBQ8N4PFfmxSXcjzIV2gp8cKLvU7Zvf1+Be6TEFLwJj9T5sengZT6WnOrBaR+4Pd44oK7QcFqCiCa0pk55BiKh/aE/TZ771ltRcz5zTVEQyMNoG+RYfa2fPgVgrRh4/NqOl80xX6WvbCo3DYjF7YQO3T5Xi++PaeDb/WiUWYcMZ3Vd/iTJ19oe/ZLoQVuDgT7Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4b62838-25bf-458e-ef67-08d85a3c62ff 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:08.3360 (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: eC6seXFixhmDVWmCfJ7qDriz+qZLbvjCCn2yQ4q0cUFQ05D5mUHpyht2z5/d+zydHejZQUUCl7ZHxxpsJak8bQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4762 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: Peng Fan When doing port reset, the PR bit of PORTSC1 will be automatically cleared by our IP, but standard EHCI needs explicit clear by software. The EHCI-HCD driver follow the EHCI specification, so after 50ms wait, it clear the PR bit by writting to the PORTSC1 register with value loaded before setting PR. This sequence is ok for our IP when the delay time is exact. But when the timer is slower, some bits like PE, PSPD have been set by controller automatically after the PR is automatically cleared. So the writing to the PORTSC1 will overwrite these bits set by controller. And eventually the driver gets wrong status. We implement the powerup_fixup operation which delays 50ms and will check the PR until it is cleared by controller. And will update the reg value which is written to PORTSC register by EHCI-HCD driver. This is much safer than depending on the delay time to be accurate and aligining with controller's behaiver. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 37b59758bb..9531fefce0 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "ehci.h" @@ -267,6 +268,21 @@ int usb_phy_mode(int port) } #endif +static void ehci_mx6_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg, + uint32_t *reg) +{ + u32 result; + int ret; + + mdelay(50); + + ret = read_poll_timeout(ehci_readl, status_reg, result, !(result & EHCI_PS_PR), 5, 2000); + if (ret) + printf("%s timeout\n", __func__); + + *reg = ehci_readl(status_reg); +} + static void usb_oc_config(int index) { #if defined(CONFIG_MX6) @@ -366,6 +382,10 @@ int ehci_mx6_common_init(struct usb_ehci *ehci, int index) } #if !CONFIG_IS_ENABLED(DM_USB) +static const struct ehci_ops mx6_ehci_ops = { + .powerup_fixup = ehci_mx6_powerup_fixup, +}; + int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { @@ -394,6 +414,8 @@ int ehci_hcd_init(int index, enum usb_init_type init, if (ret) return ret; + ehci_set_controller_priv(index, NULL, &mx6_ehci_ops); + type = board_usb_phy_mode(index); if (hccr && hcor) { @@ -467,7 +489,8 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) } static const struct ehci_ops mx6_ehci_ops = { - .init_after_reset = mx6_init_after_reset + .powerup_fixup = ehci_mx6_powerup_fixup, + .init_after_reset = mx6_init_after_reset }; static int ehci_usb_phy_mode(struct udevice *dev) From patchwork Wed Sep 16 12:56:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312380 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp412952ilg; Wed, 16 Sep 2020 05:31:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8XVlpBat2q2+vekI07zTEVSF5tWtKIIdyQ2TClZzGSbpGGuD85o0bKVr7dDWbWZqDrdRL X-Received: by 2002:a17:906:9491:: with SMTP id t17mr24556344ejx.227.1600259505887; Wed, 16 Sep 2020 05:31:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259505; cv=pass; d=google.com; s=arc-20160816; b=m2hKTZJ90S5ARTLcCFS54n0xb6r4xCCtwyE6mOp/kAg4u5U1fsJ9js9/LUbHaRItV9 CcDcdRLJAp5BhQB9Z8kvjVcr5pPk63XSL9Hka5xs8SluiLdEJYBteb7BW2hc2G4pLiBd DlWxTtDMsMEc9+EM7WMekkJ2H5WSIyuWF5NBedoAt6QUBwKU70wfh4khkmgg2ephCDWD v4kqlGOYZxOeGNuQVfUlm6wwMYnK3i1WVpjOKd683puHkHZDH0uiqzIGfYhEimgkjBlT ut8/cgsX+gsIxhWJ+fyYgsUYIjgSAOAvrRBv/MbztHkCu2LwcgCZxJDJQw/zYdh6xLds Ggpw== 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=HeuASNzFOAMpbHk+/KVdCMvEGhHZCndoRC/WJHRh6fs=; b=O2uIwN5XWskeDoHaKff8GgPijjezJTzuK9M7wwXobtkL+Jj+MuaLJ2StheBVpZxC4b L3SihxSnJrP0AOxixNu5Brgl7tBDJAUXuofI3SUPzs9RprW3Xy9WYyeq5Lyrq6OzsD/p pakk6pW5VxPU6FusYvK6GQK6+1arPMFUWfpV3hdh3V5gzTUYqPhgf5p1IBbKS08svnUI aLbagXlq9ZMncb/AA3x4YoQra594an2queUfoBxudi/Kw6OBP3iR0IyDR4zeDxlPzAOI dq9NIFKA6lD3bATeCPTm34SVB7NdQ6zgHqcx5cbn8JEg1kx4lDu4dStATkvyvmN+1Ilo 5SVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JhRI88Sg; 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 i7si12364634ejo.706.2020.09.16.05.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:31:45 -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=JhRI88Sg; 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 7D79D82324; Wed, 16 Sep 2020 14:31: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="JhRI88Sg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C5E782294; Wed, 16 Sep 2020 14:31:16 +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 EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::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 D099582294 for ; Wed, 16 Sep 2020 14:31:11 +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=BmFCXIwBTq8TbmcOOgM78CsoGJEs9VuJvn/mtt1Rpavmz6qnlRb/iNR7HQAwAcekDbB0t73ur8eKQFI3EN4xFx3zdvZMEFX10CNwM9iL7jOzp320qUkgQ1MRbCEuSkgY7XITms/cJHECEw5x995URzLF8cDCPpgdP61BxBhO3pxOE4VE1iguUxWbf1wneU5Q1DdI0Wfe6FoLp3JnmjV+JQ+yZmt6dK2whEytNjUj9o0DytTfqCmwCvgabewMip+Ea6zU2rTaDYt+9XzLMqj/2Ko9C+dSWQ6VKe2LT6X9M5R/Ho3fR7r9lbWItP8W2e9mwHPDqIh3TQ/qaZtK+cGCRg== 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=HeuASNzFOAMpbHk+/KVdCMvEGhHZCndoRC/WJHRh6fs=; b=F6LVNSqrZE8HvwqJIj42lyHIOfiM9oyqXUamHjT61qfBCL2pXZO43JUB15vfTuvVnqnxxbqcW8ZaBBN0JQXovRob4Lp7XrLL0919XrROXwdLwMrStAauFLVwEQGLcRLyvDTR8zyhj/82iINzCFqHmkrwj5vRwzYVaXuCuUq2JRPM6+ZDU5EIhscvqUYXUGUg2z7v0al7UyNc1+qURERytc79vhmG9VDRUSzPyrg0XKttqpetC6MA4EAh1bLLWPQDm5qbOVPDWIVdl3xjooLBBkpFpFe5Tti5RN6k9HXsooO9YilcS3C78jIfG2xqM/aAjkdlfkWYPXGmpTLJbuGckA== 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=HeuASNzFOAMpbHk+/KVdCMvEGhHZCndoRC/WJHRh6fs=; b=JhRI88Sg3bBm3Ifi1s/VXd51XViwijoRcQnOjeOshZxY5uo/4l6fpXMBUxbIT67S+dDUan07zGNmpncmfubAS/EuXqwjUhA9Ac/IPDELQPygGycnQ/TclywSzp0HS7VgVk5eZN/oSfge673/GX01nFys5+qAc7SmRved3CixR3A= 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 DB7PR04MB4762.eurprd04.prod.outlook.com (2603:10a6:10:16::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Wed, 16 Sep 2020 12:31:10 +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:10 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan Subject: [PATCH 02/13] usb: ehci-mx6: preparing for ARM64 build Date: Wed, 16 Sep 2020 20:56:54 +0800 Message-Id: <20200916125705.4341-3-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:08 +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: 33334708-6981-4190-b035-08d85a3c6486 X-MS-TrafficTypeDiagnostic: DB7PR04MB4762: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8sHnUp+eXVHJpWotTbJIQskOKn1kbL0SJ/eJgZZ+4EneFxWE4eGXzDF9QVJhFYQaS+0nW8sJN43DkZ4ktY4sr155BlVy08ee0Imu+lq8IeJfRngfpQ85rOAWy2AoY5tyRgrr66ijEOJXsyV9INxpe4CPmPj5QauSP8jk9qZekTxuNohWMSPEKHsJJ+dMMdMwMLMUD8L5A42wZPpnMVHr4QUfdFmecIdLGz8ewtuvuwZ7q7lCS0sm+lqyUG//SDJgQLlbgWiLqG/xE7P5H3DkZxDVN6g4DYUaKl5zSVlPc0uvRXsecniUdgpRLKvGnFGt6Ky0lwEuKuveIXEMKlspUg== 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)(396003)(376002)(136003)(346002)(366004)(39860400002)(66946007)(6486002)(8936002)(26005)(52116002)(956004)(9686003)(2616005)(8676002)(66476007)(86362001)(66556008)(6512007)(316002)(478600001)(186003)(6666004)(2906002)(83380400001)(16526019)(36756003)(6506007)(4326008)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IN9lH32FeA2VBd4w5VcEgIcR7tm5EdMdKeagQpWr0e85aMaWL/iwcwUVXvUj2/uqtGk/ka1zP3MGwbfosij8hy7K7Ksi06QQ2KOT8TVGuvvyMEmV8TdttMIPSSDCyLo6uCt/625IXQYoHoRGidwdFn4SrIoMNq6McCJown2pYHJhjGhd04wJ01a6GDm/GnP3/GpHRNY7ZpT7pETFOeLYf97aRFIlgYmrOH7gSfH7UlbrLQThB71E/I0QBrS8tKi4/oWXI9TfE2ijpbrW7AS/hy1XKQxhBW8e3Z/llvqSjCLKIG1HQ7Mb/STeOX71fIWIxc5R9R4EytiwyniHNj/3XDqAT2vj3qr40oHNbu/T1S1UWPh7LWJKRCAZqnqjMiXBTjx/UVu/pcp1gHzhzUboW9h9+ysmPSVold+z6Afg2IFpSIVPdg6E6Qs4CBYCbga596y8tKIEon5x3gIhqXYoKLgRJCojNtWiL6VUr6dvHKPI6RsKMh4NtZXB7hsAbqyaLyeNnJDgD4CzyzrLJzCbmkWwgJh/qblF9o9VKMowgn6hDc/NXQMKmn5hgWSMs+1D+KocYazvcTm8NNtN798iBN3dZDSkTLy5S4mmlreua0AgAKhmH4wmlFp67+NFHB/ro9CqEKAHNOOfrztkaBym1g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33334708-6981-4190-b035-08d85a3c6486 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:10.6300 (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: jojaPSqSNAdOGuTJlqy+BcOCxIWMLVxaCLOveLdTB68qkhCpqrOMPCsDwRsRKGSWEkassz+87BpnbEQsHBUSqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4762 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: Peng Fan Use uintptr_t and ulong to avoid build warning for ARM64 platforms Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 9531fefce0..4b8b3087ec 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -68,7 +68,7 @@ DECLARE_GLOBAL_DATA_PTR; #define UCMD_RESET (1 << 1) /* controller reset */ #if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) -static const unsigned phy_bases[] = { +static const ulong phy_bases[] = { USB_PHY0_BASE_ADDR, #if defined(USB_PHY1_BASE_ADDR) USB_PHY1_BASE_ADDR, @@ -241,7 +241,7 @@ struct usbnc_regs { static void usb_power_config(int index) { - struct usbnc_regs *usbnc = (struct usbnc_regs *)(USB_BASE_ADDR + + struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + (0x10000 * index) + USBNC_OFFSET); void __iomem *phy_cfg2 = (void __iomem *)(&usbnc->phy_cfg2); @@ -254,7 +254,7 @@ static void usb_power_config(int index) int usb_phy_mode(int port) { - struct usbnc_regs *usbnc = (struct usbnc_regs *)(USB_BASE_ADDR + + struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + (0x10000 * port) + USBNC_OFFSET); void __iomem *status = (void __iomem *)(&usbnc->phy_status); u32 val; @@ -286,11 +286,11 @@ static void ehci_mx6_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg, static void usb_oc_config(int index) { #if defined(CONFIG_MX6) - struct usbnc_regs *usbnc = (struct usbnc_regs *)(USB_BASE_ADDR + + struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + USB_OTHERREGS_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); #elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) - struct usbnc_regs *usbnc = (struct usbnc_regs *)(USB_BASE_ADDR + + struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + (0x10000 * index) + USBNC_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl1); #endif @@ -395,7 +395,7 @@ int ehci_hcd_init(int index, enum usb_init_type init, #elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) u32 controller_spacing = 0x10000; #endif - struct usb_ehci *ehci = (struct usb_ehci *)(USB_BASE_ADDR + + struct usb_ehci *ehci = (struct usb_ehci *)(uintptr_t)(USB_BASE_ADDR + (controller_spacing * index)); int ret; @@ -419,8 +419,8 @@ int ehci_hcd_init(int index, enum usb_init_type init, type = board_usb_phy_mode(index); if (hccr && hcor) { - *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); - *hcor = (struct ehci_hcor *)((uint32_t)*hccr + + *hccr = (struct ehci_hccr *)((uintptr_t)&ehci->caplength); + *hcor = (struct ehci_hcor *)((uintptr_t)*hccr + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); } @@ -652,8 +652,8 @@ static int ehci_usb_probe(struct udevice *dev) mdelay(10); - hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); - hcor = (struct ehci_hcor *)((uint32_t)hccr + + hccr = (struct ehci_hccr *)((uintptr_t)&ehci->caplength); + hcor = (struct ehci_hcor *)((uintptr_t)hccr + HC_LENGTH(ehci_readl(&(hccr)->cr_capbase))); return ehci_register(dev, hccr, hcor, &mx6_ehci_ops, 0, priv->init_type); From patchwork Wed Sep 16 12:56:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312381 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp413145ilg; Wed, 16 Sep 2020 05:31:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4CnC85vYI6pWAd08oJGopjscClSLAcY9tpYH+ZQdsASERqRvj6is2w1iYwqW2Z18LDjhI X-Received: by 2002:a05:6402:1612:: with SMTP id f18mr26720976edv.166.1600259517605; Wed, 16 Sep 2020 05:31:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259517; cv=pass; d=google.com; s=arc-20160816; b=NtcepXBpVoNSpAWsgp//DWxroPWDk9gmAfMtMnKuPvesCPU13iAoGkE9+GBtxHo4UZ tdLYLkdnaOLFcbHYGfJkSiGZnfvGyTABwZ3dPWSelohGG8vARWvwdHTjGKHMRLaqLyFh 0dukR+6Rr1+b8Hl2v4lalOnQsVgFWBYIxU0LGeQ70IfvQrYqZMKmMTMzBVnboHcDDmvb EepwF2rBD5+ZC6mjn2Duuk1I0EWmrv6QTquSd5NidXbR1/yY5ScoIMx5vRcpBJYmSqfb 8ZvSeCsHqvQyF7qDdUXk6iKoNbzmxTovjv3xQ2o+ZbVRtzsBzysvs5IF19bjK0k8rxVB LauQ== 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=+kQAxgqBUhGiEFe7ZRnr/A7k1xiqgZAxkEHShQk2BGA=; b=Rbaup850zXEQjvCI4sCqhzB2dPTk5aoPvk7QnoO4JM7qgfNgq+gx9ljPg3o31rFhjJ SVVnHMZ4H2CsHpKyS1Wep80ctKJcM94LBE/hh7A2rXPsGeGKQlpdXzoHZ5lwI9l/dxu8 P+a9QIntwyQVpGL2wcXsy00zULpPm4JpyWhmLtnYYDsBG57rQHOs8g5q7pPnMbYt6cgW 26NJ8D9zvSg6DFcSpF+Y35jX5Gr0JkHQjUJNMf2LaAncgexuPocx4+iw+zciW51v79ko M8hfMXobhwUtSSAsewzi89Dv2cmreaKohPjbdJOBzwwXViN4dGCLRkOfu9Wvfe8q45HB nCkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cNW85+4W; 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 f14si10970931ejq.98.2020.09.16.05.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:31:57 -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=cNW85+4W; 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 ED76B8233D; Wed, 16 Sep 2020 14:31: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=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="cNW85+4W"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DAAB48231F; Wed, 16 Sep 2020 14:31: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-ve1eur01on0622.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::622]) (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 7418B81260 for ; Wed, 16 Sep 2020 14:31: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=jMBDoU874kIyG+dJLF/N7AQ7YjkutYdzlDW+vW7Ie5DCryDZRSWBKa9LmYV628g6rNkvyfTHptkoI12xnY65iUOdlPGTKnEHgObXU4hf6sfAx4SqUyRZCuVkOniKdMPcxtkabbM98tV5zAjlaw2k51GNQXx8SsC+GmTRzXFfIk3ts01A+cPSPDuiGSeifrTjCk3NvQIEcHYCntkd4Ties3sgbxxdPr0/4CttZSKr5rhjs1S4oRTTssUOTraOjOUxFvybv3ac5pfAEB5EIiopf9pdm6aHEm2TimLwf5rmSb9RuA4XyklksbbmwpS7K1rkiedTpnzvVsphv5sg+aWisw== 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=+kQAxgqBUhGiEFe7ZRnr/A7k1xiqgZAxkEHShQk2BGA=; b=WPMdOygpKDj9HIHAgOndp5lAFPcKHMgqv7g5yg0bqICX9LYKjhz9RRKEDiyFYOmm9TwMr11t+ObJjz/D+TE8WMc+JBYbfjM2YAoBCooP4mtdjtEqV3diOS11+MAKH1hMXdgUtze1E1bqSA2NB0DO/Yg9jQumnaDVDGISPTUKyfdP9cLqsd2oVodWrKrBPjgsJIdrEBh/Lxfj+fZ4kIlxfwAdKPLbFqw2MmnHAO/pKwQlwUhiRTsqqjNStEEInuvIFYsBVhyEoG8MCcY7O0J6/CNVN5tM9aBbdfMQgugqa0HSxQDRYkr2M8tyTkJfQ9P/3FtWHjKyuJ82ZPh6kQq1Hw== 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=+kQAxgqBUhGiEFe7ZRnr/A7k1xiqgZAxkEHShQk2BGA=; b=cNW85+4Wq8tLHb7i+SOgxMy0HAQHGh0WjTvc3fTpvKXhwihR9rteBoEc5xz4abBKeIpL9IHFu8cNcPqIQU+r0M2gaCu1qU0u2130tiaisfygaAFDbuUdUTmd86Wh2+FvpFFNQHLYA8Uu16WxPvKjwMMfB8bwqulumZ+omN04fEw= 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 DB7PR04MB4762.eurprd04.prod.outlook.com (2603:10a6:10:16::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Wed, 16 Sep 2020 12:31:13 +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:13 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan , Ye Li Subject: [PATCH 03/13] usb: ehci-mx6: Add i.MX8 OTG controller support Date: Wed, 16 Sep 2020 20:56:55 +0800 Message-Id: <20200916125705.4341-4-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:11 +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: 4a6510a0-a407-4ef7-57a1-08d85a3c65fe X-MS-TrafficTypeDiagnostic: DB7PR04MB4762: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NdWO2+lK5U/K9lB3GQwnZ4sXDT34YTQ7zQzMids6iXmlv3rvyDXBTEBg2nMFLNrsgL7sXmVPP87x+ddMe3oq9AyTIywmISAHTpv4O6LuZUvolznrPz1I2GoHruIHDNGPEfisKoic7kHw1t4YqCAdBu97p8vqOhLXyN8bNlB9FY2THCvQNWJ6Td03gYmeg9oZQX5wGC92zshKeFz3oZWJ+O5zPtbXeuBNDOX72AaTMrTChLvJV6/cNkU0ELKbvVU2kgqipCJEm2evR+/ke1Au0BIF/MvVppEAqXXVnqmbL1eyGCypKO3v5PrMbd2K1aMNTrAea5POIfvOvWn8EgshYg== 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)(396003)(376002)(136003)(346002)(366004)(39860400002)(66946007)(6486002)(8936002)(26005)(52116002)(54906003)(956004)(9686003)(2616005)(8676002)(66476007)(19627235002)(86362001)(66556008)(6512007)(316002)(478600001)(186003)(6666004)(2906002)(83380400001)(16526019)(36756003)(6506007)(4326008)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LutzKERmgGagCpViRDEKFmxCGUd5k07oacgHsshyKLOA24TmQv8fSqNgy6ngdajSN9mXMq+evJmbvKg4RT4S5GJ6ya69Cx6IBD2UZU7AutmAArriq/9Y6I8/CLIyVFogxZsHx3mFyPC7RPa99h6ismCyAIqcYqfkT18Mkqfv3DiBxwuTMJxsgr75/le1teDQ5FscZgPYQNd3mx10ooLFuNigtZkHqoFr7n7DZ9WaRnMIUtHGScJaNOvBCFCQrRhgv994F5MPp/Q28x+aJLUr6YvrFgJoFZcoI1ZQtnw+KUM4pR1/b8Tg5Z4EcE+AzqhZGQVY/pwZk8uEwfxEtUkV17JcTMjMMSs5h5AF+4VcYsaYa3KhkLeKT7SosjQDfpfIkosiz0YLbwI7a6+NJ7bhiqDiPYsMW+VhyKPAo0gptleOualxClyXA1l7edrEl880inXvrCkHjllhlZaPlroFBMHb/PdXVtCpYXMKGnfgkI9DkL/4DPajPD+6M3eMz593puLqpdLdNuCMmT/y7p0/P4Ofl0mD5lTMui6wpkUrK2AphK47XKDaE93YVeNlabGTrtfe7QKZARB+TkX7zA5PYWOvGRXyqwne4SB2fyN8e5I21UAy4GFta6dfWPdngzP1C8KUPqaLDnvtcGfYgqlhUg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a6510a0-a407-4ef7-57a1-08d85a3c65fe 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:13.0689 (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: 0qco2Ik4hUJTnsRpyUoCQ/S4GzWw8C4Xa9Kj8i8GSmUzFQBSYb1EDVXI0ohrJyu2Z2Kk8XpfcabsRd2l/UjCjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4762 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: Peng Fan The i.MX8 has two USB controllers: USBOH and USB3. The USBOH reuses previous i.MX6/7. It has same PHY IP as i.MX7ULP but NC registers are same as i.MX7D. So add its support in ehci-mx6 driver. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- arch/arm/include/asm/arch-imx8/clock.h | 8 ++++ drivers/usb/host/Kconfig | 4 +- drivers/usb/host/ehci-mx6.c | 61 +++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 7 deletions(-) -- 2.28.0 diff --git a/arch/arm/include/asm/arch-imx8/clock.h b/arch/arm/include/asm/arch-imx8/clock.h index bea157171f..55475f2bc4 100644 --- a/arch/arm/include/asm/arch-imx8/clock.h +++ b/arch/arm/include/asm/arch-imx8/clock.h @@ -24,4 +24,12 @@ enum mxc_clock { u32 mxc_get_clock(enum mxc_clock clk); +#define PLL_USB_EN_USB_CLKS_MASK (1 << 6) +#define PLL_USB_PWR_MASK (1 << 12) +#define PLL_USB_ENABLE_MASK (1 << 13) +#define PLL_USB_BYPASS_MASK (1 << 16) +#define PLL_USB_REG_ENABLE_MASK (1 << 21) +#define PLL_USB_DIV_SEL_MASK (7 << 22) +#define PLL_USB_LOCK_MASK (1 << 31) + #endif /* __ASM_ARCH_IMX8_CLOCK_H__ */ diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1c374a7bd8..f48547caa0 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -139,8 +139,8 @@ config USB_EHCI_MX5 Enables support for the on-chip EHCI controller on i.MX5 SoCs. config USB_EHCI_MX6 - bool "Support for i.MX6/i.MX7ULP on-chip EHCI USB controller" - depends on ARCH_MX6 || ARCH_MX7ULP + bool "Support for i.MX6/i.MX7ULP/i.MX8 on-chip EHCI USB controller" + depends on ARCH_MX6 || ARCH_MX7ULP || ARCH_IMX8 default y ---help--- Enables support for the on-chip EHCI controller on i.MX6 SoCs. diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 4b8b3087ec..b1721cd915 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -67,7 +67,7 @@ DECLARE_GLOBAL_DATA_PTR; #define UCMD_RUN_STOP (1 << 0) /* controller run/stop */ #define UCMD_RESET (1 << 1) /* controller reset */ -#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) +#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) static const ulong phy_bases[] = { USB_PHY0_BASE_ADDR, #if defined(USB_PHY1_BASE_ADDR) @@ -101,7 +101,44 @@ static void usb_power_config(int index) &usbphy->usb1_chrg_detect); scg_enable_usb_pll(true); +#elif defined(CONFIG_IMX8) + struct usbphy_regs __iomem *usbphy = (struct usbphy_regs __iomem *)USB_PHY0_BASE_ADDR; + int ret; + u32 val; + + if (index > 0) + return; + + writel(ANADIG_USB2_CHRG_DETECT_EN_B | ANADIG_USB2_CHRG_DETECT_CHK_CHRG_B, + &usbphy->usb1_chrg_detect); + + if (!(readl(&usbphy->usb1_pll_480_ctrl) & PLL_USB_LOCK_MASK)) { + + /* Enable the regulator first */ + writel(PLL_USB_REG_ENABLE_MASK, &usbphy->usb1_pll_480_ctrl_set); + + /* Wait at least 25us */ + udelay(25); + + /* Enable the power */ + writel(PLL_USB_PWR_MASK, &usbphy->usb1_pll_480_ctrl_set); + + /* Wait lock */ + ret = readl_poll_sleep_timeout(&usbphy->usb1_pll_480_ctrl, val, + val & PLL_USB_LOCK_MASK, 10, 1000000); + + if (ret) { + /* If timeout, we power down the pll */ + writel(PLL_USB_PWR_MASK, &usbphy->usb1_pll_480_ctrl_clr); + return; + } + } + /* Clear the bypass */ + writel(PLL_USB_BYPASS_MASK, &usbphy->usb1_pll_480_ctrl_clr); + + /* Enable the PLL clock out to USB */ + writel((PLL_USB_EN_USB_CLKS_MASK | PLL_USB_ENABLE_MASK), &usbphy->usb1_pll_480_ctrl_set); #else struct anatop_regs __iomem *anatop = (struct anatop_regs __iomem *)ANATOP_BASE_ADDR; @@ -213,6 +250,20 @@ struct usbnc_regs { u32 reserve0[2]; u32 hsic_ctrl; }; +#elif defined(CONFIG_IMX8) +struct usbnc_regs { + u32 ctrl1; + u32 ctrl2; + u32 reserve1[10]; + u32 phy_cfg1; + u32 phy_cfg2; + u32 reserve2; + u32 phy_status; + u32 reserve3[4]; + u32 adp_cfg1; + u32 adp_cfg2; + u32 adp_status; +}; #else /* Base address for this IP block is 0x02184800 */ struct usbnc_regs { @@ -289,7 +340,7 @@ static void usb_oc_config(int index) struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + USB_OTHERREGS_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); -#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) +#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + (0x10000 * index) + USBNC_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl1); @@ -373,7 +424,7 @@ int ehci_mx6_common_init(struct usb_ehci *ehci, int index) usb_power_config(index); usb_oc_config(index); -#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) +#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) usb_internal_phy_clock_gate(index, 1); usb_phy_enable(index, ehci); #endif @@ -392,7 +443,7 @@ int ehci_hcd_init(int index, enum usb_init_type init, enum usb_init_type type; #if defined(CONFIG_MX6) u32 controller_spacing = 0x200; -#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) +#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) u32 controller_spacing = 0x10000; #endif struct usb_ehci *ehci = (struct usb_ehci *)(uintptr_t)(USB_BASE_ADDR + @@ -506,7 +557,7 @@ static int ehci_usb_phy_mode(struct udevice *dev) * About fsl,usbphy, Refer to * Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt. */ - if (is_mx6() || is_mx7ulp()) { + if (is_mx6() || is_mx7ulp() || is_imx8()) { phy_off = fdtdec_lookup_phandle(blob, offset, "fsl,usbphy"); From patchwork Wed Sep 16 12:56:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312383 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp413482ilg; Wed, 16 Sep 2020 05:32:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6ExSKTorko2j1gZKkdYhDzEw3mPT5yvHE/pB8i5G1WQTQ/XXHhoSOypHPS+Xv/OvkHMYN X-Received: by 2002:a17:906:d9c3:: with SMTP id qk3mr13250065ejb.207.1600259532146; Wed, 16 Sep 2020 05:32:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259532; cv=pass; d=google.com; s=arc-20160816; b=H1YH9SXTCCarlR2Dp2qUMYBkytWcrgizxhQ2t7XvApRAEkhVNZfZi2izrwCYrij3b/ 8omjumQ5K6t5FMSCBYUAW4gaTldnC7UgivwD9Jm7cSo049Gfa68kMeAM4c6i9tdVeknJ ultu9jsa7nXYCs67Ir7gc+P8QrK5fUlwU5SwPhrCKQCNTGytTe/M8VEw4E8Q3BNieJgC o+gb1C1F65buoAIwD6zNKa+NqIgXZLb7QnTd41InJCt4V5kjmLRIAc9uzB4frv+bwh72 ZInAuMrs8aHh+9+DaxqcwBYQ/JsX1P/dHF22Z9RK+OwxAhF07Gbw3N+NB5hFCXS3wUdS akRA== 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=WJz5GLMp/iH8XmlEmbQLs300oShWfNYYmle86uH3yI0=; b=ADQnPKE11GZ2YB6o8lKS9aQFYsxMqZNk4u6RI3O2wyBSgQ2fO47D3HON7qc6ZDK2R4 zKMsrQt5lzEh6JRZHYhzf/2WjKbyGxvH8smaMC2ejIz5QT5Vr6xlNRLA2bmOmpA9qWJK eoFYj/4GSM5qZma3Ias/VzHwTC76cykV/NPHQ137Ozh26ZwklqcMdx80BJkV1yHdpE/P 7z25oTBqh3lyfd9AtIWG4+8Q72XrhQGFmFXu4X0Th3R+fC3miR3QTDgBDnswXTHT6+K6 DQ+QKBKn/KbSknm+qT4FipzgcSggMKQopbyWYX98DyzlNuZAsttftT06smVC/lPsXbyy +mXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fSRSkMT9; 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 jz19si13088685ejb.241.2020.09.16.05.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:32:12 -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=fSRSkMT9; 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 BD3F982338; Wed, 16 Sep 2020 14:31: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=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="fSRSkMT9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D8748232F; Wed, 16 Sep 2020 14:31:20 +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-db5eur01on0613.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::613]) (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 57F228231E for ; Wed, 16 Sep 2020 14:31: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=eR8ZK5njND8Y1I0fP6/7t3WC4v+SZvx57ELHZHEWHVUDPvMOpJ3kLGqnUKmgbfLHUIZYm9u1BCx0Y2k1T/EmXF4tXccIqYX6h3Yyw8OuTrFkCSSsvxuqwDvRlk5Bqfl3Zqc75SsF9xUkihQx1midwL5sOSxbKseFVfLNWCnLWl/Ua5xI/QIZEMV9FXC1bQQ1JTUOxlOo+W5uZNAfxMPdt7cDz4etvzhfD/DhIY1NEakVLekEoz4dXL9J5XzquEIGZUUys014DmSRLvbRItiWGW30sOLqW/n+fXNgA4bEd/983wQMK2KW0yXDCJI2B4BDzk1j0CieVA3tLmQgM/ge2g== 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=WJz5GLMp/iH8XmlEmbQLs300oShWfNYYmle86uH3yI0=; b=TU2erRjV6ODciIoODz98Zi4ttLlyHuiV43PDqD5HNWDLfmxXrkIZuHCHS97DADNLNk+JLZ6oGMyvPjyo1k3U5kIQxQH3YXualOUy4w7GyMccA+cv3BtT3oNSZ0iozyqzSocO5oMsHNsaFZQVwYqiEhoxc9xSRcA9Apbxh01FBmQul65LHPUled70N8lVQYj0SzAI9C2Z7TzYznHiQ9EKsL+mFLy3NhaVJS+iRpH96Sbr3/T1YNuGhXBZFOPc4dcjFj6A8zubNzMD6QANpdaxtJSjoo36Jv6yr2YpAyt9tMDcvldrpiY/IJDG4fJE8TrAEShP3PINlG1THMpPZczlKg== 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=WJz5GLMp/iH8XmlEmbQLs300oShWfNYYmle86uH3yI0=; b=fSRSkMT90O+OZsDWe+8qJrDrFLf07uJdzpNNYEV2Scv4mO21q32/bq0BkmurYvTGe4AbPb2ODjyNyyvdV7QRw09y5zMsRMiaXfeggAuAOhKQM6Ta8yM2OPAO0B8s0cdYHken8YhRCQUxc4pjHe/yBCN+LrfaaG4pe/khdc2Z4z0= 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:15 +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:15 +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 04/13] usb: ehci-mx6: Turn on the power domain of USB PHY Date: Wed, 16 Sep 2020 20:56:56 +0800 Message-Id: <20200916125705.4341-5-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: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: b64f517d-6b14-484b-90f3-08d85a3c679e X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Le/ZwQSlQI+uPcI/hljZpwF+Ip9OxLXg7C1wLX16c7OI3Oqhna2vrWdrVgE1kkLeNJMvjgGP0iQw+e258aznt/sntD5bHixjQHQKROULm0dWvkxAMjpttrYNygBUYgsCgsD3GAVmFpUsbqYkH+f4P7lI02Jl0PKFWPA/03OWJMAJ2dxgrVPAS2vybKvzORHO0kvXvZ2Hfs4HCCEVlJIwtQFJHjhhjz2VqoKbEgIqDQlWJgJuI7pQTiPL53GqBPLY/Ccbx9BO0CiYsUxEpDdyzazzBFJGNO6IcCFRnTDowgSu9uj/krOfkYBQSsVsi7nT9JGRwMQwLY/jPBnmNtcIdQ== 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)(396003)(39860400002)(346002)(136003)(376002)(366004)(4326008)(66946007)(66556008)(9686003)(26005)(8676002)(66476007)(8936002)(54906003)(36756003)(6486002)(6506007)(478600001)(1076003)(2906002)(186003)(16526019)(6512007)(52116002)(316002)(86362001)(83380400001)(2616005)(5660300002)(6666004)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hfT3czIq/2NNisD+ttKfk8AJNkLxEGzS3qgAyrU4BI6/kNjLs/yZBztJKZuK/eUzsO3yT0p05WOphaiJU61qnzQuqvPFkSMOG+XBCYtjxL3RkuMC8GSj4ZdXhIujLgyX8uOMxDnn6XGr18PmEYLsI0nC+bakMYnBZGh0MB78QoNtPHyqKO/9QCOFa3kiw6+OkrjNFCHVUgPq007FKF9Wi2z6bBdFw4a16d5o/343saE3jqM6wBFyeYcbimwky43uoxigqqVpoKFb+8rnkeIzRh9lkD+7SqjrkGQm5F0+t98wjiar8l5BY+Kh/Ns8BtH96r/8YZh7YIEhIPIXymiIGTYp/dCvFI8Elc1o2sHRJi9wGtGU05A52d1nUHKK1LyTt+cTGPANyVGgw3bdPaC/L9NKJ2IKJ3QQbrsT3yPWDNrtzmBQeLJx2OfIS6hqPkKyZ+VO0bIpnfbvHeJYUws6mWBhDN8Df7K4avA6rlipBqOTG4p1oDKaMPqA+54m90WTefixSyockNvC0doI0LV+qsmO/K9kEBVlp+LWIQZgbiPf3IxNOX2KE52/zODE+bc9Xlv+aiquOXHbdlivrU6xKdggF5nN+daRzEVbalZuOwX4K6DI06klk36yZdoZaTvvIbwup+v90OEA4jkbfjpKhQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b64f517d-6b14-484b-90f3-08d85a3c679e 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:15.8486 (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: +TGlilXsXjB1XLzpELkXBJztEdkinK/vqD4AZfcsGGIyKTuMWi+hfP0YJxtagaIZcxDBJ4t35euiBxj7ykYvhQ== 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 Since there is no uclass for USB PHY. The device won't be setup for the USB PHY node in DTB. And its associated power domain device won't be turned on neither by DM framework. This patch modifies the ehci-mx6 driver to enable the power domain device before access the USB PHY. This is only for DM driver. For non-DM part, users still need to power on the USB PHY in boards/SoC codes. Reviewed-by: Peng Fan Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index b1721cd915..0727aafc92 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2009 Daniel Mack * Copyright (C) 2010 Freescale Semiconductor, Inc. + * */ #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -569,6 +571,20 @@ static int ehci_usb_phy_mode(struct udevice *dev) if ((fdt_addr_t)addr == FDT_ADDR_T_NONE) return -EINVAL; + /* Need to power on the PHY before access it */ +#if CONFIG_IS_ENABLED(POWER_DOMAIN) + struct udevice phy_dev; + struct power_domain pd; + int ret; + + phy_dev.node = offset_to_ofnode(phy_off); + if (!power_domain_get(&phy_dev, &pd)) { + ret = power_domain_on(&pd); + if (ret) + return ret; + } +#endif + phy_ctrl = (void __iomem *)(addr + USBPHY_CTRL); val = readl(phy_ctrl); From patchwork Wed Sep 16 12:56:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312384 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp413826ilg; Wed, 16 Sep 2020 05:32:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/9zOfbVSNtodfgN10dKuiEFleYbWDbiV8ae/F89hTXvMnCdUnvUm7F1l4rjhdKGojBf+w X-Received: by 2002:a17:906:4755:: with SMTP id j21mr25664954ejs.228.1600259548215; Wed, 16 Sep 2020 05:32:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259548; cv=pass; d=google.com; s=arc-20160816; b=KB1YhTXfR0btiCioghZc5Z4lTfuTQndC5l8GUmO4iyP+Iq6Ro8K2pP465BIySjstEu ZvSe37gBpCexUZm1QC+B5Li1l85DW0SAFxO4R7sNxkJtaHT4cY6Da17QWOtUcjyH4/yT Tx5sWzNAZiYaMqsXFTTeukrpH3jCqLvDmXRDmPbfB6AMVbibrLyJ1lWDPQt30sq0BIb7 doSyGCirqxUmbgfWtTBzD8ZRJbhryXIZiQZQg8/zk68u084LTPYEH5bQQcligg9/fmU3 010XnSW4SG8xvtHB/IjRIOClHX9GLCWdsWdz1lwQ3FiWoRCKLppCqFx27mDuygK7lk6h Htww== 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=61W1vWuYRIgXtJQxVsKccDyQV1F0Yof69Z2cRKgZd8g=; b=Rnty/LpRE5d+/BEXkVsl44MOGiiKzx1Unoa/WtuvAGXNFZTUyPGNuJa9+TchCnRxHi 4u5Nwin7R4q7c0dM641i1b0eOTQKd5vvBxtVoYQqn/oly6IXCMwZE2+0otlfMBZoZwu8 qvc8V6sYL3MU0mTsPnbsSKkO4he7fk1TfWCvtmj652yRsZapsCMzVJ1qv9FE0U2ceKwm q1l+wjFlia6kaPUev7OA9ZuNoupD0Qt6NokiI1IQPaSxh7Om+JcH5cpYrNNlk5MMHFAz /25PP0ILpX5Y6ZMntwT01TUYYMDHk4tLD2xQPysBCzTyuBjC0J+tgbYSElSmHfFej3xP eiIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CAhVhaZs; 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 r10si11877963ejr.168.2020.09.16.05.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:32:28 -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=CAhVhaZs; 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 DE4638234E; Wed, 16 Sep 2020 14:31: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="CAhVhaZs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8005B8234C; Wed, 16 Sep 2020 14:31: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 EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0601.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::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 7337082322 for ; Wed, 16 Sep 2020 14:31:19 +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=Thw1jkDNZGFOg2WQ8WJdMJSy9OgdEYqy/tCwgTx2UPOSGKVb74PX9S72cOcpMbsZNN5oVeWQlDc11avYXaj+cFyTgkOD/eRMouRHUAiGUJaDD+UJE45zZAsjftAqn2WM6rhaFMFnc601YDHqZcRqy1PbA/SLoIundtf+NoBxSL4V7MfNT14dEgHYNW3HvkFOHdjIzau/PjNNUiqjpj50o7NzRRhVf+1MZOHr3jOsSEdDhCgqvVw8nAkBfEk8RIGcW3lRm4t+qem1EnLsdoH1l3pZEL8HLNIkiyk2dxOcS6IeAmOduPL/7YMTdBSdryoB8DxsAHwZOXv5WXMqSy/k9g== 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=61W1vWuYRIgXtJQxVsKccDyQV1F0Yof69Z2cRKgZd8g=; b=TVFbfFNDEQan4ia8b3n8ANlnxJWSNSp2GGiga5Vdari1eyY9q2i2i0HhOUekkA/Pmh06DyUChW3S4Nd3vwpqYIX/11tttCfleDVaw28aVQ+njO5vS9rRgYJkUmTP27fWEl/TQFcrz98WInoJtA/tGoPVhIco92xqvgmyuDGlh1p6cVb5EF0UUtV5JxYrdrYfkvbh2zoWU1ySDF3L0rAri7JuzMPzVC4IU6Ztt6xz9Vd6EPrxd5F/nyVESalRyCLDvpoIQf8h7I7lhdQ/70M35ZDY7HZneIu0WRWN27DqkK1ZWVss2Kgw7Y3jeznf+8zUR1A8+PRRvvfzWfQWPnEM3g== 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=61W1vWuYRIgXtJQxVsKccDyQV1F0Yof69Z2cRKgZd8g=; b=CAhVhaZsYHarY1UDxZ2wdlDonF0hEGML1UC457bwmRBmEymtsuqkJ2NHdAcxSPS9vHMnPsQXkfmKC7nJSi4I2dLP9kgwNg2lkzQ86aYAG4LxERZ8dHl2mebMOuDYESAQJ9Fr+7bpxWOgPzdC3uczTscRIHQPq5Fy0pPcjAP9T+0= 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:18 +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:18 +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 05/13] usb: ehci-mx6: Update driver to support i.MX8MM Date: Wed, 16 Sep 2020 20:56:57 +0800 Message-Id: <20200916125705.4341-6-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: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: 456a98d2-173d-48e9-e15e-08d85a3c6919 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DS94+lqFu1vxfJw4/GwKTQR0jKgep8Xoxarm2h6ByefqI9Kas4NJZTeBkG9MBJEduoDVCOqp4VkP+TpKF6cS+XHQnI7JuwrQrY30M0zwTCmHJ7TMSMwdwHWcfpw4QD3UPqor9IyRMJ3ulYyEFBG2j4v61kUMmIgE6DzRvTwFaMv4u6I03cat07OSARQmuPFw4hSMXb7HPQTGQjLKBgffkJgZJCUHRDaaFA6Dh8BFu+i8VL4/P7FvAP/DerRZFPMXw/C8GIQ9E6YZfZ15Gwy9CUxg1myQ3AXC5MqKVyU1ODrKay9lHgaz9QFvf9nX0Ayv+cGFbq00A9PbeO+ZRLDg0A== 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: iJBN1vq3T6fFGVlxweDt6DOpA7Wr/vGkRikpvoo/1iXM9W/2GoPUYgunDmfnTlgQq56Lhzjw9esX3MLu7rUVs9ppJa1RbXs/RAp6c0+Oa8VsLS7eRqMek82L1qaHOfzo8hiUJ+yGzPyqKiEDYqj0O2byLuoqw9mYCcTEsu/29nM/AxBH8BSh/ui5hOOo2s37ZCoDApIQMWZ8FgpmwR7kcXUZkGZm7G4rTMHS1aI1oN2mpNxMv3SQ8jpK1n4FMFOd2HjaX44M4qJXrpTY+K8YHS6ABIEWiGZsP1m3SNnYBmCeibR0casDS38j0Iq0zGETAt4LpHM8bWhmXMWYNTFQ3b9V1IQ1cHPlkm3p/oKnPg+X6YZXCqW8PDiwerVR9tx3BeH2+xB0mrgPKU9hnVWVKyDNJfvyVLxhvsdYpwxguhHRlqbtgE1b9ilpgATJZ4k9TfBNXIJmDq5wmI21kdF8G0LrWhGFfjlDmu6+I8DaZsLIapw/rIASZaljg5D9yB2OUZoSBTDKM61sMG6PfjuHFfkv9xNL1VrEibLQflwb7UevVhXqCMFyt7asWH7LvGWLvHzq60OHeBG8BZgQwBI0EIEznUgj46699rHC7iRDokD4vCYJaiSj72x2fkiUEf3hv0fqsw1Fiutytxg4l8CXSg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 456a98d2-173d-48e9-e15e-08d85a3c6919 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:18.3125 (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: 2Alqamar9JBzvoOvPjAB1ZK83B6oCenHvBZuQm9cisOqmYSHcud8hvM+hhUcnyHjDLfPDrbeyHy5Z7QuuLjJew== 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 Since the i.MX8MM reuses the otg controllers on i.MX7D. We can use CONFIG_USB_EHCI_MX7 for them. Due the TCPC and load switch are used on Typec circuit. Add the board_usb_init and board_usb_cleanup to ehci-mx6 DM driver. So we can implement the TCPC settings in these board functions. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/ehci-mx6.c | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f48547caa0..1e2c5006d4 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -147,7 +147,7 @@ config USB_EHCI_MX6 config USB_EHCI_MX7 bool "Support for i.MX7 on-chip EHCI USB controller" - depends on ARCH_MX7 + depends on ARCH_MX7 || IMX8MM default y ---help--- Enables support for the on-chip EHCI controller on i.MX7 SoCs. diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 0727aafc92..1db27949c6 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -277,7 +277,7 @@ struct usbnc_regs { }; #endif -#elif defined(CONFIG_MX7) +#elif defined(CONFIG_USB_EHCI_MX7) struct usbnc_regs { u32 ctrl1; u32 ctrl2; @@ -342,8 +342,8 @@ static void usb_oc_config(int index) struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + USB_OTHERREGS_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); -#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) - struct usbnc_regs *usbnc = (struct usbnc_regs *)(uintptr_t)(USB_BASE_ADDR + +#elif defined(CONFIG_USB_EHCI_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) + struct usbnc_regs *usbnc = (struct usbnc_regs *)(ulong)(USB_BASE_ADDR + (0x10000 * index) + USBNC_OFFSET); void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl1); #endif @@ -445,7 +445,7 @@ int ehci_hcd_init(int index, enum usb_init_type init, enum usb_init_type type; #if defined(CONFIG_MX6) u32 controller_spacing = 0x200; -#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) +#elif defined(CONFIG_USB_EHCI_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8) u32 controller_spacing = 0x10000; #endif struct usb_ehci *ehci = (struct usb_ehci *)(uintptr_t)(USB_BASE_ADDR + @@ -513,6 +513,12 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) struct usb_ehci *ehci = priv->ehci; int ret; + ret = board_usb_init(priv->portnr, priv->init_type); + if (ret) { + printf("Failed to initialize board for USB\n"); + return ret; + } + ret = ehci_mx6_common_init(priv->ehci, priv->portnr); if (ret) return ret; @@ -592,7 +598,7 @@ static int ehci_usb_phy_mode(struct udevice *dev) plat->init_type = USB_INIT_DEVICE; else plat->init_type = USB_INIT_HOST; - } else if (is_mx7()) { + } else if (is_mx7() || is_imx8mm()) { phy_status = (void __iomem *)(addr + USBNC_PHY_STATUS_OFFSET); val = readl(phy_status); @@ -689,6 +695,12 @@ static int ehci_usb_probe(struct udevice *dev) priv->portnr = dev->seq; priv->init_type = type; + ret = board_usb_init(priv->portnr, priv->init_type); + if (ret) { + printf("Failed to initialize board for USB\n"); + return ret; + } + #if CONFIG_IS_ENABLED(DM_REGULATOR) ret = device_get_supply_regulator(dev, "vbus-supply", &priv->vbus_supply); @@ -726,6 +738,15 @@ static int ehci_usb_probe(struct udevice *dev) return ehci_register(dev, hccr, hcor, &mx6_ehci_ops, 0, priv->init_type); } +int ehci_usb_remove(struct udevice *dev) +{ + struct ehci_mx6_priv_data *priv = dev_get_priv(dev); + + ehci_deregister(dev); + + return board_usb_cleanup(dev->seq, priv->init_type); +} + static const struct udevice_id mx6_usb_ids[] = { { .compatible = "fsl,imx27-usb" }, { } @@ -738,7 +759,7 @@ U_BOOT_DRIVER(usb_mx6) = { .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, .bind = ehci_usb_bind, .probe = ehci_usb_probe, - .remove = ehci_deregister, + .remove = ehci_usb_remove, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_mx6_priv_data), From patchwork Wed Sep 16 12:56:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312387 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp414179ilg; Wed, 16 Sep 2020 05:32:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhbS1C0bUXBm6sUruO4JxE3XSGW6BvtszRyKmQCdsn+t7fdEeb0/nGg4adrDCw7T/tZW+P X-Received: by 2002:a50:d61e:: with SMTP id x30mr2641641edi.70.1600259564164; Wed, 16 Sep 2020 05:32:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259564; cv=pass; d=google.com; s=arc-20160816; b=wchZV2lKuMiLBBHSGKuTWQOQmknnQ+Ajd6YqWlSTCZ8WmLK8ku6sHguJxTtA+Jggqo BStFH15M7VmjimRzmSlwFDkaosQv/oe2dAjWbzrQ3EkwylM/rq2q64edrwCZTrpDz1pk XCpycxqeyp0ZXnLFHzvaLoRhKt7RXUgzwPT7IjtOrs79JTHHlYUBiF+y3Dc/fhUZTjj8 t748MU7EzgTkn0ssORqNCWXCwXhy8EH3Cb80lDpV+sD4oiRkTbK0whgUB22+4hRSWogd eYr96WoT+fYV/TK4EHLHo/FPhjYxuCf3B4w3KrZpUrSC8t/66g1WuJbJTrGdJHr2zygD CuVg== 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=7VxvI1UM8Cv/s/Wj6jrUhcDaO/qR8j12KWZMs66cM5I=; b=zeWE5OeSNM0iFa08cGFVET+/vsn8Ewhm5TeicoaqVqLdgoWPU6RQFtNRF159QxVSBc H8pd0nOvT0Bag665iSijb8FDYg8L+PQOtxDE1bHdnwTuIvozgmVuLDlHD7WECsXy1r7O ssLmHV+2J4F8bJvcPWokGQHSxx0eUPk8X6eCGQlvK+IrhXOR1ilSeHtdXqHLOdhl3a+q rkK+wCG7AHCBWsqJaXfmXNNzrG+P//o+OAPs9daeqJPDdG/1jNWDLwolG8cgwGdqx1Vr adCSnY84qrqGd0J058juWit3okZrdd036USDwDhxve6xdlsL4p8VcxX9bzhe3zrNtyGv 3QoA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=J5oNf8HC; 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 y59si12016824ede.24.2020.09.16.05.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:32:44 -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=J5oNf8HC; 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 845EB82355; Wed, 16 Sep 2020 14:31:34 +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="J5oNf8HC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1350B82338; Wed, 16 Sep 2020 14:31:25 +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-db5eur01on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::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 09DCC8233E for ; Wed, 16 Sep 2020 14:31: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=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XGkvt05s+C+UuhqJ36zkSKK2QdBp2nhBpzQOVYCjhT0v2blWwnA6qZbrspqoeZVivXMbK9h6wVt4PHcIT4qgC8hSFONkvewyTOoNnG9M9GF9Z6Z/QGtYISYVyHPsLV/vRLLyd6+XbS6RHkMPA8Xmd0l8JOdLny+114UVMuFJ0zi1KQfzLMoiJtLXJxNhihAMRRFClsXnHOJ02z6upTQfdcaddkje5dYNJP2MdikXC6uz6kst71YmEEDpYV7QTQapoA0auw+Z/c9CJGXFwfrSXKphIgpColWj4UzBeXExuNO+X+zPqNobh/QoQO9lJ2fMKAq50Zsp+gfZqWTUik6gNA== 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=7VxvI1UM8Cv/s/Wj6jrUhcDaO/qR8j12KWZMs66cM5I=; b=gCbSs7LBqvUA+q6k99R5EmmAut2HPS+Npeawwx02aJgFe9qtpdpwCmprCF//HUd9W941+tWrv+OOqdHEEKGGParBiG5O7aBpA4bXsMNROSYT8M/KQ5V2AgpJks88WJbx7Bpl2NRW3zWMEA6iAARtVkD3TZQIJxnvA4WHMP82ofQoa/QxsNUkLXIqJVEoT/kHVxgWk3KrLSCe9bJKDgiJjNsBWC6dVnOucVkQMy1O7Z9wq2BYFnwVvd+SYP8v2Miorh4SP3+QajhKzcuypyGUf6BiWu4iL7I3+qLZxDtBo7S3V8EQI0Z+tEOH33/Ei8liYEZCozf8pbj6rV83L9zirA== 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=7VxvI1UM8Cv/s/Wj6jrUhcDaO/qR8j12KWZMs66cM5I=; b=J5oNf8HCZ2xIxVgQMTMgaXcJKxDIOQDxR7YpvJZlhI8dDV7oxRwFdpDxiU7jc6Fh+KGJfgZdmjwgWGyuH8DZZKOC3lu/Xit7KvW2+8oakH/xL6ZAWQram15u++Xod1EAB4dUgZtbdJBbEDR83NluLOoKL+foMFn/xjnqp3Z/zu8= 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:20 +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:20 +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 06/13] usb: ehci-mx6: fix controller index for imx8m and imx8 Date: Wed, 16 Sep 2020 20:56:58 +0800 Message-Id: <20200916125705.4341-7-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:18 +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: 4c49145f-c61b-4ec2-3f1e-08d85a3c6a8f 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: Gs6ccT2+yWYnEA1YQ8nMt3w+7uEFl9ylREp+DVjgmMSEPndpcOumoXST0z9FunP/YPUYlXGoy8zZma4e7/Vvo8XJj7qCIEXy+RFebDA46Wit/oIiCy4NXqQib4w3wDLcazs24g4uUVJfmM8xor6rR0hVMY1q7UxMcardiXRhrsu8JgCL9xjyIx/x3MzsSIvBBhWgIu0AK95Gy/VfPZAKiKlewFjmzL29PSOohmQAL945kk9Te4DU8vaRvRcqXHe/W0mPRpW589ruGcRr1zRR6chn4ODYHg4PdSkPf7os8Oq0nBKBAsv91I5ucoOv24eNwg0YCaTvneajmt+aCDSYEm9NfxXoqNnZ4YCUn1LoNoFnzPEn8RXti/0iGWlphhmC 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)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CUhoFwqmBQgjGXZYRQfEBfCLaknE01c/yy4d6CI1jTABECLo3yePHK3X+beJrAI5FwHF1eBROIIHOkiW4PRoXS/BPy1MIoYSJYT4gT4lGEnv5nxMHNCVMuHKwfu41s2eNoJ8/O8BYw8iGO8t0CfZWQjr6BcuvS35BmxQQlWZ5RFaXh/JNP0fltSFhd/XQxQzyEEX/YxUb3q62EZt3MsdiP0itGYNxbeWCQubR1D6hy5811FaW/2A+TfRDlA3D4mpDV8zCowpUITBIMjzTNrgkgwZgD/KbSYT9z8cXYekCHEdpT2x5Xey4vMN4tJqw+vFuCcLGwZd9iviOv3V7y53xpE1p7zt/gLYSKeArX1N+s1jYIAIk3xy5HGX+sB4EMxiOpCw1uR4cEdZNwQ9MAxI/3XbFHDhh1eDNaqFycooD5UNucDZRYpEm515cbCxfTJ9s0Vdbz31L2HS3gsPG8ZDov+wSRkl6Cu+j2lSuc++jyrAsCvaHEg9UXpIfBKMqbvmiB3VSdIKysTRBgoqxG1T1X4S9iyghyf0fDLtx2YkCVbksyuyG0Pc8PLTjCZBQOPi/x3PcJC4/HDprQQ256Jy3tgKwdBe2Rhbw0bj/y7SsG/XnbBCA0sGaUT+fgptZGteU1cVG8hNDcN4UKQyzJtY+g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c49145f-c61b-4ec2-3f1e-08d85a3c6a8f 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:20.7304 (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: FmDnJ4Df/qg9f9Tq4j5rG0R2s4WTw0+rCCwIQOM0mFbe0BuwtHzuO9h/1skTpWfZVvnvRbWyy20K3+UVVstCzQ== 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 bind codes calculate the address offset for controller index, but it is wrong for imx8m and imx8. It causes secondary controller fails to work. So fix this problem, and also change all seq to req_seq. There is another issue here for imx8, the codes use runtime CPU type check. One iMX8, this check depends on IPC communication with SCFW, and need MU driver been probed. But the usbotg is configured with "u-boot,dm_spl" property for SDP download in SPL, so it will bind in early DM in u-boot while the MU is not bound at same time, so the CPU type check will hang. Fix it to use static check. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 1db27949c6..96dcf7655b 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -665,7 +665,11 @@ static int ehci_usb_bind(struct udevice *dev) * With these changes in place, the ad-hoc indexing goes away and * the driver is fully converted to DT probing. */ - u32 controller_spacing = is_mx7() ? 0x10000 : 0x200; + u32 controller_spacing; + if (IS_ENABLED(CONFIG_MX6)) + controller_spacing = 0x200; + else + controller_spacing = 0x10000; fdt_addr_t addr = devfdt_get_addr_index(dev, 0); dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; @@ -692,7 +696,7 @@ static int ehci_usb_probe(struct udevice *dev) } priv->ehci = ehci; - priv->portnr = dev->seq; + priv->portnr = dev->req_seq; priv->init_type = type; ret = board_usb_init(priv->portnr, priv->init_type); @@ -744,7 +748,7 @@ int ehci_usb_remove(struct udevice *dev) ehci_deregister(dev); - return board_usb_cleanup(dev->seq, priv->init_type); + return board_usb_cleanup(dev->req_seq, priv->init_type); } static const struct udevice_id mx6_usb_ids[] = { From patchwork Wed Sep 16 12:56:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312390 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp414482ilg; Wed, 16 Sep 2020 05:32:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx3Ia+eelZetOUQMCmagCzwqS3l/iBNPcZ41mvd4kS2k7tzib18jvG34V2GCAIxWSskAjz X-Received: by 2002:aa7:c148:: with SMTP id r8mr28076228edp.210.1600259578055; Wed, 16 Sep 2020 05:32:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259578; cv=pass; d=google.com; s=arc-20160816; b=p6E7EDwx1Ur8yijMsGRP9X+JCy/SRcGznDMQKeCRMkDQyIWQKjL1mCGtL2O+sFNyl3 sZXpe/RHf5V18gUvelh0Fy/Ga5UEX1hgjK3kNfzb8HR4pS/n4QNnBRvtodNQUC6B3gAl ZR+kZHI8YPiAx0x+Py4o0O5Pv8N5gRc3ePaz5P/Ia1U85h1JkfA3JWa0hVCt3aJkCG32 zaf6DxltUSv896JgN8ep/cvbdiO4466MdFEYz7jV9ShCPQR289qgdC6XQJ5SbhGImuDZ 3WH6ntZRxx4Bn/hyA8hjzEvucYTzs5+ZR4xkU1ruOu1LvfqVSHJhVD9pZIY9MTZjEARd 8pZg== 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=xQe9gN+fnPWXwJcBWlqpw6ae5mIqWkc3tkabuKOA3nw=; b=vsbCC7C/pqRMs5qvUvPhhlS2a22YCQ++LEm27drqsj372b3ZJ1HvZMbB8EI4kzsILb xlpjiHJXqskFHjq8s9/LkrIR+GeDoj8J9hQnBB5Gnen7QsIinTds0NvWtyYBKHSaMJ36 AjpmNV1pjyOGowZMI6Ynlpox8vaLcKxfBdDMiTaf5jbM3XRJhkQHTsQK5JHXJdggC58j OQ62gEgXrXtgXxJ0roLoKBWEk92wMZbdDqK+rjM3fIbA9qJwIGOEsswruHYn3+gnPpau ScXJUYbHYVb1mF31GiPKCIkXGWeP6GWcP9nyoKEbmR+XW/ontToS6LHxjdDVGBdLGCVQ ijVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jPHZzWI2; 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 o13si12122618edr.482.2020.09.16.05.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:32:58 -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=jPHZzWI2; 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 6547C82362; Wed, 16 Sep 2020 14:31:36 +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="jPHZzWI2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51FA58233E; Wed, 16 Sep 2020 14:31: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-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 DB77A82337 for ; Wed, 16 Sep 2020 14:31: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=GF7uSlTRKnJTuh6SrX18H18dJ1+t6YBelEPBZgdntrJ7os/+qj5Zbm3JUR1ErkNpxU0D6wwrIEwUh3wqskGd+AcQwulo9So7saX8tUcibgg7lhRaFXMU2tYuxOImuaudGIGyDB9B9gBjg4znBlhW9y4Zy7K9uQ0gZQCU9BBYQQUq/PkJfXIozCLF/HHffmgnLeJqELV/mS8COOYwmEoLq6UXzT7P92SruFe7wkzqB1hvGT9iXfRSgqS9WOBtLBGtNhh0Lok2vs9PGkhqELuLWREWlV2DO/nIOKLe/iy0bVetUQoVVLsiPN2yvohowVuf9qKzdyURFOLMHqIN6QtFRw== 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=xQe9gN+fnPWXwJcBWlqpw6ae5mIqWkc3tkabuKOA3nw=; b=mZC4JITCfg2p3cCkLdto8n+vTiXD0kUwzh3metH8jHXtFu95qaz+5J/Gsem+06hG2s5m8BFoTAFXjmT1kBv4bKVcISb3bRrXvwmc6Xq5Y+UradpTP095+LpvzFcykWLWb7eGLPhOV9uuoFiyLwo5mMqLIcV/fXXF8BJf1yU0AnYL1k5DEo1sfamplNclqhtsP6pb8JpoCQUt7WTA4qE+E2pjwxH2lnpRmZehcsD7+i3KBqh6Uj3Oq6bWSEyOeswznSNZaR8HKPjZ4mN89T8aNsOrRsvpLPFCFJBREOB7oDU0AiNJEgDkiaFlUVji4kpav2YWv02rYx/2YojqnnXIQg== 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=xQe9gN+fnPWXwJcBWlqpw6ae5mIqWkc3tkabuKOA3nw=; b=jPHZzWI2NKzorbh0nAfyDx/U6Ac054x3HexsSrX/USiNvgDbKL4MG6zmfbQNM7PYdGqH15UxKlBUCC1bCqxvaQpQrYPkxBeZuEKZMEeB1JCZLKjYMVgETy9Zbl8KM0f6omq69SoqpzoLD7O9Oknqpec1Pl6KyGcZfmOavBwAdq4= 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: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 12:31:23 +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 07/13] usb: ehci-mx6: Enable iMX EHCI driver for iMX8M Nano Date: Wed, 16 Sep 2020 20:56:59 +0800 Message-Id: <20200916125705.4341-8-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:21 +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: 879eac6d-79f1-4557-4644-08d85a3c6bff X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FQDgbwi90+0HACTTO2wRbyTD7VpMxgJo7EzjUA6UaVnLmYFxN+gQdXhA+snnucAbnCjeasWEpb990RFi3mygmZ4MEQjK1Vk5o3xDIpgytIiBpU1AU+q+EscUzsZJ5V0RvayIeWLWZz/5QqaU4BroTmKq5Ah1heAexPX+MOpQsmM086akI4XN8/pBIxST0s5XhTYcr2+wQoM1a29YgUuP0Ctn+HxB8CH3bPA32d1tHc4je08FZ/Q44kr3ANxYO7UeH65rZ7sV41+a2syS0/998PbCbhMlcncbQqulN4lwqnTb7x0KboXm7gYvLz8v/tsruJTrwnN1ZY3FLj3qFfU0PhiQXBZ+eLWRLadYog9A1+CUktz5RYzGp1kJRINBUi+c 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)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: e7vyaJXq25pIcL+qgcpJOanzUBQXLN0122L9ded98UDgL8EH6PSQN9vWSHfzbpMWDV6mPnBmG1VkiTeXC7NidJya67FH3RSWgAsaYR5P/Rxjftwjfr3kjxodiqCndHu53PWDvnQ7rAL0DQtn7hOl6/pLxOXCQa8mCukEaQ8mdlR2QET14uoH261ZGj93oauF/0IdzzXM7HxAYju9wDV2Qm7A/3qp/RKo+tLuHTSWAOT4oeRsUXBb5xdKYpTGjSKUsbEzVKjYkJ7r3a+gEXF+E379uMOL8EG5JvlE/nFp+EIvZ1PWvFSU+atDWt/RgagFUf3X8ia8rTw92II5KCYzwMwUZKCXxLEQsW/dZbpP1zmB/+UjWO0t3ZUsng0N8tjtTzMVh4zwIXYmkWaLVM3pw9W8XWtWsgR9pJrDg2aubDKcQY0Dtp5OXNIN17g/ahC9zvZJeNne98OkDktFpikzulbV1a5z0lhr2EqcISM4ZshPo7xIC46lWNaYOQwnTB5Qj7DmRJmC2lgKh7id8K0eEjRgu4rN1Kg+RXIvtsVjYuVRob1GnrUm6RLPp1YJ7nJR8ktVtABz1BeTZRFd2kUKdMmflWndpqTWWT4Bszg4IUnBiXtHbRgf7/sHuxqiwgiRAQoodnR9eAn5tSpTtjfVVA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 879eac6d-79f1-4557-4644-08d85a3c6bff 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:23.3312 (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: MkV0MV1JaFqxvkF//vwd/m/w1+YTl3aKMs1LEgfSzk+3A7uAchM7Lhz+FbX+FVpakshv9jaAgbIyf6DqfJmFIg== 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 Add the IMX8MN to the EHCI-MX7 kconfig dependency. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/ehci-mx6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1e2c5006d4..36eb1138c4 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -147,7 +147,7 @@ config USB_EHCI_MX6 config USB_EHCI_MX7 bool "Support for i.MX7 on-chip EHCI USB controller" - depends on ARCH_MX7 || IMX8MM + depends on ARCH_MX7 || IMX8MM || IMX8MN default y ---help--- Enables support for the on-chip EHCI controller on i.MX7 SoCs. diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 96dcf7655b..ca015ef2f3 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -598,7 +598,7 @@ static int ehci_usb_phy_mode(struct udevice *dev) plat->init_type = USB_INIT_DEVICE; else plat->init_type = USB_INIT_HOST; - } else if (is_mx7() || is_imx8mm()) { + } else if (is_mx7() || is_imx8mm() || is_imx8mn()) { phy_status = (void __iomem *)(addr + USBNC_PHY_STATUS_OFFSET); val = readl(phy_status); From patchwork Wed Sep 16 12:57:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312391 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp414774ilg; Wed, 16 Sep 2020 05:33:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrCuxMo3Ur99dEXfqDKJ3JhWBx1KQc5MQJkNZxStOsvo6/wQegMojIGvlflkBPSF+usDBf X-Received: by 2002:a17:906:249b:: with SMTP id e27mr24916685ejb.105.1600259591088; Wed, 16 Sep 2020 05:33:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259591; cv=pass; d=google.com; s=arc-20160816; b=wnDUMLAWfvpxT1rjk5TPqrwYDt6IvlOzrFa4QETDM/M9PYYjujl6WjLoD37HLrR6TO TBc702etdfJ707qwdHjrGoWHvfGduqJYDQVsfqSKlzIq+0RuSED3PWLI7R8FpzlQ2KRb w/Kk+578jQI2Yh/OvCHA/sEoSA0DueWfA5t5orEGPM/s6r5rJF1kp2XGiTjaDuRTDL3u v4xEUmwZ4Rd10zLmXCnurmW0iws4yspQvvFImxd81F/g2t/6Fei9BtJuE1B6T03Goyi6 0YloMbs8kG4Y179mmpNbsZwjpyi5VYkDmPI83MNBpIolYtpVQwHDoTOZH9J4TBlj8KyU UGjg== 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=H7u1Qh1VaRmzbuNmgxi9MRNyNdvJBP7NmzF+k2MrypA=; b=BcIDYIuSNbgfhksuZVpODYv+rshPNLVn4GL1qgUfShQFf8yFMpR1kccxvJsVU0qsHv UrliuWp22rSTPOISqDs1tO3AQwkRUqPuLcNknEvnm2YXiF7dbNcmtpbyTconZ9y7Mice GzvwgnR+DEqQ7QTuv3mTDgoLj8vm/Wy1uRn14v93Vn43jpVQB/O25Vg4fAVLZ7TUM2UU AAzCGxgVv61lqgr75m6c+ljeN0rGJBKSEJ7QDW7pcpAUJobZt2+rUCAUX9WVPXC42t3R o+O3x/hCx7DelgOXuacWiiz+bahDEPQ2FpCTDWlYFeIXlGUIq1VhfwtMrfdo1LbRuLRL +02A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ikLbIDLN; 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 gl17si11243703ejb.311.2020.09.16.05.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:33:11 -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=ikLbIDLN; 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 C5C7F82369; Wed, 16 Sep 2020 14:31:37 +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="ikLbIDLN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 638E382354; Wed, 16 Sep 2020 14:31:30 +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-db5eur01on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::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 2D8A582339 for ; Wed, 16 Sep 2020 14:31: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=LIlw9DWM3CyRBeYGGMcde0xhpdwhJGsiI/IKSaIEtSeVVwojMf9jitX80WDV0S0STAv9OjomNttifL6k+J6OBoJlCAeAKDBTR+d2RB74+4vD0FgNsTaoCDPWW0fR5mLgZtV8LKy40UFojGeMqQZgSYr/c2iNEi0uhv2hjA/hE1FBjBrbgGldodO+2q6jymwjzZKkxIZO0pUWZg76OYJuqLyU6ZT7hdR+IwsFaDJtHGG8A1v3hiMTUIUfJtCpiRr3AsSFBuUDBJXFDkBeJHq4jO73VEJa6lThbKqQMZW8mhw2xeLIjmXaNUABgoB17cAJlIyXTcavMYr9taCr1p9SCA== 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=H7u1Qh1VaRmzbuNmgxi9MRNyNdvJBP7NmzF+k2MrypA=; b=DfPzIdXT8BRqMp5J3OSSnPe0GxBeIw8dYh2UWBm/rJZwe7s9SA07zX4jBRzRwAS5uQaK3sTrNZa+lxQ50y6A7zXJrQB6nJNpaCCOVNtsibbhRt6E63OZ3GeOLjVUxInsRy1OTVlVpWmSATVhPDbmlE4ZsfVDH9ZS6jI6uWmHj7WQO0XjpD6vdWN2ebs4YQ5vANT2mzIDkMT+XqJowJFNNuFt+1lWyMdbPOm1OQTLE7AcKX5tfwYk4tTDjMMmVD/c6tKZgKrW28/K1fXC634YygeEnyRoPOCGvVffng5bO3nUHYk5WlrLepqFeHN+sKL8IOWF1sZfuwScXZIBg+s5cg== 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=H7u1Qh1VaRmzbuNmgxi9MRNyNdvJBP7NmzF+k2MrypA=; b=ikLbIDLNlfdadN8k+xVZ2ugfuLWQcPbaRn2hdoPAL92tKTfSAnh5LrEU6HSSiydsON4lyLmSMarRzSpD3k5s48eKSN6nyPvNxN5NIxxJyYd9xNVy++zAtySxSOZcdjFGfgqyyO0sUgAhSNPo1S3Ju708nwQAFkKQNeK/Lc2icoI= 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: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 12:31:26 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Peng Fan , Li Jun , Ye Li Subject: [PATCH 08/13] usb: ehci-mx6: configure usb out of suspend state Date: Wed, 16 Sep 2020 20:57:00 +0800 Message-Id: <20200916125705.4341-9-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: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: ff3fab70-96e0-453b-2c59-08d85a3c6db3 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DM58J7z/b2W53Gns9kBol5VaYUvzQLR3C9LsdqJ274aPmCGVm0JBGEm8haCJpO3kRsqw5lsdviRV6Rtke51JSVxwfsneoVzVEIhMVA/YKd0oix3wFU2fX336OUE24EtT8WP6uRn0sc0It1qq4hU3fJnAh53WNz9Z3ZGFmtYYWUn+X+x/ZevEXSkbXV7N63RmJVp3MPY0S5RN1mrrwPd03Kq1KRQXbgeU2bXdFgrY3b3Qf53hnvbOGmdSROGohiijp1nbZ3XoEJfCSGp1drhOZv9SbIEmANTLh5OiJZh73v4noR9tNqCYBIAdKnRMQ4hZFrdBmhRFKoyGC/ZApR8RGw== 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)(15650500001)(86362001)(4326008)(26005)(66476007)(8676002)(9686003)(66946007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: v5K3M/NXXCI1KiLYL1uhBunbr93lcjDPmcKiO5p9S9gQ0HHRdiwcPOT7HyCrZWbw2ntgMxA7NaYl3GyH3Z2IbhCmuIGhy1TpGunAwpwxN7u+ed+2LIOcrviEtibnzi9qy7ck1KzrrqO8zF0/1HMtHSPxhL9S92DolN9KTcwdus8IDmFaX5avxi5ifCQjYvVndSCuNFSvwb4r0Ozbq8qni7pi2dRDBuv+f1AVeutqCXIiNQ5zFtPoMBBXQ5MAjLBD08zBcMSuyGhfzLrdBPO45xXBAp1DlKY255C0hl7f4XbR40jviP9bZPXmtsIXNx2HG1Q/Nv42ra81F8T92TsVhsrtmw0YZVrxvE0obBHT7DP06YHTNCQ6l5tN2a4sUC6814wY+KQBeKjcKuchkHcOk2TXdSlS+dRRN6Lf6zkELPawsaDYATW3BCNzSqGEqSTVKTI7VWReY2sxTDxsYYbsPc7+/IOM5gqpIkwklWqNQYSG8CmnAFKsgWXgsVo9a55dbUaj25OrG26L4sEz4pOOZoQtXv4UmHI4bX3sR9o1SzbTZlzuK8pKqL0mRpcSQ7kSomzbNwgo50s/XOyXgWGhHZbdZNZ313hutBmV/1faO4U2DqadwLJRJyD8e00Fp5fASRj52qpfDchQhhdw1jighw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff3fab70-96e0-453b-2c59-08d85a3c6db3 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:26.1639 (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: 7XBCxZYr3UKZZCo4dikgtT14TuZSHraR0RA9qiR5UwQzZpnmLa2rKZ7N5B22VXT9KtUf2bkQuX1LjNJDkq4lhQ== 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: Peng Fan When moving to support partition reboot or android auto on XEN, linux kernel will runs into runtime suspend state, and the usb will be configured to low power suspend state by Linux. Then we reboot and runs into U-Boot, however the usb already in suspended state and uboot not able to lock the phy pll, after clearing PHCD to out of suspended state, the phy pll could be locked and fastboot works. Suggested-by: Li Jun Reviewed-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index ca015ef2f3..de0b0c3156 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -414,10 +414,17 @@ int __weak board_ehci_power(int port, int on) int ehci_mx6_common_init(struct usb_ehci *ehci, int index) { int ret; + u32 portsc; enable_usboh3_clk(1); mdelay(1); + portsc = readl(&ehci->portsc); + if (portsc & PORT_PTS_PHCD) { + debug("suspended: portsc %x, enabled it.\n", portsc); + clrbits_le32(&ehci->portsc, PORT_PTS_PHCD); + } + /* Do board specific initialization */ ret = board_ehci_hcd_init(index); if (ret) From patchwork Wed Sep 16 12:57:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312393 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp415103ilg; Wed, 16 Sep 2020 05:33:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYuVXKllKg5pzZD3DLg+RGyqBwBFpBnjx90Upt1dF6XyFH7VP7XMz97hsCFqo45BCmSeN6 X-Received: by 2002:a50:9b44:: with SMTP id a4mr26626629edj.12.1600259604499; Wed, 16 Sep 2020 05:33:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259604; cv=pass; d=google.com; s=arc-20160816; b=BEXb9mizdVe7M06JPR0JrVANQ4pMq84JxG+9adXnRcxatvNA2KKL0Xz9VgVnmIbMqi Sjr5qLnrg+G04KyfLdMyU3MG2gpSXT/GbQzU6MPGZL9vf0fW3KBlpEm2eP7fCxDGhGx+ UFmCqmb6AW05PZE9meeKEDVXXzGiX/3RKYOP8x9RbiJYpTpeA4MSBbPp9bGEWy/s9mcn hN/k4WFJhphSd1qDf+jx0tU3W4mcKT0tkqJtyjG5wjjXfOiljkETh4ooZQbqWJ400jTI OjnH8Y4qkU6PIvvRLBrHrI1JOcrMf7aK8RLFibl4fEMd3hazqJMYNFodYbRm9e/6ECjR Z2ZQ== 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=i+4/xpn54VNIsYzAwqKoXMA9fm5T5UhRXgydJCsxoqk=; b=cUR38AVatmDJZRtaePsltgMuTVLqo50ExyEZt48y4+0tmWrQ8qCq+t40zVtG56XUIj tZkN/ycdmvZsKqFH+OGU+gBtgiiOLXcTOV3AST4n8xrlo3OXP63ih9h2vWHWZ55b1OhZ M+y8heydkTKJfufsJSSbKxD1OQCZ2dHeCNfOsZqb9raOhq4gERDI8pH9BjM6XlQSc/48 8ot7+bhMQTvC5TVrScWGybGQz+1WKucFpFWlmvXOYpzpXM28hfNttMywNGGFN7rNsGDn StT0yrvoiPJQSXVqqs+gfIhhX/TgWhBg+PPCNAd7HmA7PoN/4rv+1QmNjTw8F/OHfVc6 nPWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="EkdqzzK/"; 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 x18si5604817ejn.61.2020.09.16.05.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:33:24 -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="EkdqzzK/"; 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 15D0D8235C; Wed, 16 Sep 2020 14:31:39 +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="EkdqzzK/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C12382356; Wed, 16 Sep 2020 14:31:33 +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-db5eur01on0616.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::616]) (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 0DB6C8234F for ; Wed, 16 Sep 2020 14:31: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=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F0+q6egm41GTE8ZMyQmjvOIMyXsXDXRTPN6/Ler8DF1k872Uljok7/s77kJC6DmTlYXwXMOxkhztwquvvOKEi0dgGVfm0hVzB5K4QpW5IV/qIx7p+WHXFRrK5YiJEO/iIAgxgWlpGUnszvn68Fboai4HqCQgkitAu1SVL8xg1ou3Whhy2sruuvjcxf/2DjkiA3Cyg/XysnRuGb0Za5QlNij0fps77UR3DNCC3BTGBVqzsD059nPPlRHvEoQysJlcCY4ChB9FxYfPyco3i/bzyPwXHKPzkKXYHHYSYUPYaTGKqlkyfYKn+9OUCPJDWO+rYsegdZLxINBN83Xig+sqnA== 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=i+4/xpn54VNIsYzAwqKoXMA9fm5T5UhRXgydJCsxoqk=; b=eB2eQ+1Y9cJhPqGMZk1hmpSXg2VCykq77Tw+b9nMC7ygG0/txrAbWmdvWoCgEzKdp5DIq9PRW0gC47+Fc8xH2iCVU8bcn3xrMgKwITPzj1twP0HNWhufNfgSvIPcZ7ZyDCDgfPR6IvX+Ys1bk1+inPsA/tNq7OXFZ7wfXUSYcHSOf8Dmp5nnG72McFwaOWxLD/LqMCldBRDksO31USZeWaK+qMZD9jg4+x8jdrMmVsRXAAE4QsjhKTb/LvqXoZwCsZnqQJWmcLO4vsIzypSicfmh4Uaf4hztwY5x/Tkv0RpNKSK9YzDh767mhP4yJPKXvztSFDNDajXTNV2U0sMuGw== 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=i+4/xpn54VNIsYzAwqKoXMA9fm5T5UhRXgydJCsxoqk=; b=EkdqzzK/B+5gFyBE54sChUtrXvBcwSaClqV1uIX1xik4hIhhxrO+LLOhcVgUrFK6dTfyUMrabfemGlQuzy0IjiosTgMIyjCuSPL55OEWhNYdIDpZNO3AdOMcw42JPzeZXtLn/Fpl+AtlaBEWkfiv2e80gO3Os/cjGMmIxeSLC+Y= 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:28 +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:28 +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 , Peter Chen , Peng Fan Subject: [PATCH 09/13] usb: ehci-mx6: Fix USB QTD data buffer error Date: Wed, 16 Sep 2020 20:57:01 +0800 Message-Id: <20200916125705.4341-10-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:26 +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: c3102c12-f348-4349-46b7-08d85a3c6f61 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LOGFnGY0JKnpfelbHDKXXe0OHsBn2CYSISFOuzO3PyJK7GzUi9Z1C4771jr4WeYwNTVFZ8Rrutph3LTFMv0NDPLyqYKTpF228F3ZyhYynx9yThRC8YgB/P3XDBJzb5JSuGxeJmUzxm/GLSaxBdVDk48c1ei7bSj21V8YQOEuVEclXdKlCSzxWMFuD56Z5HS3I/8QjGn8SdWAiiSstH5iHPeHUS8jskDTHIEbXQO0Z1liu2dxsDVrGDomKUUR/ECZb78Cpy1oegSmPs06pNomO/SAYxAyRnxPpTOE+bRJAO7PvKPCd4WfRRa2cRd9d9MwHfHm22NefuiDsiKsKio0yA== 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: f6Yr0At7b4RZu5DbvCWHPb+H3KJlXTNNH1VwbmrS1vAwUjYLEMYWbBnwbdNybGOP4Fw4RgXnWZEbDrxyXJpT4qYtPxhiqHaSiXpGKwTiqF0fUJmNDS3Oj0WTjReFg5+1hr7TdllkzMOS5h513AIT/xRddELRAcI+hZ/ndnoQZQjIwFyPPX8gTP5d5nseFjxDtVIRJ6fB/OwjReaYR6t6gu9Gem/9DKS61C2mJfAoy+Z7x3rRbb/FnzZcNtthEVQ1HDwatooVF2oDvSiP+adxDyo6sKqI5an1pq7QY83aGEo4kI6FrG6CqBU8gVh1rPksspnsrYlUkruqeLe7Wfrc9QgRGjYURZTqS571TKFSUt/SgsOfvG85ecBPHY+LYheGPwD95GGxTCvL6k2TdD1xkEt/VWXM9iWH+eJ5We2Sd6A0VGT2I57x9o1i12DX0VsSayYIR8tGZGc7tZeMqMmFdEfGNODzDMDBlzuM+buRioLV53yFubK1bRnnjD9YtJEs4eWTdJIwe7nFLcS0FhqkllbfYskuQt5ltlcyZKL+ey6HV0YJldoAjzsSYkNV/AeECzMUrwAANZpaW8pXtl1xMBxuAYHWHRj1hbmwQpYMch7oZvLXJWHo6emn/xe1bVFUUDqxvNwEYv86uCFi9hgccQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3102c12-f348-4349-46b7-08d85a3c6f61 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:28.8247 (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: RSbNevIjayN3dAt5xrzfoH3ApljWyuen8ySDlXMgd3KKuBJwIBMP19XTuCQ+exvJzg7xNbmdwib1z/jI1a/vvw== 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 Some iMX6 platforms will meet "EHCI timed out on TD" when reading or writing data to USB disk. The root cause is last QTD reports data buffer error. Accroding to RM, this event indicates that an overrun of incoming data or a underrun of outgoing data has occurred for this transaction. This would generally be caused by the host controller not being able to access required data buffers in memory within necessary latency requirements. Follow kernel's method to fix the issue by disabling stream mode Signed-off-by: Ye Li Reviewed-by: Peter Chen Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index de0b0c3156..aa0c1c355d 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -488,6 +488,11 @@ int ehci_hcd_init(int index, enum usb_init_type init, board_ehci_power(index, (type == USB_INIT_DEVICE) ? 0 : 1); if (type != init) return -ENODEV; + + if (is_mx6dqp() || is_mx6dq() || is_mx6sdl() || + ((is_mx6sl() || is_mx6sx()) && type == USB_INIT_HOST)) + setbits_le32(&ehci->usbmode, SDIS); + if (type == USB_INIT_DEVICE) return 0; @@ -542,6 +547,10 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) } #endif + if (is_mx6dqp() || is_mx6dq() || is_mx6sdl() || + ((is_mx6sl() || is_mx6sx()) && type == USB_INIT_HOST)) + setbits_le32(&ehci->usbmode, SDIS); + if (type == USB_INIT_DEVICE) return 0; 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); From patchwork Wed Sep 16 12:57:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312395 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp415722ilg; Wed, 16 Sep 2020 05:33:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5x2xFkTtowr00482QsJvMYCg7Ih6zgUBP780E5QRNnbB05H207jRxuJmMdjQk9ek3CAjP X-Received: by 2002:a17:906:2dd:: with SMTP id 29mr14508355ejk.31.1600259628790; Wed, 16 Sep 2020 05:33:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259628; cv=pass; d=google.com; s=arc-20160816; b=xE9D92O6jeztMAUssUwBQYa0P7Ylq39lz9Pi4BUs8ft8ifuIB/liUqjOINm8L+ilXL CgBDW/n8wzgpfyQ69rpLYRBV5ULUmx4YeuWbFtTSQIkPrccCsf1/+0V8RIlHS4ADntDR goLvzKfqSyCvbGB43wliX5xo+3GUdQf+4icxb5uB1BmottBjCBrY5JNNV9/Fv6Wq/fdF uS/XMB13cuKGN3zKh5e5vhp6yWjdiPB6FfeP2N6gV6br+dWI5czzcdAIEGXtQCzEyevv OfQwHRd0P1Ph79n3Vul1/mwp6WxkEE/IuumoAGVlHGCR0bBBIsEt4QlrlJ1bplEq+j2X TEig== 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=w3S+idgVjjXqNFwVGzux6yM0X6zOxt78yekRjf8rgBE=; b=Wje4LYQ9Q52hb+KumAEqtKNlT2Za7Cpqn5FQ/LKkXFA7nC7K4NCeGxYI0fWg1VeIoR rtQIXlZo0m09jflOHyObDDyez0ucMTy9gB2F2LTyI63Ljs1tB/Pwu2A01H4vcAid1Fw6 UZVYhDfGTRXIwFMgLfvENdmN/DU2xph8HgDBW+hGX3lL2DB3WKFR/EFga31ekyy6xmE5 Tp3qXhND3AQ3zrKSLARhVLxnWAw1f3EeEadEndP9MLTHUOhSvVx21MAkasTBltEe4zbl +7dHn09d3i905vqIC6klhy7JRaj6KJ9lKEOjlXuoeDZzDsNSt1uhIrk6qH1vkNTwQNC9 1p6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jRKGdh1C; 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 i19si11374387edy.150.2020.09.16.05.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:33:48 -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=jRKGdh1C; 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 9FC198237A; Wed, 16 Sep 2020 14:31: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="jRKGdh1C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFF008236C; Wed, 16 Sep 2020 14:31:37 +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-vi1eur05on20620.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::620]) (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 DA1C58235C for ; Wed, 16 Sep 2020 14:31:34 +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=Exd0sifN+v6Quq+Vr7OEujqxhbISCZXPZQ47dP0uB6Lb8jDAO1+luRdOppv4rk55DOXm+sXz477O4PPHRj7sr7oGLueaTjYckYvrV09gLnFIDMNQ6ROXJmDoLCHd/wD0hpPgGt2mZBHvM30c5H+QoSQpPK5GZl6YH3PoP9+UDX4kmjMxsMUAMVXk8aRtcnheOXcyqDl+0aH0Et2I2B/wMZZFwVhsVsnCfGLvsB9Z8jHw3hOS5Ol5g1f+uveal8vh7ocgAW4Q5EolFPMN6ncjcezdRkM964YMEfv4WETlKWkPRh8HM3bMx9BSXUQasVPHlsIMfNNm8xZ3gKouxRnKVA== 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=w3S+idgVjjXqNFwVGzux6yM0X6zOxt78yekRjf8rgBE=; b=UzELr8e3iFZ9BYvee23x5sZ4jC4wrBWEGp3i8uERZeAJkzMoMxVF0hVncjMCvnVZ76yy4igqbPZOJ4grKUmQxR0zoq8KRpm+5hKAy0swb55Y9MFqiN69sx028Er6VwJDzEyodOKg8eoXZkXyMA2AGzwVmr0PLfmK6sdUE4U+2er3AgIxWeYaNzD0pukI2fBSi+nwlfrLweOr/+EPPf6nUAwblpI2+GPRQpJNhGQo9KruoEJj/4FAWm9uNMre1ogUxshX+X0wqVaaR8zkveO/K4adZDeRKcBKa0qCF43KiCbvtNF0fJe3qFl9NdZlx8il3dhMbqLQwQ6JQG6pB3wzgA== 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=w3S+idgVjjXqNFwVGzux6yM0X6zOxt78yekRjf8rgBE=; b=jRKGdh1CsRZgRGVDTLUadiGD+/cl0G4auWFug6e6J0W++fPDN0o5kSdbmt4t0LJyUnd/D3K3d7HM2uhzBepsiRAEbmc97gup0ZDjtc5DLjj8Gz7DTCT+oV8sGHF//XUUbxdOAdbsHcil3dAdPepdi9np5PJ/kUwL/LAWzD+Iq3M= 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:33 +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:33 +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 11/13] usb: ehci-mx6: Fix usb type issue in DM driver Date: Wed, 16 Sep 2020 20:57:03 +0800 Message-Id: <20200916125705.4341-12-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:31 +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: e8208bb6-4420-4b23-c505-08d85a3c7255 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OVLqtraBm/nqOjMUKQ315rbxqhZ9jG0dXMUnJRtnufwe6rb+1g+vFtBibbkKOwTzgG23GZkgOluI7uDANdfPLtx+Zl0GrqKGbrR6J937f9nrdML9EXPh+PC2/R8NN/bGiOf4R+4HdmnozE6XQP0FGSoFYWkmYMv/Dl2BApmvIOVwxBO6CNMgLjw5HTK617uAOkg1w3qwdL9UKeISviRVuC7mZmG5Lm9kpyGWqNDHxtIlc/4JDIx74EBDLBUt+o6c+y0LS9DZqF2Efy9T1zDO0BcH6pcsD14i5hCXioXgoM2PSEOi+nod03AiInMC2/bx 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: ebT1gTO78dsScX4qjB72RmOICJ9IQO5wQwpdChbp8wS9zMKDad5PyJaalbbvXWkykn+nrHemt1tHvre3x3MZzC51aad1igHaeKi3M5K6o61NDI94GWBaM9LfkDLQ9bHz64imZt/+wbDnBlY47C4mySXLa8Saf/MQAbidO2ddd045AHeHeTbNddXGDace06+9pdoG2y02M6N8y4qYECetjqZRDVV84bx7+tJECfEjW7ysZDXWdZZWVdaAuPpzeLBTw8FwZctiCrjxt7+/z8EWRf53O0PCot8FVNTtWlHYt3jO5IzSN4NrYVhpTKgZXSR0AvKc8VtCV1i60DS02ygvqpa+KDoOxV6AvDPRTkpYFBvVg1+HA0jIxIi7VZJ7m6j3Wj17LzXyX2oNmvt9XiW3+WVKsQVf2e94BADgnxAbfBq0GpmEAl9mAat0KEyhJIC0AJP1UfWN1fsUCKFMvMjUEU6HqpgeWHIT0vdOiD9KpX2IdVtO2h5sYLxZqmp7Dcyi6op8h6udzIAU8PfVYKXHcLYWhKOpp/LMZcY4ILj5kDYMnvVgpxlMbAvTuS+lVWFGA+hGYo9lZREl2BmvSlXqEnMTV+C4qTqFmrEu+ks4V7qJMWZXtD6JN5Dey85b0xSHY+0s9eeN257Ckhxxc9dSpw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8208bb6-4420-4b23-c505-08d85a3c7255 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:33.8105 (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: mCrKB8tZGyZ5qG1uN4bTgh9wIhNVrC4INAIeme9nftjJyA99BPmWbxw+y71VOMzkggA1/A59ibxtUGBwGs3Hzw== 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 Currently the clocks and power of USB controller and USB PHY are both controlled by ehci-mx6 driver in device probe. However, the function "ehci_usb_ofdata_to_platdata" calls "ehci_usb_phy_mode" to access PHY registers when "dr_mode" is set to OTG, both "dr_mode" and "extcon" properties are not set in DTB. This may cause hang at accessing USB PHY registers if the power and clocks are not enabled. Change the usb type logic to more clear way: 1. plat->init_type: The requested USB mode type from uplayers 2. priv->init_type: The USB mode type specified by DTB or by the USB ID pin or by external controller like tcpc or GPIO. 3. If two init_type are not same, return failure. Align with non-DM driver. 4. USB PHY access is moved after power and clock enabled. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 50 ++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 14 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 555a810953..7079750a93 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -510,6 +510,8 @@ int ehci_hcd_stop(int index) return 0; } #else +#define USB_INIT_UNKNOWN (USB_INIT_DEVICE + 1) + struct ehci_mx6_priv_data { struct ehci_ctrl ctrl; struct usb_ehci *ehci; @@ -589,7 +591,7 @@ int __weak board_ehci_usb_phy_mode(struct udevice *dev) static int ehci_usb_phy_mode(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct ehci_mx6_priv_data *priv = dev_get_priv(dev); void *__iomem addr = dev_read_addr_ptr(dev); void *__iomem phy_ctrl, *__iomem phy_status; const void *blob = gd->fdt_blob; @@ -630,18 +632,18 @@ static int ehci_usb_phy_mode(struct udevice *dev) val = readl(phy_ctrl); if (val & USBPHY_CTRL_OTG_ID) - plat->init_type = USB_INIT_DEVICE; + priv->init_type = USB_INIT_DEVICE; else - plat->init_type = USB_INIT_HOST; + priv->init_type = USB_INIT_HOST; } else if (is_mx7() || is_imx8mm() || is_imx8mn()) { phy_status = (void __iomem *)(addr + USBNC_PHY_STATUS_OFFSET); val = readl(phy_status); if (val & USBNC_PHYSTATUS_ID_DIG) - plat->init_type = USB_INIT_DEVICE; + priv->init_type = USB_INIT_DEVICE; else - plat->init_type = USB_INIT_HOST; + priv->init_type = USB_INIT_HOST; } else { return -EINVAL; } @@ -652,31 +654,39 @@ static int ehci_usb_phy_mode(struct udevice *dev) static int ehci_usb_ofdata_to_platdata(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); + struct ehci_mx6_priv_data *priv = dev_get_priv(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; + priv->init_type = board_ehci_usb_phy_mode(dev); + goto check_type; } dr_mode = usb_get_dr_mode(dev->node); switch (dr_mode) { case USB_DR_MODE_HOST: - plat->init_type = USB_INIT_HOST; + priv->init_type = USB_INIT_HOST; break; case USB_DR_MODE_PERIPHERAL: - plat->init_type = USB_INIT_DEVICE; + priv->init_type = USB_INIT_DEVICE; break; case USB_DR_MODE_OTG: case USB_DR_MODE_UNKNOWN: - return ehci_usb_phy_mode(dev); + priv->init_type = USB_INIT_UNKNOWN; + break; }; +check_type: + if (priv->init_type != USB_INIT_UNKNOWN && priv->init_type != plat->init_type) { + debug("Request USB type is %u, board forced type is %u\n", + plat->init_type, priv->init_type); + return -ENODEV; + } + return 0; } @@ -741,9 +751,9 @@ static int ehci_usb_probe(struct udevice *dev) priv->ehci = ehci; priv->portnr = dev->req_seq; - priv->init_type = type; - ret = board_usb_init(priv->portnr, priv->init_type); + /* Init usb board level according to the requested init type */ + ret = board_usb_init(priv->portnr, type); if (ret) { printf("Failed to initialize board for USB\n"); return ret; @@ -759,10 +769,19 @@ static int ehci_usb_probe(struct udevice *dev) if (ret) return ret; + /* If the init_type is unknown due to it is not forced in DTB, we use USB ID to detect */ + if (priv->init_type == USB_INIT_UNKNOWN) { + ret = ehci_usb_phy_mode(dev); + if (ret) + return ret; + if (priv->init_type != type) + return -ENODEV; + } + #if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) { ret = regulator_set_enable(priv->vbus_supply, - (type == USB_INIT_DEVICE) ? + (priv->init_type == USB_INIT_DEVICE) ? false : true); if (ret && ret != -ENOSYS) { printf("Error enabling VBUS supply (ret=%i)\n", ret); @@ -789,9 +808,12 @@ static int ehci_usb_probe(struct udevice *dev) int ehci_usb_remove(struct udevice *dev) { struct ehci_mx6_priv_data *priv = dev_get_priv(dev); + struct usb_platdata *plat = dev_get_platdata(dev); ehci_deregister(dev); + plat->init_type = 0; /* Clean the requested usb type to host mode */ + return board_usb_cleanup(dev->req_seq, priv->init_type); } From patchwork Wed Sep 16 12:57:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312397 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp415988ilg; Wed, 16 Sep 2020 05:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiaj3Q9LxhGu7I4L1ZJVdThtQKbfdzOkrfkQfRrNVnebgfVlVFw2pkKulg3ZjqKR325QfY X-Received: by 2002:a50:fe82:: with SMTP id d2mr26509512edt.86.1600259639710; Wed, 16 Sep 2020 05:33:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259639; cv=pass; d=google.com; s=arc-20160816; b=RZKDcNLmK7Mur7hYVHvKEGEMx6Esgs48e9OeDumsTySh66/dd3g+X+NWcHbuaqBbIr 0CHt8nazV0md8322ODpYoSD3s2dW9PJ9lyV3LTi3NPrrMbA+vL2IyCIeTyTJOUq0HxDb oG8QpRMetuOBzDHWAZkrEUKmo/l8Wd8qgpryZr7KiAWrWD6L+bawUfsIRYtaX5ywcPQ+ B4SJ+Cw/v2IH0z73mMNPaM8Q2OasCHIj5q3O39H1lB8/lrroqROZ94YRzev+2vemx8bW S8HFjO09HTPA/3LTk2PI49BTFsi/lVS9x9rDIjTe9Q5tR4uEliAZ4UmZKOJgaCWaNu/5 IZHg== 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=qar1WVFYIp3jtTXqjKT9WTv5Ausey5Btw1NwSYOMEEw=; b=Fc6C4Bo/SXxu6zWBxT7B4mbOqyy3LKiBJe6w5AvN9vVoenhG8GMgDwptHRicAN5dDd P1hOtREQAfohMyQjWzpS6T5yXAA/ByrCAew7kLy76NBcjCkJyVypXAGJl8OzIwbNQNbK LH6/In7R/EV6FKughEr/q/01Wdc1CGIbBtMqCZDcezF4OUrdbdxxIgKrrFXrTxXhrhkJ dxMuI7SqLCNWdeAbxeQMvKDgeQ7BVLnj3h54N6SLC+VOyJJNeGEOvlUYGWvKbRhcG/hJ V6Wo3/vNE/KHT1roPt21MBEk+/0qoSD66FLYdG2QmOY3Uq/Gh/fIhvnuwWsAewRkzeue mYjA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XV3PoIaw; 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 p21si12051256edq.151.2020.09.16.05.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:33:59 -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=XV3PoIaw; 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 501A482383; Wed, 16 Sep 2020 14:31: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=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="XV3PoIaw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9777682376; Wed, 16 Sep 2020 14:31:40 +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-vi1eur05on20629.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::629]) (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 C512B82358 for ; Wed, 16 Sep 2020 14:31:37 +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=ctRPTSvP1oVJD9SIccPQZFjzQHVauRqUdfVkl+ce9MLfqpsTaGWTo2MwO+pvKeRSCr+9BPL9rG5+ldJy+A7efoCBzqMju5FLuCvXqOBsa6jbv3HgKnHLTWbpEALEiytn31EIVYvXzw6/NJ317JwyHKdvssnDLVVs8NqD2YsR2waEeB9WxtNRWU0LYNDm3MKmyNCJojtwmY2wmQQH9HRvaAvgIS1CH6nRW1m9zGCS57sfzpZNKxwNEZ52kNLWXKdsShnCjZmvdtC6tySeJUkVaCFR01c2q9JG8r2BLF+ZkDIPrL3I+Xs6RBthR1ltq8wGE7nkWriR3GyCc71bETa8pA== 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=qar1WVFYIp3jtTXqjKT9WTv5Ausey5Btw1NwSYOMEEw=; b=GKIjzRklNFTkwyuyNg8WaXw2sTmjEjHYKEyI7nUPUvlqe1I4Wjp7BzjdTBQhOhK2MMTUWeswZaTdbAGPA6pQ87NYC16FJa5DGwHSYdyHllRasX79HRC5IbMXMh7R7AhcYPDMWLx35Z4w3/U/D+T51ZCirQvO5gYcu+nMGWl3ujdYIT+75jc0A62UaLQd98bCYuu3ymJUdTIMJJYOp5B/X0eo6oH0XrbvS8Yfu7886AzQWWPUEoClkcAj6JyJOtyfz9wR1ieXEi1AmHHTXlhog5+GESCn8vHd4GM62VvaCg5qxf9KX53vOy1rVuSxlvjyckT9ntl43pmhOqHEACkz0g== 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=qar1WVFYIp3jtTXqjKT9WTv5Ausey5Btw1NwSYOMEEw=; b=XV3PoIawea7F2+KTknjAn+0g1pzOVHYEqD5xvRvm8dTP0sqGq2D8KmXol08tdt3HvsIuhGHesnRLMRgWbhhDPpAJwv41v+dH3KDachuFySrP5PqAJd98Rvoa9IsdAGL0QzFG6LqVOPnyvAdhHvKnwe4fjFGTcRSdHrz8Wy36W60= 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:36 +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:36 +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 12/13] usb: ehci-mx6: Fix PHY power up issue on iMX8 platforms Date: Wed, 16 Sep 2020 20:57:04 +0800 Message-Id: <20200916125705.4341-13-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:34 +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: 2ca7388a-96e7-489f-4dd5-08d85a3c73d2 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:873; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aAzrXjk9w+b5Q3820j8Z6Vpcrobrjos70eFP0tjqa5pdaHsMHUGl6KRW1wl7ZU0V2T4z49fgqaOssuK6T9jzBG5k0y4F7LLbHAqMuHCY6jWxCMMINWE5HBz+dQcMHwIpdtYiSt+Ml4NgasRJulfZcrSqQGkUcg4pBDBy002JMgGEGTTv1r95IjGR+D9XA3oCFFayvpEX8ucuXLawCPYZ4iJDy7k3BwbNY0dlKjEQaHP3QLkK1Wb275O2ClybxXvYWbn01ZMA0jkFSYkx4DnNUr06aQEvUm+0YfCF6vJsfKPhCr1KGj0sea3F6mHD+gC3k8MLvSF6Zqk/Hx8mOHDhOA== 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: Cq2rtVn55xFv6Ga3uiJoB94XK1Ugbs1pMI7oXGUACqev7wzcOtLnoRWP23lcHA8EMraBJ86X/n/EQpbRawPnXVk00ZVtePCgPZVH5k+cLoCdvx73zeady8auzXQ1I5OK9rxNOByP+G/HR2LdU3PMajk/ZC3aMosa6DyPZdhAN99AIpok55S6azrEsHRQF1rSVOuiGqycjdrnNIT628O00yR0/6fEdq1cp01a5wQKakUIRZ4/XALaCx+fSUL31woXFXe/mBmTI3lGf/141ysPKVLJcLBli64pd2u/pHmZTFYiyRY/sZEMHkLAD6IaPwunGFl1naljdQgAg4s2P8LHF05a84N4/zq9r6/V6fnkxDEDn797w1oSZAaVpsxYlr+Epgdp/kfdAXw/gJgq1zQM5ewcoDOIu+7WChYO7wJG+Js1lduzWtcWLw8rv9KymjTT/d6Mz4rL06lRNaDmeMFwhSWjlF4s/Jhs2lKDXEgEwuHnmJMwp1qLG3AMB72lVwmZHi/6le5V+WiLE7yemAG0JKCqFtB7RgkmX3Z1GIiFHjTPVRB1cYB/J2ZcQmiXFojvnSGhWEIJJp8vH5TNcTAqkaU2NfSDlfW1gO4i8Yv7jMKpcBHwaSpuLgLw8wVAwP/tzh93TvC4mz2it+Jn5KcqHg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ca7388a-96e7-489f-4dd5-08d85a3c73d2 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:36.2844 (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: EE8HVekF22LScOENzBJFdRx6NTjn2l/fYcTokVumKZoLuH29YxYNWL6lX4Gavap3TqEtnFh+4iSbTT7Kd08HvQ== 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 On iMX8 platforms like 8QM/QXP, we must power up the USB PHY resource before accessing the PHY. However, current init flow access the USB PHY in ehci_mx6_common_init prior than ehci_usb_phy_mode where the PHY is power up. Fix the issue by adding ehci_get_usb_phy function to parse the PHY address from DTB and power up the PHY before ehci_mx6_common_init. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 58 +++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 18 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 7079750a93..080bde71d3 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -517,6 +517,7 @@ struct ehci_mx6_priv_data { struct usb_ehci *ehci; struct udevice *vbus_supply; enum usb_init_type init_type; + void *__iomem phy_base; int portnr; }; @@ -592,11 +593,39 @@ int __weak board_ehci_usb_phy_mode(struct udevice *dev) static int ehci_usb_phy_mode(struct udevice *dev) { struct ehci_mx6_priv_data *priv = dev_get_priv(dev); - void *__iomem addr = dev_read_addr_ptr(dev); void *__iomem phy_ctrl, *__iomem phy_status; + u32 val; + + if (is_mx6() || is_mx7ulp() || is_imx8()) { + phy_ctrl = (void __iomem *)(priv->phy_base + USBPHY_CTRL); + val = readl(phy_ctrl); + + if (val & USBPHY_CTRL_OTG_ID) + priv->init_type = USB_INIT_DEVICE; + else + priv->init_type = USB_INIT_HOST; + } else if (is_mx7() || is_imx8mm() || is_imx8mn()) { + phy_status = (void __iomem *)(priv->phy_base + + USBNC_PHY_STATUS_OFFSET); + val = readl(phy_status); + + if (val & USBNC_PHYSTATUS_ID_DIG) + priv->init_type = USB_INIT_DEVICE; + else + priv->init_type = USB_INIT_HOST; + } else { + return -EINVAL; + } + + return 0; +} + +static int ehci_get_usb_phy(struct udevice *dev) +{ + struct ehci_mx6_priv_data *priv = dev_get_priv(dev); + void *__iomem addr = (void *__iomem)devfdt_get_addr(dev); const void *blob = gd->fdt_blob; int offset = dev_of_offset(dev), phy_off; - u32 val; /* * About fsl,usbphy, Refer to @@ -627,23 +656,9 @@ static int ehci_usb_phy_mode(struct udevice *dev) return ret; } #endif - - phy_ctrl = (void __iomem *)(addr + USBPHY_CTRL); - val = readl(phy_ctrl); - - if (val & USBPHY_CTRL_OTG_ID) - priv->init_type = USB_INIT_DEVICE; - else - priv->init_type = USB_INIT_HOST; + priv->phy_base = addr; } else if (is_mx7() || is_imx8mm() || is_imx8mn()) { - phy_status = (void __iomem *)(addr + - USBNC_PHY_STATUS_OFFSET); - val = readl(phy_status); - - if (val & USBNC_PHYSTATUS_ID_DIG) - priv->init_type = USB_INIT_DEVICE; - else - priv->init_type = USB_INIT_HOST; + priv->phy_base = addr; } else { return -EINVAL; } @@ -765,6 +780,13 @@ static int ehci_usb_probe(struct udevice *dev) if (ret) debug("%s: No vbus supply\n", dev->name); #endif + + ret = ehci_get_usb_phy(dev); + if (ret) { + debug("%s: fail to get USB PHY base\n", dev->name); + return ret; + } + ret = ehci_mx6_common_init(ehci, priv->portnr); if (ret) return ret; From patchwork Wed Sep 16 12:57:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 312398 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp416230ilg; Wed, 16 Sep 2020 05:34:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy+daBpQKPUNsO/tDuHF6fyzcklwpHijk82z9Uq9/N0iZ1v/qTDgh+XdNSaPw5suasKQIc X-Received: by 2002:a17:906:1b15:: with SMTP id o21mr24691266ejg.377.1600259650648; Wed, 16 Sep 2020 05:34:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600259650; cv=pass; d=google.com; s=arc-20160816; b=SeYYex0KhwX4jtr7ZeRLP2Zb4WNLH2wOI5KvPTcoo2ZKyjRI2SB4csMgbZEpCqDy4o ABqM9+QJoNG3AUZeI3kmYEw8gZpBmbfXPMrEBdyPI5HReKaxkL9EuqmRxyKRR4SIiLmR GtE4PCXs6fRi24YdatB6eItWG/L2bszISkL174VZpO7s0mSfbPRODyi8nnDBVOswhUt6 RM13knsoW28ItYQG5CjVVcnTS+dWiiyEeDLamMqj6c/AKe954+yjpn27afJXyeOT/T13 A/j0F9rOMp6BfMny1YUZu0s9Crn1DpetvfmMIqKJrhDUva2FDr3nqHwleOT14cAkeqYG U0fw== 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=XMS18v6a01osic7S1kbgAiNucf8B6J/sxY3LQNaYmOk=; b=u2KELet0i5cof8Xwq4rKCAAh+UwBhdWNpF7hdgKMu/y3nVc1Tzw9bhyU35mKUI3hCj cZeKrgSBBUy1qLyqi1dd4DyAs2pu6kPEVRgfs2ZLKY7zJTSmgh6BK91Kp8YOeSIOHchW bhjyGHcfRuo69tWpP5vmReVw5QWo/3hxymNgg3IVUPOmLZO0+kEfRhbmj5amVdFW1N4x 50wHbpVDYiXI7Z47Ca7qI0SZGG8NhKIV0Znna9hyZ57GxA8UT5yLXpQuOstdliR4Tx2c HJeMAZXc6WRGccNhxktPVHRb6Tzg8PolCI3MDiOcWLiclV9WaZdx83mnjJHHxUM+zItL E8yQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=IyVjQzJ2; 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 k6si12081913edr.111.2020.09.16.05.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 05:34:10 -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=IyVjQzJ2; 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 BF14182389; Wed, 16 Sep 2020 14:31: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="IyVjQzJ2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B09AC82374; Wed, 16 Sep 2020 14:31:42 +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-db5eur01on0619.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::619]) (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 2A2A382371 for ; Wed, 16 Sep 2020 14:31: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=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PNLJrApPFDE7AznVWT0LkCo0TU7HzOsq5EpGa6Xj0w/Rh/U0oVuGcLGvLf6OraElOZkpaNzeV9NESfc3VJEqXQL2nyIUVt89pXKH3aU4rLPu4Dn37hOZwnSC2YO1PheRqqo9H9eV46TXrohUuwBCK5N4yG2VRq/jcaQHigHwS86gOggbj2e5ZjkP6P3WQNr+RclQTzTfb/JUW30MiwBdfww5flBVZPt/niDVL1zZqVnMU+KPhMuNF63PFpsvlXrcCAr5SyoUR5wLmvtDJqok6WnLHABN1TfPj8neIS9Uae3mVULizC6wDkMYyQ3zTIzYsDxhXekRYTV676SVy+WV6Q== 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=XMS18v6a01osic7S1kbgAiNucf8B6J/sxY3LQNaYmOk=; b=bNXqAS5oM9cwgOuO79gfmQJD3kcWwAcqW/0Aq3sB+vLTKGn8FNqQZUfH6me5EbRZ/V9pP7ePs7U/mncHbK/k1vzfp2XSMmeH8sjln5Z2RxK+Yj+7hS42foPvVsTR6JH6Wdewy7nvnqW803LE2UWnh3OQRUPhw1S3z4kXS+mEtA98Ii71FzhSc3Jc4kgacwbaeCtzkQmwffh3xAgz3YpClfomSkFRwzESInAEJHNKkCEOkhJnOKePFzc1whnJOHOGdB3X4BwXNoZxHfkuBuPNZQStdUdQd366dEDnvd6BqYskA+IaDLVAVb/0mO3nyS5vhU4IwToOHB+PDlAdHCtbKw== 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=XMS18v6a01osic7S1kbgAiNucf8B6J/sxY3LQNaYmOk=; b=IyVjQzJ202ObkGWjjb0QPd6C6uuAo8s2TtO4xPLXWZUkQeZ1EF8eaRsBlQjrSdsAZXihUjKc0WopTBXzRkW0qaPJstZrYkvrJCVDFiCRH4PX/ddVyLgNVoHgFVDM+uxVyK6cykcnBi8nL+yoB7SKBACpPkA87d5b891wr7wfzw4= 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: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:31:38 +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 13/13] usb: ehci-mx6: Improve the bind function Date: Wed, 16 Sep 2020 20:57:05 +0800 Message-Id: <20200916125705.4341-14-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:36 +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: 2142d3b8-cc88-4204-f53d-08d85a3c7549 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PHbzCilzkEGph2VjHg6/4G844aLCYXFFpM2Dga2bsoSkYmLD0snln1SPHy5exTQqFz+/f055BgvwQKV2pw+jgQQzxft9qDF7mg+B0/nOLVE5S+zizK+7+i8xT0il3ly+wMHfmwKPf4v45JaGGAl/Cs48nWJFAjTcgX/ue5pyfOO6LxzZidAapWNnA+oKtyMSQu2mdJTm5gPk847NunGPD2n/4+C0HfEDhmR/oLte4Dpk5iIjctm03T8xzlUWpOycnd9m6EtHEJ+AfQ4GxvrOLLOHEh0FxwdpKcElxvUIZcwVCkx6kjH926GvCJTMgLXR0IE+91Z9FUt1trfUzRl6Gg== 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: h4QfzO0T1BR7kFamYBTCbeMqbyYepl6/PPWJFPE3rKhPMpeAHSxHe2ROkZz5D28zBXex6f0DfkAW99Ju3gLuDku4dY+B6cGjn6VPMjqci9KTNCeNvvc96YPBzyS7vfe0q3E8aaennSRw6+PCHVNCHHC1X/5iaNZHBkp+YNLnu4PmACFugvLXwDZYxJ+txOh7dskBwtquHGdvTXsOiS2k3Y+oXKasmaN3A7/Q9vixjuEfZkglYu/iDCUNuhfNUEAwE9ElBDVuyN2APAtmv3Ck9RgD9WoNgew3zTpcCgGZIvrA4Yuko72ps66uRFgoVjSAf0AfePswbMpYZXdA8jDU3uM9NKyiv4fiY1qMSBFsnRxQ5AmeMe/7x0Gl4uyPRUEmIk5HlXKLxSZC0GmE5SVg0QGdw6G+14ROZP4+qrX2RwLTX8icJ8qqef0Ev/lAeinVPuI4+3jQcvnspyWJj80tOIbGL8hLI/GoqyMOYj0mtM3Cyqd4t5E5FNfipho+vivlwcjdwKAmJct5fBivTbMhZJv86YvXY57L9WWffc+l7bmJOB9AXJ+PsM388LfH1o4HKvzMZI4r7ZLAjvke/xUOvicMJt5PE2viBXr4uCLtFkeH2zswiTJzeThPj1SimGzWzskXAkJoM1lhRcYtxF52sw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2142d3b8-cc88-4204-f53d-08d85a3c7549 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:38.9242 (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: FJd+Y9IGKYl4KkpxDoG9iMtKIE/Dim0jHY4JBqM0i+ySFHSDQLSc9dSK6VJXKcNovQ9xRHxLHsdYBdejg/yyUA== 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 To avoid calling devfdt_get_addr_index in bind, which introduces much overhead, checks the req_seq and only call the devfdt_get_addr_index when the req_seq (usb alias) is not set in DTS Signed-off-by: Ye Li Reviewed-by: Peng Fan Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 080bde71d3..20617850f3 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -735,13 +735,16 @@ static int ehci_usb_bind(struct udevice *dev) * the driver is fully converted to DT probing. */ u32 controller_spacing; - if (IS_ENABLED(CONFIG_MX6)) - controller_spacing = 0x200; - else - controller_spacing = 0x10000; - fdt_addr_t addr = devfdt_get_addr_index(dev, 0); - dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; + if (dev->req_seq == -1) { + if (IS_ENABLED(CONFIG_MX6)) + controller_spacing = 0x200; + else + controller_spacing = 0x10000; + fdt_addr_t addr = devfdt_get_addr_index(dev, 0); + + dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; + } return 0; }