From patchwork Mon Oct 21 14:18:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 3077961 Return-Path: X-Original-To: patchwork-dri-devel@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 2FB4DBF924 for ; Mon, 21 Oct 2013 14:20:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81BCF20211 for ; Mon, 21 Oct 2013 14:20:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 74C03201CD for ; Mon, 21 Oct 2013 14:20:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 220B0E6F5F for ; Mon, 21 Oct 2013 07:20:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A56DE6799 for ; Mon, 21 Oct 2013 07:18:54 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MV000A6EVRGHF30@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 21 Oct 2013 23:18:52 +0900 (KST) X-AuditID: cbfee61a-b7f836d0000025d7-04-526537cc78a4 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 06.0F.09687.CC735625; Mon, 21 Oct 2013 23:18:52 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MV000F8PVR0T800@mmp1.samsung.com>; Mon, 21 Oct 2013 23:18:52 +0900 (KST) From: Tomasz Stanislawski To: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 01/12] clk: propagate parent change up one level Date: Mon, 21 Oct 2013 16:18:20 +0200 Message-id: <1382365111-6533-2-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1382365111-6533-1-git-send-email-t.stanislaws@samsung.com> References: <1382365111-6533-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsVy+t9jAd0z5qlBBjOPa1nMP3KO1eLK1/ds FpPuT2Cx6F1wlc3iwtMeNouzTW/YLS7vmsNmMeP8PiaLpxMusllMWXSY1eLwm3ZWixmTX7JZ rJ/xmsViXvtLVotjM5YwOvB73Lm2h83jfvdxJo++LasYPY7f2M7k8XmTXABrFJdNSmpOZllq kb5dAlfG3st3WAqO8lfMvTKDuYHxJE8XIyeHhICJxNEXb5kgbDGJC/fWs3UxcnEICSxilDh0 6BkLhNPFJPH+1Qx2kCo2oI5jSz4zgtgiAokSv5rvMoMUMQscYpLY3TKFGSQhLGAnse/EXVYQ m0VAVWLaoX0sIDavgLvEzyWr2CHWyUs8vd/HBmJzCnhInHq5FmyoEFDNu2/zWCYw8i5gZFjF KJpakFxQnJSea6hXnJhbXJqXrpecn7uJERyoz6R2MK5ssDjEKMDBqMTDG+CSEiTEmlhWXJl7 iFGCg1lJhLfKNDVIiDclsbIqtSg/vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwT B6dUAyPvl1lrDol8k76XVFnyk/PTXbmrgvOOGvRZSZv+c9z35PuOv2v4eVRTAtO+z9RaX2/U LSVnXKx0qOnGxVXPGI8Vxm5m5lD9FyQS8Oe62pSbrZsVvXfMVL72pMf+2xL9ql0vctxtrXKE 1vgk7m7YZL5g141bJ1LD24LuS/46/OeQ0wXjS15PVlsosRRnJBpqMRcVJwIABgX0b1ACAAA= Cc: Tomasz Stanislawski , kgene.kim@samsung.com, mturquette@linaro.org, sw0312.kim@samsung.com, dri-devel@lists.freedesktop.org, kishon@ti.com, kyungmin.park@samsung.com, s.nawrocki@samsung.com, rahul.sharma@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch adds support for propagation of setup of clock's parent one level up. This feature is helpful when a driver changes topology of its clocks using clk_set_parent(). The problem occurs when on one platform/SoC driver's clock is located at MUX output but on the other platform/SoC there is a gated proxy clock between the MUX and driver's clock. In such a case, driver's code has to be modified to use one clock for enabling and the other clock for setup of a parent. The code updates are avoided by propagating setup of a parent up one level. Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming) flag to inform clk-core that clk_set_parent() should be propagated. Signed-off-by: Tomasz Stanislawski --- 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 a004769..14eda80 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1595,6 +1595,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent) /* try finding the new parent index */ if (parent) { + if ((clk->flags & CLK_SET_PARENT_PARENT) + && clk->num_parents == 1) { + ret = clk_set_parent(clk->parent, parent); + goto out; + } + p_index = clk_fetch_parent_index(clk, parent); p_rate = parent->rate; if (p_index == clk->num_parents) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 73bdb69..83c98d5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -29,6 +29,7 @@ #define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ #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_SET_PARENT_PARENT BIT(8) /* propagate parent change up one level */ struct clk_hw;