From patchwork Wed Mar 12 23:36:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3821341 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 9A3A09F2BB for ; Wed, 12 Mar 2014 23:40:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B89FB202A1 for ; Wed, 12 Mar 2014 23:40:50 +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 AE5F22027D for ; Wed, 12 Mar 2014 23:40:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNsl2-0001Tu-Bc; Wed, 12 Mar 2014 23:40:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNsgA-0007lP-6p; Wed, 12 Mar 2014 23:35:18 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNsg5-0007jv-I5 for linux-arm-kernel@lists.infradead.org; Wed, 12 Mar 2014 23:35:15 +0000 Received: by mail-pa0-f49.google.com with SMTP id lj1so231723pab.22 for ; Wed, 12 Mar 2014 16:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=MsDTI1ymKK9bZyg/NC63BIuYsYdKygrhOmZQTlPQbQg=; b=NH5ictQ7Y0zqkbW86xM8xReIGT9waiw23Clx1+hPv/CggU3JYIQUj6xe9v+W/ALmmH qo61BqZ+op/+AVsvAwg9Z+MjQDRwFOGXhlwhnKuzdknvavMaDtLiDHGBbN7yR9llJ8Nb nyVWJL86jWtcaOOCqypmYtwVBkscbdKpQnNsf+f0kh3A4QD/kEg42gyxWyEIR/K9J3Hz CHcmJRg35RYq9SQO/ovpFRYpwCkoykzts/oZLjj4W3ez9j1rs80E/pbjvh4qrbOjjS11 u8fwjEFJQ5UvlVdnaeW3OS8p2GfvOoOizA8Cj1WsXqy4LhSa0rxv+ENEYE37B4s0A2ae HjWw== X-Received: by 10.69.31.75 with SMTP id kk11mr235099pbd.101.1394667291615; Wed, 12 Mar 2014 16:34:51 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id j3sm783305pbh.38.2014.03.12.16.34.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Mar 2014 16:34:50 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Thu, 13 Mar 2014 08:36:17 +0900 Message-Id: <20140312233617.17009.94940.sendpatchset@w520> In-Reply-To: <20140312233608.17009.65690.sendpatchset@w520> References: <20140312233608.17009.65690.sendpatchset@w520> Subject: [PATCH v2 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140312_193513_750544_196E70A9 X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -2.0 (--) Cc: horms@verge.net.au, Magnus Damm , linux-arm-kernel@lists.infradead.org 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: Magnus Damm Introduce a new clock workaround function used by DT reference code on the mach-shmobile subarchitecture. The new function shmobile_clk_workaround() is used to configure clkdev to allow DT and platform devices to coexist. It is possible for the DT reference board code to also request enabling of the clock in case the driver does not implement clock control. Signed-off-by: Magnus Damm --- Changes since V1: - Reworked patch dependency, updated include file path arch/arm/mach-shmobile/Makefile | 2 - arch/arm/mach-shmobile/clock.c | 29 +++++++++++++++++++++++++++ arch/arm/mach-shmobile/include/mach/clock.h | 16 ++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) --- 0001/arch/arm/mach-shmobile/Makefile +++ work/arch/arm/mach-shmobile/Makefile 2014-03-13 08:29:12.000000000 +0900 @@ -21,8 +21,8 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2. obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o # Clock objects -ifndef CONFIG_COMMON_CLK obj-y += clock.o +ifndef CONFIG_COMMON_CLK obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o --- 0001/arch/arm/mach-shmobile/clock.c +++ work/arch/arm/mach-shmobile/clock.c 2014-03-13 08:29:35.000000000 +0900 @@ -21,6 +21,32 @@ */ #include #include + +#ifdef CONFIG_COMMON_CLK +#include +#include +#include + +void __init shmobile_clk_workaround(const struct clk_name *clks, + int nr_clks, bool enable) +{ + const struct clk_name *clkn; + struct clk *clk; + unsigned int i; + + for (i = 0; i < nr_clks; ++i) { + clkn = clks + i; + clk = clk_get(NULL, clkn->clk); + if (!IS_ERR(clk)) { + clk_register_clkdev(clk, clkn->con_id, clkn->dev_id); + if (enable) + clk_prepare_enable(clk); + clk_put(clk); + } + } +} + +#else /* CONFIG_COMMON_CLK */ #include #include #include @@ -58,3 +84,6 @@ void __clk_put(struct clk *clk) { } EXPORT_SYMBOL(__clk_put); + +#endif /* CONFIG_COMMON_CLK */ + --- 0001/arch/arm/mach-shmobile/include/mach/clock.h +++ work/arch/arm/mach-shmobile/include/mach/clock.h 2014-03-13 08:29:12.000000000 +0900 @@ -1,6 +1,21 @@ #ifndef CLOCK_H #define CLOCK_H +#ifdef CONFIG_COMMON_CLK +/* temporary clock configuration helper for platform devices */ + +struct clk_name { + const char *clk; + const char *con_id; + const char *dev_id; +}; + +void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks, + bool enable); + +#else /* CONFIG_COMMON_CLK */ +/* legacy clock implementation */ + unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk); extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops; @@ -36,4 +51,5 @@ do { \ (p)->div = d; \ } while (0) +#endif /* CONFIG_COMMON_CLK */ #endif