| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2007-08-01 21:09:31 +09:00
										 |  |  |  *  linux/arch/m32r/platforms/opsput/setup.c | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  *  Setup routines for Renesas OPSPUT Board | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  |  *  Copyright (c) 2002-2005 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * 	Hiroyuki Kondo, Hirokazu Takata, | 
					
						
							|  |  |  |  *      Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  This file is subject to the terms and conditions of the GNU General | 
					
						
							|  |  |  |  *  Public License.  See the file "COPYING" in the main directory of this | 
					
						
							|  |  |  |  *  archive for more details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/irq.h>
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							| 
									
										
										
										
											2005-10-29 19:07:23 +01:00
										 |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <asm/m32r.h>
 | 
					
						
							|  |  |  | #include <asm/io.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * OPSP Interrupt Control Unit (Level 1) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-23 22:47:22 +01:00
										 |  |  | icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | static void disable_opsput_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	port = irq2port(irq); | 
					
						
							|  |  |  | 	data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; | 
					
						
							|  |  |  | 	outl(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void enable_opsput_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	port = irq2port(irq); | 
					
						
							|  |  |  | 	data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; | 
					
						
							|  |  |  | 	outl(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | static void mask_opsput(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	disable_opsput_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | static void unmask_opsput(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	enable_opsput_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | static void shutdown_opsput(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	unsigned long port; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	port = irq2port(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	outl(M32R_ICUCR_ILEVEL7, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-16 15:33:26 -07:00
										 |  |  | static struct irq_chip opsput_irq_type = | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	.name		= "OPSPUT-IRQ", | 
					
						
							|  |  |  | 	.irq_shutdown	= shutdown_opsput, | 
					
						
							|  |  |  | 	.irq_mask	= mask_opsput, | 
					
						
							|  |  |  | 	.irq_unmask	= unmask_opsput, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Interrupt Control Unit of PLD on OPSPUT (Level 2) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define irq2pldirq(x)		((x) - OPSPUT_PLD_IRQ_BASE)
 | 
					
						
							|  |  |  | #define pldirq2port(x)		(unsigned long)((int)PLD_ICUCR1 + \
 | 
					
						
							|  |  |  | 				 (((x) - 1) * sizeof(unsigned short))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  | 	unsigned short icucr;  /* ICU Control Register */ | 
					
						
							|  |  |  | } pld_icu_data_t; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static pld_icu_data_t pld_icu_data[OPSPUT_NUM_PLD_IRQ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void disable_opsput_pld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2pldirq(irq); | 
					
						
							|  |  |  | 	port = pldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void enable_opsput_pld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2pldirq(irq); | 
					
						
							|  |  |  | 	port = pldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | static void mask_opsput_pld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 	disable_opsput_pld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | static void unmask_opsput_pld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 	enable_opsput_pld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	enable_opsput_irq(M32R_IRQ_INT1); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | static void shutdown_opsput_pld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	unsigned long port; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 	pldirq = irq2pldirq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	port = pldirq2port(pldirq); | 
					
						
							|  |  |  | 	outw(PLD_ICUCR_ILEVEL7, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-16 15:33:26 -07:00
										 |  |  | static struct irq_chip opsput_pld_irq_type = | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 	.name		= "OPSPUT-PLD-IRQ", | 
					
						
							|  |  |  | 	.irq_shutdown	= shutdown_opsput_pld, | 
					
						
							|  |  |  | 	.irq_mask	= mask_opsput_pld, | 
					
						
							|  |  |  | 	.irq_unmask	= unmask_opsput_pld, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Interrupt Control Unit of PLD on OPSPUT-LAN (Level 2) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define irq2lanpldirq(x)	((x) - OPSPUT_LAN_PLD_IRQ_BASE)
 | 
					
						
							|  |  |  | #define lanpldirq2port(x)	(unsigned long)((int)OPSPUT_LAN_ICUCR1 + \
 | 
					
						
							|  |  |  | 				 (((x) - 1) * sizeof(unsigned short))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static pld_icu_data_t lanpld_icu_data[OPSPUT_NUM_LAN_PLD_IRQ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void disable_opsput_lanpld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2lanpldirq(irq); | 
					
						
							|  |  |  | 	port = lanpldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void enable_opsput_lanpld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2lanpldirq(irq); | 
					
						
							|  |  |  | 	port = lanpldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | static void mask_opsput_lanpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | 	disable_opsput_lanpld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | static void unmask_opsput_lanpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | 	enable_opsput_lanpld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	enable_opsput_irq(M32R_IRQ_INT0); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | static void shutdown_opsput_lanpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	unsigned long port; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | 	pldirq = irq2lanpldirq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	port = lanpldirq2port(pldirq); | 
					
						
							|  |  |  | 	outw(PLD_ICUCR_ILEVEL7, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-16 15:33:26 -07:00
										 |  |  | static struct irq_chip opsput_lanpld_irq_type = | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | 	.name		= "OPSPUT-PLD-LAN-IRQ", | 
					
						
							|  |  |  | 	.irq_shutdown	= shutdown_opsput_lanpld, | 
					
						
							|  |  |  | 	.irq_mask	= mask_opsput_lanpld, | 
					
						
							|  |  |  | 	.irq_unmask	= unmask_opsput_lanpld, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Interrupt Control Unit of PLD on OPSPUT-LCD (Level 2) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define irq2lcdpldirq(x)	((x) - OPSPUT_LCD_PLD_IRQ_BASE)
 | 
					
						
							|  |  |  | #define lcdpldirq2port(x)	(unsigned long)((int)OPSPUT_LCD_ICUCR1 + \
 | 
					
						
							|  |  |  | 				 (((x) - 1) * sizeof(unsigned short))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static pld_icu_data_t lcdpld_icu_data[OPSPUT_NUM_LCD_PLD_IRQ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void disable_opsput_lcdpld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2lcdpldirq(irq); | 
					
						
							|  |  |  | 	port = lcdpldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void enable_opsput_lcdpld_irq(unsigned int irq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long port, data; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pldirq = irq2lcdpldirq(irq); | 
					
						
							|  |  |  | 	port = lcdpldirq2port(pldirq); | 
					
						
							|  |  |  | 	data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; | 
					
						
							|  |  |  | 	outw(data, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | static void mask_opsput_lcdpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | 	disable_opsput_lcdpld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | static void unmask_opsput_lcdpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | 	enable_opsput_lcdpld_irq(data->irq); | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 	enable_opsput_irq(M32R_IRQ_INT2); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | static void shutdown_opsput_lcdpld(struct irq_data *data) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	unsigned long port; | 
					
						
							|  |  |  | 	unsigned int pldirq; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | 	pldirq = irq2lcdpldirq(data->irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	port = lcdpldirq2port(pldirq); | 
					
						
							|  |  |  | 	outw(PLD_ICUCR_ILEVEL7, port); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | static struct irq_chip opsput_lcdpld_irq_type = { | 
					
						
							|  |  |  | 	.name		= "OPSPUT-PLD-LCD-IRQ", | 
					
						
							|  |  |  | 	.irq_shutdown	= shutdown_opsput_lcdpld, | 
					
						
							|  |  |  | 	.irq_mask	= mask_opsput_lcdpld, | 
					
						
							|  |  |  | 	.irq_unmask	= unmask_opsput_lcdpld, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init init_IRQ(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if defined(CONFIG_SMC91X)
 | 
					
						
							|  |  |  | 	/* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(OPSPUT_LAN_IRQ_LAN, &opsput_lanpld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:58:45 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02;	/* "H" edge sense */ | 
					
						
							|  |  |  | 	disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN); | 
					
						
							|  |  |  | #endif  /* CONFIG_SMC91X */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* MFT2 : system timer */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_MFT2, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_MFT2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SIO0 : receive */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_SIO0_R].icucr = 0; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_SIO0_R); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SIO0 : send */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_SIO0_S].icucr = 0; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_SIO0_S); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SIO1 : receive */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_SIO1_R].icucr = 0; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_SIO1_R); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SIO1 : send */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_SIO1_S].icucr = 0; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_SIO1_S); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* DMA1 : */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_DMA1, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_DMA1].icucr = 0; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_DMA1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SERIAL_M32R_PLDSIO
 | 
					
						
							|  |  |  | 	/* INT#1: SIO0 Receive on PLD */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(PLD_IRQ_SIO0_RCV, &opsput_pld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; | 
					
						
							|  |  |  | 	disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* INT#1: SIO0 Send on PLD */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(PLD_IRQ_SIO0_SND, &opsput_pld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; | 
					
						
							|  |  |  | 	disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); | 
					
						
							|  |  |  | #endif  /* CONFIG_SERIAL_M32R_PLDSIO */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* INT#1: CFC IREQ on PLD */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(PLD_IRQ_CFIREQ, &opsput_pld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01;	/* 'L' level sense */ | 
					
						
							|  |  |  | 	disable_opsput_pld_irq(PLD_IRQ_CFIREQ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* INT#1: CFC Insert on PLD */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(PLD_IRQ_CFC_INSERT, &opsput_pld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00;	/* 'L' edge sense */ | 
					
						
							|  |  |  | 	disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* INT#1: CFC Eject on PLD */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(PLD_IRQ_CFC_EJECT, &opsput_pld_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:55:09 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02;	/* 'H' edge sense */ | 
					
						
							|  |  |  | 	disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * INT0# is used for LAN, DIO | 
					
						
							|  |  |  | 	 * We enable it here. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; | 
					
						
							|  |  |  | 	enable_opsput_irq(M32R_IRQ_INT0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * INT1# is used for UART, MMC, CF Controller in FPGA. | 
					
						
							|  |  |  | 	 * We enable it here. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; | 
					
						
							|  |  |  | 	enable_opsput_irq(M32R_IRQ_INT1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_USB)
 | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | 	outw(USBCR_OTGS, USBCR);	/* USBCR: non-OTG */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(OPSPUT_LCD_IRQ_USB_INT1, | 
					
						
							| 
									
										
										
										
											2011-01-19 19:01:23 +01:00
										 |  |  | 				 &opsput_lcdpld_irq_type, handle_level_irq); | 
					
						
							|  |  |  | 	lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01;	/* "L" level sense */ | 
					
						
							|  |  |  | 	disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * INT2# is used for BAT, USB, AUDIO | 
					
						
							|  |  |  | 	 * We enable it here. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; | 
					
						
							|  |  |  | 	enable_opsput_irq(M32R_IRQ_INT2); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #if defined(CONFIG_VIDEO_M32R_AR)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * INT3# is used for AR | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-03-24 17:32:45 +01:00
										 |  |  | 	irq_set_chip_and_handler(M32R_IRQ_INT3, &opsput_irq_type, | 
					
						
							| 
									
										
										
										
											2011-01-19 18:48:15 +01:00
										 |  |  | 				 handle_level_irq); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; | 
					
						
							|  |  |  | 	disable_opsput_irq(M32R_IRQ_INT3); | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #endif /* CONFIG_VIDEO_M32R_AR */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #if defined(CONFIG_SMC91X)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define LAN_IOSTART     0x300
 | 
					
						
							|  |  |  | #define LAN_IOEND       0x320
 | 
					
						
							|  |  |  | static struct resource smc91x_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start  = (LAN_IOSTART), | 
					
						
							|  |  |  | 		.end    = (LAN_IOEND), | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start  = OPSPUT_LAN_IRQ_LAN, | 
					
						
							|  |  |  | 		.end    = OPSPUT_LAN_IRQ_LAN, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device smc91x_device = { | 
					
						
							|  |  |  | 	.name		= "smc91x", | 
					
						
							|  |  |  | 	.id		= 0, | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(smc91x_resources), | 
					
						
							|  |  |  | 	.resource       = smc91x_resources, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_FB_S1D13XXX)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <video/s1d13xxxfb.h>
 | 
					
						
							|  |  |  | #include <asm/s1d13806.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct s1d13xxxfb_pdata s1d13xxxfb_data = { | 
					
						
							|  |  |  | 	.initregs		= s1d13xxxfb_initregs, | 
					
						
							|  |  |  | 	.initregssize		= ARRAY_SIZE(s1d13xxxfb_initregs), | 
					
						
							|  |  |  | 	.platform_init_video	= NULL, | 
					
						
							|  |  |  | #ifdef CONFIG_PM
 | 
					
						
							|  |  |  | 	.platform_suspend_video	= NULL, | 
					
						
							|  |  |  | 	.platform_resume_video	= NULL, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource s1d13xxxfb_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start  = 0x10600000UL, | 
					
						
							|  |  |  | 		.end    = 0x1073FFFFUL, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start  = 0x10400000UL, | 
					
						
							|  |  |  | 		.end    = 0x104001FFUL, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device s1d13xxxfb_device = { | 
					
						
							|  |  |  | 	.name		= S1D_DEVICENAME, | 
					
						
							|  |  |  | 	.id		= 0, | 
					
						
							|  |  |  | 	.dev            = { | 
					
						
							|  |  |  | 		.platform_data  = &s1d13xxxfb_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(s1d13xxxfb_resources), | 
					
						
							|  |  |  | 	.resource       = s1d13xxxfb_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | static int __init platform_init(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #if defined(CONFIG_SMC91X)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	platform_device_register(&smc91x_device); | 
					
						
							| 
									
										
										
										
											2005-07-07 17:59:32 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #if defined(CONFIG_FB_S1D13XXX)
 | 
					
						
							|  |  |  | 	platform_device_register(&s1d13xxxfb_device); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | arch_initcall(platform_init); |