clk: clock: compatible clk count for different platform [1/1]
authorShunzhou Jiang <shunzhou.jiang@amlogic.com>
Mon, 11 Jun 2018 04:08:22 +0000 (12:08 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 29 Jun 2018 07:45:09 +0000 (00:45 -0700)
PD#165090: clock: fix clk count error

Change-Id: I3b7c181e159b2a028ddc53e7c72066ec3633fd75
Signed-off-by: Shunzhou Jiang <shunzhou.jiang@amlogic.com>
drivers/amlogic/clk/axg/axg.c
drivers/amlogic/clk/axg/axg_ao.c
drivers/amlogic/clk/clk_test.c
drivers/amlogic/clk/clkc.h
drivers/amlogic/clk/g12a/g12a.c
drivers/amlogic/clk/g12a/g12a_ao.c
drivers/amlogic/clk/g12b/g12b.c
drivers/amlogic/clk/gxl/gxl.c
drivers/amlogic/clk/m8b/meson8b.c
drivers/amlogic/clk/txlx/txlx.c

index 25b1d94aa8e84a1be36919e7d05ec12e54f35469..d267eb63ee6ba60f2ce2eae0fe3668762c2925b8 100644 (file)
@@ -871,6 +871,7 @@ static void __init axg_clkc_init(struct device_node *np)
                        /* return -ENOMEM; */
                        return;
                }
+               clk_numbers = NR_CLKS;
        }
 
        if (NULL == clks) {
index 8fa0c5e404b2223e3c65555a08890254c416a5d5..8ca22b885f9a43323c995bf21101c0a34e2e5d78 100644 (file)
@@ -125,6 +125,7 @@ static void __init axg_aoclkc_init(struct device_node *np)
                        /* return -ENOMEM; */
                        return;
                }
+               clk_numbers = NR_CLKS;
        }
 
        for (clkid = CLKID_AO_BASE; clkid < NR_CLKS; clkid++) {
index ae2df3017e47360989c6eaed9b1bf1b2071fa63c..0bfab8b4df25f934cf9fc26dcbef14964fbe6489 100644 (file)
@@ -29,7 +29,8 @@
 #include "clkc.h"
 
 static struct dentry *debugfs_root;
-#define NR_CLKS 221
+//#define NR_CLKS 221
+
 void usage(void)
 {
        pr_info("\nclk_test:\n");
@@ -44,7 +45,7 @@ struct clk *aml_get_clk_by_name(char *name)
        int idx;
        struct clk *cur_clk;
 
-       for (idx = 0; idx < NR_CLKS; idx++) {
+       for (idx = 0; idx < clk_numbers; idx++) {
                if (!clks[idx]) {
                        pr_debug("no such clk clks[%d]\n", idx);
                        continue;
index f8370656878454f816ad251997aaf910dee2166a..5a90fdb419bb060f665c52280c9879e8485ce62d 100644 (file)
@@ -286,4 +286,5 @@ void meson_g12a_media_init(void);
 void meson_g12a_gpu_init(void);
 void meson_g12a_misc_init(void);
 
+extern int clk_numbers;
 #endif /* __CLKC_H */
index dd13b0e5ab285dea298b086cd8735751554665b8..e2c7afd9caf9caf35ab0392cfa27fb4d34220b82 100644 (file)
@@ -871,6 +871,7 @@ static void __init g12a_clkc_init(struct device_node *np)
                        /* return -ENOMEM; */
                        return;
                }
+               clk_numbers = NR_CLKS;
        }
 
        clk_data.clks = clks;
index ccba986d79505d93b93ce52b367cc37c45044221..92dc5f45ebe753123ffcad3a68bb43b72635dbcd 100644 (file)
@@ -125,6 +125,7 @@ static void __init g12a_aoclkc_init(struct device_node *np)
                        /* return -ENOMEM; */
                        return;
                }
+               clk_numbers = NR_CLKS;
        }
 
        for (clkid = CLKID_AO_BASE; clkid < NR_CLKS; clkid++) {
index 9c7482c9805a3d1aa5668be4221497eaf37af578..86e9c1f2f4be8dbd5689f8d2ed9ec66dbe8759ce 100644 (file)
@@ -552,6 +552,7 @@ static void __init g12b_clkc_init(struct device_node *np)
                        pr_err("%s: alloc clks fail!", __func__);
                        return;
                }
+               clk_numbers = NR_CLKS;
        }
 
        /*
index 508e91d7cdb87f311ee83cf0691c8c9d62d73e24..8831de5cc14e01769ee736b2bdd58b0717153514 100644 (file)
@@ -28,6 +28,7 @@
 
 DEFINE_SPINLOCK(clk_lock);
 struct clk **clks;
+int clk_numbers;
 static struct clk_onecell_data clk_data;
 void __iomem *clk_base;
 /* #undef pr_debug */
@@ -1071,6 +1072,7 @@ static void __init gxl_clkc_init(struct device_node *np)
                /* return -ENOMEM; */
                return;
        }
+       clk_numbers = NR_CLKS;
        /* pr_debug("%s: kzalloc clks ok!", __func__); */
        clk_data.clks = clks;
        clk_data.clk_num = NR_CLKS;
index 45223cdb6dcdca0e1b93861fe4d3c178118bc8f1..a93043881bb3958ac32a2dfcec96ab411681d222 100644 (file)
@@ -30,6 +30,7 @@ DEFINE_SPINLOCK(clk_lock);
 struct clk **clks;
 void __iomem *clk_base;
 static struct clk_onecell_data clk_data;
+int clk_numbers;
 
 static const struct pll_rate_table sys_pll_rate_table[] = {
        PLL_RATE(312000000, 52, 1, 2),
@@ -732,6 +733,7 @@ static void __init meson8b_clkc_init(struct device_node *np)
                /* return -ENOMEM; */
                return;
        }
+       clk_numbers = NR_CLKS;
        clk_data.clks = clks;
        clk_data.clk_num = NR_CLKS;
        /*
index 9ec1c6ffab72fec80c8ab99b39f302854e222d6f..227ec77c465498051e5f68736f5227f87332245c 100644 (file)
@@ -975,7 +975,7 @@ static void __init txlx_clkc_init(struct device_node *np)
                pr_err("%s: error: not kzalloc clks in eeclk!", __func__);
                return;
        }
-
+       clk_numbers = NR_CLKS;
        clk_data.clks = clks;
        clk_data.clk_num = NR_CLKS;