John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License version 2 as published |
| 4 | * by the Free Software Foundation. |
| 5 | * |
| 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LTQ_CLK_H__ |
| 10 | #define _LTQ_CLK_H__ |
| 11 | |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 12 | #include <linux/clkdev.h> |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 13 | |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 14 | /* clock speeds */ |
| 15 | #define CLOCK_33M 33333333 |
| 16 | #define CLOCK_60M 60000000 |
| 17 | #define CLOCK_62_5M 62500000 |
| 18 | #define CLOCK_83M 83333333 |
| 19 | #define CLOCK_83_5M 83500000 |
| 20 | #define CLOCK_98_304M 98304000 |
| 21 | #define CLOCK_100M 100000000 |
| 22 | #define CLOCK_111M 111111111 |
| 23 | #define CLOCK_125M 125000000 |
| 24 | #define CLOCK_133M 133333333 |
| 25 | #define CLOCK_150M 150000000 |
| 26 | #define CLOCK_166M 166666666 |
| 27 | #define CLOCK_167M 166666667 |
| 28 | #define CLOCK_196_608M 196608000 |
| 29 | #define CLOCK_200M 200000000 |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 30 | #define CLOCK_222M 222000000 |
| 31 | #define CLOCK_240M 240000000 |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 32 | #define CLOCK_250M 250000000 |
| 33 | #define CLOCK_266M 266666666 |
| 34 | #define CLOCK_300M 300000000 |
| 35 | #define CLOCK_333M 333333333 |
| 36 | #define CLOCK_393M 393215332 |
| 37 | #define CLOCK_400M 400000000 |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 38 | #define CLOCK_450M 450000000 |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 39 | #define CLOCK_500M 500000000 |
| 40 | #define CLOCK_600M 600000000 |
| 41 | |
| 42 | /* clock out speeds */ |
| 43 | #define CLOCK_32_768K 32768 |
| 44 | #define CLOCK_1_536M 1536000 |
| 45 | #define CLOCK_2_5M 2500000 |
| 46 | #define CLOCK_12M 12000000 |
| 47 | #define CLOCK_24M 24000000 |
| 48 | #define CLOCK_25M 25000000 |
| 49 | #define CLOCK_30M 30000000 |
| 50 | #define CLOCK_40M 40000000 |
| 51 | #define CLOCK_48M 48000000 |
| 52 | #define CLOCK_50M 50000000 |
| 53 | #define CLOCK_60M 60000000 |
| 54 | |
| 55 | struct clk { |
| 56 | struct clk_lookup cl; |
| 57 | unsigned long rate; |
| 58 | unsigned long *rates; |
| 59 | unsigned int module; |
| 60 | unsigned int bits; |
| 61 | unsigned long (*get_rate) (void); |
| 62 | int (*enable) (struct clk *clk); |
| 63 | void (*disable) (struct clk *clk); |
| 64 | int (*activate) (struct clk *clk); |
| 65 | void (*deactivate) (struct clk *clk); |
| 66 | void (*reboot) (struct clk *clk); |
| 67 | }; |
| 68 | |
| 69 | extern void clkdev_add_static(unsigned long cpu, unsigned long fpi, |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 70 | unsigned long io, unsigned long ppe); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 71 | |
| 72 | extern unsigned long ltq_danube_cpu_hz(void); |
| 73 | extern unsigned long ltq_danube_fpi_hz(void); |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 74 | extern unsigned long ltq_danube_pp32_hz(void); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 75 | |
| 76 | extern unsigned long ltq_ar9_cpu_hz(void); |
| 77 | extern unsigned long ltq_ar9_fpi_hz(void); |
| 78 | |
| 79 | extern unsigned long ltq_vr9_cpu_hz(void); |
| 80 | extern unsigned long ltq_vr9_fpi_hz(void); |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 81 | extern unsigned long ltq_vr9_pp32_hz(void); |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 82 | |
| 83 | #endif |