diff options
Diffstat (limited to 'arch/arm/plat-samsung/clock.c')
-rw-r--r-- | arch/arm/plat-samsung/clock.c | 98 |
1 files changed, 6 insertions, 92 deletions
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 0c9f95d98561..302c42670bd1 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -71,74 +71,6 @@ static int clk_null_enable(struct clk *clk, int enable) | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static int dev_is_s3c_uart(struct device *dev) | ||
75 | { | ||
76 | struct platform_device **pdev = s3c24xx_uart_devs; | ||
77 | int i; | ||
78 | for (i = 0; i < ARRAY_SIZE(s3c24xx_uart_devs); i++, pdev++) | ||
79 | if (*pdev && dev == &(*pdev)->dev) | ||
80 | return 1; | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * Serial drivers call get_clock() very early, before platform bus | ||
86 | * has been set up, this requires a special check to let them get | ||
87 | * a proper clock | ||
88 | */ | ||
89 | |||
90 | static int dev_is_platform_device(struct device *dev) | ||
91 | { | ||
92 | return dev->bus == &platform_bus_type || | ||
93 | (dev->bus == NULL && dev_is_s3c_uart(dev)); | ||
94 | } | ||
95 | |||
96 | /* Clock API calls */ | ||
97 | |||
98 | struct clk *clk_get(struct device *dev, const char *id) | ||
99 | { | ||
100 | struct clk *p; | ||
101 | struct clk *clk = ERR_PTR(-ENOENT); | ||
102 | int idno; | ||
103 | |||
104 | if (dev == NULL || !dev_is_platform_device(dev)) | ||
105 | idno = -1; | ||
106 | else | ||
107 | idno = to_platform_device(dev)->id; | ||
108 | |||
109 | spin_lock(&clocks_lock); | ||
110 | |||
111 | list_for_each_entry(p, &clocks, list) { | ||
112 | if (p->id == idno && | ||
113 | strcmp(id, p->name) == 0 && | ||
114 | try_module_get(p->owner)) { | ||
115 | clk = p; | ||
116 | break; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /* check for the case where a device was supplied, but the | ||
121 | * clock that was being searched for is not device specific */ | ||
122 | |||
123 | if (IS_ERR(clk)) { | ||
124 | list_for_each_entry(p, &clocks, list) { | ||
125 | if (p->id == -1 && strcmp(id, p->name) == 0 && | ||
126 | try_module_get(p->owner)) { | ||
127 | clk = p; | ||
128 | break; | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | spin_unlock(&clocks_lock); | ||
134 | return clk; | ||
135 | } | ||
136 | |||
137 | void clk_put(struct clk *clk) | ||
138 | { | ||
139 | module_put(clk->owner); | ||
140 | } | ||
141 | |||
142 | int clk_enable(struct clk *clk) | 74 | int clk_enable(struct clk *clk) |
143 | { | 75 | { |
144 | if (IS_ERR(clk) || clk == NULL) | 76 | if (IS_ERR(clk) || clk == NULL) |
@@ -241,8 +173,6 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
241 | return ret; | 173 | return ret; |
242 | } | 174 | } |
243 | 175 | ||
244 | EXPORT_SYMBOL(clk_get); | ||
245 | EXPORT_SYMBOL(clk_put); | ||
246 | EXPORT_SYMBOL(clk_enable); | 176 | EXPORT_SYMBOL(clk_enable); |
247 | EXPORT_SYMBOL(clk_disable); | 177 | EXPORT_SYMBOL(clk_disable); |
248 | EXPORT_SYMBOL(clk_get_rate); | 178 | EXPORT_SYMBOL(clk_get_rate); |
@@ -265,7 +195,6 @@ struct clk_ops clk_ops_def_setrate = { | |||
265 | 195 | ||
266 | struct clk clk_xtal = { | 196 | struct clk clk_xtal = { |
267 | .name = "xtal", | 197 | .name = "xtal", |
268 | .id = -1, | ||
269 | .rate = 0, | 198 | .rate = 0, |
270 | .parent = NULL, | 199 | .parent = NULL, |
271 | .ctrlbit = 0, | 200 | .ctrlbit = 0, |
@@ -273,30 +202,25 @@ struct clk clk_xtal = { | |||
273 | 202 | ||
274 | struct clk clk_ext = { | 203 | struct clk clk_ext = { |
275 | .name = "ext", | 204 | .name = "ext", |
276 | .id = -1, | ||
277 | }; | 205 | }; |
278 | 206 | ||
279 | struct clk clk_epll = { | 207 | struct clk clk_epll = { |
280 | .name = "epll", | 208 | .name = "epll", |
281 | .id = -1, | ||
282 | }; | 209 | }; |
283 | 210 | ||
284 | struct clk clk_mpll = { | 211 | struct clk clk_mpll = { |
285 | .name = "mpll", | 212 | .name = "mpll", |
286 | .id = -1, | ||
287 | .ops = &clk_ops_def_setrate, | 213 | .ops = &clk_ops_def_setrate, |
288 | }; | 214 | }; |
289 | 215 | ||
290 | struct clk clk_upll = { | 216 | struct clk clk_upll = { |
291 | .name = "upll", | 217 | .name = "upll", |
292 | .id = -1, | ||
293 | .parent = NULL, | 218 | .parent = NULL, |
294 | .ctrlbit = 0, | 219 | .ctrlbit = 0, |
295 | }; | 220 | }; |
296 | 221 | ||
297 | struct clk clk_f = { | 222 | struct clk clk_f = { |
298 | .name = "fclk", | 223 | .name = "fclk", |
299 | .id = -1, | ||
300 | .rate = 0, | 224 | .rate = 0, |
301 | .parent = &clk_mpll, | 225 | .parent = &clk_mpll, |
302 | .ctrlbit = 0, | 226 | .ctrlbit = 0, |
@@ -304,7 +228,6 @@ struct clk clk_f = { | |||
304 | 228 | ||
305 | struct clk clk_h = { | 229 | struct clk clk_h = { |
306 | .name = "hclk", | 230 | .name = "hclk", |
307 | .id = -1, | ||
308 | .rate = 0, | 231 | .rate = 0, |
309 | .parent = NULL, | 232 | .parent = NULL, |
310 | .ctrlbit = 0, | 233 | .ctrlbit = 0, |
@@ -313,7 +236,6 @@ struct clk clk_h = { | |||
313 | 236 | ||
314 | struct clk clk_p = { | 237 | struct clk clk_p = { |
315 | .name = "pclk", | 238 | .name = "pclk", |
316 | .id = -1, | ||
317 | .rate = 0, | 239 | .rate = 0, |
318 | .parent = NULL, | 240 | .parent = NULL, |
319 | .ctrlbit = 0, | 241 | .ctrlbit = 0, |
@@ -322,7 +244,6 @@ struct clk clk_p = { | |||
322 | 244 | ||
323 | struct clk clk_usb_bus = { | 245 | struct clk clk_usb_bus = { |
324 | .name = "usb-bus", | 246 | .name = "usb-bus", |
325 | .id = -1, | ||
326 | .rate = 0, | 247 | .rate = 0, |
327 | .parent = &clk_upll, | 248 | .parent = &clk_upll, |
328 | }; | 249 | }; |
@@ -330,7 +251,6 @@ struct clk clk_usb_bus = { | |||
330 | 251 | ||
331 | struct clk s3c24xx_uclk = { | 252 | struct clk s3c24xx_uclk = { |
332 | .name = "uclk", | 253 | .name = "uclk", |
333 | .id = -1, | ||
334 | }; | 254 | }; |
335 | 255 | ||
336 | /* initialise the clock system */ | 256 | /* initialise the clock system */ |
@@ -346,14 +266,11 @@ int s3c24xx_register_clock(struct clk *clk) | |||
346 | if (clk->enable == NULL) | 266 | if (clk->enable == NULL) |
347 | clk->enable = clk_null_enable; | 267 | clk->enable = clk_null_enable; |
348 | 268 | ||
349 | /* add to the list of available clocks */ | 269 | /* fill up the clk_lookup structure and register it*/ |
350 | 270 | clk->lookup.dev_id = clk->devname; | |
351 | /* Quick check to see if this clock has already been registered. */ | 271 | clk->lookup.con_id = clk->name; |
352 | BUG_ON(clk->list.prev != clk->list.next); | 272 | clk->lookup.clk = clk; |
353 | 273 | clkdev_add(&clk->lookup); | |
354 | spin_lock(&clocks_lock); | ||
355 | list_add(&clk->list, &clocks); | ||
356 | spin_unlock(&clocks_lock); | ||
357 | 274 | ||
358 | return 0; | 275 | return 0; |
359 | } | 276 | } |
@@ -463,10 +380,7 @@ static int clk_debugfs_register_one(struct clk *c) | |||
463 | char s[255]; | 380 | char s[255]; |
464 | char *p = s; | 381 | char *p = s; |
465 | 382 | ||
466 | p += sprintf(p, "%s", c->name); | 383 | p += sprintf(p, "%s", c->devname); |
467 | |||
468 | if (c->id >= 0) | ||
469 | sprintf(p, ":%d", c->id); | ||
470 | 384 | ||
471 | d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); | 385 | d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); |
472 | if (!d) | 386 | if (!d) |