ARM: OMAP1: Move dpll1 rates selection from config to runtime
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Fri, 9 Dec 2011 02:01:41 +0000 (18:01 -0800)
committerTony Lindgren <tony@atomide.com>
Fri, 9 Dec 2011 02:02:23 +0000 (18:02 -0800)
For still better multi-OMAP1 support, expand omap1_rate_table with flags
for different SoC types and match them while selecting clock rates. The
idea is stolen from current omap24xx clock rate selection algorithm.

Since clkdev platform flag definitions are reused here, those had to be
expanded with one extra entry for OMAP1710 subtype, as this is the only
SoC for which we allow selection of the highest, 216 MHz rate.

Once done, remove no longer needed clock rate configure time options.

Tested on Amstrad Delta.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
[tony@atomide.com: updated comments]
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/configs/omap1_defconfig
arch/arm/mach-omap1/Kconfig
arch/arm/mach-omap1/clock.c
arch/arm/mach-omap1/clock.h
arch/arm/mach-omap1/clock_data.c
arch/arm/mach-omap1/opp.h
arch/arm/mach-omap1/opp_data.c
arch/arm/plat-omap/include/plat/clkdev_omap.h

index 945a34f2a34dbd9e711ac440500d1e17cfad2ac0..dde2a1af7b39bd73cec54cf22417a9e53920f792 100644 (file)
@@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y
 CONFIG_MACH_NOKIA770=y
 CONFIG_MACH_AMS_DELTA=y
 CONFIG_MACH_OMAP_GENERIC=y
-CONFIG_OMAP_ARM_182MHZ=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_PCCARD=y
 CONFIG_OMAP_CF=y
index 73f287d6429b629d57f7c093645962ce48cee318..4f8d66f044e7b90ef64fc40e27441f063ac1afa9 100644 (file)
@@ -168,70 +168,6 @@ config MACH_OMAP_GENERIC
           custom OMAP boards. Say Y here if you have a custom
           board.
 
-comment "OMAP CPU Speed"
-       depends on ARCH_OMAP1
-
-config OMAP_ARM_216MHZ
-       bool "OMAP ARM 216 MHz CPU (1710 only)"
-        depends on ARCH_OMAP1 && ARCH_OMAP16XX
-        help
-          Enable 216 MHz clock for OMAP1710 CPU. If unsure, say N.
-
-config OMAP_ARM_195MHZ
-       bool "OMAP ARM 195 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 195MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_192MHZ
-       bool "OMAP ARM 192 MHz CPU"
-       depends on ARCH_OMAP1 && ARCH_OMAP16XX
-       help
-          Enable 192MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_182MHZ
-       bool "OMAP ARM 182 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 182MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_168MHZ
-       bool "OMAP ARM 168 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 168MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_150MHZ
-       bool "OMAP ARM 150 MHz CPU"
-       depends on ARCH_OMAP1 && ARCH_OMAP15XX
-       help
-         Enable 150MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_120MHZ
-       bool "OMAP ARM 120 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 120MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_96MHZ
-       bool "OMAP ARM 96 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 96MHz clock for OMAP CPU. If unsure, say N.
-
-config OMAP_ARM_60MHZ
-       bool "OMAP ARM 60 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_OMAP850)
-        default y
-       help
-          Enable 60MHz clock for OMAP CPU. If unsure, say Y.
-
-config OMAP_ARM_30MHZ
-       bool "OMAP ARM 30 MHz CPU"
-       depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_OMAP850)
-       help
-          Enable 30MHz clock for OMAP CPU. If unsure, say N.
-
 endmenu
 
 endif
