From patchwork Wed Aug 24 13:15:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 1092512 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7ODN3tn022162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 24 Aug 2011 13:23:29 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwDLS-0007WA-RQ; Wed, 24 Aug 2011 13:18:16 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QwDLS-0006B5-1j; Wed, 24 Aug 2011 13:18:14 +0000 Received: from opensource.wolfsonmicro.com ([80.75.67.52] helo=opensource2.wolfsonmicro.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwDJP-0005bB-Du for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2011 13:16:10 +0000 Received: from finisterre.wolfsonmicro.main (unknown [87.246.78.26]) by opensource2.wolfsonmicro.com (Postfix) with ESMTPSA id 4F9FB11056E; Wed, 24 Aug 2011 14:16:01 +0100 (BST) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.76) (envelope-from ) id 1QwDJI-0004Q3-Me; Wed, 24 Aug 2011 14:16:00 +0100 From: Mark Brown To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/11] clk: Add fixed-rate clock Date: Wed, 24 Aug 2011 14:15:51 +0100 Message-Id: <1314191759-16941-3-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1314191759-16941-1-git-send-email-broonie@opensource.wolfsonmicro.com> References: <20110824131324.GB16520@opensource.wolfsonmicro.com> <1314191759-16941-1-git-send-email-broonie@opensource.wolfsonmicro.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110824_091607_838759_6402BA21 X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -0.5 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Jeremy Kerr , Mark Brown , Linus Walleij , Mike Turquette X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 24 Aug 2011 13:23:29 +0000 (UTC) From: Jeremy Kerr Signed-off-by: Jeremy Kerr Signed-off-by: Mark Brown --- drivers/clk/Kconfig | 4 ++++ drivers/clk/Makefile | 1 + drivers/clk/clk-fixed.c | 17 +++++++++++++++++ include/linux/clk.h | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/clk-fixed.c diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index c53ed59..d8313d7 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -8,3 +8,7 @@ config HAVE_MACH_CLKDEV config GENERIC_CLK bool + +config GENERIC_CLK_FIXED + bool + depends on GENERIC_CLK diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 570d5b9..9a3325a 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o obj-$(CONFIG_GENERIC_CLK) += clk.o +obj-$(CONFIG_GENERIC_CLK_FIXED) += clk-fixed.o diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c new file mode 100644 index 0000000..47a27f9 --- /dev/null +++ b/drivers/clk/clk-fixed.c @@ -0,0 +1,17 @@ + +#include +#include + +#define to_clk_fixed(c) container_of(c, struct clk_hw_fixed, hw) + +static unsigned long clk_fixed_recalc_rate(struct clk_hw *hw) +{ + return to_clk_fixed(hw)->rate; +} + +struct clk_hw_ops clk_fixed_ops = { + .recalc_rate = clk_fixed_recalc_rate, +}; +EXPORT_SYMBOL_GPL(clk_fixed_ops); + + diff --git a/include/linux/clk.h b/include/linux/clk.h index e0969d2..fd62e86 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -110,6 +110,20 @@ int clk_prepare(struct clk *clk); */ void clk_unprepare(struct clk *clk); +/* Base clock implementations. Platform clock implementations can use these + * directly, or 'subclass' as approprate */ + +#ifdef CONFIG_GENERIC_CLK_FIXED + +struct clk_hw_fixed { + struct clk_hw hw; + unsigned long rate; +}; + +extern struct clk_hw_ops clk_fixed_ops; + +#endif /* CONFIG_GENERIC_CLK_FIXED */ + #else /* !CONFIG_GENERIC_CLK */ /*