From patchwork Sat Aug 8 22:02:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joachim Eastwood X-Patchwork-Id: 6976111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0AAD49F358 for ; Sat, 8 Aug 2015 22:05:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E74F20708 for ; Sat, 8 Aug 2015 22:05:41 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id E35F120558 for ; Sat, 8 Aug 2015 22:05:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOCD9-0003ZJ-Ez; Sat, 08 Aug 2015 22:03:27 +0000 Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOCD6-0003Wk-Gn for linux-arm-kernel@lists.infradead.org; Sat, 08 Aug 2015 22:03:25 +0000 Received: by lagz9 with SMTP id z9so38183377lag.3 for ; Sat, 08 Aug 2015 15:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=B+BiwBm/N4SCUM1Wve3dmZpuY+HEi8P8idrSxQ8cFbw=; b=jHkxO+IUCGjoBKOdR2AzwwzfvrpxIOeG4yTSsiaH/iQHlbMDhZrLpdi4IRGRa5ukfq h/WauLw47LP8HS4uo5FgLRYhgyIVQK55v1B/6iuQKwuwXkTf95tsA98oMRsIur1Utj9M PzNXxdNPLbetdpTb12PSjZ52UbcvdGFNLhBYjrEHoBDhjydbG8mkZmkcM0gWQaukP+FB BTP5e/VfYN92NXMjMNzGgtgDxaQviPEbGMQS4WKam8DtKi/qnw7Aq1AFTVoxjLCNKgEZ A98YN+NIPflStSmm9SbRdsAYsihB9gb9aefTDDTZpTiILPQ3r/kYGgzWuOPMdxLi0saO HItw== X-Received: by 10.152.20.106 with SMTP id m10mr14589572lae.7.1439071381862; Sat, 08 Aug 2015 15:03:01 -0700 (PDT) Received: from localhost.localdomain ([89.11.213.141]) by smtp.gmail.com with ESMTPSA id ol6sm3075856lbb.37.2015.08.08.15.02.59 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Aug 2015 15:03:00 -0700 (PDT) From: Joachim Eastwood To: kishon@ti.com Subject: [PATCH] phy: lpc18xx-usb-otg: fix clock order in phy init Date: Sun, 9 Aug 2015 00:02:41 +0200 Message-Id: <1439071361-23105-1-git-send-email-manabian@gmail.com> X-Mailer: git-send-email 1.8.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150808_150324_745645_BA8782F7 X-CRM114-Status: GOOD ( 13.06 ) X-Spam-Score: -2.7 (--) 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: Joachim Eastwood , linux-usb@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-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Changing the frequency of the USB clock must be done before the PLL is powered on (prepared). This matters when the USB clock is not setup by either boot ROM or boot loader. Reorder the function calls to adhere to the order noted in the user manual. Signed-off-by: Joachim Eastwood --- Hi Kishon, Here one small fix for lpc18xx-usb-otg which I hope can go in for 4.3. While not a critical fix it will be needed when I add support for USB0 clock setup in Linux which I hope to add for 4.4. This patch is prerequisite for that. Right now USB only works if clocks are setup by either boot ROM or boot loader. Patch based on the next branch in your phy tree. drivers/phy/phy-lpc18xx-usb-otg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-lpc18xx-usb-otg.c b/drivers/phy/phy-lpc18xx-usb-otg.c index 3aa8e4de1b03..3b7a71eb5b7e 100644 --- a/drivers/phy/phy-lpc18xx-usb-otg.c +++ b/drivers/phy/phy-lpc18xx-usb-otg.c @@ -33,12 +33,12 @@ static int lpc18xx_usb_otg_phy_init(struct phy *phy) struct lpc18xx_usb_otg_phy *lpc = phy_get_drvdata(phy); int ret; - ret = clk_prepare(lpc->clk); + /* The PHY must be clocked at 480 MHz */ + ret = clk_set_rate(lpc->clk, 480000000); if (ret) return ret; - /* The PHY must be clocked at 480 MHz */ - return clk_set_rate(lpc->clk, 480000000); + return clk_prepare(lpc->clk); } static int lpc18xx_usb_otg_phy_exit(struct phy *phy)