From patchwork Thu Apr 2 15:34:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 6150331 Return-Path: X-Original-To: patchwork-linux-rockchip@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 037E39F1BE for ; Thu, 2 Apr 2015 15:36:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 276D8203B0 for ; Thu, 2 Apr 2015 15:36:58 +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 3E3C8203AB for ; Thu, 2 Apr 2015 15:36:57 +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 1YdhAu-0000Hi-C7; Thu, 02 Apr 2015 15:36:56 +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 1Ydh8l-0006Ti-Ul; Thu, 02 Apr 2015 15:34:46 +0000 Received: from ip92344031.dynamic.kabel-deutschland.de ([146.52.64.49] helo=diego.lan) by gloria.sntech.de with esmtpsa (TLS1.1:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Ydh8N-0000Sn-BX; Thu, 02 Apr 2015 17:34:19 +0200 From: Heiko Stuebner To: mturquette@linaro.org Subject: [PATCH 3/4] clk: add CLK_DEFER_ORPHAN flag to prevent orphans from being used Date: Thu, 2 Apr 2015 17:34:12 +0200 Message-Id: <1427988853-9549-4-git-send-email-heiko@sntech.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427988853-9549-1-git-send-email-heiko@sntech.de> References: <1427988853-9549-1-git-send-email-heiko@sntech.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150402_083444_216633_0318F4A9 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: linux@arm.linux.org.uk, Heiko Stuebner , linux-kernel@vger.kernel.org, dianders@chromium.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 The usage of clocks derived from an orphan can produce issues when trying to set rates etc. So ideally a clk_get to such a clock should defer till the clock hierarchy is complete. But as some arches probably rely on such clocks we can't disable them all. Therefore add a new clk flag where arches can enable this behaviour for their clocks. Signed-off-by: Heiko Stuebner --- drivers/clk/clk.c | 6 ++++++ include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 476f491..8511c62 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3041,6 +3041,12 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, if (provider->node == clkspec->np) clk = provider->get(clkspec, provider->data); if (!IS_ERR(clk)) { + if ((__clk_get_flags(clk) & CLK_DEFER_ORPHAN) + && clk_is_orphan(clk)) { + clk = ERR_PTR(-EPROBE_DEFER); + break; + } + clk = __clk_create_clk(__clk_get_hw(clk), dev_id, con_id); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 28abf1b..ef8d669 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -31,6 +31,7 @@ #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ +#define CLK_DEFER_ORPHAN BIT(9) /* defer clk_get calls for orphans */ struct clk_hw; struct clk_core;