1 /* 2 * linux/drivers/block/dtc2278.c Version 0.01 Feb 06, 1996 3 * 4 * Copyright (C) 1996 Linus Torvalds & author (see below) 5 */ 6
7 #undefREALLY_SLOW_IO/* most systems can safely undef this */ 8
9 #include <linux/types.h>
10 #include <linux/kernel.h>
11 #include <linux/delay.h>
12 #include <linux/timer.h>
13 #include <linux/mm.h>
14 #include <linux/ioport.h>
15 #include <linux/blkdev.h>
16 #include <linux/hdreg.h>
17 #include <asm/io.h>
18 #include "ide.h"
19
20 /* 21 * From: andy@cercle.cts.com (Dyan Wile) 22 * 23 * Below is a patch for DTC-2278 - alike software-programmable controllers 24 * The code enables the secondary IDE controller and the PIO4 (3?) timings on 25 * the primary (EIDE). You may probably have to enable the 32-bit support to 26 * get the full speed. You better get the disk interrupts disabled ( hdparm -u0 27 * /dev/hd.. ) for the drives connected to the EIDE interface. (I get my 28 * filesystem corrupted with -u1, but under heavy disk load only :-) 29 * 30 * From: mlord@bnr.ca -- this chipset is now forced to use the "serialize" feature, 31 * which hopefully will make it more reliable to use.. maybe it has the same bugs 32 * as the CMD640B and RZ1000 ?? 33 */ 34
35 staticvoidsub22 (charb, charc)
/* */ 36 { 37 inti;
38
39 for(i = 0; i < 3; ++i) { 40 inb(0x3f6);
41 outb_p(b,0xb0);
42 inb(0x3f6);
43 outb_p(c,0xb4);
44 inb(0x3f6);
45 if(inb(0xb4) == c) { 46 outb_p(7,0xb0);
47 inb(0x3f6);
48 return; /* success */ 49 } 50 } 51 } 52
53 staticvoidtune_dtc2278 (ide_drive_t *drive, bytepio_mode)
/* */ 54 { 55 unsignedlongflags;
56
57 if (pio_mode != 255) {/* auto-tune not yet supported here */ 58 if (pio_mode >= 3) { 59 save_flags(flags);
60 cli();
61 /* 62 * This enables PIO mode4 (3?) on the first interface 63 */ 64 sub22(1,0xc3);
65 sub22(0,0xa0);
66 restore_flags(flags);
67 }else{ 68 /* we don't know how to set it back again.. */ 69 } 70 } 71 } 72
73 voidinit_dtc2278 (void)
/* */ 74 { 75 unsignedlongflags;
76
77 save_flags(flags);
78 cli();
79 /* 80 * This enables the second interface 81 */ 82 outb_p(4,0xb0);
83 inb(0x3f6);
84 outb_p(0x20,0xb4);
85 inb(0x3f6);
86 restore_flags(flags);
87
88 ide_hwifs[0].serialized = 1;
89 ide_hwifs[0].chipset = ide_dtc2278;
90 ide_hwifs[1].chipset = ide_dtc2278;
91 ide_hwifs[0].tuneproc = &tune_dtc2278;
92 }