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)))
23 icu_data_t icu_data[NR_IRQS];
25 static void disable_m32104ut_irq(unsigned int irq)
27 unsigned long port, data;
30 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
34 static void enable_m32104ut_irq(unsigned int irq)
36 unsigned long port, data;
39 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
43 static void mask_and_ack_m32104ut(unsigned int irq)
45 disable_m32104ut_irq(irq);
48 static void end_m32104ut_irq(unsigned int irq)
50 enable_m32104ut_irq(irq);
53 static unsigned int startup_m32104ut_irq(unsigned int irq)
55 enable_m32104ut_irq(irq);
59 static void shutdown_m32104ut_irq(unsigned int irq)
64 outl(M32R_ICUCR_ILEVEL7, port);
67 static struct hw_interrupt_type m32104ut_irq_type =
69 .typename = "M32104UT-IRQ",
70 .startup = startup_m32104ut_irq,
71 .shutdown = shutdown_m32104ut_irq,
72 .enable = enable_m32104ut_irq,
73 .disable = disable_m32104ut_irq,
74 .ack = mask_and_ack_m32104ut,
75 .end = end_m32104ut_irq
78 void __init init_IRQ(void)
87 #if defined(CONFIG_SMC91X)
88 /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/
89 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
90 irq_desc[M32R_IRQ_INT0].handler = &m32104ut_irq_type;
91 irq_desc[M32R_IRQ_INT0].action = 0;
92 irq_desc[M32R_IRQ_INT0].depth = 1;
93 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11; /* "H" level sense */
94 disable_m32104ut_irq(M32R_IRQ_INT0);
95 #endif /* CONFIG_SMC91X */
97 /* MFT2 : system timer */
98 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
99 irq_desc[M32R_IRQ_MFT2].handler = &m32104ut_irq_type;
100 irq_desc[M32R_IRQ_MFT2].action = 0;
101 irq_desc[M32R_IRQ_MFT2].depth = 1;
102 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
103 disable_m32104ut_irq(M32R_IRQ_MFT2);
105 #ifdef CONFIG_SERIAL_M32R_SIO
106 /* SIO0_R : uart receive data */
107 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
108 irq_desc[M32R_IRQ_SIO0_R].handler = &m32104ut_irq_type;
109 irq_desc[M32R_IRQ_SIO0_R].action = 0;
110 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
111 icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN;
112 disable_m32104ut_irq(M32R_IRQ_SIO0_R);
114 /* SIO0_S : uart send data */
115 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
116 irq_desc[M32R_IRQ_SIO0_S].handler = &m32104ut_irq_type;
117 irq_desc[M32R_IRQ_SIO0_S].action = 0;
118 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
119 icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN;
120 disable_m32104ut_irq(M32R_IRQ_SIO0_S);
121 #endif /* CONFIG_SERIAL_M32R_SIO */
124 #if defined(CONFIG_SMC91X)
126 #define LAN_IOSTART 0x300
127 #define LAN_IOEND 0x320
128 static struct resource smc91x_resources[] = {
130 .start = (LAN_IOSTART),
132 .flags = IORESOURCE_MEM,
135 .start = M32R_IRQ_INT0,
136 .end = M32R_IRQ_INT0,
137 .flags = IORESOURCE_IRQ,
141 static struct platform_device smc91x_device = {
144 .num_resources = ARRAY_SIZE(smc91x_resources),
145 .resource = smc91x_resources,
149 static int __init platform_init(void)
151 #if defined(CONFIG_SMC91X)
152 platform_device_register(&smc91x_device);
156 arch_initcall(platform_init);