Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
clock.c
Go to the documentation of this file.
1 /*
2  * linux/arch/arm/mach-w90x900/clock.c
3  *
4  * Copyright (c) 2008 Nuvoton technology corporation
5  *
6  * Wan ZongShun <[email protected]>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License.
11  */
12 
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/list.h>
16 #include <linux/errno.h>
17 #include <linux/err.h>
18 #include <linux/string.h>
19 #include <linux/clk.h>
20 #include <linux/spinlock.h>
21 #include <linux/platform_device.h>
22 #include <linux/io.h>
23 
24 #include <mach/hardware.h>
25 
26 #include "clock.h"
27 
28 #define SUBCLK 0x24
29 
30 static DEFINE_SPINLOCK(clocks_lock);
31 
32 int clk_enable(struct clk *clk)
33 {
34  unsigned long flags;
35 
37  if (clk->enabled++ == 0)
38  (clk->enable)(clk, 1);
39  spin_unlock_irqrestore(&clocks_lock, flags);
40 
41  return 0;
42 }
44 
45 void clk_disable(struct clk *clk)
46 {
47  unsigned long flags;
48 
49  WARN_ON(clk->enabled == 0);
50 
52  if (--clk->enabled == 0)
53  (clk->enable)(clk, 0);
54  spin_unlock_irqrestore(&clocks_lock, flags);
55 }
57 
58 unsigned long clk_get_rate(struct clk *clk)
59 {
60  return 15000000;
61 }
63 
64 void nuc900_clk_enable(struct clk *clk, int enable)
65 {
66  unsigned int clocks = clk->cken;
67  unsigned long clken;
68 
70 
71  if (enable)
72  clken |= clocks;
73  else
74  clken &= ~clocks;
75 
77 }
78 
79 void nuc900_subclk_enable(struct clk *clk, int enable)
80 {
81  unsigned int clocks = clk->cken;
82  unsigned long clken;
83 
85 
86  if (enable)
87  clken |= clocks;
88  else
89  clken &= ~clocks;
90 
92 }