| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * arch/arm/mach-at91/at91x40.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com> | 
					
						
							|  |  |  |  * Copyright (C) 2005 SAN People | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/irq.h>
 | 
					
						
							| 
									
										
										
										
											2012-07-04 07:45:16 +00:00
										 |  |  | #include <linux/io.h>
 | 
					
						
							| 
									
										
										
										
											2011-08-02 10:21:36 -04:00
										 |  |  | #include <asm/proc-fns.h>
 | 
					
						
							| 
									
										
										
										
											2012-03-29 23:22:44 -07:00
										 |  |  | #include <asm/system_misc.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | #include <asm/mach/arch.h>
 | 
					
						
							| 
									
										
										
										
											2008-08-05 16:14:15 +01:00
										 |  |  | #include <mach/at91x40.h>
 | 
					
						
							|  |  |  | #include <mach/at91_st.h>
 | 
					
						
							|  |  |  | #include <mach/timex.h>
 | 
					
						
							| 
									
										
										
										
											2012-10-30 06:41:28 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "at91_aic.h"
 | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | #include "generic.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-05-23 08:26:24 +01:00
										 |  |  |  * Export the clock functions for the AT91X40. Some external code common | 
					
						
							|  |  |  |  * to all AT91 family parts relys on this, like the gpio and serial support. | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | int clk_enable(struct clk *clk) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-23 08:26:24 +01:00
										 |  |  | void clk_disable(struct clk *clk) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | unsigned long clk_get_rate(struct clk *clk) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return AT91X40_MASTER_CLOCK; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-02 10:21:36 -04:00
										 |  |  | static void at91x40_idle(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Disable the processor clock.  The processor will be automatically | 
					
						
							|  |  |  | 	 * re-enabled by an interrupt or by a reset. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-09-14 20:10:19 +00:00
										 |  |  | 	__raw_writel(AT91_PS_CR_CPU, AT91_IO_P2V(AT91_PS_CR)); | 
					
						
							| 
									
										
										
										
											2011-08-02 10:21:36 -04:00
										 |  |  | 	cpu_do_idle(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | void __init at91x40_initialize(unsigned long main_clock) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-02 10:21:36 -04:00
										 |  |  | 	arm_pm_idle = at91x40_idle; | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | 	at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1) | 
					
						
							|  |  |  | 			| (1 << AT91X40_ID_IRQ2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * The default interrupt priority levels (0 = lowest, 7 = highest). | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = { | 
					
						
							|  |  |  | 	7,	/* Advanced Interrupt Controller (FIQ) */ | 
					
						
							|  |  |  | 	0,	/* System Peripherals */ | 
					
						
							|  |  |  | 	0,	/* USART 0 */ | 
					
						
							|  |  |  | 	0,	/* USART 1 */ | 
					
						
							|  |  |  | 	2,	/* Timer Counter 0 */ | 
					
						
							|  |  |  | 	2,	/* Timer Counter 1 */ | 
					
						
							|  |  |  | 	2,	/* Timer Counter 2 */ | 
					
						
							|  |  |  | 	0,	/* Watchdog timer */ | 
					
						
							|  |  |  | 	0,	/* Parallel IO Controller A */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* Reserved */ | 
					
						
							|  |  |  | 	0,	/* External IRQ0 */ | 
					
						
							|  |  |  | 	0,	/* External IRQ1 */ | 
					
						
							|  |  |  | 	0,	/* External IRQ2 */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (!priority) | 
					
						
							|  |  |  | 		priority = at91x40_default_irq_priority; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-26 22:49:09 +02:00
										 |  |  | 	at91_aic_init(priority, at91_extern_irq); | 
					
						
							| 
									
										
										
										
											2007-07-30 02:38:57 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |