Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Hirokazu Takata | 3264f97 | 2007-08-01 21:09:31 +0900 | [diff] [blame] | 2 | * linux/arch/m32r/platforms/opsput/setup.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Setup routines for Renesas OPSPUT Board |
| 5 | * |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 6 | * Copyright (c) 2002-2005 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * Hiroyuki Kondo, Hirokazu Takata, |
| 8 | * Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa |
| 9 | * |
| 10 | * This file is subject to the terms and conditions of the GNU General |
| 11 | * Public License. See the file "COPYING" in the main directory of this |
| 12 | * archive for more details. |
| 13 | */ |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/irq.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 18 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | #include <asm/system.h> |
| 21 | #include <asm/m32r.h> |
| 22 | #include <asm/io.h> |
| 23 | |
| 24 | /* |
| 25 | * OPSP Interrupt Control Unit (Level 1) |
| 26 | */ |
| 27 | #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) |
| 28 | |
Al Viro | c51d994 | 2005-08-23 22:47:22 +0100 | [diff] [blame] | 29 | icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
| 31 | static void disable_opsput_irq(unsigned int irq) |
| 32 | { |
| 33 | unsigned long port, data; |
| 34 | |
| 35 | port = irq2port(irq); |
| 36 | data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; |
| 37 | outl(data, port); |
| 38 | } |
| 39 | |
| 40 | static void enable_opsput_irq(unsigned int irq) |
| 41 | { |
| 42 | unsigned long port, data; |
| 43 | |
| 44 | port = irq2port(irq); |
| 45 | data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; |
| 46 | outl(data, port); |
| 47 | } |
| 48 | |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 49 | static void mask_opsput(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | { |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 51 | disable_opsput_irq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 54 | static void unmask_opsput(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | { |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 56 | enable_opsput_irq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 59 | static void shutdown_opsput(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | { |
| 61 | unsigned long port; |
| 62 | |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 63 | port = irq2port(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | outl(M32R_ICUCR_ILEVEL7, port); |
| 65 | } |
| 66 | |
Thomas Gleixner | 189e91f | 2009-06-16 15:33:26 -0700 | [diff] [blame] | 67 | static struct irq_chip opsput_irq_type = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | { |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 69 | .name = "OPSPUT-IRQ", |
| 70 | .irq_shutdown = shutdown_opsput, |
| 71 | .irq_mask = mask_opsput, |
| 72 | .irq_unmask = unmask_opsput, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | /* |
| 76 | * Interrupt Control Unit of PLD on OPSPUT (Level 2) |
| 77 | */ |
| 78 | #define irq2pldirq(x) ((x) - OPSPUT_PLD_IRQ_BASE) |
| 79 | #define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ |
| 80 | (((x) - 1) * sizeof(unsigned short))) |
| 81 | |
| 82 | typedef struct { |
| 83 | unsigned short icucr; /* ICU Control Register */ |
| 84 | } pld_icu_data_t; |
| 85 | |
| 86 | static pld_icu_data_t pld_icu_data[OPSPUT_NUM_PLD_IRQ]; |
| 87 | |
| 88 | static void disable_opsput_pld_irq(unsigned int irq) |
| 89 | { |
| 90 | unsigned long port, data; |
| 91 | unsigned int pldirq; |
| 92 | |
| 93 | pldirq = irq2pldirq(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | port = pldirq2port(pldirq); |
| 95 | data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; |
| 96 | outw(data, port); |
| 97 | } |
| 98 | |
| 99 | static void enable_opsput_pld_irq(unsigned int irq) |
| 100 | { |
| 101 | unsigned long port, data; |
| 102 | unsigned int pldirq; |
| 103 | |
| 104 | pldirq = irq2pldirq(irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | port = pldirq2port(pldirq); |
| 106 | data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; |
| 107 | outw(data, port); |
| 108 | } |
| 109 | |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 110 | static void mask_opsput_pld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | { |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 112 | disable_opsput_pld_irq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 115 | static void unmask_opsput_pld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | { |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 117 | enable_opsput_pld_irq(data->irq); |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 118 | enable_opsput_irq(M32R_IRQ_INT1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | } |
| 120 | |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 121 | static void shutdown_opsput_pld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | { |
| 123 | unsigned long port; |
| 124 | unsigned int pldirq; |
| 125 | |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 126 | pldirq = irq2pldirq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | port = pldirq2port(pldirq); |
| 128 | outw(PLD_ICUCR_ILEVEL7, port); |
| 129 | } |
| 130 | |
Thomas Gleixner | 189e91f | 2009-06-16 15:33:26 -0700 | [diff] [blame] | 131 | static struct irq_chip opsput_pld_irq_type = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | { |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 133 | .name = "OPSPUT-PLD-IRQ", |
| 134 | .irq_shutdown = shutdown_opsput_pld, |
| 135 | .irq_mask = mask_opsput_pld, |
| 136 | .irq_unmask = unmask_opsput_pld, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
| 139 | /* |
| 140 | * Interrupt Control Unit of PLD on OPSPUT-LAN (Level 2) |
| 141 | */ |
| 142 | #define irq2lanpldirq(x) ((x) - OPSPUT_LAN_PLD_IRQ_BASE) |
| 143 | #define lanpldirq2port(x) (unsigned long)((int)OPSPUT_LAN_ICUCR1 + \ |
| 144 | (((x) - 1) * sizeof(unsigned short))) |
| 145 | |
| 146 | static pld_icu_data_t lanpld_icu_data[OPSPUT_NUM_LAN_PLD_IRQ]; |
| 147 | |
| 148 | static void disable_opsput_lanpld_irq(unsigned int irq) |
| 149 | { |
| 150 | unsigned long port, data; |
| 151 | unsigned int pldirq; |
| 152 | |
| 153 | pldirq = irq2lanpldirq(irq); |
| 154 | port = lanpldirq2port(pldirq); |
| 155 | data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; |
| 156 | outw(data, port); |
| 157 | } |
| 158 | |
| 159 | static void enable_opsput_lanpld_irq(unsigned int irq) |
| 160 | { |
| 161 | unsigned long port, data; |
| 162 | unsigned int pldirq; |
| 163 | |
| 164 | pldirq = irq2lanpldirq(irq); |
| 165 | port = lanpldirq2port(pldirq); |
| 166 | data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; |
| 167 | outw(data, port); |
| 168 | } |
| 169 | |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 170 | static void mask_opsput_lanpld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | { |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 172 | disable_opsput_lanpld_irq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 175 | static void unmask_opsput_lanpld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | { |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 177 | enable_opsput_lanpld_irq(data->irq); |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 178 | enable_opsput_irq(M32R_IRQ_INT0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 181 | static void shutdown_opsput_lanpld(struct irq_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | { |
| 183 | unsigned long port; |
| 184 | unsigned int pldirq; |
| 185 | |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 186 | pldirq = irq2lanpldirq(data->irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | port = lanpldirq2port(pldirq); |
| 188 | outw(PLD_ICUCR_ILEVEL7, port); |
| 189 | } |
| 190 | |
Thomas Gleixner | 189e91f | 2009-06-16 15:33:26 -0700 | [diff] [blame] | 191 | static struct irq_chip opsput_lanpld_irq_type = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | { |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 193 | .name = "OPSPUT-PLD-LAN-IRQ", |
| 194 | .irq_shutdown = shutdown_opsput_lanpld, |
| 195 | .irq_mask = mask_opsput_lanpld, |
| 196 | .irq_unmask = unmask_opsput_lanpld, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | /* |
| 200 | * Interrupt Control Unit of PLD on OPSPUT-LCD (Level 2) |
| 201 | */ |
| 202 | #define irq2lcdpldirq(x) ((x) - OPSPUT_LCD_PLD_IRQ_BASE) |
| 203 | #define lcdpldirq2port(x) (unsigned long)((int)OPSPUT_LCD_ICUCR1 + \ |
| 204 | (((x) - 1) * sizeof(unsigned short))) |
| 205 | |
| 206 | static pld_icu_data_t lcdpld_icu_data[OPSPUT_NUM_LCD_PLD_IRQ]; |
| 207 | |
| 208 | static void disable_opsput_lcdpld_irq(unsigned int irq) |
| 209 | { |
| 210 | unsigned long port, data; |
| 211 | unsigned int pldirq; |
| 212 | |
| 213 | pldirq = irq2lcdpldirq(irq); |
| 214 | port = lcdpldirq2port(pldirq); |
| 215 | data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; |
| 216 | outw(data, port); |
| 217 | } |
| 218 | |
| 219 | static void enable_opsput_lcdpld_irq(unsigned int irq) |
| 220 | { |
| 221 | unsigned long port, data; |
| 222 | unsigned int pldirq; |
| 223 | |
| 224 | pldirq = irq2lcdpldirq(irq); |
| 225 | port = lcdpldirq2port(pldirq); |
| 226 | data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; |
| 227 | outw(data, port); |
| 228 | } |
| 229 | |
| 230 | static void mask_and_ack_opsput_lcdpld(unsigned int irq) |
| 231 | { |
| 232 | disable_opsput_lcdpld_irq(irq); |
| 233 | } |
| 234 | |
| 235 | static void end_opsput_lcdpld_irq(unsigned int irq) |
| 236 | { |
| 237 | enable_opsput_lcdpld_irq(irq); |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 238 | enable_opsput_irq(M32R_IRQ_INT2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | static unsigned int startup_opsput_lcdpld_irq(unsigned int irq) |
| 242 | { |
| 243 | enable_opsput_lcdpld_irq(irq); |
| 244 | return (0); |
| 245 | } |
| 246 | |
| 247 | static void shutdown_opsput_lcdpld_irq(unsigned int irq) |
| 248 | { |
| 249 | unsigned long port; |
| 250 | unsigned int pldirq; |
| 251 | |
| 252 | pldirq = irq2lcdpldirq(irq); |
| 253 | port = lcdpldirq2port(pldirq); |
| 254 | outw(PLD_ICUCR_ILEVEL7, port); |
| 255 | } |
| 256 | |
Thomas Gleixner | 189e91f | 2009-06-16 15:33:26 -0700 | [diff] [blame] | 257 | static struct irq_chip opsput_lcdpld_irq_type = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | { |
| 259 | "OPSPUT-PLD-LCD-IRQ", |
| 260 | startup_opsput_lcdpld_irq, |
| 261 | shutdown_opsput_lcdpld_irq, |
| 262 | enable_opsput_lcdpld_irq, |
| 263 | disable_opsput_lcdpld_irq, |
| 264 | mask_and_ack_opsput_lcdpld, |
| 265 | end_opsput_lcdpld_irq |
| 266 | }; |
| 267 | |
| 268 | void __init init_IRQ(void) |
| 269 | { |
| 270 | #if defined(CONFIG_SMC91X) |
| 271 | /* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/ |
Thomas Gleixner | 1899a49 | 2011-01-19 18:58:45 +0100 | [diff] [blame^] | 272 | set_irq_chip_and_handler(OPSPUT_LAN_IRQ_LAN, &opsput_lanpld_irq_type, |
| 273 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ |
| 275 | disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN); |
| 276 | #endif /* CONFIG_SMC91X */ |
| 277 | |
| 278 | /* MFT2 : system timer */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 279 | set_irq_chip_and_handler(M32R_IRQ_MFT2, &opsput_irq_type, |
| 280 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; |
| 282 | disable_opsput_irq(M32R_IRQ_MFT2); |
| 283 | |
| 284 | /* SIO0 : receive */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 285 | set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &opsput_irq_type, |
| 286 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | icu_data[M32R_IRQ_SIO0_R].icucr = 0; |
| 288 | disable_opsput_irq(M32R_IRQ_SIO0_R); |
| 289 | |
| 290 | /* SIO0 : send */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 291 | set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &opsput_irq_type, |
| 292 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | icu_data[M32R_IRQ_SIO0_S].icucr = 0; |
| 294 | disable_opsput_irq(M32R_IRQ_SIO0_S); |
| 295 | |
| 296 | /* SIO1 : receive */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 297 | set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &opsput_irq_type, |
| 298 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | icu_data[M32R_IRQ_SIO1_R].icucr = 0; |
| 300 | disable_opsput_irq(M32R_IRQ_SIO1_R); |
| 301 | |
| 302 | /* SIO1 : send */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 303 | set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &opsput_irq_type, |
| 304 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | icu_data[M32R_IRQ_SIO1_S].icucr = 0; |
| 306 | disable_opsput_irq(M32R_IRQ_SIO1_S); |
| 307 | |
| 308 | /* DMA1 : */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 309 | set_irq_chip_and_handler(M32R_IRQ_DMA1, &opsput_irq_type, |
| 310 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | icu_data[M32R_IRQ_DMA1].icucr = 0; |
| 312 | disable_opsput_irq(M32R_IRQ_DMA1); |
| 313 | |
| 314 | #ifdef CONFIG_SERIAL_M32R_PLDSIO |
| 315 | /* INT#1: SIO0 Receive on PLD */ |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 316 | set_irq_chip_and_handler(PLD_IRQ_SIO0_RCV, &opsput_pld_irq_type, |
| 317 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; |
| 319 | disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV); |
| 320 | |
| 321 | /* INT#1: SIO0 Send on PLD */ |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 322 | set_irq_chip_and_handler(PLD_IRQ_SIO0_SND, &opsput_pld_irq_type, |
| 323 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; |
| 325 | disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); |
| 326 | #endif /* CONFIG_SERIAL_M32R_PLDSIO */ |
| 327 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | /* INT#1: CFC IREQ on PLD */ |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 329 | set_irq_chip_and_handler(PLD_IRQ_CFIREQ, &opsput_pld_irq_type, |
| 330 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ |
| 332 | disable_opsput_pld_irq(PLD_IRQ_CFIREQ); |
| 333 | |
| 334 | /* INT#1: CFC Insert on PLD */ |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 335 | set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT, &opsput_pld_irq_type, |
| 336 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ |
| 338 | disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT); |
| 339 | |
| 340 | /* INT#1: CFC Eject on PLD */ |
Thomas Gleixner | 22cbc93 | 2011-01-19 18:55:09 +0100 | [diff] [blame] | 341 | set_irq_chip_and_handler(PLD_IRQ_CFC_EJECT, &opsput_pld_irq_type, |
| 342 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ |
| 344 | disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
| 346 | /* |
| 347 | * INT0# is used for LAN, DIO |
| 348 | * We enable it here. |
| 349 | */ |
| 350 | icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; |
| 351 | enable_opsput_irq(M32R_IRQ_INT0); |
| 352 | |
| 353 | /* |
| 354 | * INT1# is used for UART, MMC, CF Controller in FPGA. |
| 355 | * We enable it here. |
| 356 | */ |
| 357 | icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; |
| 358 | enable_opsput_irq(M32R_IRQ_INT1); |
| 359 | |
| 360 | #if defined(CONFIG_USB) |
| 361 | outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ |
| 362 | |
Thomas Gleixner | 863018a | 2010-09-22 19:13:16 +0200 | [diff] [blame] | 363 | set_irq_chip(OPSPUT_LCD_IRQ_USB_INT1, &opsput_lcdpld_irq_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ |
| 365 | disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1); |
| 366 | #endif |
| 367 | /* |
| 368 | * INT2# is used for BAT, USB, AUDIO |
| 369 | * We enable it here. |
| 370 | */ |
| 371 | icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; |
| 372 | enable_opsput_irq(M32R_IRQ_INT2); |
| 373 | |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 374 | #if defined(CONFIG_VIDEO_M32R_AR) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | /* |
| 376 | * INT3# is used for AR |
| 377 | */ |
Thomas Gleixner | 883c0cc | 2011-01-19 18:48:15 +0100 | [diff] [blame] | 378 | set_irq_chip_and_handler(M32R_IRQ_INT3, &opsput_irq_type, |
| 379 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; |
| 381 | disable_opsput_irq(M32R_IRQ_INT3); |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 382 | #endif /* CONFIG_VIDEO_M32R_AR */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | } |
| 384 | |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 385 | #if defined(CONFIG_SMC91X) |
| 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | #define LAN_IOSTART 0x300 |
| 388 | #define LAN_IOEND 0x320 |
| 389 | static struct resource smc91x_resources[] = { |
| 390 | [0] = { |
| 391 | .start = (LAN_IOSTART), |
| 392 | .end = (LAN_IOEND), |
| 393 | .flags = IORESOURCE_MEM, |
| 394 | }, |
| 395 | [1] = { |
| 396 | .start = OPSPUT_LAN_IRQ_LAN, |
| 397 | .end = OPSPUT_LAN_IRQ_LAN, |
| 398 | .flags = IORESOURCE_IRQ, |
| 399 | } |
| 400 | }; |
| 401 | |
| 402 | static struct platform_device smc91x_device = { |
| 403 | .name = "smc91x", |
| 404 | .id = 0, |
| 405 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 406 | .resource = smc91x_resources, |
| 407 | }; |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 408 | #endif |
| 409 | |
| 410 | #if defined(CONFIG_FB_S1D13XXX) |
| 411 | |
| 412 | #include <video/s1d13xxxfb.h> |
| 413 | #include <asm/s1d13806.h> |
| 414 | |
| 415 | static struct s1d13xxxfb_pdata s1d13xxxfb_data = { |
| 416 | .initregs = s1d13xxxfb_initregs, |
| 417 | .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs), |
| 418 | .platform_init_video = NULL, |
| 419 | #ifdef CONFIG_PM |
| 420 | .platform_suspend_video = NULL, |
| 421 | .platform_resume_video = NULL, |
| 422 | #endif |
| 423 | }; |
| 424 | |
| 425 | static struct resource s1d13xxxfb_resources[] = { |
| 426 | [0] = { |
| 427 | .start = 0x10600000UL, |
| 428 | .end = 0x1073FFFFUL, |
| 429 | .flags = IORESOURCE_MEM, |
| 430 | }, |
| 431 | [1] = { |
| 432 | .start = 0x10400000UL, |
| 433 | .end = 0x104001FFUL, |
| 434 | .flags = IORESOURCE_MEM, |
| 435 | } |
| 436 | }; |
| 437 | |
| 438 | static struct platform_device s1d13xxxfb_device = { |
| 439 | .name = S1D_DEVICENAME, |
| 440 | .id = 0, |
| 441 | .dev = { |
| 442 | .platform_data = &s1d13xxxfb_data, |
| 443 | }, |
| 444 | .num_resources = ARRAY_SIZE(s1d13xxxfb_resources), |
| 445 | .resource = s1d13xxxfb_resources, |
| 446 | }; |
| 447 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | |
| 449 | static int __init platform_init(void) |
| 450 | { |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 451 | #if defined(CONFIG_SMC91X) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | platform_device_register(&smc91x_device); |
Hirokazu Takata | 316240f | 2005-07-07 17:59:32 -0700 | [diff] [blame] | 453 | #endif |
| 454 | #if defined(CONFIG_FB_S1D13XXX) |
| 455 | platform_device_register(&s1d13xxxfb_device); |
| 456 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | return 0; |
| 458 | } |
| 459 | arch_initcall(platform_init); |