| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-w90x900/clock.h | 
 | 3 |  * | 
 | 4 |  * Copyright (c) 2008 Nuvoton technology corporation | 
 | 5 |  * | 
 | 6 |  * Wan ZongShun <mcuos.com@gmail.com> | 
 | 7 |  * | 
 | 8 |  * This program is free software; you can redistribute it and/or modify | 
 | 9 |  * it under the terms of the GNU General Public License as published by | 
 | 10 |  * the Free Software Foundation; either version 2 of the License. | 
 | 11 |  */ | 
 | 12 |  | 
 | 13 | #include <asm/clkdev.h> | 
 | 14 |  | 
| wanzongshun | 35c9221 | 2009-08-21 07:07:46 +0100 | [diff] [blame] | 15 | void nuc900_clk_enable(struct clk *clk, int enable); | 
 | 16 | void nuc900_subclk_enable(struct clk *clk, int enable); | 
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 17 |  | 
 | 18 | struct clk { | 
 | 19 | 	unsigned long		cken; | 
 | 20 | 	unsigned int		enabled; | 
 | 21 | 	void			(*enable)(struct clk *, int enable); | 
 | 22 | }; | 
 | 23 |  | 
 | 24 | #define DEFINE_CLK(_name, _ctrlbit)			\ | 
 | 25 | struct clk clk_##_name = {				\ | 
| wanzongshun | 35c9221 | 2009-08-21 07:07:46 +0100 | [diff] [blame] | 26 | 		.enable	= nuc900_clk_enable,		\ | 
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 27 | 		.cken	= (1 << _ctrlbit),		\ | 
 | 28 | 	} | 
 | 29 |  | 
| wanzongshun | db58e90 | 2009-07-14 15:10:43 +0100 | [diff] [blame] | 30 | #define DEFINE_SUBCLK(_name, _ctrlbit)			\ | 
 | 31 | struct clk clk_##_name = {				\ | 
| wanzongshun | 35c9221 | 2009-08-21 07:07:46 +0100 | [diff] [blame] | 32 | 		.enable	= nuc900_subclk_enable,	\ | 
| wanzongshun | db58e90 | 2009-07-14 15:10:43 +0100 | [diff] [blame] | 33 | 		.cken	= (1 << _ctrlbit),		\ | 
 | 34 | 	} | 
 | 35 |  | 
 | 36 |  | 
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 37 | #define DEF_CLKLOOK(_clk, _devname, _conname)		\ | 
 | 38 | 	{						\ | 
 | 39 | 		.clk		= _clk,			\ | 
 | 40 | 		.dev_id		= _devname,		\ | 
 | 41 | 		.con_id		= _conname,		\ | 
 | 42 | 	} | 
 | 43 |  |