| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2006-10-03 23:01:26 +02:00
										 |  |  |  * linux/arch/sh/boards/renesas/systemh/irq.c | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2000  Kazumoto Kojima | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Hitachi SystemH Support. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Modified for 7751 SystemH by | 
					
						
							|  |  |  |  * Jonathan Short. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/irq.h>
 | 
					
						
							| 
									
										
										
										
											2008-08-05 18:17:00 +02:00
										 |  |  | #include <linux/interrupt.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-14 12:02:25 +00:00
										 |  |  | #include <linux/io.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-20 13:02:48 +09:00
										 |  |  | #include <mach/systemh7751.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #include <asm/smc37c93x.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* address of external interrupt mask register
 | 
					
						
							|  |  |  |  * address must be set prior to use these (maybe in init_XXX_irq()) | 
					
						
							|  |  |  |  * XXX : is it better to use .config than specifying it in code? */ | 
					
						
							|  |  |  | static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004; | 
					
						
							|  |  |  | static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* forward declaration */ | 
					
						
							|  |  |  | static void enable_systemh_irq(unsigned int irq); | 
					
						
							|  |  |  | static void disable_systemh_irq(unsigned int irq); | 
					
						
							|  |  |  | static void mask_and_ack_systemh(unsigned int); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-14 12:02:25 +00:00
										 |  |  | static struct irq_chip systemh_irq_type = { | 
					
						
							|  |  |  | 	.name = " SystemH Register", | 
					
						
							|  |  |  | 	.unmask = enable_systemh_irq, | 
					
						
							|  |  |  | 	.mask = disable_systemh_irq, | 
					
						
							| 
									
										
										
										
											2005-09-10 00:26:42 -07:00
										 |  |  | 	.ack = mask_and_ack_systemh, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void disable_systemh_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (systemh_irq_mask_register) { | 
					
						
							|  |  |  | 		unsigned long val, mask = 0x01 << 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* Clear the "irq"th bit in the mask and set it in the request */ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		val = __raw_readl((unsigned long)systemh_irq_mask_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		val &= ~mask; | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		__raw_writel(val, (unsigned long)systemh_irq_mask_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		val = __raw_readl((unsigned long)systemh_irq_request_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		val |= mask; | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		__raw_writel(val, (unsigned long)systemh_irq_request_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void enable_systemh_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (systemh_irq_mask_register) { | 
					
						
							|  |  |  | 		unsigned long val, mask = 0x01 << 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* Set "irq"th bit in the mask register */ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		val = __raw_readl((unsigned long)systemh_irq_mask_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		val |= mask; | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		__raw_writel(val, (unsigned long)systemh_irq_mask_register); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void mask_and_ack_systemh(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	disable_systemh_irq(irq); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void make_systemh_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	disable_irq_nosync(irq); | 
					
						
							| 
									
										
										
										
											2008-12-14 12:02:25 +00:00
										 |  |  | 	set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	disable_systemh_irq(irq); | 
					
						
							|  |  |  | } |