From patchwork Thu Aug 7 12:57:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 4691061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7F58BC033A for ; Thu, 7 Aug 2014 12:58:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 881C0201DC for ; Thu, 7 Aug 2014 12:58:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 941C8201B4 for ; Thu, 7 Aug 2014 12:58:20 +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 1XFNF7-0000ti-0L; Thu, 07 Aug 2014 12:56:29 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFNF4-0000p6-7C for linux-arm-kernel@lists.infradead.org; Thu, 07 Aug 2014 12:56:27 +0000 Received: from ip92344b7b.dynamic.kabel-deutschland.de ([146.52.75.123] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XFNEe-00007z-K0; Thu, 07 Aug 2014 14:56:00 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Mike Turquette Subject: [PATCH] clk: rockchip: add initcall to set clk defaults after syscons are available Date: Thu, 07 Aug 2014 14:57:38 +0200 Message-ID: <1566610.B4NH8lpaoI@diego> User-Agent: KMail/4.11.5 (Linux/3.13-1-amd64; KDE/4.11.3; x86_64; ; ) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140807_055626_424007_A260C294 X-CRM114-Status: GOOD ( 10.20 ) X-Spam-Score: -0.7 (/) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 PLLs on Rockchip platforms report their locking state in an external register situated in the "General Register Files" which is provided through a syscon device. When the initial clk init runs, this syscon is of course not yet available, making it impossible to set PLLs to other frequencies through the assigned-rate property of the clock-controller node. Syscon devices are initialized through a postcore initcall, so add an arch_initcall to rerun the rockchip specific clock initalization when the GRF is available. As the clock init already runs two times (through of_clk_add_provider and of_clk_init), a third time shouldn't hurt to much and in the best case wouldn't change any settings at all. Signed-off-by: Heiko Stuebner Tested-by: Kever Yang --- drivers/clk/rockchip/clk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 9a3adb1..e14b108 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include "clk.h" @@ -126,6 +127,18 @@ void __init rockchip_clk_init(struct device_node *np, void __iomem *base, of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); } +/** + * Set clock-defaults again, after grf regmap is available for PLLs. + */ +static int __init rockchip_clk_set_defaults(void) +{ + if (cru_node) + return of_clk_set_defaults(cru_node, true); + + return 0; +} +arch_initcall(rockchip_clk_set_defaults); + struct regmap *rockchip_clk_get_grf(void) { if (IS_ERR(grf))