From patchwork Mon Feb 24 07:29:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3706781 Return-Path: X-Original-To: patchwork-linux-arm@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 E5FDBBF13A for ; Mon, 24 Feb 2014 07:29:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9B8920154 for ; Mon, 24 Feb 2014 07:29:32 +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 C70952012D for ; Mon, 24 Feb 2014 07:29:31 +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 1WHpyH-0007So-7l; Mon, 24 Feb 2014 07:29: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 1WHpy7-0001hn-VX; Mon, 24 Feb 2014 07:28:51 +0000 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WHpy6-0001gO-8Q for linux-arm-kernel@lists.infradead.org; Mon, 24 Feb 2014 07:28:50 +0000 Received: by mail-pb0-f53.google.com with SMTP id ma3so3517614pbc.40 for ; Sun, 23 Feb 2014 23:28:28 -0800 (PST) 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=uk1rrGouJSEQ88LwFb4dJwH/ddlVx9W0VmosPSjbHCg=; b=cxI8vI7lqXyQ/hFKdCXratFMFHFDvhnDnZZtK/tq883D+2x77wYcFUZxyRsZtEizFm +o5/RDtjkvWGoRhhT+MT3lhH13cap/hRTkDI5KNmRVMcx+hO399ItMvZaXXwbM13IwNe 6HtwJZL8ggcgq5nvJgvfoMCEDD8I8xCY+0US9m6gJV1FfO2BKYeXenEmJxE+MjUka7R8 sHA2mODX+2GSt472qtkVjsQYpfveTt+G6qdXuN0GZeJsd6oxOfRKZyDmY3jdzQUjBXtN D8HXek63ZcpK+y88FoQTBYyezVBW8EHJqAgn2xvotPTtnFZ0WFs+IFa65Be8h2/9tSok dKXA== X-Received: by 10.68.200.74 with SMTP id jq10mr23211018pbc.169.1393226908626; Sun, 23 Feb 2014 23:28:28 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id u6sm47011568pbu.16.2014.02.23.23.28.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Feb 2014 23:28:26 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Mon, 24 Feb 2014 16:29:30 +0900 Message-Id: <20140224072930.3522.54629.sendpatchset@w520> In-Reply-To: <20140224072921.3522.55023.sendpatchset@w520> References: <20140224072921.3522.55023.sendpatchset@w520> Subject: [PATCH 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140224_022850_400970_4843968C X-CRM114-Status: GOOD ( 13.75 ) 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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang --- 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(-) --- 0016/arch/arm/mach-shmobile/Makefile +++ work/arch/arm/mach-shmobile/Makefile 2014-02-24 15:45:31.000000000 +0900 @@ -23,8 +23,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 --- 0013/arch/arm/mach-shmobile/clock.c +++ work/arch/arm/mach-shmobile/clock.c 2014-02-24 15:56:51.000000000 +0900 @@ -21,6 +21,32 @@ */ #include #include + +#ifdef CONFIG_COMMON_CLK +#include +#include +#include "clock.h" + +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 "clock.h" @@ -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-02-24 15:45:31.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