clock.h 3.2 KB
Newer Older
1
/* linux/arch/arm/plat-s3c/include/plat/clock.h
L
Linus Torvalds 已提交
2 3 4 5 6 7 8 9 10 11
 *
 * Copyright (c) 2004-2005 Simtec Electronics
 *	http://www.simtec.co.uk/products/SWLINUX/
 *	Written by Ben Dooks, <ben@simtec.co.uk>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

12 13
#include <linux/spinlock.h>

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
struct clk;

/**
 * struct clk_ops - standard clock operations
 * @set_rate: set the clock rate, see clk_set_rate().
 * @get_rate: get the clock rate, see clk_get_rate().
 * @round_rate: round a given clock rate, see clk_round_rate().
 * @set_parent: set the clock's parent, see clk_set_parent().
 *
 * Group the common clock implementations together so that we
 * don't have to keep setting the same fiels again. We leave
 * enable in struct clk.
 *
 * Adding an extra layer of indirection into the process should
 * not be a problem as it is unlikely these operations are going
 * to need to be called quickly.
 */
struct clk_ops {
	int		    (*set_rate)(struct clk *c, unsigned long rate);
	unsigned long	    (*get_rate)(struct clk *c);
	unsigned long	    (*round_rate)(struct clk *c, unsigned long rate);
	int		    (*set_parent)(struct clk *c, struct clk *parent);
};

L
Linus Torvalds 已提交
38 39 40 41 42 43
struct clk {
	struct list_head      list;
	struct module        *owner;
	struct clk           *parent;
	const char           *name;
	int		      id;
44
	int		      usage;
L
Linus Torvalds 已提交
45 46
	unsigned long         rate;
	unsigned long         ctrlbit;
47

48
	struct clk_ops		*ops;
L
Linus Torvalds 已提交
49 50 51 52 53 54 55 56 57 58 59
	int		    (*enable)(struct clk *, int enable);
};

/* other clocks which may be registered by board support */

extern struct clk s3c24xx_dclk0;
extern struct clk s3c24xx_dclk1;
extern struct clk s3c24xx_clkout0;
extern struct clk s3c24xx_clkout1;
extern struct clk s3c24xx_uclk;

60 61
extern struct clk clk_usb_bus;

62 63 64 65 66
/* core clock support */

extern struct clk clk_f;
extern struct clk clk_h;
extern struct clk clk_p;
67
extern struct clk clk_mpll;
68
extern struct clk clk_upll;
69
extern struct clk clk_epll;
70
extern struct clk clk_xtal;
71 72 73
extern struct clk clk_ext;

/* S3C64XX specific clocks */
W
Werner Almesberger 已提交
74
extern struct clk clk_h2;
75 76
extern struct clk clk_27m;
extern struct clk clk_48m;
77

78 79 80
extern int clk_default_setrate(struct clk *clk, unsigned long rate);
extern struct clk_ops clk_ops_def_setrate;

L
Linus Torvalds 已提交
81 82 83 84 85
/* exports for arch/arm/mach-s3c2410
 *
 * Please DO NOT use these outside of arch/arm/mach-s3c2410
*/

86
extern spinlock_t clocks_lock;
87

88 89
extern int s3c2410_clkcon_enable(struct clk *clk, int enable);

L
Linus Torvalds 已提交
90
extern int s3c24xx_register_clock(struct clk *clk);
91
extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
L
Linus Torvalds 已提交
92

93 94
extern void s3c_register_clocks(struct clk *clk, int nr_clks);

95 96
extern int s3c24xx_register_baseclocks(unsigned long xtal);

97
extern void s5p_register_clocks(unsigned long xtal_freq);
98

99 100 101 102 103 104 105 106 107
extern void s3c24xx_setup_clocks(unsigned long fclk,
				 unsigned long hclk,
				 unsigned long pclk);

extern void s3c2410_setup_clocks(void);
extern void s3c2412_setup_clocks(void);
extern void s3c244x_setup_clocks(void);
extern void s3c2443_setup_clocks(void);

108 109 110
/* S3C64XX specific functions and clocks */

extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
111 112 113 114 115

/* Init for pwm clock code */

extern void s3c_pwmclk_init(void);