From patchwork Fri Apr 2 12:48:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1461683 X-Patchwork-Delegate: marek.vasut@gmail.com 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=LWg4TrKP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4FBg0m73VTz9sVq for ; Fri, 2 Apr 2021 23:51:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25C4781C84; Fri, 2 Apr 2021 14:48:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1617367738; bh=BmDiYYUCWLH0XMNFmQCqGLD/G0wTcI2FOvmf8uqrK+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LWg4TrKPh8cHI+vI+pPthidUuOW35rPdX+E7d/EdE17eP/avHnZzBaPmJB9ecpSF0 25f6T+VnM+gRHd2wOayMErhF11rBvrlj9Nu8z9tPSkPX0t6lcUl+XeSYyFReJ64dRX JJP7GTPGojPubWGP/PAB9MA4X7CiglTjxO7olg++l/ntzFSTjKw2GfgpybI6KhtaP+ P3NG2YuH1rbPH7flFTPK7eQXL6GcSkBWJAK9qNDFNo8+rmGEYpAmrzHgXmb+IgWXob 2ZHZvDkYsv5jwJ6yy5r4659TtL9kMMIDPPA83YMqrsVb2kOi7wGzpykYGV8XkFOizJ ZuyU0d2u16dWg== Received: by phobos.denx.de (Postfix, from userid 109) id 4EFE3817BD; Fri, 2 Apr 2021 14:48:53 +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.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (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 DE7AB8179F for ; Fri, 2 Apr 2021 14:48:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4FBfxZ4wNMz1qtPq; Fri, 2 Apr 2021 14:48:50 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4FBfxZ4bHvz1r18L; Fri, 2 Apr 2021 14:48:50 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id ayqe9_SI3VTE; Fri, 2 Apr 2021 14:48:48 +0200 (CEST) X-Auth-Info: BqaWVYxPDjfs0/7RnmdF/JK4xd3yy4CiI0owpCZahvY= Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 2 Apr 2021 14:48:48 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Fabio Estevam , Peng Fan , Stefano Babic , Ye Li , uboot-imx Subject: [PATCH 16/19] usb: ehci-mx6: Add generic EHCI PHY support Date: Fri, 2 Apr 2021 14:48:09 +0200 Message-Id: <20210402124812.186761-16-marex@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210402124812.186761-1-marex@denx.de> References: <20210402124812.186761-1-marex@denx.de> MIME-Version: 1.0 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.4 at phobos.denx.de X-Virus-Status: Clean In case PHY support is enabled, use the generic EHCI PHY support to start and stop the PHY. Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Peng Fan Cc: Stefano Babic Cc: Ye Li Cc: uboot-imx --- drivers/usb/host/ehci-mx6.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index b1cc62fcc37..855a1bdaaa2 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -413,6 +413,7 @@ struct ehci_mx6_priv_data { struct usb_ehci *ehci; struct udevice *vbus_supply; struct clk clk; + struct phy phy; enum usb_init_type init_type; #if !defined(CONFIG_PHY) /* Legacy iMX6/iMX7/iMX7ULP compat, they do not use PHY framework yet */ @@ -676,16 +677,26 @@ static int ehci_usb_probe(struct udevice *dev) mdelay(10); +#if defined(CONFIG_PHY) + ret = ehci_setup_phy(dev, &priv->phy, 0); + if (ret) + goto err_regulator; +#endif + hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); hcor = (struct ehci_hcor *)((uint32_t)hccr + HC_LENGTH(ehci_readl(&(hccr)->cr_capbase))); ret = ehci_register(dev, hccr, hcor, &mx6_ehci_ops, 0, priv->init_type); if (ret) - goto err_regulator; + goto err_phy; return ret; +err_phy: +#if defined(CONFIG_PHY) + ehci_shutdown_phy(dev, &priv->phy); +#endif err_regulator: #if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) @@ -707,6 +718,10 @@ int ehci_usb_remove(struct udevice *dev) ehci_deregister(dev); +#if defined(CONFIG_PHY) + ehci_shutdown_phy(dev, &priv->phy); +#endif + #if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) regulator_set_enable(priv->vbus_supply, false);