From patchwork Thu Sep 22 22:26:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 4286 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A1CF823EF5 for ; Thu, 22 Sep 2011 22:30:59 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 96A53A18304 for ; Thu, 22 Sep 2011 22:30:59 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so4544060fxe.11 for ; Thu, 22 Sep 2011 15:30:59 -0700 (PDT) Received: by 10.223.74.89 with SMTP id t25mr3816898faj.65.1316730659471; Thu, 22 Sep 2011 15:30:59 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs186670lad; Thu, 22 Sep 2011 15:30:59 -0700 (PDT) Received: by 10.68.19.71 with SMTP id c7mr6590244pbe.73.1316730658490; Thu, 22 Sep 2011 15:30:58 -0700 (PDT) Received: from na3sys009aog106.obsmtp.com ([74.125.149.76]) by mx.google.com with SMTP id k10si10383606pbj.27.2011.09.22.15.30.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Sep 2011 15:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of mturquette@ti.com designates 74.125.149.76 as permitted sender) client-ip=74.125.149.76; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mturquette@ti.com designates 74.125.149.76 as permitted sender) smtp.mail=mturquette@ti.com Received: from mail-gw0-f41.google.com ([74.125.83.41]) (using TLSv1) by na3sys009aob106.postini.com ([74.125.148.12]) with SMTP ID DSNKTnu3HjXv9aZcH9SNoSk3Ik9PtCMhGFqK@postini.com; Thu, 22 Sep 2011 15:30:58 PDT Received: by mail-gw0-f41.google.com with SMTP id a12so4300911gwa.28 for ; Thu, 22 Sep 2011 15:30:54 -0700 (PDT) Received: by 10.236.180.73 with SMTP id i49mr17252508yhm.65.1316730654576; Thu, 22 Sep 2011 15:30:54 -0700 (PDT) Received: from localhost.localdomain (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id p20sm30867801ano.4.2011.09.22.15.30.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Sep 2011 15:30:53 -0700 (PDT) From: Mike Turquette To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, jeremy.kerr@canonical.com, broonie@opensource.wolfsonmicro.com, tglx@linutronix.de, linus.walleij@stericsson.com, amit.kucheria@linaro.org, dsaxena@linaro.org, patches@linaro.org, linaro-dev@lists.linaro.org, paul@pwsan.com, grant.likely@secretlab.ca, sboyd@quiinc.com, shawn.guo@freescale.com, skannan@quicinc.com, magnus.damm@gmail.com, arnd.bergmann@linaro.org, linux@arm.linux.org.uk, eric.miao@linaro.org, richard.zhao@linaro.org, Mike Turquette Subject: [PATCH v2 3/7] clk: Add fixed-rate clock Date: Thu, 22 Sep 2011 15:26:58 -0700 Message-Id: <1316730422-20027-4-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1316730422-20027-1-git-send-email-mturquette@ti.com> References: <1316730422-20027-1-git-send-email-mturquette@ti.com> From: Jeremy Kerr Signed-off-by: Jeremy Kerr Signed-off-by: Mark Brown Signed-off-by: Mike Turquette --- Changes since v1: Add copyright header drivers/clk/Kconfig | 4 ++++ drivers/clk/Makefile | 1 + drivers/clk/clk-fixed.c | 24 ++++++++++++++++++++++++ include/linux/clk.h | 14 ++++++++++++++ 4 files changed, 43 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..956fb9a --- /dev/null +++ b/drivers/clk/clk-fixed.c @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2010-2011 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Simple fixed-rate clock implementation + */ + +#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 0d2cd5e..1903dd8 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 */ + /** * clk_register - register and initialize a new clock *