Skip to contentSkip to conversation

OMAP clock: convert static definitions in header files to C files

PATCH New Paul Walmsley 4 participants 29 messages Dec 3, 2009 – Dec 7, 2009

Subsystems (5)
lore
Share & tools
lore

Paul Walmsley

author maintainer
#0 lore raw

cover OMAP clock: convert static definitions in header files to C files

The OMAP clock code has traditionally defined its clock nodes statically in header files (e.g., mach-omap1/clock.h). This violates the general guideline that including a header file should be side-effect free, or at least as side-effect free as possible. This series moves all of the statically-allocated data from header files into C files that are linked into kernels. It moves OPP data (or at least the proto-OPP data in OMAP1 and OMAP2xxx) into separate files. It also resolves all of the checkpatch errors that appear as a result of the move.

This series has been boot-tested on OMAP1 (on a 5912 OSK), OMAP2 (on N800 and 2430 SDP), and OMAP3 (BeagleBoard).

This series was prompted by a comment from Russell King <[email protected]>, who suggested the basic layout that these patches implement.

- Paul

---

size:
text data bss dec hex filename
3582959 199264 107176 3889399 3b58f7 vmlinux.beagle.orig
3583063 199264 107176 3889503 3b595f vmlinux.beagle

Paul Walmsley (8):
OMAP1/2/3 clock: remove paranoid checks in preparation for clock{,2xxx,3xxx}_data.c OMAP2 clock: APLL code shouldn't rely on static clocks in its local namespace OMAP2/3: move SDRC macros to mach-omap2/sdrc.h
OMAP2xxx clock: remove implicit dependency between rate CPU flag and clkdev_omap CPU flag OMAP3 clock: convert clock34xx.h to clock34xx_data.c
OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx*
OMAP1 clock: convert test in disable_unused() to use ENABLE_ON_INIT
OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

 arch/arm/mach-omap1/Makefile                  |    3 
 arch/arm/mach-omap1/clock.c                   |  415 ---
 arch/arm/mach-omap1/clock.h                   |  652 -----
 arch/arm/mach-omap1/clock_data.c              |  443 +++-
 arch/arm/mach-omap1/io.c                      |    3 
 arch/arm/mach-omap1/opp.h                     |   28 
 arch/arm/mach-omap1/opp_data.c                |   59 
 arch/arm/mach-omap2/Makefile                  |    8 
 arch/arm/mach-omap2/clock.h                   |   30 
 arch/arm/mach-omap2/clock24xx.c               |  805 -------
 arch/arm/mach-omap2/clock2xxx.c               |  564 +++++
 arch/arm/mach-omap2/clock2xxx.h               |   44 
 arch/arm/mach-omap2/clock2xxx_data.c          |  844 ++-----
 arch/arm/mach-omap2/clock34xx.c               |  471 ----
 arch/arm/mach-omap2/clock34xx.h               | 3013 -------------------------
 arch/arm/mach-omap2/clock34xx_data.c          |  364 +++
 arch/arm/mach-omap2/clock_common_data.c       |   39 
 arch/arm/mach-omap2/opp2420_data.c            |  126 +
 arch/arm/mach-omap2/opp2430_data.c            |  133 +
 arch/arm/mach-omap2/opp2xxx.h                 |  424 ++++
 arch/arm/mach-omap2/sdrc.h                    |   19 
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   41 
 arch/arm/plat-omap/include/plat/clock.h       |    2 
 23 files changed, 2592 insertions(+), 5938 deletions(-)
 copy arch/arm/mach-omap1/{clock.h => clock_data.c} (58%)
 create mode 100644 arch/arm/mach-omap1/opp.h
 create mode 100644 arch/arm/mach-omap1/opp_data.c
 delete mode 100644 arch/arm/mach-omap2/clock24xx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.h
 rename arch/arm/mach-omap2/{clock24xx.h => clock2xxx_data.c} (73%)
 copy arch/arm/mach-omap2/{clock34xx.h => clock34xx_data.c} (86%)
 create mode 100644 arch/arm/mach-omap2/clock_common_data.c
 create mode 100644 arch/arm/mach-omap2/opp2420_data.c
 create mode 100644 arch/arm/mach-omap2/opp2430_data.c
 create mode 100644 arch/arm/mach-omap2/opp2xxx.h
 create mode 100644 arch/arm/plat-omap/include/plat/clkdev_omap.h
author maintainer
#1 lore raw

PATCH 1/8 OMAP1/2/3 clock: remove paranoid checks in preparation for clock{, 2xxx, 3xxx}_data.c

Some parts of the clock code took advantage of the fact that the statically allocated clock tree was in clock{,24xx,34xx}.c's local namespace to do some extra argument checks. These are overzealous and are more difficult to maintain when the clock tree is in a separate namespace, so, remove them.

---
 arch/arm/mach-omap1/clock.c     |    6 ------
 arch/arm/mach-omap2/clock24xx.c |    6 ------
 arch/arm/mach-omap2/clock34xx.c |   18 ------------------
 3 files changed, 0 insertions(+), 30 deletions(-)
arch/arm/mach-omap1/clock.c +0 -6
index 42cbe20..e006493 100644
@@ -376,9 +376,6 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate)
 	/* Find the highest supported frequency <= rate and switch to it */
 	struct mpu_rate * ptr;
 
-	if (clk != &virtual_ck_mpu)
-		return -EINVAL;
-
 	for (ptr = rate_table; ptr->rate; ptr++) {
 		if (ptr->xtal != ck_ref.rate)
 			continue;
@@ -465,9 +462,6 @@ static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate)
 	struct mpu_rate * ptr;
 	long  highest_rate;
 
