sh: clkfwk: Fix up the clk_enable() error path.
[linux-2.6] / arch / sh / include / asm / clock.h
1 #ifndef __ASM_SH_CLOCK_H
2 #define __ASM_SH_CLOCK_H
3
4 #include <linux/list.h>
5 #include <linux/seq_file.h>
6 #include <linux/clk.h>
7 #include <linux/err.h>
8
9 struct clk;
10
11 struct clk_ops {
12         void (*init)(struct clk *clk);
13         int (*enable)(struct clk *clk);
14         void (*disable)(struct clk *clk);
15         unsigned long (*recalc)(struct clk *clk);
16         int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
17         int (*set_parent)(struct clk *clk, struct clk *parent);
18         long (*round_rate)(struct clk *clk, unsigned long rate);
19 };
20
21 struct clk {
22         struct list_head        node;
23         const char              *name;
24         int                     id;
25         struct module           *owner;
26
27         struct clk              *parent;
28         struct clk_ops          *ops;
29
30         struct list_head        children;
31         struct list_head        sibling;        /* node for children */
32
33         int                     usecount;
34
35         unsigned long           rate;
36         unsigned long           flags;
37         unsigned long           arch_flags;
38 };
39
40 #define CLK_ENABLE_ON_INIT      (1 << 0)
41
42 /* Should be defined by processor-specific code */
43 void arch_init_clk_ops(struct clk_ops **, int type);
44 int __init arch_clk_init(void);
45
46 /* arch/sh/kernel/cpu/clock.c */
47 int clk_init(void);
48 unsigned long followparent_recalc(struct clk *);
49 void recalculate_root_clocks(void);
50 void propagate_rate(struct clk *);
51 void clk_recalc_rate(struct clk *);
52 int clk_register(struct clk *);
53 void clk_unregister(struct clk *);
54
55 /* the exported API, in addition to clk_set_rate */
56 /**
57  * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
58  * @clk: clock source
59  * @rate: desired clock rate in Hz
60  * @algo_id: algorithm id to be passed down to ops->set_rate
61  *
62  * Returns success (0) or negative errno.
63  */
64 int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
65
66 enum clk_sh_algo_id {
67         NO_CHANGE = 0,
68
69         IUS_N1_N1,
70         IUS_322,
71         IUS_522,
72         IUS_N11,
73
74         SB_N1,
75
76         SB3_N1,
77         SB3_32,
78         SB3_43,
79         SB3_54,
80
81         BP_N1,
82
83         IP_N1,
84 };
85
86 #endif /* __ASM_SH_CLOCK_H */