diff options
Diffstat (limited to 'arch/sh/boards/mach-microdev/setup.c')
-rw-r--r-- | arch/sh/boards/mach-microdev/setup.c | 196 |
1 files changed, 6 insertions, 190 deletions
diff --git a/arch/sh/boards/mach-microdev/setup.c b/arch/sh/boards/mach-microdev/setup.c index a9202fe3cb59..d1df2a4fb9b8 100644 --- a/arch/sh/boards/mach-microdev/setup.c +++ b/arch/sh/boards/mach-microdev/setup.c | |||
@@ -17,70 +17,12 @@ | |||
17 | #include <mach/microdev.h> | 17 | #include <mach/microdev.h> |
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | #include <asm/machvec.h> | 19 | #include <asm/machvec.h> |
20 | 20 | #include <asm/sizes.h> | |
21 | extern void microdev_heartbeat(void); | ||
22 | |||
23 | |||
24 | /****************************************************************************/ | ||
25 | |||
26 | |||
27 | /* | ||
28 | * Setup for the SMSC FDC37C93xAPM | ||
29 | */ | ||
30 | #define SMSC_CONFIG_PORT_ADDR (0x3F0) | ||
31 | #define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR | ||
32 | #define SMSC_DATA_PORT_ADDR (SMSC_INDEX_PORT_ADDR + 1) | ||
33 | |||
34 | #define SMSC_ENTER_CONFIG_KEY 0x55 | ||
35 | #define SMSC_EXIT_CONFIG_KEY 0xaa | ||
36 | |||
37 | #define SMCS_LOGICAL_DEV_INDEX 0x07 /* Logical Device Number */ | ||
38 | #define SMSC_DEVICE_ID_INDEX 0x20 /* Device ID */ | ||
39 | #define SMSC_DEVICE_REV_INDEX 0x21 /* Device Revision */ | ||
40 | #define SMSC_ACTIVATE_INDEX 0x30 /* Activate */ | ||
41 | #define SMSC_PRIMARY_BASE_INDEX 0x60 /* Primary Base Address */ | ||
42 | #define SMSC_SECONDARY_BASE_INDEX 0x62 /* Secondary Base Address */ | ||
43 | #define SMSC_PRIMARY_INT_INDEX 0x70 /* Primary Interrupt Select */ | ||
44 | #define SMSC_SECONDARY_INT_INDEX 0x72 /* Secondary Interrupt Select */ | ||
45 | #define SMSC_HDCS0_INDEX 0xf0 /* HDCS0 Address Decoder */ | ||
46 | #define SMSC_HDCS1_INDEX 0xf1 /* HDCS1 Address Decoder */ | ||
47 | |||
48 | #define SMSC_IDE1_DEVICE 1 /* IDE #1 logical device */ | ||
49 | #define SMSC_IDE2_DEVICE 2 /* IDE #2 logical device */ | ||
50 | #define SMSC_PARALLEL_DEVICE 3 /* Parallel Port logical device */ | ||
51 | #define SMSC_SERIAL1_DEVICE 4 /* Serial #1 logical device */ | ||
52 | #define SMSC_SERIAL2_DEVICE 5 /* Serial #2 logical device */ | ||
53 | #define SMSC_KEYBOARD_DEVICE 7 /* Keyboard logical device */ | ||
54 | #define SMSC_CONFIG_REGISTERS 8 /* Configuration Registers (Aux I/O) */ | ||
55 | |||
56 | #define SMSC_READ_INDEXED(index) ({ \ | ||
57 | outb((index), SMSC_INDEX_PORT_ADDR); \ | ||
58 | inb(SMSC_DATA_PORT_ADDR); }) | ||
59 | #define SMSC_WRITE_INDEXED(val, index) ({ \ | ||
60 | outb((index), SMSC_INDEX_PORT_ADDR); \ | ||
61 | outb((val), SMSC_DATA_PORT_ADDR); }) | ||
62 | |||
63 | #define IDE1_PRIMARY_BASE 0x01f0 /* Task File Registe base for IDE #1 */ | ||
64 | #define IDE1_SECONDARY_BASE 0x03f6 /* Miscellaneous AT registers for IDE #1 */ | ||
65 | #define IDE2_PRIMARY_BASE 0x0170 /* Task File Registe base for IDE #2 */ | ||
66 | #define IDE2_SECONDARY_BASE 0x0376 /* Miscellaneous AT registers for IDE #2 */ | ||
67 | |||
68 | #define SERIAL1_PRIMARY_BASE 0x03f8 | ||
69 | #define SERIAL2_PRIMARY_BASE 0x02f8 | ||
70 | |||
71 | #define MSB(x) ( (x) >> 8 ) | ||
72 | #define LSB(x) ( (x) & 0xff ) | ||
73 | |||
74 | /* General-Purpose base address on CPU-board FPGA */ | ||
75 | #define MICRODEV_FPGA_GP_BASE 0xa6100000ul | ||
76 | |||
77 | /* assume a Keyboard Controller is present */ | ||
78 | int microdev_kbd_controller_present = 1; | ||
79 | 21 | ||
80 | static struct resource smc91x_resources[] = { | 22 | static struct resource smc91x_resources[] = { |
81 | [0] = { | 23 | [0] = { |
82 | .start = 0x300, | 24 | .start = 0x300, |
83 | .end = 0x300 + 0x0001000 - 1, | 25 | .end = 0x300 + SZ_4K - 1, |
84 | .flags = IORESOURCE_MEM, | 26 | .flags = IORESOURCE_MEM, |
85 | }, | 27 | }, |
86 | [1] = { | 28 | [1] = { |
@@ -97,7 +39,6 @@ static struct platform_device smc91x_device = { | |||
97 | .resource = smc91x_resources, | 39 | .resource = smc91x_resources, |
98 | }; | 40 | }; |
99 | 41 | ||
100 | #ifdef CONFIG_FB_S1D13XXX | ||
101 | static struct s1d13xxxfb_regval s1d13806_initregs[] = { | 42 | static struct s1d13xxxfb_regval s1d13806_initregs[] = { |
102 | { S1DREG_MISC, 0x00 }, | 43 | { S1DREG_MISC, 0x00 }, |
103 | { S1DREG_COM_DISP_MODE, 0x00 }, | 44 | { S1DREG_COM_DISP_MODE, 0x00 }, |
@@ -216,12 +157,12 @@ static struct s1d13xxxfb_pdata s1d13806_platform_data = { | |||
216 | static struct resource s1d13806_resources[] = { | 157 | static struct resource s1d13806_resources[] = { |
217 | [0] = { | 158 | [0] = { |
218 | .start = 0x07200000, | 159 | .start = 0x07200000, |
219 | .end = 0x07200000 + 0x00200000 - 1, | 160 | .end = 0x07200000 + SZ_2M - 1, |
220 | .flags = IORESOURCE_MEM, | 161 | .flags = IORESOURCE_MEM, |
221 | }, | 162 | }, |
222 | [1] = { | 163 | [1] = { |
223 | .start = 0x07000000, | 164 | .start = 0x07000000, |
224 | .end = 0x07000000 + 0x00200000 - 1, | 165 | .end = 0x07000000 + SZ_2M - 1, |
225 | .flags = IORESOURCE_MEM, | 166 | .flags = IORESOURCE_MEM, |
226 | }, | 167 | }, |
227 | }; | 168 | }; |
@@ -236,145 +177,24 @@ static struct platform_device s1d13806_device = { | |||
236 | .platform_data = &s1d13806_platform_data, | 177 | .platform_data = &s1d13806_platform_data, |
237 | }, | 178 | }, |
238 | }; | 179 | }; |
239 | #endif | ||
240 | 180 | ||
241 | static struct platform_device *microdev_devices[] __initdata = { | 181 | static struct platform_device *microdev_devices[] __initdata = { |
242 | &smc91x_device, | 182 | &smc91x_device, |
243 | #ifdef CONFIG_FB_S1D13XXX | ||
244 | &s1d13806_device, | 183 | &s1d13806_device, |
245 | #endif | ||
246 | }; | 184 | }; |
247 | 185 | ||
248 | static int __init microdev_devices_setup(void) | 186 | static int __init microdev_devices_setup(void) |
249 | { | 187 | { |
250 | return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices)); | 188 | return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices)); |
251 | } | 189 | } |
252 | 190 | device_initcall(microdev_devices_setup); | |
253 | /* | ||
254 | * Setup for the SMSC FDC37C93xAPM | ||
255 | */ | ||
256 | static int __init smsc_superio_setup(void) | ||
257 | { | ||
258 | |||
259 | unsigned char devid, devrev; | ||
260 | |||
261 | /* Initially the chip is in run state */ | ||
262 | /* Put it into configuration state */ | ||
263 | outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR); | ||
264 | |||
265 | /* Read device ID info */ | ||
266 | devid = SMSC_READ_INDEXED(SMSC_DEVICE_ID_INDEX); | ||
267 | devrev = SMSC_READ_INDEXED(SMSC_DEVICE_REV_INDEX); | ||
268 | if ( (devid==0x30) && (devrev==0x01) ) | ||
269 | { | ||
270 | printk("SMSC FDC37C93xAPM SuperIO device detected\n"); | ||
271 | } | ||
272 | else | ||
273 | { /* not the device identity we expected */ | ||
274 | printk("Not detected a SMSC FDC37C93xAPM SuperIO device (devid=0x%02x, rev=0x%02x)\n", | ||
275 | devid, devrev); | ||
276 | /* inform the keyboard driver that we have no keyboard controller */ | ||
277 | microdev_kbd_controller_present = 0; | ||
278 | /* little point in doing anything else in this functon */ | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | /* Select the keyboard device */ | ||
283 | SMSC_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX); | ||
284 | /* enable it */ | ||
285 | SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX); | ||
286 | /* enable the interrupts */ | ||
287 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_KEYBOARD, SMSC_PRIMARY_INT_INDEX); | ||
288 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_MOUSE, SMSC_SECONDARY_INT_INDEX); | ||
289 | |||
290 | /* Select the Serial #1 device */ | ||
291 | SMSC_WRITE_INDEXED(SMSC_SERIAL1_DEVICE, SMCS_LOGICAL_DEV_INDEX); | ||
292 | /* enable it */ | ||
293 | SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX); | ||
294 | /* program with port addresses */ | ||
295 | SMSC_WRITE_INDEXED(MSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0); | ||
296 | SMSC_WRITE_INDEXED(LSB(SERIAL1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1); | ||
297 | SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX); | ||
298 | /* enable the interrupts */ | ||
299 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL1, SMSC_PRIMARY_INT_INDEX); | ||
300 | |||
301 | /* Select the Serial #2 device */ | ||
302 | SMSC_WRITE_INDEXED(SMSC_SERIAL2_DEVICE, SMCS_LOGICAL_DEV_INDEX); | ||
303 | /* enable it */ | ||
304 | SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX); | ||
305 | /* program with port addresses */ | ||
306 | SMSC_WRITE_INDEXED(MSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0); | ||
307 | SMSC_WRITE_INDEXED(LSB(SERIAL2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1); | ||
308 | SMSC_WRITE_INDEXED(0x00, SMSC_HDCS0_INDEX); | ||
309 | /* enable the interrupts */ | ||
310 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_SERIAL2, SMSC_PRIMARY_INT_INDEX); | ||
311 | |||
312 | /* Select the IDE#1 device */ | ||
313 | SMSC_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX); | ||
314 | /* enable it */ | ||
315 | SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX); | ||
316 | /* program with port addresses */ | ||
317 | SMSC_WRITE_INDEXED(MSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0); | ||
318 | SMSC_WRITE_INDEXED(LSB(IDE1_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1); | ||
319 | SMSC_WRITE_INDEXED(MSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0); | ||
320 | SMSC_WRITE_INDEXED(LSB(IDE1_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1); | ||
321 | SMSC_WRITE_INDEXED(0x0c, SMSC_HDCS0_INDEX); | ||
322 | SMSC_WRITE_INDEXED(0x00, SMSC_HDCS1_INDEX); | ||
323 | /* select the interrupt */ | ||
324 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE1, SMSC_PRIMARY_INT_INDEX); | ||
325 | |||
326 | /* Select the IDE#2 device */ | ||
327 | SMSC_WRITE_INDEXED(SMSC_IDE2_DEVICE, SMCS_LOGICAL_DEV_INDEX); | ||
328 | /* enable it */ | ||
329 | SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX); | ||
330 | /* program with port addresses */ | ||
331 | SMSC_WRITE_INDEXED(MSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+0); | ||
332 | SMSC_WRITE_INDEXED(LSB(IDE2_PRIMARY_BASE), SMSC_PRIMARY_BASE_INDEX+1); | ||
333 | SMSC_WRITE_INDEXED(MSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+0); | ||
334 | SMSC_WRITE_INDEXED(LSB(IDE2_SECONDARY_BASE), SMSC_SECONDARY_BASE_INDEX+1); | ||
335 | /* select the interrupt */ | ||
336 | SMSC_WRITE_INDEXED(MICRODEV_FPGA_IRQ_IDE2, SMSC_PRIMARY_INT_INDEX); | ||
337 | |||
338 | /* Select the configuration registers */ | ||
339 | SMSC_WRITE_INDEXED(SMSC_CONFIG_REGISTERS, SMCS_LOGICAL_DEV_INDEX); | ||
340 | /* enable the appropriate GPIO pins for IDE functionality: | ||
341 | * bit[0] In/Out 1==input; 0==output | ||
342 | * bit[1] Polarity 1==invert; 0==no invert | ||
343 | * bit[2] Int Enb #1 1==Enable Combined IRQ #1; 0==disable | ||
344 | * bit[3:4] Function Select 00==original; 01==Alternate Function #1 | ||
345 | */ | ||
346 | SMSC_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */ | ||
347 | SMSC_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */ | ||
348 | SMSC_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */ | ||
349 | SMSC_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */ | ||
350 | SMSC_WRITE_INDEXED(0x08, 0xe8); /* GP20 = nIDE2_OE */ | ||
351 | |||
352 | /* Exit the configuration state */ | ||
353 | outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR); | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static void __init microdev_setup(char **cmdline_p) | ||
359 | { | ||
360 | int * const fpgaRevisionRegister = (int*)(MICRODEV_FPGA_GP_BASE + 0x8ul); | ||
361 | const int fpgaRevision = *fpgaRevisionRegister; | ||
362 | int * const CacheControlRegister = (int*)CCR; | ||
363 | |||
364 | device_initcall(microdev_devices_setup); | ||
365 | device_initcall(smsc_superio_setup); | ||
366 | |||
367 | printk("SuperH %s board (FPGA rev: 0x%0x, CCR: 0x%0x)\n", | ||
368 | get_system_type(), fpgaRevision, *CacheControlRegister); | ||
369 | } | ||
370 | 191 | ||
371 | /* | 192 | /* |
372 | * The Machine Vector | 193 | * The Machine Vector |
373 | */ | 194 | */ |
374 | static struct sh_machine_vector mv_sh4202_microdev __initmv = { | 195 | static struct sh_machine_vector mv_sh4202_microdev __initmv = { |
375 | .mv_name = "SH4-202 MicroDev", | 196 | .mv_name = "SH4-202 MicroDev", |
376 | .mv_setup = microdev_setup, | 197 | .mv_nr_irqs = 72, |
377 | .mv_nr_irqs = 72, /* QQQ need to check this - use the MACRO */ | ||
378 | 198 | ||
379 | .mv_inb = microdev_inb, | 199 | .mv_inb = microdev_inb, |
380 | .mv_inw = microdev_inw, | 200 | .mv_inw = microdev_inw, |
@@ -398,8 +218,4 @@ static struct sh_machine_vector mv_sh4202_microdev __initmv = { | |||
398 | .mv_outsl = microdev_outsl, | 218 | .mv_outsl = microdev_outsl, |
399 | 219 | ||
400 | .mv_init_irq = init_microdev_irq, | 220 | .mv_init_irq = init_microdev_irq, |
401 | |||
402 | #ifdef CONFIG_HEARTBEAT | ||
403 | .mv_heartbeat = microdev_heartbeat, | ||
404 | #endif | ||
405 | }; | 221 | }; |