From patchwork Mon Oct 24 16:46:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ahaslam@baylibre.com X-Patchwork-Id: 9392629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57C7460762 for ; Mon, 24 Oct 2016 16:49:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46FA22841A for ; Mon, 24 Oct 2016 16:49:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B981291AC; Mon, 24 Oct 2016 16:49:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A28642841A for ; Mon, 24 Oct 2016 16:49:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1byiQ4-0002ih-Ky; Mon, 24 Oct 2016 16:48:16 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1byiOw-00025E-OO for linux-arm-kernel@lists.infradead.org; Mon, 24 Oct 2016 16:47:11 +0000 Received: by mail-wm0-x233.google.com with SMTP id c78so113869577wme.0 for ; Mon, 24 Oct 2016 09:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NhnR0LYz6Ld4BCVxbuLlO0rSypFUoiX6jtd+ENsmM3Q=; b=FGyRylpUg7aFApFGBnGRryEV3qlqZeKhfgch0+pgjS2ogQF3A1IakxUZXCcvTZdalE jnWBitfz9oq2adoZumfIv5Dpousvg633hF0ePvu5451p4fd61NcKTeIyavs4J0vTqkYK FzVgxlOC9gr1mAGkz6quwYigV8PYpW32All90rZNwRYpojRgoyYVfOvq1K8HsGVECDEb AG+E7YnAObP0jU2QLyIM0oeVR6a5s9eh2nq6DsBV4TAwffFiQDWTJ5Sh50TQc8XIBkrQ 0+C7qtawfQ2SpV6HEn7Hm+f+cPocf+Pe4uUSgu7d7Y1p/24rA7Y5tdDGVGMaSYpTXfAo MLfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NhnR0LYz6Ld4BCVxbuLlO0rSypFUoiX6jtd+ENsmM3Q=; b=OIIZapDQjazSs13rrawJ97Q/uRYJE/3voqVEmAzTueFJ3iz1rciwlOKyw2vghI/OjG yGoADIiIbnh/w1gSuPIMXh64zF2+H/EMSraOg7JkG4XuQKdjxbEn15DUuAHkeMJCn2UP rYDMrVoDREoNhRe4qCORD4bPLwAiqT4jPD/GJ2CDVnU3xhjkWKvW/NQxB9izVmaFEYuE ON3hfx0mWpgy/8QUvc71F+ye2g+IAoTmIgDEIxwQAdq3/N/fV9S0BoMKI8414U6AsxH6 YByH2yot8fBxs4bgjggQM8iavky7cId0mC0rTaExVElppPAaVcnR32mYvEg+htS0UnVI YA/Q== X-Gm-Message-State: ABUngvfrfINfbc3iEOWWh0UvWoSQQC9O3dhzUguGdhASDkjwTh+AksjOLI+T5gPoO0J8EW+e X-Received: by 10.194.119.66 with SMTP id ks2mr11901166wjb.181.1477327608441; Mon, 24 Oct 2016 09:46:48 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id o62sm15710148wmg.9.2016.10.24.09.46.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 09:46:48 -0700 (PDT) From: ahaslam@baylibre.com To: gregkh@linuxfoundation.org, johan@kernel.org, robh+dt@kernel.org, nsekhar@ti.com, stern@rowland.harvard.edu, khilman@baylibre.com, sshtylyov@ru.mvista.com, david@lechnology.com, manjunath.goudar@linaro.org, broonie@kernel.org, abailon@baylibre.com Subject: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable Date: Mon, 24 Oct 2016 18:46:24 +0200 Message-Id: <20161024164634.4330-8-ahaslam@baylibre.com> X-Mailer: git-send-email 2.10.1.502.g6598894 In-Reply-To: <20161024164634.4330-1-ahaslam@baylibre.com> References: <20161024164634.4330-1-ahaslam@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161024_094707_120287_03023849 X-CRM114-Status: GOOD ( 13.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Axel Haslam , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Axel Haslam While probing ochi phy with usb20 phy as a parent clock for usb11_phy, the usb20_phy clock enable would time out. This is because the usb20 module clock needs to enabled while trying to lock the usb20_phy PLL. Call clk enable and get for the usb20 peripheral before trying to enable the phy PLL. Signed-off-by: Axel Haslam --- arch/arm/mach-davinci/usb-da8xx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index 9e41a7f..982e105 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c @@ -53,11 +53,19 @@ int __init da8xx_register_usb_refclkin(int rate) static void usb20_phy_clk_enable(struct clk *clk) { + struct clk *usb20_clk; u32 val; u32 timeout = 500000; /* 500 msec */ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); + usb20_clk = clk_get(NULL, "usb20"); + if (IS_ERR(usb20_clk)) { + pr_err("could not get usb20 clk\n"); + return; + } + + clk_prepare_enable(usb20_clk); /* * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1 * host may use the PLL clock without USB 2.0 OTG being used. @@ -70,11 +78,14 @@ static void usb20_phy_clk_enable(struct clk *clk) while (--timeout) { val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); if (val & CFGCHIP2_PHYCLKGD) - return; + goto done; udelay(1); } pr_err("Timeout waiting for USB 2.0 PHY clock good.\n"); +done: + clk_disable_unprepare(usb20_clk); + clk_put(usb20_clk); } static void usb20_phy_clk_disable(struct clk *clk)