Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB7D7C3DA7A for ; Mon, 2 Jan 2023 23:43:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F3208555B; Tue, 3 Jan 2023 00:42:43 +0100 (CET) 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=1672702964; bh=E9/vjzx+vPl8SrZL0ppgshiGFD3TfXZrPlG0OVOkZII=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iquDtM1VJ4pR37/9vtw36DAPGRVwW7MAt4R07KqVA3BPAGxN/ks3uuzWnibyg84rN iDNL5zHVMIsIg+ykez2uOEea7OoG9USUD2Lxyv/lIp9fMkEkJvuApXqIIdENBJtT8G UPMjvfYF5q1zI+CIy31fK3QRc2ufEigh8xzkqZqroWAT05bMn4iG4g+aWqyqL43QkL cdaNuEdd+5Zza3fWnxZXFXFr0yF/qmkNWXXEZn4CL9VAjA5HghwiNDemFBuVXDsOck ODCNMaiEEoc9AdrLgnCxVoGE9fOaCeNqebmZpph+EN/qZ3/0EG4SKj54LbZv9qZ12F MbsaKJx82UA+w== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id D25988551B; Tue, 3 Jan 2023 00:42:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1672702949; bh=E9/vjzx+vPl8SrZL0ppgshiGFD3TfXZrPlG0OVOkZII=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=B3A3W98V1QIVkqvPV7ZS5iP5TPjtf0Knz/skkQ2wofck/gyqyL0IR6C1DIPj4K5hD v1kbvDaZQpbLby2ug8D4z180vwAnPM4DmiUY3DfuUrw2ytZl63R1puCWsdIocNyMTB x1uDvB9skEuJmLCoks71vjTNCwYo3AcLc9PbZtnyJkX+F9W4YlJmsE9JFjOf86u+Us RvbJDwwMk/0vjbmRoBB1V4wmJljBqyh5RwtgmEEnB4Q7lY8FypvykbJ2WtHKYsr2xQ nQoLWuR89j/wVrrJ9nOXa8eXCcquwrvSLdi6yDNGERVa0OQh6+8pBrUORMnV78noD7 gTWtzZI+6Ueyw== Message-ID: <92352dd0-9606-ed73-ef93-33eee8e0e17c@denx.de> Date: Tue, 3 Jan 2023 00:33:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 4/4] usb: ohci-at91: Add USB PHY functionality Content-Language: en-US To: Sergiu Moga , michal.simek@amd.com, jim.t90615@gmail.com, sumit.garg@linaro.org, weijie.gao@mediatek.com, sjg@chromium.org, eugen.hristev@microchip.com, cristian.birsan@microchip.com Cc: u-boot@lists.denx.de, Mihai Sain References: <20221223123454.362757-1-sergiu.moga@microchip.com> <20221223123454.362757-5-sergiu.moga@microchip.com> From: Marek Vasut In-Reply-To: <20221223123454.362757-5-sergiu.moga@microchip.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean On 12/23/22 13:34, Sergiu Moga wrote: > Add the ability to enable/disable whatever USB PHY's are > passed to the AT91 OHCI driver through DT. > > Signed-off-by: Sergiu Moga > Tested-by: Mihai Sain > --- > drivers/usb/host/ohci-at91.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c > index 5cf8f283e5..217f31b402 100644 > --- a/drivers/usb/host/ohci-at91.c > +++ b/drivers/usb/host/ohci-at91.c > @@ -74,6 +74,10 @@ int usb_cpu_init_fail(void) > #include > #include "ohci.h" > > +#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB) > +#include > +#endif > + > #define AT91_MAX_USBH_PORTS 3 > > #define at91_for_each_port(index) \ > @@ -91,6 +95,10 @@ struct ohci_at91_priv { > struct clk *fclk; > struct clk *hclk; > bool clocked; > + > +#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB) > + struct phy phy[AT91_MAX_USBH_PORTS]; > +#endif > }; > > static void at91_start_clock(struct ohci_at91_priv *ohci_at91) > @@ -98,6 +106,13 @@ static void at91_start_clock(struct ohci_at91_priv *ohci_at91) > if (ohci_at91->clocked) > return; > > +#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB) Use plain: if (CONFIG_IS_ENABLED(...)) { ... } instead of the #if ... , the compiler would optimize the code out correctly. > + int i; > + > + at91_for_each_port(i) > + generic_phy_power_on(&ohci_at91->phy[i]); Look at generic_phy_get_bulk() and generic_phy_power_on_bulk() and co. those should get rid of this loop altogether. [...]