aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-08-22 09:36:30 -0400
committerShawn Guo <shawn.guo@linaro.org>2012-09-11 02:45:46 -0400
commit53f9443da63db38212e784b0aa205881168757aa (patch)
tree36e142fcd0d290d8a1e1efeffe736ddb476c42dc /drivers/clk
parentb598b9f311a604ca533033baa5afcf45beb037d9 (diff)
clk: mxs: replace imx23 clk_register_clkdev with clock DT lookup
It really becomes a maintenance issue that every time a device needs to look up (clk_get) a clock we have to patch kernel clock file to call clk_register_clkdev for that clock. Since clock DT support which is meant to resolve clock lookup in device tree is in place, the patch moves imx23 client devices' clock lookup over to device tree, so that any new lookup to be added at later time can just get done in DT instead of kernel. Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/mxs/clk-imx23.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 844043ad0fe4..9f6d15546cbe 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -14,6 +14,7 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of.h>
17#include <mach/common.h> 18#include <mach/common.h>
18#include <mach/mx23.h> 19#include <mach/mx23.h>
19#include "clk.h" 20#include "clk.h"
@@ -71,44 +72,6 @@ static void __init clk_misc_init(void)
71 __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); 72 __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC);
72} 73}
73 74
74static struct clk_lookup uart_lookups[] = {
75 { .dev_id = "duart", },
76 { .dev_id = "mxs-auart.0", },
77 { .dev_id = "mxs-auart.1", },
78 { .dev_id = "8006c000.serial", },
79 { .dev_id = "8006e000.serial", },
80 { .dev_id = "80070000.serial", },
81};
82
83static struct clk_lookup hbus_lookups[] = {
84 { .dev_id = "imx23-dma-apbh", },
85 { .dev_id = "80004000.dma-apbh", },
86};
87
88static struct clk_lookup xbus_lookups[] = {
89 { .dev_id = "duart", .con_id = "apb_pclk"},
90 { .dev_id = "80070000.serial", .con_id = "apb_pclk"},
91 { .dev_id = "imx23-dma-apbx", },
92 { .dev_id = "80024000.dma-apbx", },
93};
94
95static struct clk_lookup ssp_lookups[] = {
96 { .dev_id = "imx23-mmc.0", },
97 { .dev_id = "imx23-mmc.1", },
98 { .dev_id = "80010000.ssp", },
99 { .dev_id = "80034000.ssp", },
100};
101
102static struct clk_lookup lcdif_lookups[] = {
103 { .dev_id = "imx23-fb", },
104 { .dev_id = "80030000.lcdif", },
105};
106
107static struct clk_lookup gpmi_lookups[] = {
108 { .dev_id = "imx23-gpmi-nand", },
109 { .dev_id = "8000c000.gpmi-nand", },
110};
111
112static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; 75static const char *sel_pll[] __initconst = { "pll", "ref_xtal", };
113static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; 76static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", };
114static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", }; 77static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", };
@@ -127,6 +90,7 @@ enum imx23_clk {
127}; 90};
128 91
129static struct clk *clks[clk_max]; 92static struct clk *clks[clk_max];
93static struct clk_onecell_data clk_data;
130 94
131static enum imx23_clk clks_init_on[] __initdata = { 95static enum imx23_clk clks_init_on[] __initdata = {
132 cpu, hbus, xbus, emi, uart, 96 cpu, hbus, xbus, emi, uart,
@@ -134,6 +98,7 @@ static enum imx23_clk clks_init_on[] __initdata = {
134 98
135int __init mx23_clocks_init(void) 99int __init mx23_clocks_init(void)
136{ 100{
101 struct device_node *np;
137 int i; 102 int i;
138 103
139 clk_misc_init(); 104 clk_misc_init();
@@ -188,14 +153,14 @@ int __init mx23_clocks_init(void)
188 return PTR_ERR(clks[i]); 153 return PTR_ERR(clks[i]);
189 } 154 }
190 155
156 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
157 if (np) {
158 clk_data.clks = clks;
159 clk_data.clk_num = ARRAY_SIZE(clks);
160 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
161 }
162
191 clk_register_clkdev(clks[clk32k], NULL, "timrot"); 163 clk_register_clkdev(clks[clk32k], NULL, "timrot");
192 clk_register_clkdev(clks[pwm], NULL, "80064000.pwm");
193 clk_register_clkdevs(clks[hbus], hbus_lookups, ARRAY_SIZE(hbus_lookups));
194 clk_register_clkdevs(clks[xbus], xbus_lookups, ARRAY_SIZE(xbus_lookups));
195 clk_register_clkdevs(clks[uart], uart_lookups, ARRAY_SIZE(uart_lookups));
196 clk_register_clkdevs(clks[ssp], ssp_lookups, ARRAY_SIZE(ssp_lookups));
197 clk_register_clkdevs(clks[gpmi], gpmi_lookups, ARRAY_SIZE(gpmi_lookups));
198 clk_register_clkdevs(clks[lcdif], lcdif_lookups, ARRAY_SIZE(lcdif_lookups));
199 164
200 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 165 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
201 clk_prepare_enable(clks[clks_init_on[i]]); 166 clk_prepare_enable(clks[clks_init_on[i]]);