2 * linux/drivers/ide/legacy/dtc2278.c Version 0.02 Feb 10, 1996
4 * Copyright (C) 1996 Linus Torvalds & author (see below)
7 #undef REALLY_SLOW_IO /* most systems can safely undef this */
9 #include <linux/module.h>
10 #include <linux/config.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/delay.h>
14 #include <linux/timer.h>
16 #include <linux/ioport.h>
17 #include <linux/blkdev.h>
18 #include <linux/hdreg.h>
19 #include <linux/ide.h>
20 #include <linux/init.h>
24 #ifdef CONFIG_BLK_DEV_DTC2278_MODULE
26 # include "ide_modes.h"
29 # include "ide_modes.h"
30 #endif /* CONFIG_BLK_DEV_DTC2278_MODULE */
33 * Changing this #undef to #define may solve start up problems in some systems.
35 #undef ALWAYS_SET_DTC2278_PIO_MODE
38 * From: andy@cercle.cts.com (Dyan Wile)
40 * Below is a patch for DTC-2278 - alike software-programmable controllers
41 * The code enables the secondary IDE controller and the PIO4 (3?) timings on
42 * the primary (EIDE). You may probably have to enable the 32-bit support to
43 * get the full speed. You better get the disk interrupts disabled ( hdparm -u0
44 * /dev/hd.. ) for the drives connected to the EIDE interface. (I get my
45 * filesystem corrupted with -u1, but under heavy disk load only :-)
47 * This card is now forced to use the "serialize" feature,
48 * and irq-unmasking is disallowed. If io_32bit is enabled,
49 * it must be done for BOTH drives on each interface.
51 * This code was written for the DTC2278E, but might work with any of these:
53 * DTC2278S has only a single IDE interface.
54 * DTC2278D has two IDE interfaces and is otherwise identical to the S version.
55 * DTC2278E also has serial ports and a printer port
56 * DTC2278EB: has onboard BIOS, and "works like a charm" -- Kent Bradford <kent@theory.caltech.edu>
58 * There may be a fourth controller type. The S and D versions use the
59 * Winbond chip, and I think the E version does also.
63 static void sub22 (char b, char c)
67 for(i = 0; i < 3; ++i) {
81 static void tune_dtc2278 (ide_drive_t *drive, u8 pio)
85 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
88 spin_lock_irqsave(&io_request_lock, flags);
90 * This enables PIO mode4 (3?) on the first interface
94 spin_unlock_irqrestore(&io_request_lock, flags);
96 /* we don't know how to set it back again.. */
100 * 32bit I/O has to be enabled for *both* drives at the same time.
103 HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1;
106 void __init probe_dtc2278 (void)
110 local_irq_save(flags);
112 * This enables the second interface
118 #ifdef ALWAYS_SET_DTC2278_PIO_MODE
120 * This enables PIO mode4 (3?) on the first interface
121 * and may solve start-up problems for some people.
126 local_irq_restore(flags);
128 ide_hwifs[0].serialized = 1;
129 ide_hwifs[1].serialized = 1;
130 ide_hwifs[0].chipset = ide_dtc2278;
131 ide_hwifs[1].chipset = ide_dtc2278;
132 ide_hwifs[0].tuneproc = &tune_dtc2278;
133 ide_hwifs[0].drives[0].no_unmask = 1;
134 ide_hwifs[0].drives[1].no_unmask = 1;
135 ide_hwifs[1].drives[0].no_unmask = 1;
136 ide_hwifs[1].drives[1].no_unmask = 1;
137 ide_hwifs[0].mate = &ide_hwifs[1];
138 ide_hwifs[1].mate = &ide_hwifs[0];
139 ide_hwifs[1].channel = 1;
141 #ifndef HWIF_PROBE_CLASSIC_METHOD
142 probe_hwif_init(&ide_hwifs[0]);
143 probe_hwif_init(&ide_hwifs[1]);
144 #endif /* HWIF_PROBE_CLASSIC_METHOD */
148 void __init dtc2278_release (void)
150 if (ide_hwifs[0].chipset != ide_dtc2278 &&
151 ide_hwifs[1].chipset != ide_dtc2278)
154 ide_hwifs[0].serialized = 0;
155 ide_hwifs[1].serialized = 0;
156 ide_hwifs[0].chipset = ide_unknown;
157 ide_hwifs[1].chipset = ide_unknown;
158 ide_hwifs[0].tuneproc = NULL;
159 ide_hwifs[0].drives[0].no_unmask = 0;
160 ide_hwifs[0].drives[1].no_unmask = 0;
161 ide_hwifs[1].drives[0].no_unmask = 0;
162 ide_hwifs[1].drives[1].no_unmask = 0;
163 ide_hwifs[0].mate = NULL;
164 ide_hwifs[1].mate = NULL;
171 * called by ide.c when parsing command line
174 void __init init_dtc2278 (void)
181 MODULE_AUTHOR("See Local File");
182 MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets");
183 MODULE_LICENSE("GPL");
185 int __init dtc2278_mod_init(void)
188 if (ide_hwifs[0].chipset != ide_dtc2278 &&
189 ide_hwifs[1].chipset != ide_dtc2278) {
195 module_init(dtc2278_mod_init);
197 void __init dtc2278_mod_exit(void)
201 module_exit(dtc2278_mod_exit);