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: 3939091 Return-Path: X-Original-To: patchwork-dri-devel@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 92D0E9F1EE for ; Fri, 4 Apr 2014 14:54:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9127520382 for ; Fri, 4 Apr 2014 14:54:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6233820397 for ; Fri, 4 Apr 2014 14:53:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6E426E046; Fri, 4 Apr 2014 07:53:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id CDAAF6E046 for ; Fri, 4 Apr 2014 07:53:56 -0700 (PDT) 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 dri-devel@lists.freedesktop.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== Cc: Tomasz Stanislawski , kgene.kim@samsung.com, mturquette@linaro.org, sw0312.kim@samsung.com, rob.herring@calxeda.com, kishon@ti.com, a.hajda@samsung.com, kyungmin.park@samsung.com, sylvester.nawrocki@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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;