All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@ti.com>
To: paul@pwsan.com, mturquette@ti.com
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Rajendra Nayak <rnayak@ti.com>
Subject: [PATCH 09/29] ARM: omap: clk: Nuke plat/clock.c & reuse struct clk as clk_hw_omap
Date: Thu, 14 Jun 2012 18:16:58 +0530	[thread overview]
Message-ID: <1339678038-23082-10-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1339678038-23082-1-git-send-email-rnayak@ti.com>

plat/clock.c which has most of usecounting/locking infrastructure will
be used only for OMAP1 until that is moved to use COMMON clk.

reuse most of what plat/clock.h has while we move to common clk, and
move most of what 'struct clk' was as 'struct clk_hw_omap' which
will then be used to define platform specific parameters.
All usecounting/locking related variables from 'struct clk' are
dropped as they will not be used with 'struct clk_hw_omap'.

Based on the original changes from Mike Turquette.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/plat-omap/clock.c              |    2 +
 arch/arm/plat-omap/include/plat/clock.h |   69 +++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 62ec5c4..d311b7c 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -10,6 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#ifndef CONFIG_COMMON_CLK
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/list.h>
@@ -567,3 +568,4 @@ err_out:
 late_initcall(clk_debugfs_init);
 
 #endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
+#endif /* CONFIG_COMMON_CLK */
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index d0ef57c..741275d 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -15,6 +15,14 @@
 
 #include <linux/list.h>
 
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk-provider.h>
+
+struct clockdomain;
+#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
+
+#else
+
 struct module;
 struct clk;
 struct clockdomain;
@@ -47,6 +55,7 @@ struct clkops {
 	void			(*allow_idle)(struct clk *);
 	void			(*deny_idle)(struct clk *);
 };
+#endif /* CONFIG_COMMON_CLK */
 
 #ifdef CONFIG_ARCH_OMAP2PLUS
 
@@ -192,6 +201,65 @@ struct dpll_data {
 #define INVERT_ENABLE		(1 << 4)	/* 0 enables, 1 disables */
 #define CLOCK_CLKOUTX2		(1 << 5)
 
+#ifdef CONFIG_COMMON_CLK
+/**
+ * struct clk_hw_omap - OMAP struct clk
+ * @node: list_head connecting this clock into the full clock list
+ * @enable_reg: register to write to enable the clock (see @enable_bit)
+ * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
+ * @flags: see "struct clk.flags possibilities" above
+ * @clksel_reg: for clksel clks, register va containing src/divisor select
+ * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
+ * @clksel: for clksel clks, pointer to struct clksel for this clock
+ * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
+ * @clkdm_name: clockdomain name that this clock is contained in
+ * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
+ * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
+ * @src_offset: bitshift for source selection bitfield (OMAP1 only)
+ *
+ * XXX @rate_offset, @src_offset should probably be removed and OMAP1
+ * clock code converted to use clksel.
+ *
+ */
+
+struct clk_hw_omap_ops;
+
+struct clk_hw_omap {
+	struct clk_hw		hw;
+	struct list_head	node;
+	unsigned long		fixed_rate;
+	u8			fixed_div;
+	void __iomem		*enable_reg;
+	u8			enable_bit;
+	u8			flags;
+#ifdef CONFIG_ARCH_OMAP2PLUS
+	void __iomem		*clksel_reg;
+	u32			clksel_mask;
+	const struct clksel	*clksel;
+	struct dpll_data	*dpll_data;
+	const char		*clkdm_name;
+	struct clockdomain	*clkdm;
+#else
+	u8			rate_offset;
+	u8			src_offset;
+#endif
+	const struct clk_hw_omap_ops	*ops;
+};
+
+struct clk_hw_omap_ops {
+	void			(*find_idlest)(struct clk_hw_omap *oclk,
+					void __iomem **idlest_reg,
+					u8 *idlest_bit, u8 *idlest_val);
+	void			(*find_companion)(struct clk_hw_omap *oclk,
+					void __iomem **other_reg,
+					u8 *other_bit);
+	void			(*allow_idle)(struct clk_hw_omap *oclk);
+	void			(*deny_idle)(struct clk_hw_omap *oclk);
+};
+
+unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
+		unsigned long parent_rate);
+#else
 /**
  * struct clk - OMAP struct clk
  * @node: list_head connecting this clock into the full clock list
@@ -303,4 +371,5 @@ extern const struct clkops clkops_null;
 
 extern struct clk dummy_ck;
 
+#endif /* CONFIG_COMMON_CLK */
 #endif
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: rnayak@ti.com (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/29] ARM: omap: clk: Nuke plat/clock.c & reuse struct clk as clk_hw_omap
Date: Thu, 14 Jun 2012 18:16:58 +0530	[thread overview]
Message-ID: <1339678038-23082-10-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1339678038-23082-1-git-send-email-rnayak@ti.com>

