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>
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_mappi3_irq(unsigned int irq
)
25 unsigned long port
, data
;
27 if ((irq
== 0) ||(irq
>= NR_IRQS
)) {
28 printk("bad irq 0x%08x\n", irq
);
32 data
= icu_data
[irq
].icucr
|M32R_ICUCR_ILEVEL7
;
36 static void enable_mappi3_irq(unsigned int irq
)
38 unsigned long port
, data
;
40 if ((irq
== 0) ||(irq
>= NR_IRQS
)) {
41 printk("bad irq 0x%08x\n", irq
);
45 data
= icu_data
[irq
].icucr
|M32R_ICUCR_IEN
|M32R_ICUCR_ILEVEL6
;
49 static void mask_mappi3(struct irq_data
*data
)
51 disable_mappi3_irq(data
->irq
);
54 static void unmask_mappi3(struct irq_data
*data
)
56 enable_mappi3_irq(data
->irq
);
59 static void shutdown_mappi3(struct irq_data
*data
)
63 port
= irq2port(data
->irq
);
64 outl(M32R_ICUCR_ILEVEL7
, port
);
67 static struct irq_chip mappi3_irq_type
= {
69 .irq_shutdown
= shutdown_mappi3
,
70 .irq_mask
= mask_mappi3
,
71 .irq_unmask
= unmask_mappi3
,
74 void __init
init_IRQ(void)
76 #if defined(CONFIG_SMC91X)
77 /* INT0 : LAN controller (SMC91111) */
78 set_irq_chip_and_handler(M32R_IRQ_INT0
, &mappi3_irq_type
,
80 icu_data
[M32R_IRQ_INT0
].icucr
= M32R_ICUCR_IEN
|M32R_ICUCR_ISMOD10
;
81 disable_mappi3_irq(M32R_IRQ_INT0
);
82 #endif /* CONFIG_SMC91X */
84 /* MFT2 : system timer */
85 set_irq_chip_and_handler(M32R_IRQ_MFT2
, &mappi3_irq_type
,
87 icu_data
[M32R_IRQ_MFT2
].icucr
= M32R_ICUCR_IEN
;
88 disable_mappi3_irq(M32R_IRQ_MFT2
);
90 #ifdef CONFIG_SERIAL_M32R_SIO
91 /* SIO0_R : uart receive data */
92 set_irq_chip_and_handler(M32R_IRQ_SIO0_R
, &mappi3_irq_type
,
94 icu_data
[M32R_IRQ_SIO0_R
].icucr
= 0;
95 disable_mappi3_irq(M32R_IRQ_SIO0_R
);
97 /* SIO0_S : uart send data */
98 set_irq_chip_and_handler(M32R_IRQ_SIO0_S
, &mappi3_irq_type
,
100 icu_data
[M32R_IRQ_SIO0_S
].icucr
= 0;
101 disable_mappi3_irq(M32R_IRQ_SIO0_S
);
102 /* SIO1_R : uart receive data */
103 set_irq_chip_and_handler(M32R_IRQ_SIO1_R
, &mappi3_irq_type
,
105 icu_data
[M32R_IRQ_SIO1_R
].icucr
= 0;
106 disable_mappi3_irq(M32R_IRQ_SIO1_R
);
108 /* SIO1_S : uart send data */
109 set_irq_chip_and_handler(M32R_IRQ_SIO1_S
, &mappi3_irq_type
,
111 icu_data
[M32R_IRQ_SIO1_S
].icucr
= 0;
112 disable_mappi3_irq(M32R_IRQ_SIO1_S
);
113 #endif /* CONFIG_M32R_USE_DBG_CONSOLE */
115 #if defined(CONFIG_USB)
116 /* INT1 : USB Host controller interrupt */
117 set_irq_chip_and_handler(M32R_IRQ_INT1
, &mappi3_irq_type
,
119 icu_data
[M32R_IRQ_INT1
].icucr
= M32R_ICUCR_ISMOD01
;
120 disable_mappi3_irq(M32R_IRQ_INT1
);
121 #endif /* CONFIG_USB */
124 set_irq_chip_and_handler(PLD_IRQ_CFIREQ
, &mappi3_irq_type
,
126 icu_data
[PLD_IRQ_CFIREQ
].icucr
= M32R_ICUCR_IEN
|M32R_ICUCR_ISMOD01
;
127 disable_mappi3_irq(PLD_IRQ_CFIREQ
);
129 #if defined(CONFIG_M32R_CFC)
130 /* ICUCR41: CFC Insert & eject */
131 set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT
, &mappi3_irq_type
,
133 icu_data
[PLD_IRQ_CFC_INSERT
].icucr
= M32R_ICUCR_IEN
|M32R_ICUCR_ISMOD00
;
134 disable_mappi3_irq(PLD_IRQ_CFC_INSERT
);
136 #endif /* CONFIG_M32R_CFC */
139 set_irq_chip_and_handler(PLD_IRQ_IDEIREQ
, &mappi3_irq_type
,
141 icu_data
[PLD_IRQ_IDEIREQ
].icucr
= M32R_ICUCR_IEN
|M32R_ICUCR_ISMOD10
;
142 disable_mappi3_irq(PLD_IRQ_IDEIREQ
);
146 #if defined(CONFIG_SMC91X)
148 #define LAN_IOSTART 0x300
149 #define LAN_IOEND 0x320
150 static struct resource smc91x_resources
[] = {
152 .start
= (LAN_IOSTART
),
154 .flags
= IORESOURCE_MEM
,
157 .start
= M32R_IRQ_INT0
,
158 .end
= M32R_IRQ_INT0
,
159 .flags
= IORESOURCE_IRQ
,
163 static struct platform_device smc91x_device
= {
166 .num_resources
= ARRAY_SIZE(smc91x_resources
),
167 .resource
= smc91x_resources
,
172 #if defined(CONFIG_FB_S1D13XXX)
174 #include <video/s1d13xxxfb.h>
175 #include <asm/s1d13806.h>
177 static struct s1d13xxxfb_pdata s1d13xxxfb_data
= {
178 .initregs
= s1d13xxxfb_initregs
,
179 .initregssize
= ARRAY_SIZE(s1d13xxxfb_initregs
),
180 .platform_init_video
= NULL
,
182 .platform_suspend_video
= NULL
,
183 .platform_resume_video
= NULL
,
187 static struct resource s1d13xxxfb_resources
[] = {
189 .start
= 0x1d600000UL
,
191 .flags
= IORESOURCE_MEM
,
194 .start
= 0x1d400000UL
,
196 .flags
= IORESOURCE_MEM
,
200 static struct platform_device s1d13xxxfb_device
= {
201 .name
= S1D_DEVICENAME
,
204 .platform_data
= &s1d13xxxfb_data
,
206 .num_resources
= ARRAY_SIZE(s1d13xxxfb_resources
),
207 .resource
= s1d13xxxfb_resources
,
211 static int __init
platform_init(void)
213 #if defined(CONFIG_SMC91X)
214 platform_device_register(&smc91x_device
);
216 #if defined(CONFIG_FB_S1D13XXX)
217 platform_device_register(&s1d13xxxfb_device
);
221 arch_initcall(platform_init
);