From patchwork Fri Apr 4 14:53:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 3939781 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A2C999F334 for ; Fri, 4 Apr 2014 17:04:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D390020395 for ; Fri, 4 Apr 2014 17:04:00 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 88DB52011D for ; Fri, 4 Apr 2014 17:03:59 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WW5WG-0004wq-Pu; Fri, 04 Apr 2014 14:55:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WW5Vh-000508-3D; Fri, 04 Apr 2014 14:54:25 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WW5Vc-0004xK-9w for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2014 14:54:21 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3I001TLHDVE430@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2014 23:53:55 +0900 (KST) X-AuditID: cbfee61a-b7fb26d00000724f-80-533ec783b45b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 56.2F.29263.387CE335; Fri, 04 Apr 2014 23:53:55 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3I00MT5HD4NV30@mmp2.samsung.com>; Fri, 04 Apr 2014 23:53:55 +0900 (KST) From: Tomasz Stanislawski To: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/4] clk: propagate parent change up one level Date: Fri, 04 Apr 2014 16:53:18 +0200 Message-id: <1396623201-26000-2-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1396623201-26000-1-git-send-email-t.stanislaws@samsung.com> References: <1396623201-26000-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsVy+t9jQd3m43bBBnu2aFvcWneO1aL33Ekm i/lHgKwrX9+zWUy6P4HFonfBVTaLC0972CzONr1ht9j0+BqrxeVdc9gsZpzfx2TxdMJFNovD Kw4wWcyY/JLNYt7nnUwW62e8ZrGY1/6S1UHQY8HnK+weO2fdZfe4c20Pm8f2bw9YPe53H2fy 2Lyk3qNvyypGj+M3tjN5fN4kF8AZxWWTkpqTWZZapG+XwJXx/ApbwTn+iskbrrM1MF7k6WLk 5JAQMJFY93waK4QtJnHh3nq2LkYuDiGB6YwSV7deY4Zwupgklly4zwhSxQbUcWzJZ0aQhIjA KkaJif+fsoM4zAKbmCR2NnazdDFycAgL2En0//QFaWARUJXY86eLFSTMK+AhsXKKGcQ2RYnu ZxPYQGxOAU+J3iXfmUFsIaCS7jULWCYw8i5gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJ ERzez6R2MK5ssDjEKMDBqMTD27HDLliINbGsuDL3EKMEB7OSCG/dBKAQb0piZVVqUX58UWlO avEhRmkOFiVx3gOt1oFCAumJJanZqakFqUUwWSYOTqkGRp5Tn084zi5eW7zd6i/PJNV7ji/W 3vPXKOGrnCDntshaZM6t4mgJth8mYuFzLitmV2v/PDBn2s3eixMl2FQaPCtV79vMY7q5vmJR jtUlMZbjurrHrV3mu/Fv/7+ia8Zc7U/Xr6yt73XZtHd361v/oLBwxd+nvxVuMjz4qu/k8SIe xnOv5a5pHVFiKc5INNRiLipOBABuav0CawIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140404_105420_621671_266150DF X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -7.5 (-------) Cc: Tomasz Stanislawski , kgene.kim@samsung.com, mturquette@linaro.org, airlied@linux.ie, t.figa@samsung.com, sw0312.kim@samsung.com, rob.herring@calxeda.com, kishon@ti.com, inki.dae@samsung.com, a.hajda@samsung.com, kyungmin.park@samsung.com, sylvester.nawrocki@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.8 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 Reviewed-by: Tomasz Figa --- 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 dff0373..53bbfda 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1737,6 +1737,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 < 0) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5119174..daa0b03 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -30,6 +30,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_SET_PARENT_PARENT BIT(9) /* propagate parent change up one level */ struct clk_hw; struct dentry;