sh: introduce struct clk_div4_table
authorMagnus Damm <damm@opensource.se>
Fri, 19 Feb 2010 09:22:25 +0000 (09:22 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 22 Feb 2010 10:11:20 +0000 (19:11 +0900)
This patch introduces struct clk_div4_table. The structure
will be used to keep div4 specific data, and is with this
patch replacing the struct clk_div_mult_table pointer arg
used by the sh_clk_div4_register() functions.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/clock.h
arch/sh/kernel/cpu/clock-cpg.c
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c

index 501d0b0762836b99bc203f2f3abb77d82cbfeb17..dbb5746e88f66df0ae5d5e293eaebcf5cc61da49 100644 (file)
@@ -146,12 +146,16 @@ int sh_clk_mstp32_register(struct clk *clks, int nr);
        .flags = _flags,                                                \
 }
 
+struct clk_div4_table {
+       struct clk_div_mult_table *div_mult_table;
+};
+
 int sh_clk_div4_register(struct clk *clks, int nr,
-                        struct clk_div_mult_table *table);
+                        struct clk_div4_table *table);
 int sh_clk_div4_enable_register(struct clk *clks, int nr,
-                        struct clk_div_mult_table *table);
+                        struct clk_div4_table *table);
 int sh_clk_div4_reparent_register(struct clk *clks, int nr,
-                        struct clk_div_mult_table *table);
+                        struct clk_div4_table *table);
 
 #define SH_CLK_DIV6(_name, _parent, _reg, _flags)      \
 {                                                      \
index 72a5e621a9bbcdbe54b1adeed575e77e69315a8a..1fc8a0e50603471812f3aaa3604417965e0d891c 100644 (file)
@@ -149,7 +149,8 @@ int __init sh_clk_div6_register(struct clk *clks, int nr)
 
 static unsigned long sh_clk_div4_recalc(struct clk *clk)
 {
-       struct clk_div_mult_table *table = clk->priv;
+       struct clk_div4_table *d4t = clk->priv;
+       struct clk_div_mult_table *table = d4t->div_mult_table;
        unsigned int idx;
 
        clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
@@ -162,7 +163,8 @@ static unsigned long sh_clk_div4_recalc(struct clk *clk)
 
 static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent)
 {
-       struct clk_div_mult_table *table = clk->priv;
+       struct clk_div4_table *d4t = clk->priv;
+       struct clk_div_mult_table *table = d4t->div_mult_table;
        u32 value;
        int ret;
 
@@ -234,11 +236,11 @@ static struct clk_ops sh_clk_div4_reparent_clk_ops = {
 };
 
 static int __init sh_clk_div4_register_ops(struct clk *clks, int nr,
-                       struct clk_div_mult_table *table, struct clk_ops *ops)
+                       struct clk_div4_table *table, struct clk_ops *ops)
 {
        struct clk *clkp;
        void *freq_table;
-       int nr_divs = table->nr_divisors;
+       int nr_divs = table->div_mult_table->nr_divisors;
        int freq_table_size = sizeof(struct cpufreq_frequency_table);
        int ret = 0;
        int k;
@@ -267,20 +269,20 @@ static int __init sh_clk_div4_register_ops(struct clk *clks, int nr,
 }
 
 int __init sh_clk_div4_register(struct clk *clks, int nr,
-                               struct clk_div_mult_table *table)
+                               struct clk_div4_table *table)
 {
        return sh_clk_div4_register_ops(clks, nr, table, &sh_clk_div4_clk_ops);
 }
 
 int __init sh_clk_div4_enable_register(struct clk *clks, int nr,
-                               struct clk_div_mult_table *table)
+                               struct clk_div4_table *table)
 {
        return sh_clk_div4_register_ops(clks, nr, table,
                                        &sh_clk_div4_enable_clk_ops);
 }
 
 int __init sh_clk_div4_reparent_register(struct clk *clks, int nr,
-                               struct clk_div_mult_table *table)
+                               struct clk_div4_table *table)
 {
        return sh_clk_div4_register_ops(clks, nr, table,
                                        &sh_clk_div4_reparent_clk_ops);
index 0ee3ee86125241c4518dc3e646b72ce95d196f06..2c16df37eda64bd836baf45dbefb8e26aa7ee269 100644 (file)
@@ -107,13 +107,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
        DIV4_SIUA, DIV4_SIUB, DIV4_NR };
 
index a95ebaba095c0e7030c4482a1a60cd0627a4611c..91588d280cd83a1e68d68246ecfcc00dd83ed9fd 100644 (file)
@@ -110,13 +110,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
        DIV4_SIUA, DIV4_SIUB, DIV4_NR };
 
index 860ee2bf4bf0a2bf620620de9f76d80abac9d6fd..15db6d521c5cb39a0548c72a6d5974f03f6726f4 100644 (file)
@@ -110,13 +110,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
   SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags)
 
index 76731b61998efcfa71606bba278561bd2aa75397..50babe01fe44eabaee9300652286c0881c883727 100644 (file)
@@ -110,13 +110,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR };
 
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
index 9db743802f06d04afc176d5e6200a206c9673f07..70517900ef8f2b7f5733dc771f2a15c10fb34e8a 100644 (file)
@@ -129,11 +129,15 @@ struct clk *main_clks[] = {
 
 static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_P, DIV4_M1, DIV4_NR };
 
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
index 73abfbf2f16d29aa79e9255278725210e365b981..d997f0a25b104a519a7854d101fbd06a9472a5e0 100644 (file)
@@ -57,11 +57,15 @@ static struct clk *clks[] = {
 static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18,
                               24, 32, 36, 48 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = div2,
        .nr_divisors = ARRAY_SIZE(div2),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_GA,
        DIV4_DU, DIV4_P, DIV4_NR };
 
index 494c636012bbf2b5dd680f8cb705c790c88e2c94..af69fd4687038e5eecd53a5e95c988c600cdc956 100644 (file)
@@ -59,11 +59,15 @@ static struct clk *clks[] = {
 static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18,
                               24, 32, 36, 48 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = div2,
        .nr_divisors = ARRAY_SIZE(div2),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_DU, DIV4_P, DIV4_NR };
 
 #define DIV4(_str, _bit, _mask, _flags) \