2 * linux/arch/m32r/kernel/setup_m32104ut.c
4 * Setup routines for M32104UT Board
6 * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa,
8 * Naoto Sugai, Hayato Fujiwara
11 #include <linux/config.h>
12 #include <linux/irq.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/device.h>
17 #include <asm/system.h>
21 #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
25 unsigned long icucr; /* ICU Control Register */
27 #endif /* CONFIG_SMP */
29 icu_data_t icu_data[NR_IRQS];
31 static void disable_m32104ut_irq(unsigned int irq)
33 unsigned long port, data;
36 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
40 static void enable_m32104ut_irq(unsigned int irq)
42 unsigned long port, data;
45 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
49 static void mask_and_ack_m32104ut(unsigned int irq)
51 disable_m32104ut_irq(irq);
54 static void end_m32104ut_irq(unsigned int irq)
56 enable_m32104ut_irq(irq);
59 static unsigned int startup_m32104ut_irq(unsigned int irq)
61 enable_m32104ut_irq(irq);
65 static void shutdown_m32104ut_irq(unsigned int irq)
70 outl(M32R_ICUCR_ILEVEL7, port);
73 static struct hw_interrupt_type m32104ut_irq_type =
75 .typename = "M32104UT-IRQ",
76 .startup = startup_m32104ut_irq,
77 .shutdown = shutdown_m32104ut_irq,
78 .enable = enable_m32104ut_irq,
79 .disable = disable_m32104ut_irq,
80 .ack = mask_and_ack_m32104ut,
81 .end = end_m32104ut_irq
84 void __init init_IRQ(void)
93 #if defined(CONFIG_SMC91X)
94 /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/
95 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
96 irq_desc[M32R_IRQ_INT0].handler = &m32104ut_irq_type;
97 irq_desc[M32R_IRQ_INT0].action = 0;
98 irq_desc[M32R_IRQ_INT0].depth = 1;
99 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11; /* "H" level sense */
100 disable_m32104ut_irq(M32R_IRQ_INT0);
101 #endif /* CONFIG_SMC91X */
103 /* MFT2 : system timer */
104 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
105 irq_desc[M32R_IRQ_MFT2].handler = &m32104ut_irq_type;
106 irq_desc[M32R_IRQ_MFT2].action = 0;
107 irq_desc[M32R_IRQ_MFT2].depth = 1;
108 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
109 disable_m32104ut_irq(M32R_IRQ_MFT2);
111 #ifdef CONFIG_SERIAL_M32R_SIO
112 /* SIO0_R : uart receive data */
113 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
114 irq_desc[M32R_IRQ_SIO0_R].handler = &m32104ut_irq_type;
115 irq_desc[M32R_IRQ_SIO0_R].action = 0;
116 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
117 icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN;
118 disable_m32104ut_irq(M32R_IRQ_SIO0_R);
120 /* SIO0_S : uart send data */
121 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
122 irq_desc[M32R_IRQ_SIO0_S].handler = &m32104ut_irq_type;
123 irq_desc[M32R_IRQ_SIO0_S].action = 0;
124 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
125 icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN;
126 disable_m32104ut_irq(M32R_IRQ_SIO0_S);
127 #endif /* CONFIG_SERIAL_M32R_SIO */
130 #if defined(CONFIG_SMC91X)
132 #define LAN_IOSTART 0x300
133 #define LAN_IOEND 0x320
134 static struct resource smc91x_resources[] = {
136 .start = (LAN_IOSTART),
138 .flags = IORESOURCE_MEM,
141 .start = M32R_IRQ_INT0,
142 .end = M32R_IRQ_INT0,
143 .flags = IORESOURCE_IRQ,
147 static struct platform_device smc91x_device = {
150 .num_resources = ARRAY_SIZE(smc91x_resources),
151 .resource = smc91x_resources,
155 static int __init platform_init(void)
157 #if defined(CONFIG_SMC91X)
158 platform_device_register(&smc91x_device);
162 arch_initcall(platform_init);