-	if (clk != &virtual_ck_mpu)
-		return -EINVAL;
-
 	highest_rate = -EINVAL;
 
 	for (ptr = rate_table; ptr->rate; ptr++) {
arch/arm/mach-omap2/clock24xx.c +0 -6
index 845b478..8ecd175 100644
@@ -512,9 +512,6 @@ static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
 	struct prcm_config *ptr;
 	long highest_rate;
 
-	if (clk != &virt_prcm_set)
-		return -EINVAL;
-
 	highest_rate = -EINVAL;
 
 	for (ptr = rate_table; ptr->mpu_speed; ptr++) {
@@ -540,9 +537,6 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
 	unsigned long found_speed = 0;
 	unsigned long flags;
 
-	if (clk != &virt_prcm_set)
-		return -EINVAL;
-
 	for (prcm = rate_table; prcm->mpu_speed; prcm++) {
 		if (!(prcm->flags & cpu_mask))
 			continue;
arch/arm/mach-omap2/clock34xx.c +0 -18
index 2878733..a4b903d 100644
@@ -520,9 +520,6 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
 	u8 ai;
 	int r;
 
-	if (clk == &dpll3_ck)
-		return -EINVAL;
-
 	pr_debug("clock: locking DPLL %s\n", clk->name);
 
 	ai = omap3_dpll_autoidle_read(clk);
@@ -557,9 +554,6 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
 	int r;
 	u8 ai;
 
-	if (clk == &dpll3_ck)
-		return -EINVAL;
-
 	if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
 		return -EINVAL;
 
@@ -593,9 +587,6 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
 {
 	u8 ai;
 
-	if (clk == &dpll3_ck)
-		return -EINVAL;
-
 	if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
 		return -EINVAL;
 
@@ -632,9 +623,6 @@ static int omap3_noncore_dpll_enable(struct clk *clk)
 	int r;
 	struct dpll_data *dd;
 
-	if (clk == &dpll3_ck)
-		return -EINVAL;
-
 	dd = clk->dpll_data;
 	if (!dd)
 		return -EINVAL;
@@ -669,9 +657,6 @@ static int omap3_noncore_dpll_enable(struct clk *clk)
  */
 static void omap3_noncore_dpll_disable(struct clk *clk)
 {
-	if (clk == &dpll3_ck)
-		return;
-
 	_omap3_noncore_dpll_stop(clk);
 }
 
@@ -844,9 +829,6 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
 	if (!clk || !rate)
 		return -EINVAL;
 
-	if (clk != &dpll3_m2_ck)
-		return -EINVAL;
-
 	validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
 	if (validrate != rate)
 		return -EINVAL;
author maintainer
#2 lore raw

PATCH 2/8 OMAP2 clock: APLL code shouldn't rely on static clocks in its local namespace

In reply to Paul Walmsley

Similar to the previous patch, the APLL code relied on the presence of the static struct clks in its own namespace. The APLL code didn't use them for validation, however - it adjusted its own internal state depending on the struct clk * that called it. Now that static struct clks are leaving the clock24xx.c namespace, use a more durable method: split the omap2_clk_fixed_enable() function into omap2_clk_apll96_enable() and omap2_clk_apll54_enable(). They still share a disable function.

---
 arch/arm/mach-omap2/clock24xx.c |   35 +++++++++++++++++++++++------------
 arch/arm/mach-omap2/clock24xx.h |    4 ++--
 2 files changed, 25 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/clock24xx.c +23 -12
index 8ecd175..e60d1c0 100644
@@ -42,7 +42,8 @@
 #include "cm-regbits-24xx.h"
 
 static const struct clkops clkops_oscck;
-static const struct clkops clkops_fixed;
+static const struct clkops clkops_apll96;
+static const struct clkops clkops_apll54;
 
 static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
 					   void __iomem **idlest_reg,
@@ -338,7 +339,7 @@ static void omap2_sys_clk_recalc(struct clk * clk)
 #endif	/* OLD_CK */
 
 /* Enable an APLL if off */
-static int omap2_clk_fixed_enable(struct clk *clk)
+static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
 {
 	u32 cval, apll_mask;
 
@@ -353,12 +354,7 @@ static int omap2_clk_fixed_enable(struct clk *clk)
 	cval |= apll_mask;
 	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 
-	if (clk == &apll96_ck)
-		cval = OMAP24XX_ST_96M_APLL;
-	else if (clk == &apll54_ck)
-		cval = OMAP24XX_ST_54M_APLL;
-
-	omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval,
+	omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), status_mask,
 			     clk->name);
 
 	/*
@@ -368,8 +364,18 @@ static int omap2_clk_fixed_enable(struct clk *clk)
 	return 0;
 }
 
+static int omap2_clk_apll96_enable(struct clk *clk)
+{
+	return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL);
+}
+
+static int omap2_clk_apll54_enable(struct clk *clk)
+{
+	return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL);
+}
+
 /* Stop APLL */
-static void omap2_clk_fixed_disable(struct clk *clk)
+static void omap2_clk_apll_disable(struct clk *clk)
 {
 	u32 cval;
 
@@ -378,9 +384,14 @@ static void omap2_clk_fixed_disable(struct clk *clk)
 	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 }
 
-static const struct clkops clkops_fixed = {
-	.enable		= &omap2_clk_fixed_enable,
-	.disable	= &omap2_clk_fixed_disable,
+static const struct clkops clkops_apll96 = {
+	.enable		= &omap2_clk_apll96_enable,
+	.disable	= &omap2_clk_apll_disable,
+};
+
+static const struct clkops clkops_apll54 = {
+	.enable		= &omap2_clk_apll54_enable,
+	.disable	= &omap2_clk_apll_disable,
 };
 
 /*
arch/arm/mach-omap2/clock24xx.h +2 -2
index d19cf7a..21238d1 100644
@@ -708,7 +708,7 @@ static struct clk dpll_ck = {
 
 static struct clk apll96_ck = {
 	.name		= "apll96_ck",
-	.ops		= &clkops_fixed,
+	.ops		= &clkops_apll96,
 	.parent		= &sys_ck,
 	.rate		= 96000000,
 	.flags		= RATE_FIXED | ENABLE_ON_INIT,
@@ -719,7 +719,7 @@ static struct clk apll96_ck = {
 
 static struct clk apll54_ck = {
 	.name		= "apll54_ck",
-	.ops		= &clkops_fixed,
+	.ops		= &clkops_apll54,
 	.parent		= &sys_ck,
 	.rate		= 54000000,
 	.flags		= RATE_FIXED | ENABLE_ON_INIT,
author maintainer
#3 lore raw

PATCH 3/8 OMAP2/3: move SDRC macros to mach-omap2/sdrc.h

In reply to Paul Walmsley

clock34xx.c contains some macros which probably belong in mach-omap2/sdrc.h. Move those macros to mach-omap2/sdrc.h.

Signed-off-by Paul Walmsley <paul at pwsan.com
---
 arch/arm/mach-omap2/clock34xx.c |   14 --------------
 arch/arm/mach-omap2/sdrc.h      |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/clock34xx.c +0 -14
index a4b903d..3929544 100644
@@ -322,22 +322,8 @@ static struct omap_clk omap34xx_clks[] = {
 
 #define MAX_DPLL_WAIT_TRIES		1000000
 
-#define MIN_SDRC_DLL_LOCK_FREQ		83000000
-
 #define CYCLES_PER_MHZ			1000000
 
-/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
-#define SDRC_MPURATE_SCALE		8
-
-/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
-#define SDRC_MPURATE_BASE_SHIFT		9
-
-/*
- * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
- * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
- */
-#define SDRC_MPURATE_LOOPS		96
-
 /*
  * DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks
  * that are sourced by DPLL5, and both of these require this clock
arch/arm/mach-omap2/sdrc.h +16 -0
index 48207b0..12fc7da 100644
@@ -56,4 +56,20 @@ static inline u32 sms_read_reg(u16 reg)
 			OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
 #endif	/* __ASSEMBLER__ */
 
+/* Minimum frequency that the SDRC DLL can lock@*/
+#define MIN_SDRC_DLL_LOCK_FREQ		83000000
+
+/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
+#define SDRC_MPURATE_SCALE		8
+
+/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
+#define SDRC_MPURATE_BASE_SHIFT		9
+
+/*
+ * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
+ * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
+ */
+#define SDRC_MPURATE_LOOPS		96
+
+
 #endif
author maintainer
#4 lore raw

PATCH 4/8 OMAP2xxx clock: remove implicit dependency between rate CPU flag and clkdev_omap CPU flag

In reply to Paul Walmsley

cpu_mask is reused in the OMAP2xxx clock code to match against both the CPU-specific rate flags (e.g., RATE_IN_2420) and the OMAP clkdev integration code CPU flags (e.g., CK_242X). This means that any patch that renumbers the CK_* macros, as the next patch does, will probably break. This patch separates the clkdev_omap and clksel_rate CPU type detection flags so the CK_* macros can be renumbered freely.

---
 arch/arm/mach-omap2/clock24xx.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock24xx.c +4 -1
index e60d1c0..5f201d2 100644
@@ -751,13 +751,16 @@ int __init omap2_clk_init(void)
 	struct prcm_config *prcm;
 	struct omap_clk *c;
 	u32 clkrate;
+	u16 cpu_clkflg;
 
 	if (cpu_is_omap242x()) {
 		prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
 		cpu_mask = RATE_IN_242X;
+		cpu_clkflg = CK_242X;
 	} else if (cpu_is_omap2430()) {
 		prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
 		cpu_mask = RATE_IN_243X;
+		cpu_clkflg = CK_243X;
 	}
 
 	clk_init(&omap2_clk_functions);
@@ -771,7 +774,7 @@ int __init omap2_clk_init(void)
 	propagate_rate(&sys_ck);
 
 	for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
-		if (c->cpu & cpu_mask) {
+		if (c->cpu & cpu_clkflg) {
 			clkdev_add(&c->lk);
 			clk_register(c->lk.clk);
 			omap2_init_clk_clkdm(c->lk.clk);
author maintainer
#5 lore raw

PATCH 5/8 OMAP3 clock: convert clock34xx.h to clock34xx_data.c

In reply to Paul Walmsley

The OMAP3 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2
---
 arch/arm/mach-omap2/Makefile                  |    2 
 arch/arm/mach-omap2/clock.h                   |    2 
 arch/arm/mach-omap2/clock24xx.c               |   21 
 arch/arm/mach-omap2/clock34xx.c               |  439 ----
 arch/arm/mach-omap2/clock34xx.h               | 3013 -------------------------
 arch/arm/mach-omap2/clock34xx_data.c          |  364 +++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   35 
 7 files changed, 464 insertions(+), 3412 deletions(-)
 copy arch/arm/mach-omap2/{clock34xx.h => clock34xx_data.c} (86%)
 create mode 100644 arch/arm/plat-omap/include/plat/clkdev_omap.h
arch/arm/mach-omap2/Makefile +1 -1
index 59b0ccc..27cb2f8 100644
@@ -42,7 +42,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
 obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +2 -0
index 43b6bed..b1991e3 100644
@@ -77,6 +77,8 @@ extern const struct clkops clkops_omap2_dflt;
 
 extern u8 cpu_mask;
 
+extern struct clk_functions omap2_clk_functions;
+
 /* clksel_rate data common to 24xx/343x */
 static const struct clksel_rate gpt_32k_rates[] = {
 	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
arch/arm/mach-omap2/clock24xx.c +2 -19
index 5f201d2..a422174 100644
@@ -31,6 +31,7 @@
 #include <plat/clock.h>
 #include <plat/sram.h>
 #include <plat/prcm.h>
+#include <plat/clkdev_omap.h>
 #include <asm/div64.h>
 #include <asm/clkdev.h>
 
@@ -59,24 +60,6 @@ static const struct clkops clkops_omap2430_i2chs_wait = {
 
 #include "clock24xx.h"
 
-struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
-};
-
-#define CLK(dev, con, ck, cp) 		\
-	{				\
-		 .cpu = cp,		\
-		.lk = {			\
-			.dev_id = dev,	\
-			.con_id = con,	\
-			.clk = ck,	\
-		},			\
-	}
-
-#define CK_243X			RATE_IN_243X
-#define CK_242X			RATE_IN_242X
-
 static struct omap_clk omap24xx_clks[] = {
 	/* external root sources */
 	CLK(NULL,	"func_32k_ck",	&func_32k_ck,	CK_243X | CK_242X),
@@ -658,7 +641,7 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
 }
 #endif
 
-static struct clk_functions omap2_clk_functions = {
+struct clk_functions omap2_clk_functions = {
 	.clk_enable		= omap2_clk_enable,
 	.clk_disable		= omap2_clk_disable,
 	.clk_round_rate		= omap2_clk_round_rate,
arch/arm/mach-omap2/clock34xx.c +49 -390

591 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx.h +30 -2983

2,354 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx_data.c renamed from arch/arm/mach-omap2/clock34xx.h +345 -19

364 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h new file +35 -0
new file mode 100644
index 0000000..d6121c0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author maintainer
#6 lore raw

PATCH 6/8 OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx*

In reply to Paul Walmsley

The OMAP2 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the prcm_config data structures out into their own files, opp2xxx.h and opp24{2,3}0_data.c, and only build in the OPP tables for the target device. This should save some memory. In the long run, these prcm_config tables should be replaced with OPP code.

Cc Russell King <[email protected]>
Cc Richard Woodruff <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap2/Makefile            |    6 
 arch/arm/mach-omap2/clock.h             |   30 -
 arch/arm/mach-omap2/clock24xx.c         |  796 -----------------------------
 arch/arm/mach-omap2/clock2xxx.c         |  564 +++++++++++++++++++++
 arch/arm/mach-omap2/clock2xxx.h         |   44 ++
 arch/arm/mach-omap2/clock2xxx_data.c    |  840 ++++++++++---------------------
 arch/arm/mach-omap2/clock_common_data.c |   39 +
 arch/arm/mach-omap2/opp2420_data.c      |  126 +++++
 arch/arm/mach-omap2/opp2430_data.c      |  133 +++++
 arch/arm/mach-omap2/opp2xxx.h           |  424 ++++++++++++++++
 arch/arm/mach-omap2/sdrc.h              |    3 
 arch/arm/plat-omap/include/plat/clock.h |    2 
 12 files changed, 1610 insertions(+), 1397 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/clock24xx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.h
 rename arch/arm/mach-omap2/{clock24xx.h => clock2xxx_data.c} (73%)
 create mode 100644 arch/arm/mach-omap2/clock_common_data.c
 create mode 100644 arch/arm/mach-omap2/opp2420_data.c
 create mode 100644 arch/arm/mach-omap2/opp2430_data.c
 create mode 100644 arch/arm/mach-omap2/opp2xxx.h
arch/arm/mach-omap2/Makefile +4 -2
index 27cb2f8..5da2d96 100644
@@ -7,7 +7,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
 
 omap-2-3-common				= irq.o sdrc.o omap_hwmod.o
 prcm-common				= prcm.o powerdomain.o
-clock-common				= clock.o clockdomain.o
+clock-common				= clock.o clock_common_data.o clockdomain.o
 
 obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common)
 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common)
@@ -41,8 +41,10 @@ obj-$(CONFIG_ARCH_OMAP3)		+= cm.o
 obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
-obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
+obj-$(CONFIG_ARCH_OMAP2)		+= clock2xxx.o clock2xxx_data.o
+obj-$(CONFIG_ARCH_OMAP2420)		+= opp2420_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
+obj-$(CONFIG_ARCH_OMAP2430)		+= opp2430_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +8 -22
index b1991e3..87c0805 100644
@@ -1,8 +1,8 @@
 /*
  *  linux/arch/arm/mach-omap2/clock.h
  *
- *  Copyright (C) 2005-2008 Texas Instruments, Inc.
- *  Copyright (C) 2004-2008 Nokia Corporation
+ *  Copyright (C) 2005-2009 Texas Instruments, Inc.
+ *  Copyright (C) 2004-2009 Nokia Corporation
  *
  *  Contacts:
  *  Richard Woodruff <[email protected]>
@@ -72,31 +72,17 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
 void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
 				u8 *idlest_bit);
 
+extern u8 cpu_mask;
+
 extern const struct clkops clkops_omap2_dflt_wait;
 extern const struct clkops clkops_omap2_dflt;
 
-extern u8 cpu_mask;
-
 extern struct clk_functions omap2_clk_functions;
+extern struct clk *vclk, *sclk;
 
-/* clksel_rate data common to 24xx/343x */
-static const struct clksel_rate gpt_32k_rates[] = {
-	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gpt_sys_rates[] = {
-	 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gfx_l3_rates[] = {
-	{ .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
-	{ .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	{ .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 0 }
-};
+extern const struct clksel_rate gpt_32k_rates[];
+extern const struct clksel_rate gpt_sys_rates[];
+extern const struct clksel_rate gfx_l3_rates[];
 
 
 #endif
arch/arm/mach-omap2/clock24xx.c deleted +0 -796

796 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.c new file +564 -0

564 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.h new file +44 -0

44 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx_data.c renamed from arch/arm/mach-omap2/clock24xx.h +263 -577

875 lines not on this page · raw message

arch/arm/mach-omap2/clock_common_data.c new file +39 -0
new file mode 100644
index 0000000..f69096b
@@ -0,0 +1,39 @@
+/*
+ *  linux/arch/arm/mach-omap2/clock_common_data.c
+ *
+ *  Copyright (C) 2005-2009 Texas Instruments, Inc.
+ *  Copyright (C) 2004-2009 Nokia Corporation
+ *
+ *  Contacts:
+ *  Richard Woodruff <[email protected]>
+ *  Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains clock data that is common to both the OMAP2xxx and
+ * OMAP3xxx clock definition files.
+ */
+
+#include "clock.h"
+
+/* clksel_rate data common to 24xx/343x */
+const struct clksel_rate gpt_32k_rates[] = {
+	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	 { .div = 0 }
+};
+
+const struct clksel_rate gpt_sys_rates[] = {
+	 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	 { .div = 0 }
+};
+
+const struct clksel_rate gfx_l3_rates[] = {
+	{ .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
+	{ .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	{ .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
+	{ .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
+	{ .div = 0 }
+};
+
arch/arm/mach-omap2/opp2420_data.c new file +126 -0

126 lines not on this page · raw message

arch/arm/mach-omap2/opp2430_data.c new file +133 -0

133 lines not on this page · raw message

arch/arm/mach-omap2/opp2xxx.h new file +424 -0

357 lines not on this page · raw message

arch/arm/mach-omap2/sdrc.h +3 -0
index 12fc7da..68f57bb 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-omap/include/plat/clock.h +2 -0
index 4b8b0d6..00310f2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author maintainer
#7 lore raw

PATCH 7/8 OMAP1 clock: convert test in disable_unused() to use ENABLE_ON_INIT

In reply to Paul Walmsley

mach-omap1/clock.c:omap1_clk_disable_unused() contains a test that assumes that the clock structures are available in the file's namespace. After a following patch, this will no longer be the case. So we need to reimplement that test. It turns out that we already have a facility in the clock framework to handle this case - the ENABLE_ON_INIT flag - used on OMAP2/3. Remove the offending test and mark the clocks that it was intended to catch as ENABLE_ON_INIT.

---
 arch/arm/mach-omap1/clock.c |   11 -----------
 arch/arm/mach-omap1/clock.h |   17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 12 deletions(-)
arch/arm/mach-omap1/clock.c +0 -11
index e006493..26a887c 100644
@@ -718,17 +718,6 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
 	if ((regval32 & (1 << clk->enable_bit)) == 0)
 		return;
 
-	/* FIXME: This clock seems to be necessary but no-one
-	 * has asked for its activation. */
-	if (clk == &tc2_ck		/* FIX: pm.c (SRAM), CCP, Camera */
-	    || clk == &ck_dpll1out.clk	/* FIX: SoSSI, SSR */
-	    || clk == &arm_gpio_ck	/* FIX: GPIO code for 1510 */
-		) {
-		printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n",
-		       clk->name);
-		return;
-	}
-
 	printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name);
 	clk->ops->disable(clk);
 	printk(" done\n");
arch/arm/mach-omap1/clock.h +16 -1
index 29ffa97..70195ca 100644
@@ -157,12 +157,17 @@ static struct clk ck_dpll1 = {
 	.parent		= &ck_ref,
 };
 
+/*
+ * FIXME: This clock seems to be necessary but no-one has asked for its
+ * activation.  [ FIX: SoSSI, SSR ]
+ */
 static struct arm_idlect1_clk ck_dpll1out = {
 	.clk = {
 		.name		= "ck_dpll1out",
 		.ops		= &clkops_generic,
 		.parent		= &ck_dpll1,
-		.flags		= CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT,
+		.flags		= CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
+				  ENABLE_ON_INIT,
 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
 		.enable_bit	= EN_CKOUT_ARM,
 		.recalc		= &followparent_recalc,
@@ -207,10 +212,15 @@ static struct arm_idlect1_clk armper_ck = {
 	.idlect_shift	= 2,
 };
 
+/*
+ * FIXME: This clock seems to be necessary but no-one has asked for its
+ * activation.  [ GPIO code for 1510 ]
+ */
 static struct clk arm_gpio_ck = {
 	.name		= "arm_gpio_ck",
 	.ops		= &clkops_generic,
 	.parent		= &ck_dpll1,
+	.flags		= ENABLE_ON_INIT,
 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
 	.enable_bit	= EN_GPIOCK,
 	.recalc		= &followparent_recalc,
@@ -372,10 +382,15 @@ static struct clk tc1_ck = {
 	.recalc		= &followparent_recalc,
 };
 
+/*
+ * FIXME: This clock seems to be necessary but no-one has asked for its
+ * activation.  [ pm.c (SRAM), CCP, Camera ]
+ */
 static struct clk tc2_ck = {
 	.name		= "tc2_ck",
 	.ops		= &clkops_generic,
 	.parent		= &tc_ck.clk,
+	.flags		= ENABLE_ON_INIT,
 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
 	.enable_bit	= EN_TC2_CK,
 	.recalc		= &followparent_recalc,
author maintainer
#8 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

In reply to Paul Walmsley

The OMAP1 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the mpu_rate data structures out into their own files, opp.h and opp_data.c. In the long run, these mpu_rate tables should be replaced with OPP code.

Also includes a patch from Felipe Balbi <[email protected]> to mark omap1_clk_functions as __initdata to avoid a section warning:

    http://patchwork.kernel.org/patch/64366/
Cc Russell King <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap1/Makefile                  |    3 
 arch/arm/mach-omap1/clock.c                   |  402 ++-------------
 arch/arm/mach-omap1/clock.h                   |  667 +------------------------
 arch/arm/mach-omap1/clock_data.c              |  426 +++++++++++-----
 arch/arm/mach-omap1/io.c                      |    3 
 arch/arm/mach-omap1/opp.h                     |   28 +
 arch/arm/mach-omap1/opp_data.c                |   59 ++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   20 -
 8 files changed, 496 insertions(+), 1112 deletions(-)
 copy arch/arm/mach-omap1/{clock.h => clock_data.c} (60%)
 create mode 100644 arch/arm/mach-omap1/opp.h
 create mode 100644 arch/arm/mach-omap1/opp_data.c
arch/arm/mach-omap1/Makefile +2 -1
index 87e539a..ceced8f 100644
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o irq.o mux.o serial.o devices.o
+obj-y += clock.o clock_data.o opp_data.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
arch/arm/mach-omap1/clock.c +62 -340

603 lines not on this page · raw message

arch/arm/mach-omap1/clock.h +36 -631

684 lines not on this page · raw message

arch/arm/mach-omap1/clock_data.c renamed from arch/arm/mach-omap1/clock.h +294 -132

446 lines not on this page · raw message

arch/arm/mach-omap1/io.c +2 -1
index 2a6d68a..d9b8d82 100644
@@ -18,7 +18,8 @@
 #include <plat/mux.h>
 #include <plat/tc.h>
 
-extern int omap1_clk_init(void);
+#include "clock.h"
+
 extern void omap_check_revision(void);
 extern void omap_sram_init(void);
 extern void omapfb_reserve_sdram(void);
arch/arm/mach-omap1/opp.h new file +28 -0
new file mode 100644
index 0000000..07074d7
@@ -0,0 +1,28 @@
+/*
+ *  linux/arch/arm/mach-omap1/opp.h
+ *
+ *  Copyright (C) 2004 - 2005 Nokia corporation
+ *  Written by Tuukka Tikkanen <[email protected]>
+ *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP1_OPP_H
+#define __ARCH_ARM_MACH_OMAP1_OPP_H
+
+#include <linux/types.h>
+
+struct mpu_rate {
+	unsigned long		rate;
+	unsigned long		xtal;
+	unsigned long		pll_rate;
+	__u16			ckctl_val;
+	__u16			dpllctl_val;
+};
+
+extern struct mpu_rate omap1_rate_table[];
+
+#endif
arch/arm/mach-omap1/opp_data.c new file +59 -0

59 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h +13 -7
index d6121c0..3cd5eb8 100644
@@ -1,6 +1,8 @@
 /*
  * clkdev <-> OMAP integration
  *
+ * Russell King <[email protected]>
+ *
  */
 
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
@@ -9,8 +11,8 @@
 #include <asm/clkdev.h>
 
 struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
+	u16				cpu;
+	struct clk_lookup		lk;
 };
 
 #define CLK(dev, con, ck, cp) 		\
@@ -24,11 +26,15 @@ struct omap_clk {
 	}
 
 
-#define CK_243X		(1 << 0)
-#define CK_242X		(1 << 1)
-#define CK_343X		(1 << 2)
-#define CK_3430ES1	(1 << 3)
-#define CK_3430ES2	(1 << 4)
+#define CK_310		(1 << 0)
+#define CK_7XX		(1 << 1)
+#define CK_1510		(1 << 2)
+#define CK_16XX		(1 << 3)
+#define CK_243X		(1 << 4)
+#define CK_242X		(1 << 5)
+#define CK_343X		(1 << 6)
+#define CK_3430ES1	(1 << 7)
+#define CK_3430ES2	(1 << 8)
 
 
 #endif
#9 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Quoted 5 lines · Paul Walmsley
arch/arm/mach-omap1/clock.c +1 -1
-static int clk_omap1_dummy_enable(struct clk *clk)
+int clk_omap1_dummy_enable(struct clk *clk)
 {
 	return 0;
 }

arch/arm/mach-omap1/clock.c line 48

Quoted 10 lines
arch/arm/mach-omap1/clock.c +1 -5
 
-static void clk_omap1_dummy_disable(struct clk *clk)
+void clk_omap1_dummy_disable(struct clk *clk)
 {
 }
 
-static const struct clkops clkops_dummy = {
-	.enable = clk_omap1_dummy_enable,
-	.disable = clk_omap1_dummy_disable,
-};

I've no idea why you're moving the clkops into these other files - I think this is going far too far. Why not just make the clkops structures non- static?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
author maintainer
#10 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Hello Russell,

Quoted 12 lines · Russell King
Quoted 11 lines · Paul Walmsley
arch/arm/mach-omap1/clock.c +2 -2
-static int clk_omap1_dummy_enable(struct clk *clk)
+int clk_omap1_dummy_enable(struct clk *clk)
 {
 	return 0;
 }
 
-static void clk_omap1_dummy_disable(struct clk *clk)
+void clk_omap1_dummy_disable(struct clk *clk)
 {
 }
Quoted 8 lines

arch/arm/mach-omap1/clock.c line 48

Quoted 4 lines
arch/arm/mach-omap1/clock.c +0 -4
-static const struct clkops clkops_dummy = {
-	.enable = clk_omap1_dummy_enable,
-	.disable = clk_omap1_dummy_disable,
-};

I've no idea why you're moving the clkops into these other files - I think this is going far too far. Why not just make the clkops structures non- static?

clkops that are shared between multiple platforms, such as clkops_null, are indeed non-static. However, many of the clkops are only used by one OMAP variant, so it seemed pointless to make them non-static. No point in polluting the symbol table unnecessarily. Is there some reason that all of them should be non-static?

- Paul

#11 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Quoted 25 lines · Paul Walmsley

Hello Russell,

Quoted 12 lines · Russell King
Quoted 11 lines · Paul Walmsley
arch/arm/mach-omap1/clock.c +2 -2
-static int clk_omap1_dummy_enable(struct clk *clk)
+int clk_omap1_dummy_enable(struct clk *clk)
 {
 	return 0;
 }
 
-static void clk_omap1_dummy_disable(struct clk *clk)
+void clk_omap1_dummy_disable(struct clk *clk)
 {
 }
Quoted 8 lines

arch/arm/mach-omap1/clock.c line 48

Quoted 4 lines
arch/arm/mach-omap1/clock.c +0 -4
-static const struct clkops clkops_dummy = {
-	.enable = clk_omap1_dummy_enable,
-	.disable = clk_omap1_dummy_disable,
-};

I've no idea why you're moving the clkops into these other files - I think this is going far too far. Why not just make the clkops structures non- static?

Quoted 5 lines

clkops that are shared between multiple platforms, such as clkops_null, are indeed non-static. However, many of the clkops are only used by one OMAP variant, so it seemed pointless to make them non-static. No point in polluting the symbol table unnecessarily. Is there some reason that all of them should be non-static?

You say this, but you're keeping the associated code around as well which is pointless.

You also say about polluting the symbol table unnecessarily. What about the pollution caused by having two (or more) functions made public rather than just one data structure?

author maintainer
#12 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Hello Russell,

Quoted 2 lines · Russell King - ARM Linux

You say this, but you're keeping the associated code around as well which is pointless.

Could you elaborate?

Quoted 3 lines

You also say about polluting the symbol table unnecessarily. What about the pollution caused by having two (or more) functions made public rather than just one data structure?

Good point. Will move the clkops structures to the appropriate clock.c files, and mark the functions static.

- Paul

author maintainer
#13 lore raw

PATCH v2 5/8 OMAP3 clock: convert clock34xx.h to clock34xx_data.c

The OMAP3 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2
---
 arch/arm/mach-omap2/Makefile                  |    2 +-
 arch/arm/mach-omap2/clock.h                   |    2 +
 arch/arm/mach-omap2/clock24xx.c               |   21 +-
 arch/arm/mach-omap2/clock34xx.c               |  437 +---
 arch/arm/mach-omap2/clock34xx.h               | 3000 +----------------------
 arch/arm/mach-omap2/clock34xx_data.c          | 3289 +++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   37 +
 7 files changed, 3416 insertions(+), 3372 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clock34xx_data.c
 create mode 100644 arch/arm/plat-omap/include/plat/clkdev_omap.h
arch/arm/mach-omap2/Makefile +1 -1
index 59b0ccc..27cb2f8 100644
@@ -42,7 +42,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
 obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +2 -0
index 43b6bed..b1991e3 100644
@@ -77,6 +77,8 @@ extern const struct clkops clkops_omap2_dflt;
 
 extern u8 cpu_mask;
 
+extern struct clk_functions omap2_clk_functions;
+
 /* clksel_rate data common to 24xx/343x */
 static const struct clksel_rate gpt_32k_rates[] = {
 	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
arch/arm/mach-omap2/clock24xx.c +2 -19
index 5f201d2..a422174 100644
@@ -31,6 +31,7 @@
 #include <plat/clock.h>
 #include <plat/sram.h>
 #include <plat/prcm.h>
+#include <plat/clkdev_omap.h>
 #include <asm/div64.h>
 #include <asm/clkdev.h>
 
@@ -59,24 +60,6 @@ static const struct clkops clkops_omap2430_i2chs_wait = {
 
 #include "clock24xx.h"
 
-struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
-};
-
-#define CLK(dev, con, ck, cp) 		\
-	{				\
-		 .cpu = cp,		\
-		.lk = {			\
-			.dev_id = dev,	\
-			.con_id = con,	\
-			.clk = ck,	\
-		},			\
-	}
-
-#define CK_243X			RATE_IN_243X
-#define CK_242X			RATE_IN_242X
-
 static struct omap_clk omap24xx_clks[] = {
 	/* external root sources */
 	CLK(NULL,	"func_32k_ck",	&func_32k_ck,	CK_243X | CK_242X),
@@ -658,7 +641,7 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
 }
 #endif
 
-static struct clk_functions omap2_clk_functions = {
+struct clk_functions omap2_clk_functions = {
 	.clk_enable		= omap2_clk_enable,
 	.clk_disable		= omap2_clk_disable,
 	.clk_round_rate		= omap2_clk_round_rate,
arch/arm/mach-omap2/clock34xx.c +64 -373

565 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx.h +21 -2979

2,380 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx_data.c new file +3289 -0

3,289 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h new file +37 -0
new file mode 100644
index 0000000..97b8c12

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.5.GIT

Part of the diff is not shown here. View the raw message.

author maintainer
#14 lore raw

PATCH v2 6/8 OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx*

In reply to Paul Walmsley

The OMAP2 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the prcm_config data structures out into their own files, opp2xxx.h and opp24{2,3}0_data.c, and only build in the OPP tables for the target device. This should save some memory. In the long run, these prcm_config tables should be replaced with OPP code.

Cc Russell King <[email protected]>
Cc Richard Woodruff <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap2/Makefile                       |    6 +-
 arch/arm/mach-omap2/clock.h                        |   30 +-
 arch/arm/mach-omap2/clock24xx.c                    |  796 -------------------
 arch/arm/mach-omap2/clock2xxx.c                    |  591 ++++++++++++++
 arch/arm/mach-omap2/clock2xxx.h                    |   41 +
 .../mach-omap2/{clock24xx.h => clock2xxx_data.c}   |  832 ++++++--------------
 arch/arm/mach-omap2/clock_common_data.c            |   39 +
 arch/arm/mach-omap2/opp2420_data.c                 |  126 +++
 arch/arm/mach-omap2/opp2430_data.c                 |  133 ++++
 arch/arm/mach-omap2/opp2xxx.h                      |  424 ++++++++++
 arch/arm/mach-omap2/sdrc.h                         |    3 +
 arch/arm/plat-omap/include/plat/clock.h            |    2 +
 12 files changed, 1613 insertions(+), 1410 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/clock24xx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.h
 rename arch/arm/mach-omap2/{clock24xx.h => clock2xxx_data.c} (73%)
 create mode 100644 arch/arm/mach-omap2/clock_common_data.c
 create mode 100644 arch/arm/mach-omap2/opp2420_data.c
 create mode 100644 arch/arm/mach-omap2/opp2430_data.c
 create mode 100644 arch/arm/mach-omap2/opp2xxx.h
arch/arm/mach-omap2/Makefile +4 -2
index 27cb2f8..5da2d96 100644
@@ -7,7 +7,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
 
 omap-2-3-common				= irq.o sdrc.o omap_hwmod.o
 prcm-common				= prcm.o powerdomain.o
-clock-common				= clock.o clockdomain.o
+clock-common				= clock.o clock_common_data.o clockdomain.o
 
 obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common)
 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common)
@@ -41,8 +41,10 @@ obj-$(CONFIG_ARCH_OMAP3)		+= cm.o
 obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
-obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
+obj-$(CONFIG_ARCH_OMAP2)		+= clock2xxx.o clock2xxx_data.o
+obj-$(CONFIG_ARCH_OMAP2420)		+= opp2420_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
+obj-$(CONFIG_ARCH_OMAP2430)		+= opp2430_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +8 -22
index b1991e3..87c0805 100644
@@ -1,8 +1,8 @@
 /*
  *  linux/arch/arm/mach-omap2/clock.h
  *
- *  Copyright (C) 2005-2008 Texas Instruments, Inc.
- *  Copyright (C) 2004-2008 Nokia Corporation
+ *  Copyright (C) 2005-2009 Texas Instruments, Inc.
+ *  Copyright (C) 2004-2009 Nokia Corporation
  *
  *  Contacts:
  *  Richard Woodruff <[email protected]>
@@ -72,31 +72,17 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
 void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
 				u8 *idlest_bit);
 
+extern u8 cpu_mask;
+
 extern const struct clkops clkops_omap2_dflt_wait;
 extern const struct clkops clkops_omap2_dflt;
 
-extern u8 cpu_mask;
-
 extern struct clk_functions omap2_clk_functions;
+extern struct clk *vclk, *sclk;
 
-/* clksel_rate data common to 24xx/343x */
-static const struct clksel_rate gpt_32k_rates[] = {
-	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gpt_sys_rates[] = {
-	 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gfx_l3_rates[] = {
-	{ .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
-	{ .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	{ .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 0 }
-};
+extern const struct clksel_rate gpt_32k_rates[];
+extern const struct clksel_rate gpt_sys_rates[];
+extern const struct clksel_rate gfx_l3_rates[];
 
 
 #endif
arch/arm/mach-omap2/clock24xx.c deleted +0 -796

796 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.c new file +591 -0

591 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.h new file +41 -0

41 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx_data.c renamed from arch/arm/mach-omap2/clock24xx.h +242 -590

855 lines not on this page · raw message

arch/arm/mach-omap2/clock_common_data.c new file +39 -0
new file mode 100644
index 0000000..f69096b
@@ -0,0 +1,39 @@
+/*
+ *  linux/arch/arm/mach-omap2/clock_common_data.c
+ *
+ *  Copyright (C) 2005-2009 Texas Instruments, Inc.
+ *  Copyright (C) 2004-2009 Nokia Corporation
+ *
+ *  Contacts:
+ *  Richard Woodruff <[email protected]>
+ *  Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains clock data that is common to both the OMAP2xxx and
+ * OMAP3xxx clock definition files.
+ */
+
+#include "clock.h"
+
+/* clksel_rate data common to 24xx/343x */
+const struct clksel_rate gpt_32k_rates[] = {
+	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	 { .div = 0 }
+};
+
+const struct clksel_rate gpt_sys_rates[] = {
+	 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	 { .div = 0 }
+};
+
+const struct clksel_rate gfx_l3_rates[] = {
+	{ .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
+	{ .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
+	{ .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
+	{ .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
+	{ .div = 0 }
+};
+
arch/arm/mach-omap2/opp2420_data.c new file +126 -0

126 lines not on this page · raw message

arch/arm/mach-omap2/opp2430_data.c new file +133 -0

133 lines not on this page · raw message

arch/arm/mach-omap2/opp2xxx.h new file +424 -0

353 lines not on this page · raw message

arch/arm/mach-omap2/sdrc.h +3 -0
index 12fc7da..68f57bb 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-omap/include/plat/clock.h +2 -0
index 4b8b0d6..00310f2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.5.GIT

Part of the diff is not shown here. View the raw message.

author maintainer
#15 lore raw

PATCH v2 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

In reply to Paul Walmsley

The OMAP1 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the mpu_rate data structures out into their own files, opp.h and opp_data.c. In the long run, these mpu_rate tables should be replaced with OPP code.

Also includes a patch from Felipe Balbi <[email protected]> to mark omap1_clk_functions as __initdata to avoid a section warning:

    http://patchwork.kernel.org/patch/64366/
Cc Russell King <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap1/Makefile                  |    3 +-
 arch/arm/mach-omap1/clock.c                   |  484 ++++-----------
 arch/arm/mach-omap1/clock.h                   |  662 +------------------
 arch/arm/mach-omap1/clock_data.c              |  843 +++++++++++++++++++++++++
 arch/arm/mach-omap1/io.c                      |    3 +-
 arch/arm/mach-omap1/opp.h                     |   28 +
 arch/arm/mach-omap1/opp_data.c                |   59 ++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   18 +-
 8 files changed, 1093 insertions(+), 1007 deletions(-)
 create mode 100644 arch/arm/mach-omap1/clock_data.c
 create mode 100644 arch/arm/mach-omap1/opp.h
 create mode 100644 arch/arm/mach-omap1/opp_data.c
arch/arm/mach-omap1/Makefile +2 -1
index 87e539a..ceced8f 100644
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o irq.o mux.o serial.o devices.o
+obj-y += clock.o clock_data.o opp_data.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
arch/arm/mach-omap1/clock.c +116 -368

651 lines not on this page · raw message

arch/arm/mach-omap1/clock.h +32 -630

680 lines not on this page · raw message

arch/arm/mach-omap1/clock_data.c new file +843 -0

843 lines not on this page · raw message

arch/arm/mach-omap1/io.c +2 -1
index 2a6d68a..d9b8d82 100644
@@ -18,7 +18,8 @@
 #include <plat/mux.h>
 #include <plat/tc.h>
 
-extern int omap1_clk_init(void);
+#include "clock.h"
+
 extern void omap_check_revision(void);
 extern void omap_sram_init(void);
 extern void omapfb_reserve_sdram(void);
arch/arm/mach-omap1/opp.h new file +28 -0
new file mode 100644
index 0000000..07074d7
@@ -0,0 +1,28 @@
+/*
+ *  linux/arch/arm/mach-omap1/opp.h
+ *
+ *  Copyright (C) 2004 - 2005 Nokia corporation
+ *  Written by Tuukka Tikkanen <[email protected]>
+ *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP1_OPP_H
+#define __ARCH_ARM_MACH_OMAP1_OPP_H
+
+#include <linux/types.h>
+
+struct mpu_rate {
+	unsigned long		rate;
+	unsigned long		xtal;
+	unsigned long		pll_rate;
+	__u16			ckctl_val;
+	__u16			dpllctl_val;
+};
+
+extern struct mpu_rate omap1_rate_table[];
+
+#endif
arch/arm/mach-omap1/opp_data.c new file +59 -0

59 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h +11 -7
index 97b8c12..96e5d38 100644
@@ -11,8 +11,8 @@
 #include <asm/clkdev.h>
 
 struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
+	u16				cpu;
+	struct clk_lookup		lk;
 };
 
 #define CLK(dev, con, ck, cp) 		\
@@ -26,11 +26,15 @@ struct omap_clk {
 	}
 
 
-#define CK_243X		(1 << 0)
-#define CK_242X		(1 << 1)
-#define CK_343X		(1 << 2)
-#define CK_3430ES1	(1 << 3)
-#define CK_3430ES2	(1 << 4)
+#define CK_310		(1 << 0)
+#define CK_7XX		(1 << 1)
+#define CK_1510		(1 << 2)
+#define CK_16XX		(1 << 3)
+#define CK_243X		(1 << 4)
+#define CK_242X		(1 << 5)
+#define CK_343X		(1 << 6)
+#define CK_3430ES1	(1 << 7)
+#define CK_3430ES2	(1 << 8)
 
 
 #endif
Signature · 1 line
1.6.5.GIT
#16 lore raw

PATCH v2 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Quoted 8 lines · Paul Walmsley
arch/arm/mach-omap1/clock.c +0 -4
@@ -42,134 +47,19 @@ static void clk_omap1_dummy_disable(struct clk *clk)
 {
 }
 
-static const struct clkops clkops_dummy = {
-	.enable = clk_omap1_dummy_enable,
-	.disable = clk_omap1_dummy_disable,
-};

...

Quoted 24 lines
arch/arm/mach-omap1/clock.c +11 -10
+/*
+ * clkops
+ */
 
-	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
-	/* (on 730, bit 13 must not be cleared) */
-	if (cpu_is_omap7xx())
-		omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
-	else
-		omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
+const struct clkops clkops_dspck = {
+	.enable		= omap1_clk_enable_dsp_domain,
+	.disable	= omap1_clk_disable_dsp_domain,
+};
 
-	/* Put DSP/MPUI into reset until needed */
-	omap_writew(0, ARM_RSTCT1);
-	omap_writew(1, ARM_RSTCT2);
-	omap_writew(0x400, ARM_IDLECT1);
+const struct clkops clkops_dummy = {
+	.enable		= clk_omap1_dummy_enable,
+	.disable	= clk_omap1_dummy_disable,
+};
 

arch/arm/mach-omap1/clock.c static void __init omap1_clk_disable_unused(struct clk *clk) · line 631

Quoted 10 lines
arch/arm/mach-omap1/clock.c +4 -6
-	/*
-	 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
-	 * of the ARM_IDLECT2 register must be set to zero. The power-on
-	 * default value of this bit is one.
-	 */
-	omap_writew(0x0000, ARM_IDLECT2);	/* Turn LCD clock off also */
+const struct clkops clkops_uart = {
+	.enable		= omap1_clk_enable_uart_functional,
+	.disable	= omap1_clk_disable_uart_functional,
+};

What is the reasoning for moving all clkops away from their associated enable/disable functions right to the end of the file?

Isn't it better to have like stuff together, in much the same way that it's preferred to have EXPORT_SYMBOL next to their function/data that it's exporting?

author maintainer
#17 lore raw

PATCH v2 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Hello Russell,

Quoted 48 lines · Russell King - ARM Linux
Quoted 8 lines · Paul Walmsley
arch/arm/mach-omap1/clock.c +0 -4
@@ -42,134 +47,19 @@ static void clk_omap1_dummy_disable(struct clk *clk)
 {
 }
 
-static const struct clkops clkops_dummy = {
-	.enable = clk_omap1_dummy_enable,
-	.disable = clk_omap1_dummy_disable,
-};

...

Quoted 24 lines
arch/arm/mach-omap1/clock.c +11 -10
+/*
+ * clkops
+ */
 
-	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
-	/* (on 730, bit 13 must not be cleared) */
-	if (cpu_is_omap7xx())
-		omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
-	else
-		omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
+const struct clkops clkops_dspck = {
+	.enable		= omap1_clk_enable_dsp_domain,
+	.disable	= omap1_clk_disable_dsp_domain,
+};
 
-	/* Put DSP/MPUI into reset until needed */
-	omap_writew(0, ARM_RSTCT1);
-	omap_writew(1, ARM_RSTCT2);
-	omap_writew(0x400, ARM_IDLECT1);
+const struct clkops clkops_dummy = {
+	.enable		= clk_omap1_dummy_enable,
+	.disable	= clk_omap1_dummy_disable,
+};
 

arch/arm/mach-omap1/clock.c static void __init omap1_clk_disable_unused(struct clk *clk) · line 631

Quoted 10 lines
arch/arm/mach-omap1/clock.c +4 -6
-	/*
-	 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
-	 * of the ARM_IDLECT2 register must be set to zero. The power-on
-	 * default value of this bit is one.
-	 */
-	omap_writew(0x0000, ARM_IDLECT2);	/* Turn LCD clock off also */
+const struct clkops clkops_uart = {
+	.enable		= omap1_clk_enable_uart_functional,
+	.disable	= omap1_clk_disable_uart_functional,
+};

What is the reasoning for moving all clkops away from their associated enable/disable functions right to the end of the file?

Quoted 3 lines

Isn't it better to have like stuff together, in much the same way that it's preferred to have EXPORT_SYMBOL next to their function/data that it's exporting?

My preference was to keep data separated from code in the source files; I think it is slightly more readable.

The other consideration is that there are some patches in the works here to move all of the struct clk function pointers into the struct clkops. When this happens, many function pointers are shared between struct clkops, and so it becomes somewhat arbitrary as to which set of functions the struct clkops is placed near.

But as for the current set of patches, there's no major attachment to the the placement of the struct clkops. I'd be happy to move them back, close to the enable/disable code if you prefer. Would you like me to do so?

- Paul

#18 lore raw

PATCH v2 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Quoted 2 lines · Paul Walmsley

My preference was to keep data separated from code in the source files; I think it is slightly more readable.

It's less readable because instead of having similar stuff together, it's at opposite ends of the file.

Quoted 2 lines

The other consideration is that there are some patches in the works here to move all of the struct clk function pointers into the struct clkops.

Oh for gods sake, why do people take things to the extreme?

I looked into doing exactly that and decided it was a *bad* *idea* because it stupidly multiplies the number of ops structures. Instead of having a few well-defined and well-understood ops structures, you end up with one ops structure per special case.

Then you're going to be back into adding all that sodding crap that you had back before I cleaned up the enable/disable shite.

No, please don't do this, this would definitely be a total backwards step.

Please take a moment to think about the changes you're doing.

author maintainer
#19 lore raw

PATCH v2 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Hello Russell,

Quoted 6 lines · Russell King - ARM Linux
Quoted 2 lines · Paul Walmsley

My preference was to keep data separated from code in the source files; I think it is slightly more readable.

It's less readable because instead of having similar stuff together, it's at opposite ends of the file.

Okay. Our opinions differ. I'm happy to make this change to align it with what you like.

- Paul

author maintainer
#20 lore raw

PATCH v3 5/8 OMAP3 clock: convert clock34xx.h to clock34xx_data.c

The OMAP3 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2
---
 arch/arm/mach-omap2/Makefile                  |    2 
 arch/arm/mach-omap2/clock.h                   |    2 
 arch/arm/mach-omap2/clock24xx.c               |   21 
 arch/arm/mach-omap2/clock34xx.c               |  453 +--
 arch/arm/mach-omap2/clock34xx.h               | 3000 -----------------------
 arch/arm/mach-omap2/clock34xx_data.c          | 3289 +++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   37 
 7 files changed, 3418 insertions(+), 3386 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clock34xx_data.c
 create mode 100644 arch/arm/plat-omap/include/plat/clkdev_omap.h
arch/arm/mach-omap2/Makefile +1 -1
index 59b0ccc..27cb2f8 100644
@@ -42,7 +42,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
 obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +2 -0
index 43b6bed..b1991e3 100644
@@ -77,6 +77,8 @@ extern const struct clkops clkops_omap2_dflt;
 
 extern u8 cpu_mask;
 
+extern struct clk_functions omap2_clk_functions;
+
 /* clksel_rate data common to 24xx/343x */
 static const struct clksel_rate gpt_32k_rates[] = {
 	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
arch/arm/mach-omap2/clock24xx.c +2 -19
index 5f201d2..a422174 100644
@@ -31,6 +31,7 @@
 #include <plat/clock.h>
 #include <plat/sram.h>
 #include <plat/prcm.h>
+#include <plat/clkdev_omap.h>
 #include <asm/div64.h>
 #include <asm/clkdev.h>
 
@@ -59,24 +60,6 @@ static const struct clkops clkops_omap2430_i2chs_wait = {
 
 #include "clock24xx.h"
 
-struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
-};
-
-#define CLK(dev, con, ck, cp) 		\
-	{				\
-		 .cpu = cp,		\
-		.lk = {			\
-			.dev_id = dev,	\
-			.con_id = con,	\
-			.clk = ck,	\
-		},			\
-	}
-
-#define CK_243X			RATE_IN_243X
-#define CK_242X			RATE_IN_242X
-
 static struct omap_clk omap24xx_clks[] = {
 	/* external root sources */
 	CLK(NULL,	"func_32k_ck",	&func_32k_ck,	CK_243X | CK_242X),
@@ -658,7 +641,7 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
 }
 #endif
 
-static struct clk_functions omap2_clk_functions = {
+struct clk_functions omap2_clk_functions = {
 	.clk_enable		= omap2_clk_enable,
 	.clk_disable		= omap2_clk_disable,
 	.clk_round_rate		= omap2_clk_round_rate,
arch/arm/mach-omap2/clock34xx.c +66 -387

609 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx.h +21 -2979

2,336 lines not on this page · raw message

arch/arm/mach-omap2/clock34xx_data.c new file +3289 -0

3,289 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h new file +37 -0
new file mode 100644
index 0000000..97b8c12

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author maintainer
#21 lore raw

PATCH v3 6/8 OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx*

In reply to Paul Walmsley

The OMAP2 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the prcm_config data structures out into their own files, opp2xxx.h and opp24{2,3}0_data.c, and only build in the OPP tables for the target device. This should save some memory. In the long run, these prcm_config tables should be replaced with OPP code.

Cc Russell King <[email protected]>
Cc Richard Woodruff <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap2/Makefile            |    6 
 arch/arm/mach-omap2/clock.h             |   30 
 arch/arm/mach-omap2/clock24xx.c         |  796 ---------
 arch/arm/mach-omap2/clock24xx.h         | 2657 -------------------------------
 arch/arm/mach-omap2/clock2xxx.c         |  587 +++++++
 arch/arm/mach-omap2/clock2xxx.h         |   41 
 arch/arm/mach-omap2/clock2xxx_data.c    | 2309 +++++++++++++++++++++++++++
 arch/arm/mach-omap2/clock_common_data.c |   39 
 arch/arm/mach-omap2/opp2420_data.c      |  126 +
 arch/arm/mach-omap2/opp2430_data.c      |  133 ++
 arch/arm/mach-omap2/opp2xxx.h           |  424 +++++
 arch/arm/mach-omap2/sdrc.h              |    3 
 arch/arm/plat-omap/include/plat/clock.h |    2 
 13 files changed, 3676 insertions(+), 3477 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/clock24xx.c
 delete mode 100644 arch/arm/mach-omap2/clock24xx.h
 create mode 100644 arch/arm/mach-omap2/clock2xxx.c
 create mode 100644 arch/arm/mach-omap2/clock2xxx.h
 create mode 100644 arch/arm/mach-omap2/clock2xxx_data.c
 create mode 100644 arch/arm/mach-omap2/clock_common_data.c
 create mode 100644 arch/arm/mach-omap2/opp2420_data.c
 create mode 100644 arch/arm/mach-omap2/opp2430_data.c
 create mode 100644 arch/arm/mach-omap2/opp2xxx.h
arch/arm/mach-omap2/Makefile +4 -2
index 27cb2f8..5da2d96 100644
@@ -7,7 +7,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
 
 omap-2-3-common				= irq.o sdrc.o omap_hwmod.o
 prcm-common				= prcm.o powerdomain.o
-clock-common				= clock.o clockdomain.o
+clock-common				= clock.o clock_common_data.o clockdomain.o
 
 obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common)
 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common)
@@ -41,8 +41,10 @@ obj-$(CONFIG_ARCH_OMAP3)		+= cm.o
 obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 
 # Clock framework
-obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
+obj-$(CONFIG_ARCH_OMAP2)		+= clock2xxx.o clock2xxx_data.o
+obj-$(CONFIG_ARCH_OMAP2420)		+= opp2420_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o clock34xx_data.o
+obj-$(CONFIG_ARCH_OMAP2430)		+= opp2430_data.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
arch/arm/mach-omap2/clock.h +8 -22
index b1991e3..87c0805 100644
@@ -1,8 +1,8 @@
 /*
  *  linux/arch/arm/mach-omap2/clock.h
  *
- *  Copyright (C) 2005-2008 Texas Instruments, Inc.
- *  Copyright (C) 2004-2008 Nokia Corporation
+ *  Copyright (C) 2005-2009 Texas Instruments, Inc.
+ *  Copyright (C) 2004-2009 Nokia Corporation
  *
  *  Contacts:
  *  Richard Woodruff <[email protected]>
@@ -72,31 +72,17 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
 void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
 				u8 *idlest_bit);
 
+extern u8 cpu_mask;
+
 extern const struct clkops clkops_omap2_dflt_wait;
 extern const struct clkops clkops_omap2_dflt;
 
-extern u8 cpu_mask;
-
 extern struct clk_functions omap2_clk_functions;
+extern struct clk *vclk, *sclk;
 
-/* clksel_rate data common to 24xx/343x */
-static const struct clksel_rate gpt_32k_rates[] = {
-	 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gpt_sys_rates[] = {
-	 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	 { .div = 0 }
-};
-
-static const struct clksel_rate gfx_l3_rates[] = {
-	{ .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
-	{ .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
-	{ .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
-	{ .div = 0 }
-};
+extern const struct clksel_rate gpt_32k_rates[];
+extern const struct clksel_rate gpt_sys_rates[];
+extern const struct clksel_rate gfx_l3_rates[];
 
 
 #endif
arch/arm/mach-omap2/clock24xx.c deleted +0 -796

796 lines not on this page · raw message

arch/arm/mach-omap2/clock24xx.h deleted +0 -2657

2,138 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.c new file +587 -0

587 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx.h new file +41 -0

41 lines not on this page · raw message

arch/arm/mach-omap2/clock2xxx_data.c new file +2309 -0

2,309 lines not on this page · raw message

arch/arm/mach-omap2/clock_common_data.c new file +39 -0
new file mode 100644
index 0000000..f69096b

Lines of this file are not shown. View the raw message.

arch/arm/mach-omap2/opp2420_data.c new file +126 -0

126 lines not on this page · raw message

arch/arm/mach-omap2/opp2430_data.c new file +133 -0

133 lines not on this page · raw message

arch/arm/mach-omap2/opp2xxx.h new file +424 -0

424 lines not on this page · raw message

arch/arm/mach-omap2/sdrc.h +3 -0
index 12fc7da..68f57bb 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-omap/include/plat/clock.h +2 -0
index 4b8b0d6..00310f2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author maintainer
#22 lore raw

PATCH v3 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

In reply to Paul Walmsley

The OMAP1 clock code currently #includes a large .h file full of static data structures. Instead, define the data in a .c file.

Russell King <[email protected]> proposed this new arrangement:

    http://marc.info/?l=linux-omap&m=125967425908895&w=2

This patch also deals with most of the flagrant checkpatch violations.

While here, separate the mpu_rate data structures out into their own files, opp.h and opp_data.c. In the long run, these mpu_rate tables should be replaced with OPP code.

Also includes a patch from Felipe Balbi <[email protected]> to mark omap1_clk_functions as __initdata to avoid a section warning:

    http://patchwork.kernel.org/patch/64366/
Cc Russell King <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/mach-omap1/Makefile                  |    3 
 arch/arm/mach-omap1/clock.c                   |  486 +++-----------
 arch/arm/mach-omap1/clock.h                   |  662 +-------------------
 arch/arm/mach-omap1/clock_data.c              |  843 +++++++++++++++++++++++++
 arch/arm/mach-omap1/io.c                      |    3 
 arch/arm/mach-omap1/opp.h                     |   28 +
 arch/arm/mach-omap1/opp_data.c                |   59 ++
 arch/arm/plat-omap/include/plat/clkdev_omap.h |   18 -
 8 files changed, 1091 insertions(+), 1011 deletions(-)
 create mode 100644 arch/arm/mach-omap1/clock_data.c
 create mode 100644 arch/arm/mach-omap1/opp.h
 create mode 100644 arch/arm/mach-omap1/opp_data.c
arch/arm/mach-omap1/Makefile +2 -1
index 87e539a..ceced8f 100644
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o irq.o mux.o serial.o devices.o
+obj-y += clock.o clock_data.o opp_data.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
arch/arm/mach-omap1/clock.c +114 -372

650 lines not on this page · raw message

arch/arm/mach-omap1/clock.h +32 -630

680 lines not on this page · raw message

arch/arm/mach-omap1/clock_data.c new file +843 -0

843 lines not on this page · raw message

arch/arm/mach-omap1/io.c +2 -1
index 2a6d68a..d9b8d82 100644
@@ -18,7 +18,8 @@
 #include <plat/mux.h>
 #include <plat/tc.h>
 
-extern int omap1_clk_init(void);
+#include "clock.h"
+
 extern void omap_check_revision(void);
 extern void omap_sram_init(void);
 extern void omapfb_reserve_sdram(void);
arch/arm/mach-omap1/opp.h new file +28 -0
new file mode 100644
index 0000000..07074d7
@@ -0,0 +1,28 @@
+/*
+ *  linux/arch/arm/mach-omap1/opp.h
+ *
+ *  Copyright (C) 2004 - 2005 Nokia corporation
+ *  Written by Tuukka Tikkanen <[email protected]>
+ *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP1_OPP_H
+#define __ARCH_ARM_MACH_OMAP1_OPP_H
+
+#include <linux/types.h>
+
+struct mpu_rate {
+	unsigned long		rate;
+	unsigned long		xtal;
+	unsigned long		pll_rate;
+	__u16			ckctl_val;
+	__u16			dpllctl_val;
+};
+
+extern struct mpu_rate omap1_rate_table[];
+
+#endif
arch/arm/mach-omap1/opp_data.c new file +59 -0

59 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clkdev_omap.h +11 -7
index 97b8c12..96e5d38 100644
@@ -11,8 +11,8 @@
 #include <asm/clkdev.h>
 
 struct omap_clk {
-	u32		cpu;
-	struct clk_lookup lk;
+	u16				cpu;
+	struct clk_lookup		lk;
 };
 
 #define CLK(dev, con, ck, cp) 		\
@@ -26,11 +26,15 @@ struct omap_clk {
 	}
 
 
-#define CK_243X		(1 << 0)
-#define CK_242X		(1 << 1)
-#define CK_343X		(1 << 2)
-#define CK_3430ES1	(1 << 3)
-#define CK_3430ES2	(1 << 4)
+#define CK_310		(1 << 0)
+#define CK_7XX		(1 << 1)
+#define CK_1510		(1 << 2)
+#define CK_16XX		(1 << 3)
+#define CK_243X		(1 << 4)
+#define CK_242X		(1 << 5)
+#define CK_343X		(1 << 6)
+#define CK_3430ES1	(1 << 7)
+#define CK_3430ES2	(1 << 8)
 
 
 #endif
#23 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

In reply to Paul Walmsley

Also, why are you emailing me at my rmk+kernel address and claiming that I used this address to make the suggestion. It was my linux@ address.

Deleting these mails from this mailbox.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
author maintainer
#24 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Hi Russell,

Quoted 5 lines · Russell King

Also, why are you emailing me at my rmk+kernel address and claiming that I used this address to make the suggestion. It was my linux@ address.

Deleting these mails from this mailbox.

Sorry about that. I'll replace the rmk+kernel@ address in the patches with linux@. Would you like me to resend the patches to that address?

- Paul

#25 lore raw

PATCH 8/8 OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c

Quoted 4 lines · Paul Walmsley

Hi Russell,

On Thu, 3 Dec 2009, Russell King wrote:

Quoted 8 lines
Quoted 5 lines

Also, why are you emailing me at my rmk+kernel address and claiming that I used this address to make the suggestion. It was my linux@ address.

Deleting these mails from this mailbox.

Sorry about that. I'll replace the rmk+kernel@ address in the patches with linux at . Would you like me to resend the patches to that address?

No, I get them just fine from the mailing list.

#26 lore raw

cover OMAP clock: convert static definitions in header files to C files

In reply to Paul Walmsley

Hi Paul,

Some patches in this series seem to be missing, specifically 5/8 and 6/8. Can you please re-post?

regards,
Rajendra

Quoted 1 line

-----Original Message-----

From: [email protected]

Quoted 96 lines

[mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Paul Walmsley
Sent: Thursday, December 03, 2009 3:37 PM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: [PATCH 0/8] OMAP clock: convert static definitions in header files to C files

The OMAP clock code has traditionally defined its clock nodes statically in header files (e.g., mach-omap1/clock.h). This violates the general guideline that including a header file should be side-effect free, or at least as side-effect free as possible. This series moves all of the statically-allocated data from header files into C files that are linked into kernels. It moves OPP data (or at least the proto-OPP data in OMAP1 and OMAP2xxx) into separate files. It also resolves all of the checkpatch errors that appear as a result of the move.

This series has been boot-tested on OMAP1 (on a 5912 OSK), OMAP2 (on N800 and
2430 SDP), and OMAP3 (BeagleBoard).

This series was prompted by a comment from Russell King <[email protected]>, who suggested the basic layout that these
patches implement.

- Paul

---

size:
text data bss dec hex filename
3582959 199264 107176 3889399 3b58f7 vmlinux.beagle.orig
3583063 199264 107176 3889503 3b595f vmlinux.beagle

Paul Walmsley (8):
OMAP1/2/3 clock: remove paranoid checks in preparation
for clock{,2xxx,3xxx}_data.c
OMAP2 clock: APLL code shouldn't rely on static clocks
in its local namespace
OMAP2/3: move SDRC macros to mach-omap2/sdrc.h OMAP2xxx clock: remove implicit dependency between rate
CPU flag and clkdev_omap CPU flag
OMAP3 clock: convert clock34xx.h to clock34xx_data.c OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx* OMAP1 clock: convert test in disable_unused() to use
ENABLE_ON_INIT
OMAP1 clock: convert mach-omap1/clock.h to
mach-omap1/clock_data.c

arch/arm/mach-omap1/Makefile                  |    3 
arch/arm/mach-omap1/clock.c                   |  415 ---
arch/arm/mach-omap1/clock.h                   |  652 -----
arch/arm/mach-omap1/clock_data.c              |  443 +++-
arch/arm/mach-omap1/io.c                      |    3 
arch/arm/mach-omap1/opp.h                     |   28 
arch/arm/mach-omap1/opp_data.c                |   59 
arch/arm/mach-omap2/Makefile                  |    8 
arch/arm/mach-omap2/clock.h                   |   30 
arch/arm/mach-omap2/clock24xx.c               |  805 -------
arch/arm/mach-omap2/clock2xxx.c               |  564 +++++
arch/arm/mach-omap2/clock2xxx.h               |   44 
arch/arm/mach-omap2/clock2xxx_data.c          |  844 ++-----
arch/arm/mach-omap2/clock34xx.c               |  471 ----
arch/arm/mach-omap2/clock34xx.h               | 3013 
-------------------------
arch/arm/mach-omap2/clock34xx_data.c          |  364 +++
arch/arm/mach-omap2/clock_common_data.c       |   39 
arch/arm/mach-omap2/opp2420_data.c            |  126 +
arch/arm/mach-omap2/opp2430_data.c            |  133 +
arch/arm/mach-omap2/opp2xxx.h                 |  424 ++++
arch/arm/mach-omap2/sdrc.h                    |   19 
arch/arm/plat-omap/include/plat/clkdev_omap.h |   41 
arch/arm/plat-omap/include/plat/clock.h       |    2 
23 files changed, 2592 insertions(+), 5938 deletions(-)

copy arch/arm/mach-omap1/{clock.h => clock_data.c} (58%) create mode 100644 arch/arm/mach-omap1/opp.h
create mode 100644 arch/arm/mach-omap1/opp_data.c delete mode 100644 arch/arm/mach-omap2/clock24xx.c create mode 100644 arch/arm/mach-omap2/clock2xxx.c create mode 100644 arch/arm/mach-omap2/clock2xxx.h rename arch/arm/mach-omap2/{clock24xx.h => clock2xxx_data.c} (73%) copy arch/arm/mach-omap2/{clock34xx.h => clock34xx_data.c} (86%) create mode 100644 arch/arm/mach-omap2/clock_common_data.c create mode 100644 arch/arm/mach-omap2/opp2420_data.c create mode 100644 arch/arm/mach-omap2/opp2430_data.c create mode 100644 arch/arm/mach-omap2/opp2xxx.h
create mode 100644 arch/arm/plat-omap/include/plat/clkdev_omap.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

#27 lore raw

cover OMAP clock: convert static definitions in header files to C files

Quoted 2 lines · Rajendra

Some patches in this series seem to be missing, specifically 5/8 and 6/8. Can you please re-post?

Probably because they're on the large side.