Ben Dooks | a503059 | 2008-10-21 14:06:43 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/plat-s3c/include/plat/clock.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright (c) 2004-2005 Simtec Electronics |
| 4 | * http://www.simtec.co.uk/products/SWLINUX/ |
| 5 | * Written by Ben Dooks, <ben@simtec.co.uk> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
Kukjin Kim | 3a0ec25 | 2011-08-19 21:12:19 +0900 | [diff] [blame] | 12 | #ifndef __ASM_PLAT_CLOCK_H |
| 13 | #define __ASM_PLAT_CLOCK_H __FILE__ |
| 14 | |
Ben Dooks | c3391e3 | 2008-10-21 14:06:37 +0100 | [diff] [blame] | 15 | #include <linux/spinlock.h> |
Thomas Abraham | f86c666 | 2011-06-14 19:12:26 +0900 | [diff] [blame] | 16 | #include <linux/clkdev.h> |
Ben Dooks | c3391e3 | 2008-10-21 14:06:37 +0100 | [diff] [blame] | 17 | |
Ben Dooks | b3bf41b | 2009-12-01 01:24:37 +0000 | [diff] [blame] | 18 | struct clk; |
| 19 | |
| 20 | /** |
| 21 | * struct clk_ops - standard clock operations |
| 22 | * @set_rate: set the clock rate, see clk_set_rate(). |
| 23 | * @get_rate: get the clock rate, see clk_get_rate(). |
| 24 | * @round_rate: round a given clock rate, see clk_round_rate(). |
| 25 | * @set_parent: set the clock's parent, see clk_set_parent(). |
| 26 | * |
| 27 | * Group the common clock implementations together so that we |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 28 | * don't have to keep setting the same fields again. We leave |
Ben Dooks | b3bf41b | 2009-12-01 01:24:37 +0000 | [diff] [blame] | 29 | * enable in struct clk. |
| 30 | * |
| 31 | * Adding an extra layer of indirection into the process should |
| 32 | * not be a problem as it is unlikely these operations are going |
| 33 | * to need to be called quickly. |
| 34 | */ |
| 35 | struct clk_ops { |
| 36 | int (*set_rate)(struct clk *c, unsigned long rate); |
| 37 | unsigned long (*get_rate)(struct clk *c); |
| 38 | unsigned long (*round_rate)(struct clk *c, unsigned long rate); |
| 39 | int (*set_parent)(struct clk *c, struct clk *parent); |
| 40 | }; |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | struct clk { |
| 43 | struct list_head list; |
| 44 | struct module *owner; |
| 45 | struct clk *parent; |
| 46 | const char *name; |
Thomas Abraham | f86c666 | 2011-06-14 19:12:26 +0900 | [diff] [blame] | 47 | const char *devname; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | int id; |
Ben Dooks | 2a513ce | 2006-02-08 21:09:05 +0000 | [diff] [blame] | 49 | int usage; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | unsigned long rate; |
| 51 | unsigned long ctrlbit; |
Ben Dooks | d3468da | 2006-03-20 17:10:04 +0000 | [diff] [blame] | 52 | |
Ben Dooks | b3bf41b | 2009-12-01 01:24:37 +0000 | [diff] [blame] | 53 | struct clk_ops *ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | int (*enable)(struct clk *, int enable); |
Thomas Abraham | f86c666 | 2011-06-14 19:12:26 +0900 | [diff] [blame] | 55 | struct clk_lookup lookup; |
Amit Daniel Kachhap | 436c387 | 2011-01-12 13:40:04 +0900 | [diff] [blame] | 56 | #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) |
| 57 | struct dentry *dent; /* For visible tree hierarchy */ |
| 58 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | /* other clocks which may be registered by board support */ |
| 62 | |
| 63 | extern struct clk s3c24xx_dclk0; |
| 64 | extern struct clk s3c24xx_dclk1; |
| 65 | extern struct clk s3c24xx_clkout0; |
| 66 | extern struct clk s3c24xx_clkout1; |
| 67 | extern struct clk s3c24xx_uclk; |
| 68 | |
Ben Dooks | 36c64af | 2006-03-20 21:00:48 +0000 | [diff] [blame] | 69 | extern struct clk clk_usb_bus; |
| 70 | |
Ben Dooks | 99c1385 | 2006-06-22 22:18:20 +0100 | [diff] [blame] | 71 | /* core clock support */ |
| 72 | |
| 73 | extern struct clk clk_f; |
| 74 | extern struct clk clk_h; |
| 75 | extern struct clk clk_p; |
Ben Dooks | 513846f | 2006-06-24 21:21:29 +0100 | [diff] [blame] | 76 | extern struct clk clk_mpll; |
Ben Dooks | 99c1385 | 2006-06-22 22:18:20 +0100 | [diff] [blame] | 77 | extern struct clk clk_upll; |
Ben Dooks | 4b31d8b | 2008-10-21 14:07:00 +0100 | [diff] [blame] | 78 | extern struct clk clk_epll; |
Ben Dooks | 513846f | 2006-06-24 21:21:29 +0100 | [diff] [blame] | 79 | extern struct clk clk_xtal; |
Ben Dooks | 4b31d8b | 2008-10-21 14:07:00 +0100 | [diff] [blame] | 80 | extern struct clk clk_ext; |
| 81 | |
| 82 | /* S3C64XX specific clocks */ |
Werner Almesberger | a03f7da | 2009-03-05 11:43:13 +0800 | [diff] [blame] | 83 | extern struct clk clk_h2; |
Ben Dooks | 4b31d8b | 2008-10-21 14:07:00 +0100 | [diff] [blame] | 84 | extern struct clk clk_27m; |
| 85 | extern struct clk clk_48m; |
Maurus Cuelenaere | 05e021f | 2010-05-17 20:17:42 +0200 | [diff] [blame] | 86 | extern struct clk clk_xusbxti; |
Ben Dooks | 99c1385 | 2006-06-22 22:18:20 +0100 | [diff] [blame] | 87 | |
Kukjin Kim | ed27684 | 2010-01-14 12:50:23 +0900 | [diff] [blame] | 88 | extern int clk_default_setrate(struct clk *clk, unsigned long rate); |
| 89 | extern struct clk_ops clk_ops_def_setrate; |
| 90 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | /* exports for arch/arm/mach-s3c2410 |
| 92 | * |
| 93 | * Please DO NOT use these outside of arch/arm/mach-s3c2410 |
| 94 | */ |
| 95 | |
Ben Dooks | c3391e3 | 2008-10-21 14:06:37 +0100 | [diff] [blame] | 96 | extern spinlock_t clocks_lock; |
Ben Dooks | 36c64af | 2006-03-20 21:00:48 +0000 | [diff] [blame] | 97 | |
Ben Dooks | 99c1385 | 2006-06-22 22:18:20 +0100 | [diff] [blame] | 98 | extern int s3c2410_clkcon_enable(struct clk *clk, int enable); |
| 99 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | extern int s3c24xx_register_clock(struct clk *clk); |
Ben Dooks | ce89c20 | 2007-04-20 11:15:27 +0100 | [diff] [blame] | 101 | extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
Ben Dooks | 1d9f13c | 2010-01-06 01:21:38 +0900 | [diff] [blame] | 103 | extern void s3c_register_clocks(struct clk *clk, int nr_clks); |
Ben Dooks | 4e04691 | 2010-04-28 12:58:13 +0900 | [diff] [blame] | 104 | extern void s3c_disable_clocks(struct clk *clkp, int nr_clks); |
Ben Dooks | 1d9f13c | 2010-01-06 01:21:38 +0900 | [diff] [blame] | 105 | |
Ben Dooks | e425382 | 2008-10-21 14:06:38 +0100 | [diff] [blame] | 106 | extern int s3c24xx_register_baseclocks(unsigned long xtal); |
| 107 | |
Kukjin Kim | 1a0e8a5 | 2010-01-14 08:13:37 +0900 | [diff] [blame] | 108 | extern void s5p_register_clocks(unsigned long xtal_freq); |
Ben Dooks | 4b31d8b | 2008-10-21 14:07:00 +0100 | [diff] [blame] | 109 | |
Ben Dooks | e425382 | 2008-10-21 14:06:38 +0100 | [diff] [blame] | 110 | extern void s3c24xx_setup_clocks(unsigned long fclk, |
| 111 | unsigned long hclk, |
| 112 | unsigned long pclk); |
| 113 | |
| 114 | extern void s3c2410_setup_clocks(void); |
| 115 | extern void s3c2412_setup_clocks(void); |
| 116 | extern void s3c244x_setup_clocks(void); |
| 117 | extern void s3c2443_setup_clocks(void); |
| 118 | |
Ben Dooks | cf18acf | 2008-10-21 14:07:02 +0100 | [diff] [blame] | 119 | /* S3C64XX specific functions and clocks */ |
| 120 | |
| 121 | extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable); |
Ben Dooks | 9d325f2 | 2008-11-21 10:36:05 +0000 | [diff] [blame] | 122 | |
| 123 | /* Init for pwm clock code */ |
| 124 | |
| 125 | extern void s3c_pwmclk_init(void); |
| 126 | |
Marek Szyprowski | caf2730 | 2011-09-05 20:10:06 +0900 | [diff] [blame] | 127 | /* Global watchdog clock used by arch_wtd_reset() callback */ |
| 128 | |
| 129 | extern struct clk *s3c2410_wdtclk; |
Kukjin Kim | 3a0ec25 | 2011-08-19 21:12:19 +0900 | [diff] [blame] | 130 | |
| 131 | #endif /* __ASM_PLAT_CLOCK_H */ |