Linux 3.15-rc1
[linux/fpc-iii.git] / arch / mips / jz4740 / clock.h
blob5d07499d74619f517d149e9563ff1ecb302a9597
1 /*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC clock support
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 #ifndef __MIPS_JZ4740_CLOCK_H__
17 #define __MIPS_JZ4740_CLOCK_H__
19 #include <linux/list.h>
21 struct jz4740_clock_board_data {
22 unsigned long ext_rate;
23 unsigned long rtc_rate;
26 extern struct jz4740_clock_board_data jz4740_clock_bdata;
28 void jz4740_clock_suspend(void);
29 void jz4740_clock_resume(void);
31 struct clk;
33 struct clk_ops {
34 unsigned long (*get_rate)(struct clk *clk);
35 unsigned long (*round_rate)(struct clk *clk, unsigned long rate);
36 int (*set_rate)(struct clk *clk, unsigned long rate);
37 int (*enable)(struct clk *clk);
38 int (*disable)(struct clk *clk);
39 int (*is_enabled)(struct clk *clk);
41 int (*set_parent)(struct clk *clk, struct clk *parent);
45 struct clk {
46 const char *name;
47 struct clk *parent;
49 uint32_t gate_bit;
51 const struct clk_ops *ops;
53 struct list_head list;
55 #ifdef CONFIG_DEBUG_FS
56 struct dentry *debugfs_entry;
57 struct dentry *debugfs_parent_entry;
58 #endif
62 #define JZ4740_CLK_NOT_GATED ((uint32_t)-1)
64 int clk_is_enabled(struct clk *clk);
66 #ifdef CONFIG_DEBUG_FS
67 void jz4740_clock_debugfs_init(void);
68 void jz4740_clock_debugfs_add_clk(struct clk *clk);
69 void jz4740_clock_debugfs_update_parent(struct clk *clk);
70 #else
71 static inline void jz4740_clock_debugfs_init(void) {};
72 static inline void jz4740_clock_debugfs_add_clk(struct clk *clk) {};
73 static inline void jz4740_clock_debugfs_update_parent(struct clk *clk) {};
74 #endif
76 #endif