plat/clock.c which has most of usecounting/locking infrastructure will
be used only for OMAP1 until that is moved to use COMMON clk.

reuse most of what plat/clock.h has while we move to common clk, and
move most of what 'struct clk' was as 'struct clk_hw_omap' which
will then be used to define platform specific parameters.
All usecounting/locking related variables from 'struct clk' are
dropped as they will not be used with 'struct clk_hw_omap'.

Based on the original changes from Mike Turquette.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/plat-omap/clock.c              |    2 +
 arch/arm/plat-omap/include/plat/clock.h |   69 +++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 62ec5c4..d311b7c 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -10,6 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#ifndef CONFIG_COMMON_CLK
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/list.h>
@@ -567,3 +568,4 @@ err_out:
 late_initcall(clk_debugfs_init);
 
 #endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
+#endif /* CONFIG_COMMON_CLK */
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index d0ef57c..741275d 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -15,6 +15,14 @@
 
 #include <linux/list.h>
 
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk-provider.h>
+
+struct clockdomain;
+#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
+
+#else
+
 struct module;
 struct clk;
 struct clockdomain;
@@ -47,6 +55,7 @@ struct clkops {
 	void			(*allow_idle)(struct clk *);
 	void			(*deny_idle)(struct clk *);
 };
+#endif /* CONFIG_COMMON_CLK */
 
 #ifdef CONFIG_ARCH_OMAP2PLUS
 
@@ -192,6 +201,65 @@ struct dpll_data {
 #define INVERT_ENABLE		(1 << 4)	/* 0 enables, 1 disables */
 #define CLOCK_CLKOUTX2		(1 << 5)
 
+#ifdef CONFIG_COMMON_CLK
+/**
+ * struct clk_hw_omap - OMAP struct clk
+ * @node: list_head connecting this clock into the full clock list
+ * @enable_reg: register to write to enable the clock (see @enable_bit)
+ * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
+ * @flags: see "struct clk.flags possibilities" above
+ * @clksel_reg: for clksel clks, register va containing src/divisor select
+ * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
+ * @clksel: for clksel clks, pointer to struct clksel for this clock
+ * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
+ * @clkdm_name: clockdomain name that this clock is contained in
+ * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name@runtime
+ * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
+ * @src_offset: bitshift for source selection bitfield (OMAP1 only)
+ *
+ * XXX @rate_offset, @src_offset should probably be removed and OMAP1
+ * clock code converted to use clksel.
+ *
+ */
+
+struct clk_hw_omap_ops;
+
+struct clk_hw_omap {
+	struct clk_hw		hw;
+	struct list_head	node;
+	unsigned long		fixed_rate;
+	u8			fixed_div;
+	void __iomem		*enable_reg;
+	u8			enable_bit;
+	u8			flags;
+#ifdef CONFIG_ARCH_OMAP2PLUS
+	void __iomem		*clksel_reg;
+	u32			clksel_mask;
+	const struct clksel	*clksel;
+	struct dpll_data	*dpll_data;
+	const char		*clkdm_name;
+	struct clockdomain	*clkdm;
+#else
+	u8			rate_offset;
+	u8			src_offset;
+#endif
+	const struct clk_hw_omap_ops	*ops;
+};
+
+struct clk_hw_omap_ops {
+	void			(*find_idlest)(struct clk_hw_omap *oclk,
+					void __iomem **idlest_reg,
+					u8 *idlest_bit, u8 *idlest_val);
+	void			(*find_companion)(struct clk_hw_omap *oclk,
+					void __iomem **other_reg,
+					u8 *other_bit);
+	void			(*allow_idle)(struct clk_hw_omap *oclk);
+	void			(*deny_idle)(struct clk_hw_omap *oclk);
+};
+
+unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
+		unsigned long parent_rate);
+#else
 /**
  * struct clk - OMAP struct clk
  * @node: list_head connecting this clock into the full clock list
@@ -303,4 +371,5 @@ extern const struct clkops clkops_null;
 
 extern struct clk dummy_ck;
 
+#endif /* CONFIG_COMMON_CLK */
 #endif
