From patchwork Mon Jun 29 02:13:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1318709 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=ogJ19RDL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49w9Rd20fgz9s6w for ; Mon, 29 Jun 2020 11:50:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB6E681EFB; Mon, 29 Jun 2020 03:50: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=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="ogJ19RDL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DBB9081EEC; Mon, 29 Jun 2020 03:49:51 +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-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20624.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::624]) (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 5E05681ED8 for ; Mon, 29 Jun 2020 03:49: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=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3ChyJQY3tLrGIyCe+LbrnHWgGCyoaXNAqY4rCRnAouVHFVnfGBwjiMQCaD7ER65yh3tsTj0m63Xc+TPbKZp+dlLm2kxjTCrx425ykI1y0FXJMhr5oyhVrwrVyCesEcWrvpXP4hqHtJfgQczNLM+tR6ywMurKbhlI2KGuYSZ0VGA0N8ASs3gwquIRioZI65KRV9xgOFr0Y93c3rFC4qnPZTv1CBWASejEEx9gISb2AboQWnRWtSULYgIvN5ebQClcimOJ5JgG3Yr5MSb2hx2lyhXgfbq+73Zqlra0vJ1fOnaccH1BN5zxHiwNHZCGdpCOi0gLbyRFcCUIgQx8lzsXQ== 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=zrGXwemViw+oK/4QHRax5J7/WrS5CcW/qduTfraPXsM=; b=O27GpqrPOoT3Ju9UVWA+RO0nA5yvbFPkJNuRc7GScKMeMWSi7gn0Qaicip6B4HbSjVXjLLroqcAfO+b6bf4eC2C0eldwUYdOpMr2gZEFS8eQ/ySl+QSrMAaPzUn7OtOjWUWkYd7U96GuyjAT5Re/radvK1fBqc3cOvifOh6aQKhEM9lXkfzOsS1d7bOaFCaVGcxGhqqdwNsJ96CmIjCWn+6VGqrVGL/0142WOAr5WOr/aT59xPdF959+w/a4+chMi6T7LVWW0MssesS9PCpr1HWPk8d8CbabdJOPA731AJedz0XyeJUg8kBf5716iEZt3Gxqopm0NPb8pKNP1k0qeA== 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=zrGXwemViw+oK/4QHRax5J7/WrS5CcW/qduTfraPXsM=; b=ogJ19RDL42qAxgtoJrBPJoDKcyo0itoLQVriwDgvp5HmQdCKFr9Mzc6GM1Yy3LUt8VWLxj4zhLYD1LsZfCUgEQNeDQBizQCm5aacAJA4IfnhXreMGRkCSf1G7q901gY8GfyFEwtT7OsQswX8/w2JfsMl9bZTho8mLJE+7N7AIbc= 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 DB8PR04MB7177.eurprd04.prod.outlook.com (2603:10a6:10:127::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Mon, 29 Jun 2020 01:49:31 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::2d36:b569:17c:7701]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::2d36:b569:17c:7701%4]) with mapi id 15.20.3131.026; Mon, 29 Jun 2020 01:49:31 +0000 From: Peng Fan To: sbabic@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Ye Li , Peng Fan Subject: [PATCH 3/7] usb: ehci-mx6: Turn on the power domain of USB PHY Date: Mon, 29 Jun 2020 10:13:46 +0800 Message-Id: <20200629021350.21262-3-peng.fan@nxp.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200629021350.21262-1-peng.fan@nxp.com> References: <20200629021350.21262-1-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) 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 SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21 via Frontend Transport; Mon, 29 Jun 2020 01:49:29 +0000 X-Mailer: git-send-email 2.16.4 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1bc80fe2-4c48-4142-6827-08d81bceaad1 X-MS-TrafficTypeDiagnostic: DB8PR04MB7177: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 044968D9E1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LJoez95ReVwR/Aff117yZ4ex2yJg8eZcgEIB3a+dVvll1Im+vLPRwUr5+RVgBUqgqLL9XQjlPP3dI7NrLwH4c1gyVGTwtS+liYhN9sE9eJp4WVRKRmbJVHvU/d2Fzx+SLV3dxOA9MjUqS0Mq/8Jsidh1a+UqcUPWxwQ2fDwEFhpnCnx0cHS6rUkobNlEK1B2UXaiMP1nGvUtCcGpG68X6rNYXg9OAbtZTTgM1IwX8hqEzozfFuuq6oUedgqWExgTwVEHP4qObDPR4CqR+txI7bfNSvBEqyTpOoi7PWfuRptOKR2PbSwgICmn9t2RBr9FNuKwTgKt9ZvILSCWyO6YyA== 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; SFTY:; SFS:(4636009)(346002)(376002)(366004)(136003)(39860400002)(396003)(86362001)(478600001)(956004)(1076003)(44832011)(6666004)(6512007)(8676002)(8936002)(6506007)(5660300002)(2616005)(36756003)(2906002)(6486002)(66476007)(66946007)(52116002)(54906003)(186003)(66556008)(16526019)(4326008)(26005)(316002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: auh196LAHOLWUGQ/CERxKj5gqX5jK2lMCXDpfwbVDyJ63jJFD1vmdi9A58uCNsl/0Uc4USCwjqCneYxY4Demboj+UA47DMo6TeG9g9wNvtTGRtXzAo2njBfAu497pXxflhKf/KcK3jrTSCCGimZ48eKFvroaohj6ZDk+u75SASrG5Ka41yQkyai4sM6xBmvwCk8frRW9RcGxc+PSh5gJ92iL6t6jQ2p36dKt1lHYQ/Tt5nRWKFRojRgzOxU4+WCkxLzCRb14uMHKHnJ76ZLOJdrkRROQTufRuhq7mFwR7dSVd/SB5upGr71sAOu0a9WVGF9K2YXTD/atpCDMTp2GbpdO75/GAcP+3sZpr8pPaub1SnoJDex9wYowGQR0LTlb3bRSowRwQAVzlu9t9zoJtPm7hvPwfKKchxfhSwxMUrqim1nRGY/Jqk0QamDMQnoqJAGVnSGld+BLtFb5fsRIvZnFd2914lF8w4LkkhH0zDU= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bc80fe2-4c48-4142-6827-08d81bceaad1 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2020 01:49:31.8317 (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: xI7CfE+U9w9jFyVcdI26o8BYC2obRFkuELgs9jRo+5lxnpWcBsgANdnXTiwhCkr8ZdezSX+E0dej1lf2bOgNig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7177 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 191d619220..92e8bb91d2 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -2,6 +2,8 @@ /* * Copyright (c) 2009 Daniel Mack * Copyright (C) 2010 Freescale Semiconductor, Inc. + * Copyright 2017 NXP + * */ #include @@ -23,6 +25,9 @@ #include #include "ehci.h" +#if CONFIG_IS_ENABLED(POWER_DOMAIN) +#include +#endif DECLARE_GLOBAL_DATA_PTR; @@ -590,6 +595,18 @@ 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; + + phy_dev.node = offset_to_ofnode(phy_off); + if (!power_domain_get(&phy_dev, &pd)) { + if (power_domain_on(&pd)) + return -EINVAL; + } +#endif + phy_ctrl = (void __iomem *)(addr + USBPHY_CTRL); val = readl(phy_ctrl);