index 84ef70476b511e1005b75f7e80b633ef3a66c7fd..ff27dbdba3d649a128ad5cff74d60cb229aeb158 100644 (file)
@@ -197,6 +197,9 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate)
        ref_rate = ck_ref_p->rate;
 
        for (ptr = omap1_rate_table; ptr->rate; ptr++) {
+               if (!(ptr->flags & cpu_mask))
+                       continue;
+
                if (ptr->xtal != ref_rate)
                        continue;
 
@@ -290,6 +293,9 @@ long omap1_round_to_table_rate(struct clk *clk, unsigned long rate)
        highest_rate = -EINVAL;
 
        for (ptr = omap1_rate_table; ptr->rate; ptr++) {
+               if (!(ptr->flags & cpu_mask))
+                       continue;
+
                if (ptr->xtal != ref_rate)
                        continue;
 
index 16b1423b454a32dea7197460a393b12a4bd4e2b0..3d04f4f67676280a591f7bbcfb003c426fdba2dc 100644 (file)
@@ -111,4 +111,7 @@ extern const struct clkops clkops_dummy;
 extern const struct clkops clkops_uart_16xx;
 extern const struct clkops clkops_generic;
 
+/* used for passing SoC type to omap1_{select,round_to}_table_rate() */
+extern u32 cpu_mask;
+
 #endif
index 9ff90a744a2140a0bf5168403301ac9cec68b927..ff2d5248df239bdcc91ce641c2cab366fc255ce3 100644 (file)
@@ -778,12 +778,14 @@ static void __init omap1_show_rates(void)
                arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
 }
 
+u32 cpu_mask;
+
 int __init omap1_clk_init(void)
 {
        struct omap_clk *c;
        const struct omap_clock_config *info;
        int crystal_type = 0; /* Default 12 MHz */
-       u32 reg, cpu_mask;
+       u32 reg;
 
 #ifdef CONFIG_DEBUG_LL
        /*
@@ -808,6 +810,8 @@ int __init omap1_clk_init(void)
                clk_preinit(c->lk.clk);
 
        cpu_mask = 0;
+       if (cpu_is_omap1710())
+               cpu_mask |= CK_1710;
        if (cpu_is_omap16xx())
                cpu_mask |= CK_16XX;
        if (cpu_is_omap1510())
index 07074d79adcea5aae223d890d0f5e4239e696041..79a683864a5cea2c3c35086c87cb6b547aa08263 100644 (file)
@@ -21,6 +21,7 @@ struct mpu_rate {
        unsigned long           pll_rate;
        __u16                   ckctl_val;
        __u16                   dpllctl_val;
+       u32                     flags;
 };
 
 extern struct mpu_rate omap1_rate_table[];
index 75a5465149947aeeba33adbfdec804d595d2256c..9cd4ddb51397dc56fecc26c7384b0564836eaf0d 100644 (file)
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <plat/clkdev_omap.h>
 #include "opp.h"
 
 /*-------------------------------------------------------------------------
@@ -20,40 +21,34 @@ struct mpu_rate omap1_rate_table[] = {
         * NOTE: Comment order here is different from bits in CKCTL value:
         * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
         */
-#if defined(CONFIG_OMAP_ARM_216MHZ)
-       { 216000000, 12000000, 216000000, 0x050d, 0x2910 }, /* 1/1/2/2/2/8 */
-#endif
-#if defined(CONFIG_OMAP_ARM_195MHZ)
-       { 195000000, 13000000, 195000000, 0x050e, 0x2790 }, /* 1/1/2/2/4/8 */
-#endif
-#if defined(CONFIG_OMAP_ARM_192MHZ)
-       { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
-       { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
-       {  96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
-       {  48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/4/4/8/8/8 */
-       {  24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
-#endif
-#if defined(CONFIG_OMAP_ARM_182MHZ)
-       { 182000000, 13000000, 182000000, 0x050e, 0x2710 }, /* 1/1/2/2/4/8 */
-#endif
-#if defined(CONFIG_OMAP_ARM_168MHZ)
-       { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
-#endif
-#if defined(CONFIG_OMAP_ARM_150MHZ)
-       { 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
-#endif
-#if defined(CONFIG_OMAP_ARM_120MHZ)
-       { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
-#endif
-#if defined(CONFIG_OMAP_ARM_96MHZ)
-       {  96000000, 12000000,  96000000, 0x0005, 0x2410 }, /* 1/1/1/1/2/2 */
-#endif
-#if defined(CONFIG_OMAP_ARM_60MHZ)
-       {  60000000, 12000000,  60000000, 0x0005, 0x2290 }, /* 1/1/1/1/2/2 */
-#endif
-#if defined(CONFIG_OMAP_ARM_30MHZ)
-       {  30000000, 12000000,  60000000, 0x0555, 0x2290 }, /* 2/2/2/2/2/2 */
-#endif
+       { 216000000, 12000000, 216000000, 0x050d, 0x2910, /* 1/1/2/2/2/8 */
+                       CK_1710 },
+       { 195000000, 13000000, 195000000, 0x050e, 0x2790, /* 1/1/2/2/4/8 */
+                       CK_7XX },
+       { 192000000, 19200000, 192000000, 0x050f, 0x2510, /* 1/1/2/2/8/8 */
+                       CK_16XX },
+       { 192000000, 12000000, 192000000, 0x050f, 0x2810, /* 1/1/2/2/8/8 */
+                       CK_16XX },
+       {  96000000, 12000000, 192000000, 0x055f, 0x2810, /* 2/2/2/2/8/8 */
+                       CK_16XX },
+       {  48000000, 12000000, 192000000, 0x0baf, 0x2810, /* 4/4/4/8/8/8 */
+                       CK_16XX },
+       {  24000000, 12000000, 192000000, 0x0fff, 0x2810, /* 8/8/8/8/8/8 */
+                       CK_16XX },
+       { 182000000, 13000000, 182000000, 0x050e, 0x2710, /* 1/1/2/2/4/8 */
+                       CK_7XX },
+       { 168000000, 12000000, 168000000, 0x010f, 0x2710, /* 1/1/1/2/8/8 */
+                       CK_16XX|CK_7XX },
+       { 150000000, 12000000, 150000000, 0x010a, 0x2cb0, /* 1/1/1/2/4/4 */
+                       CK_1510 },
+       { 120000000, 12000000, 120000000, 0x010a, 0x2510, /* 1/1/1/2/4/4 */
+                       CK_16XX|CK_1510|CK_310|CK_7XX },
+       {  96000000, 12000000,  96000000, 0x0005, 0x2410, /* 1/1/1/1/2/2 */
+                       CK_16XX|CK_1510|CK_310|CK_7XX },
+       {  60000000, 12000000,  60000000, 0x0005, 0x2290, /* 1/1/1/1/2/2 */
+                       CK_16XX|CK_1510|CK_310|CK_7XX },
+       {  30000000, 12000000,  60000000, 0x0555, 0x2290, /* 2/2/2/2/2/2 */
+                       CK_16XX|CK_1510|CK_310|CK_7XX },
        { 0, 0, 0, 0, 0 },
 };
 
index 387a9638991b78a47514a0fd5d811f0ea25b3984..b299b8d201c8ba22fffc7c0991edbd30842a5dc5 100644 (file)
@@ -40,6 +40,7 @@ struct omap_clk {
 #define CK_443X                (1 << 11)
 #define CK_TI816X      (1 << 12)
 #define CK_446X                (1 << 13)
+#define CK_1710                (1 << 15)       /* 1710 extra for rate selection */
 
 
 #define CK_34XX                (CK_3430ES1 | CK_3430ES2PLUS)
This page took 0.029357 seconds and 5 git commands to generate.