From patchwork Fri Oct 7 16:42:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Haslam X-Patchwork-Id: 9366995 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 62BF160752 for ; Fri, 7 Oct 2016 16:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52AD9296D9 for ; Fri, 7 Oct 2016 16:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46E1529745; Fri, 7 Oct 2016 16:45:05 +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 BAD422977B for ; Fri, 7 Oct 2016 16:45:04 +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 1bsYF6-0006cL-H6; Fri, 07 Oct 2016 16:43:28 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bsYF1-0006Uv-Cd for linux-arm-kernel@lists.infradead.org; Fri, 07 Oct 2016 16:43:24 +0000 Received: by mail-wm0-x22a.google.com with SMTP id k125so42872229wma.1 for ; Fri, 07 Oct 2016 09:43:02 -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=LFXbxeyEJhxazaotScgKPXzx3YaHV/ESULTSBhrNv/8=; b=IIkEW1qMrRHCD+Z1eWOa+i/UHQQqxd4DdehqKPbwdlQbWg318UBYw7wUP91SaKu+gy KBXwDnAivz0o+N7HV0lO/nTX4k/BHxsnsESu98sLnmKJ5ZV0xPjwnYvspDxqnIGuXYJ7 OpbpQ+hpGGj7J47pfpC8bjMB7EiKb8Ma6vIlaBwAtLWT21FU8z7NmyE+kB5iy6v0MqaG HGxyCOLqftiV+rl/uEvOeN6nV+VVLFC+XamthjXDfBYTYPkBCD6EzaeT9gUsjVwS1vRx RuBhCsyMSxSq/kZbCrPky3d8qEI8vrd9likToJpaXYt/pGjyaQXU8kU+rfJ2Fv0mOMGt /9gw== 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=LFXbxeyEJhxazaotScgKPXzx3YaHV/ESULTSBhrNv/8=; b=LIYeav9QcoriiL27Ayv7Ex7xDDZjOlMmvmPRWwt2c/ljf934FBevOl/hlkIKI9yh/6 +xQZkAG/Br1XK+6NgAWEB4mbUXoE2p/+ckgbESRPTCdOI0JDV27zpnx2uXmtpqsJmE8m aXS98eQAGH+UDVgFZQvfYqppxJsVtlZM7OT1s0EzXuKeOC57+vK3d8pbqm/9yYXSrjYb gcAbr9krMlvwgifGIgQnuon4qG/eGgx/PkuwI+nRK7okQmwBGUCXYhNxmMh+us6qeezt dNaW9K3zj3I9sW6+8b/+GMsEtE9FCuUWRPqTA/qOsWFreunDElwbtHqhLzyXm3MPYDGp x+OA== X-Gm-Message-State: AA6/9RlSk7fCkbdSdolLnDHLsAKWS62fgjoGPmHtASh5NHjRZBxURNXOt4fHnImx5hoDBnuZ X-Received: by 10.28.140.213 with SMTP id o204mr29062090wmd.111.1475858581529; Fri, 07 Oct 2016 09:43:01 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n5sm20353566wjv.35.2016.10.07.09.43.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Oct 2016 09:43:01 -0700 (PDT) From: ahaslam@baylibre.com To: gregkh@linuxfoundation.org, robh+dt@kernel.org, nsekhar@ti.com, stern@rowland.harvard.edu, khilman@baylibre.com, sshtylyov@ru.mvista.com, david@lechnology.com Subject: [PATCH/RFT 01/12] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable Date: Fri, 7 Oct 2016 18:42:46 +0200 Message-Id: <1475858577-10366-2-git-send-email-ahaslam@baylibre.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1475858577-10366-1-git-send-email-ahaslam@baylibre.com> References: <1475858577-10366-1-git-send-email-ahaslam@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161007_094323_672414_D22E15D8 X-CRM114-Status: GOOD ( 13.06 ) 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)