Root/target/linux/xburst/files-2.6.32/arch/mips/jz4740/clock.h

1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC clock support
4 *
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.
9 *
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.
13 *
14 */
15
16#ifndef __JZ4740_CLOCK_H__
17#define __JZ4740_CLOCK_H__
18
19struct jz4740_clock_board_data {
20    unsigned long ext_rate;
21    unsigned long rtc_rate;
22};
23
24extern struct jz4740_clock_board_data jz4740_clock_bdata;
25
26int jz4740_clock_init(void);
27void jz4740_clock_suspend(void);
28void jz4740_clock_resume(void);
29
30struct clk;
31
32struct clk_ops {
33    unsigned long (*get_rate)(struct clk* clk);
34    unsigned long (*round_rate)(struct clk *clk, unsigned long rate);
35    int (*set_rate)(struct clk* clk, unsigned long rate);
36    int (*enable)(struct clk* clk);
37    int (*disable)(struct clk* clk);
38    int (*is_enabled)(struct clk* clk);
39
40    int (*set_parent)(struct clk* clk, struct clk *parent);
41
42};
43
44struct clk {
45    const char *name;
46    struct clk* parent;
47
48    uint32_t gate_bit;
49
50    const struct clk_ops *ops;
51
52    struct list_head list;
53
54#ifdef CONFIG_DEBUG_FS
55    struct dentry *debugfs_entry;
56    struct dentry *debugfs_parent_entry;
57#endif
58
59};
60
61#define JZ4740_CLK_NOT_GATED ((uint32_t)-1)
62
63int clk_is_enabled(struct clk *clk);
64
65#ifdef CONFIG_DEBUG_FS
66void jz4740_clock_debugfs_init(void);
67void jz4740_clock_debugfs_add_clk(struct clk *clk);
68void jz4740_clock_debugfs_update_parent(struct clk *clk);
69#else
70static inline void jz4740_clock_debugfs_init(void) {};
71static inline void jz4740_clock_debugfs_add_clk(struct clk *clk) {};
72static inline void jz4740_clock_debugfs_update_parent(struct clk *clk) {};
73#endif
74
75#endif
76

Archive Download this file



interactive