2 * linux/arch/m32r/platforms/mappi/setup.c
4 * Setup routines for Renesas MAPPI Board
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
10 #include <linux/irq.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
15 #include <asm/system.h>
19 #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21 icu_data_t icu_data[NR_IRQS];
23 static void disable_mappi_irq(unsigned int irq)
25 unsigned long port, data;
28 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
32 static void enable_mappi_irq(unsigned int irq)
34 unsigned long port, data;
37 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
41 static void mask_and_ack_mappi(unsigned int irq)
43 disable_mappi_irq(irq);
46 static void end_mappi_irq(unsigned int irq)
48 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
49 enable_mappi_irq(irq);
52 static unsigned int startup_mappi_irq(unsigned int irq)
54 enable_mappi_irq(irq);
58 static void shutdown_mappi_irq(unsigned int irq)
63 outl(M32R_ICUCR_ILEVEL7, port);
66 static struct hw_interrupt_type mappi_irq_type =
68 .typename = "MAPPI-IRQ",
69 .startup = startup_mappi_irq,
70 .shutdown = shutdown_mappi_irq,
71 .enable = enable_mappi_irq,
72 .disable = disable_mappi_irq,
73 .ack = mask_and_ack_mappi,
77 void __init init_IRQ(void)
87 /* INT0 : LAN controller (RTL8019AS) */
88 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
89 irq_desc[M32R_IRQ_INT0].chip = &mappi_irq_type;
90 irq_desc[M32R_IRQ_INT0].action = NULL;
91 irq_desc[M32R_IRQ_INT0].depth = 1;
92 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
93 disable_mappi_irq(M32R_IRQ_INT0);
94 #endif /* CONFIG_M32R_NE2000 */
96 /* MFT2 : system timer */
97 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
98 irq_desc[M32R_IRQ_MFT2].chip = &mappi_irq_type;
99 irq_desc[M32R_IRQ_MFT2].action = NULL;
100 irq_desc[M32R_IRQ_MFT2].depth = 1;
101 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
102 disable_mappi_irq(M32R_IRQ_MFT2);
104 #ifdef CONFIG_SERIAL_M32R_SIO
105 /* SIO0_R : uart receive data */
106 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
107 irq_desc[M32R_IRQ_SIO0_R].chip = &mappi_irq_type;
108 irq_desc[M32R_IRQ_SIO0_R].action = NULL;
109 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
110 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
111 disable_mappi_irq(M32R_IRQ_SIO0_R);
113 /* SIO0_S : uart send data */
114 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
115 irq_desc[M32R_IRQ_SIO0_S].chip = &mappi_irq_type;
116 irq_desc[M32R_IRQ_SIO0_S].action = NULL;
117 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
118 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
119 disable_mappi_irq(M32R_IRQ_SIO0_S);
121 /* SIO1_R : uart receive data */
122 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
123 irq_desc[M32R_IRQ_SIO1_R].chip = &mappi_irq_type;
124 irq_desc[M32R_IRQ_SIO1_R].action = NULL;
125 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
126 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
127 disable_mappi_irq(M32R_IRQ_SIO1_R);
129 /* SIO1_S : uart send data */
130 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
131 irq_desc[M32R_IRQ_SIO1_S].chip = &mappi_irq_type;
132 irq_desc[M32R_IRQ_SIO1_S].action = NULL;
133 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
134 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
135 disable_mappi_irq(M32R_IRQ_SIO1_S);
136 #endif /* CONFIG_SERIAL_M32R_SIO */
138 #if defined(CONFIG_M32R_PCC)
139 /* INT1 : pccard0 interrupt */
140 irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
141 irq_desc[M32R_IRQ_INT1].chip = &mappi_irq_type;
142 irq_desc[M32R_IRQ_INT1].action = NULL;
143 irq_desc[M32R_IRQ_INT1].depth = 1;
144 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
145 disable_mappi_irq(M32R_IRQ_INT1);
147 /* INT2 : pccard1 interrupt */
148 irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED;
149 irq_desc[M32R_IRQ_INT2].chip = &mappi_irq_type;
150 irq_desc[M32R_IRQ_INT2].action = NULL;
151 irq_desc[M32R_IRQ_INT2].depth = 1;
152 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
153 disable_mappi_irq(M32R_IRQ_INT2);
154 #endif /* CONFIG_M32RPCC */
157 #if defined(CONFIG_FB_S1D13XXX)
159 #include <video/s1d13xxxfb.h>
160 #include <asm/s1d13806.h>
162 static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
163 .initregs = s1d13xxxfb_initregs,
164 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
165 .platform_init_video = NULL,
167 .platform_suspend_video = NULL,
168 .platform_resume_video = NULL,
172 static struct resource s1d13xxxfb_resources[] = {
174 .start = 0x10200000UL,
176 .flags = IORESOURCE_MEM,
179 .start = 0x10000000UL,
181 .flags = IORESOURCE_MEM,
185 static struct platform_device s1d13xxxfb_device = {
186 .name = S1D_DEVICENAME,
189 .platform_data = &s1d13xxxfb_data,
191 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
192 .resource = s1d13xxxfb_resources,
195 static int __init platform_init(void)
197 platform_device_register(&s1d13xxxfb_device);
200 arch_initcall(platform_init);