From patchwork Sun Apr 19 15:48:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1272950 X-Patchwork-Delegate: trini@ti.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=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=none (p=none dis=none) header.from=nic.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.a=rsa-sha256 header.s=default header.b=NNUoSxqt; 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 494vS56Nymz9s71 for ; Mon, 20 Apr 2020 01:50:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 021C081C3F; Sun, 19 Apr 2020 17:49:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz 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; secure) header.d=nic.cz header.i=@nic.cz header.b="NNUoSxqt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4045781205; Sun, 19 Apr 2020 17:49: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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.nic.cz (lists.nic.cz [IPv6:2001:1488:800:400::400]) (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 A5E548082B for ; Sun, 19 Apr 2020 17:48:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marek.behun@nic.cz Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 1442F140E7D; Sun, 19 Apr 2020 17:48:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1587311336; bh=Xmz36UoYA7KTSFRitgj7SqOjwFGIsGQElSdWsaMJtjI=; h=From:To:Date; b=NNUoSxqt+74to0ify9aEOWi7gI2tOIUHlaClprkEaZ3f2AbTD752vrz2t4hvg+gZI xmPMYtHxzf5Vq6mSAnG1ozXTYQuFJV8hiDGyvgwKbFAKfmIKFxCzdgmzVoVoShnjrM bzNV/IRPVS2AOQw/9h9qBvFwQV+Hg2nXAED3SXvI= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, Konstantin Porotchkin , make@marvell.com, Vladimir Vid , "Matwey V . Kornilov" , Miquel Raynal , Gregory CLEMENT , Andrew Lunn , Thomas Petazzoni , Tomasz Maciej Nowak , Ellie Reeves , Vladimir Oltean , Marek Vasut , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 05/11] usb: ehci-marvell: call generic-phy initialization Date: Sun, 19 Apr 2020 17:48:44 +0200 Message-Id: <20200419154850.25868-6-marek.behun@nic.cz> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200419154850.25868-1-marek.behun@nic.cz> References: <20200419154850.25868-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Spamd-Bar: / 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 Use the new usb_phys_setup and usb_phys_shutdown to initialize potential generic-phys in the ehci-marvell driver. Signed-off-by: Marek BehĂșn --- drivers/usb/host/ehci-marvell.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c index 8efe6b63b9..cee3896ba8 100644 --- a/drivers/usb/host/ehci-marvell.c +++ b/drivers/usb/host/ehci-marvell.c @@ -19,6 +19,8 @@ #include #endif +#include "phy.h" + DECLARE_GLOBAL_DATA_PTR; #define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4)) @@ -103,6 +105,7 @@ static int ehci_mvebu_probe(struct udevice *dev) struct ehci_mvebu_priv *priv = dev_get_priv(dev); struct ehci_hccr *hccr; struct ehci_hcor *hcor; + int err; /* * Get the base address for EHCI controller from the device node @@ -125,6 +128,10 @@ static int ehci_mvebu_probe(struct udevice *dev) else usb_brg_adrdec_setup((void *)priv->hcd_base); + err = usb_phys_setup(dev); + if (err) + return err; + hccr = (struct ehci_hccr *)(priv->hcd_base + 0x100); hcor = (struct ehci_hcor *) ((uintptr_t)hccr + HC_LENGTH(ehci_readl(&hccr->cr_capbase))); @@ -133,8 +140,28 @@ static int ehci_mvebu_probe(struct udevice *dev) (uintptr_t)hccr, (uintptr_t)hcor, (uintptr_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase))); - return ehci_register(dev, hccr, hcor, &marvell_ehci_ops, 0, - USB_INIT_HOST); + err = ehci_register(dev, hccr, hcor, &marvell_ehci_ops, 0, + USB_INIT_HOST); + if (err) + goto phy_err; + + return 0; + +phy_err: + usb_phys_shutdown(dev); + + return err; +} + +static int ehci_mvebu_remove(struct udevice *dev) +{ + int ret; + + ret = ehci_deregister(dev); + if (ret) + return ret; + + return usb_phys_shutdown(dev); } static const struct udevice_id ehci_usb_ids[] = { @@ -148,7 +175,7 @@ U_BOOT_DRIVER(ehci_mvebu) = { .id = UCLASS_USB, .of_match = ehci_usb_ids, .probe = ehci_mvebu_probe, - .remove = ehci_deregister, + .remove = ehci_mvebu_remove, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_mvebu_priv),