2 * linux/arch/m32r/platforms/mappi3/setup.c
4 * Setup routines for Renesas MAPPI-III(M3A-2170) Board
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa
10 #include <linux/irq.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
18 #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
20 icu_data_t icu_data[NR_IRQS];
22 static void disable_mappi3_irq(unsigned int irq)
24 unsigned long port, data;
26 if ((irq == 0) ||(irq >= NR_IRQS)) {
27 printk("bad irq 0x%08x\n", irq);
31 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
35 static void enable_mappi3_irq(unsigned int irq)
37 unsigned long port, data;
39 if ((irq == 0) ||(irq >= NR_IRQS)) {
40 printk("bad irq 0x%08x\n", irq);
44 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
48 static void mask_mappi3(struct irq_data *data)
50 disable_mappi3_irq(data->irq);
53 static void unmask_mappi3(struct irq_data *data)
55 enable_mappi3_irq(data->irq);
58 static void shutdown_mappi3(struct irq_data *data)
62 port = irq2port(data->irq);
63 outl(M32R_ICUCR_ILEVEL7, port);
66 static struct irq_chip mappi3_irq_type = {
68 .irq_shutdown = shutdown_mappi3,
69 .irq_mask = mask_mappi3,
70 .irq_unmask = unmask_mappi3,
73 void __init init_IRQ(void)
75 #if defined(CONFIG_SMC91X)
76 /* INT0 : LAN controller (SMC91111) */
77 irq_set_chip_and_handler(M32R_IRQ_INT0, &mappi3_irq_type,
79 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
80 disable_mappi3_irq(M32R_IRQ_INT0);
81 #endif /* CONFIG_SMC91X */
83 /* MFT2 : system timer */
84 irq_set_chip_and_handler(M32R_IRQ_MFT2, &mappi3_irq_type,
86 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
87 disable_mappi3_irq(M32R_IRQ_MFT2);
89 #ifdef CONFIG_SERIAL_M32R_SIO
90 /* SIO0_R : uart receive data */
91 irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &mappi3_irq_type,
93 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
94 disable_mappi3_irq(M32R_IRQ_SIO0_R);
96 /* SIO0_S : uart send data */
97 irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &mappi3_irq_type,
99 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
100 disable_mappi3_irq(M32R_IRQ_SIO0_S);
101 /* SIO1_R : uart receive data */
102 irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &mappi3_irq_type,
104 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
105 disable_mappi3_irq(M32R_IRQ_SIO1_R);
107 /* SIO1_S : uart send data */
108 irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &mappi3_irq_type,
110 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
111 disable_mappi3_irq(M32R_IRQ_SIO1_S);
112 #endif /* CONFIG_M32R_USE_DBG_CONSOLE */
114 #if defined(CONFIG_USB)
115 /* INT1 : USB Host controller interrupt */
116 irq_set_chip_and_handler(M32R_IRQ_INT1, &mappi3_irq_type,
118 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
119 disable_mappi3_irq(M32R_IRQ_INT1);
120 #endif /* CONFIG_USB */
123 irq_set_chip_and_handler(PLD_IRQ_CFIREQ, &mappi3_irq_type,
125 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
126 disable_mappi3_irq(PLD_IRQ_CFIREQ);
128 #if defined(CONFIG_M32R_CFC)
129 /* ICUCR41: CFC Insert & eject */
130 irq_set_chip_and_handler(PLD_IRQ_CFC_INSERT, &mappi3_irq_type,
132 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
133 disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
135 #endif /* CONFIG_M32R_CFC */
138 irq_set_chip_and_handler(PLD_IRQ_IDEIREQ, &mappi3_irq_type,
140 icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
141 disable_mappi3_irq(PLD_IRQ_IDEIREQ);
145 #if defined(CONFIG_SMC91X)
147 #define LAN_IOSTART 0x300
148 #define LAN_IOEND 0x320
149 static struct resource smc91x_resources[] = {
151 .start = (LAN_IOSTART),
153 .flags = IORESOURCE_MEM,
156 .start = M32R_IRQ_INT0,
157 .end = M32R_IRQ_INT0,
158 .flags = IORESOURCE_IRQ,
162 static struct platform_device smc91x_device = {
165 .num_resources = ARRAY_SIZE(smc91x_resources),
166 .resource = smc91x_resources,
171 #if defined(CONFIG_FB_S1D13XXX)
173 #include <video/s1d13xxxfb.h>
174 #include <asm/s1d13806.h>
176 static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
177 .initregs = s1d13xxxfb_initregs,
178 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
179 .platform_init_video = NULL,
181 .platform_suspend_video = NULL,
182 .platform_resume_video = NULL,
186 static struct resource s1d13xxxfb_resources[] = {
188 .start = 0x1d600000UL,
190 .flags = IORESOURCE_MEM,
193 .start = 0x1d400000UL,
195 .flags = IORESOURCE_MEM,
199 static struct platform_device s1d13xxxfb_device = {
200 .name = S1D_DEVICENAME,
203 .platform_data = &s1d13xxxfb_data,
205 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
206 .resource = s1d13xxxfb_resources,
210 static int __init platform_init(void)
212 #if defined(CONFIG_SMC91X)
213 platform_device_register(&smc91x_device);
215 #if defined(CONFIG_FB_S1D13XXX)
216 platform_device_register(&s1d13xxxfb_device);
220 arch_initcall(platform_init);