| 
					
				 | 
			
			
				@@ -0,0 +1,67 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* linux/arch/arm/plat-s3c24xx/pwm-clock.c 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Copyright (c) 2007 Simtec Electronics 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Copyright (c) 2007, 2008 Ben Dooks 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *	Ben Dooks <ben-linux@fluff.org> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * This program is free software; you can redistribute it and/or modify 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * it under the terms of the GNU General Public License as published by 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * the Free Software Foundation; either version 2 of the License. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/init.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/module.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/kernel.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/list.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/errno.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/log2.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/clk.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/err.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/io.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <mach/hardware.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <mach/map.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <asm/irq.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <plat/clock.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <plat/cpu.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <plat/regs-timer.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <plat/pwm-clock.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* Each of the timers 0 through 5 go through the following 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * clock tree, with the inputs depending on the timers. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * pclk ---- [ prescaler 0 ] -+---> timer 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *			      +---> timer 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * pclk ---- [ prescaler 1 ] -+---> timer 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *			      +---> timer 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *			      \---> timer 4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Which are fed into the timers as so: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * prescaled 0 ---- [ div 2,4,8,16 ] ---\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *				       [mux] -> timer 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * tclk 0 ------------------------------/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * prescaled 0 ---- [ div 2,4,8,16 ] ---\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *				       [mux] -> timer 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * tclk 0 ------------------------------/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * prescaled 1 ---- [ div 2,4,8,16 ] ---\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *				       [mux] -> timer 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * tclk 1 ------------------------------/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * prescaled 1 ---- [ div 2,4,8,16 ] ---\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *				       [mux] -> timer 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * tclk 1 ------------------------------/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * prescaled 1 ---- [ div 2,4,8, 16 ] --\ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *				       [mux] -> timer 4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * tclk 1 ------------------------------/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Since the mux and the divider are tied together in the 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * same register space, it is impossible to set the parent 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * and the rate at the same time. To avoid this, we add an 
			 |