-- 
1.7.1

  parent reply	other threads:[~2012-06-14 12:47 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 12:46 [PATCH 00/29] Move OMAP2+ over to use COMMON clock Rajendra Nayak
2012-06-14 12:46 ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 01/29] clk: Add support for rate table based dividers Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-18 20:04   ` Mike Turquette
2012-06-18 20:04     ` Mike Turquette
2012-06-19  5:22     ` Rajendra Nayak
2012-06-19  5:22       ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 02/29] clk: Add CLK_IS_BASIC flag to identify basic clocks Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-07-03 12:34   ` Rajendra Nayak
2012-07-03 12:34     ` Rajendra Nayak
2012-07-04  6:18     ` Turquette, Mike
2012-07-04  6:18       ` Turquette, Mike
2012-07-04  6:39       ` Rajendra Nayak
2012-07-04  6:39         ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 03/29] ARM: omap4: cm: add bitfield width values Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 04/29] ARM: omap: clk: use clk_prepare_enable and clk_disable_unprepare Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 19:11   ` Mike Turquette
2012-06-14 19:11     ` Mike Turquette
2012-06-15  4:56     ` Rajendra Nayak
2012-06-15  4:56       ` Rajendra Nayak
2012-06-20 11:41       ` Tony Lindgren
2012-06-20 11:41         ` Tony Lindgren
2012-06-21  5:36         ` Rajendra Nayak
2012-06-21  5:36           ` Rajendra Nayak
2012-06-21  5:43           ` Paul Walmsley
2012-06-21  5:43             ` Paul Walmsley
2012-06-21  5:49             ` Rajendra Nayak
2012-06-21  5:49               ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 05/29] mmc: omap_hsmmc: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 06/29] hwrng: omap: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 07/29] mfd: omap-usb: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-07-02 11:18   ` Samuel Ortiz
2012-07-02 11:18     ` Samuel Ortiz
2012-07-02 11:16     ` Rajendra Nayak
2012-07-02 11:16       ` Rajendra Nayak
2012-07-02 15:23       ` Samuel Ortiz
2012-07-02 15:23         ` Samuel Ortiz
2012-06-14 12:46 ` [PATCH 08/29] ARM: omap: hwmod: get rid of all omap_clk_get_by_name usage Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` Rajendra Nayak [this message]
2012-06-14 12:46   ` [PATCH 09/29] ARM: omap: clk: Nuke plat/clock.c & reuse struct clk as clk_hw_omap Rajendra Nayak
2012-06-19  1:38   ` Mike Turquette
2012-06-19  1:38     ` Mike Turquette
2012-06-14 12:46 ` [PATCH 10/29] ARM: omap: clk: Remove all direct dereferncing of struct clk Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 11/29] ARM: omap: hwmod: Fix up hwmod based clkdm accesses Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 12/29] ARM: omap4: clk: Convert to common clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 13/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 14/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 15/29] ARM: omap: clk: list all clk_hw_omap clks to enable/disable autoidle Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 16/29] ARM: omap: clk: Define a function to enable clocks at init Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 17/29] ARM: omap: clock: Get rid of unwanted clkdm assocations within clks Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 18/29] ARM: omap4: clk: Add 44xx data using common struct clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 19/29] ARM: omap3: clk: Add 3xxx " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 20/29] ARM: omap2: clk: Add 24xx " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 21/29] ARM: omap: clk: Switch to COMMON clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 22/29] ARM: omap: clk: Use plat/clock.c only for OMAP1 Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 23/29] ARM: omap: hwmod: Cleanup !CONFIG_COMMON_CLK parts Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 24/29] ARM: omap4: clk: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 25/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 26/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 27/29] ARM: omap4: clk: Delete old OMAP clock data Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 28/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 29/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-18  4:27 ` [PATCH 00/29] Move OMAP2+ over to use COMMON clock Paul Walmsley
2012-06-18  4:27   ` Paul Walmsley
2012-06-18 11:03   ` Rajendra Nayak
2012-06-18 11:03     ` Rajendra Nayak
2012-09-11  6:35 ` Paul Walmsley
2012-09-11  6:35   ` Paul Walmsley
2012-09-11  9:46   ` Vaibhav Hiremath
2012-09-11  9:46     ` Vaibhav Hiremath
2012-09-11 23:10     ` Paul Walmsley
2012-09-11 23:10       ` Paul Walmsley
2012-09-12  3:53       ` Hiremath, Vaibhav
2012-09-12  3:53         ` Hiremath, Vaibhav
2012-09-11 20:09   ` Paul Walmsley
2012-09-11 20:09     ` Paul Walmsley
2012-09-15  5:32   ` Paul Walmsley
2012-09-15  5:32     ` Paul Walmsley
2012-09-15  5:49     ` Paul Walmsley
2012-09-15  5:49       ` Paul Walmsley
2012-09-16 20:36   ` Paul Walmsley
2012-09-16 20:36     ` Paul Walmsley
2012-09-17 21:26     ` Tony Lindgren
2012-09-17 21:26       ` Tony Lindgren
2012-09-17 22:12       ` Paul Walmsley
2012-09-17 22:12         ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339678038-23082-10-git-send-email-rnayak@ti.com \
    --to=rnayak@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@ti.com \
    --cc=paul@pwsan.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.