aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/ht6560b.c
diff options
context:
space:
mode:
authorJan Evert van Grootheest <j.e.van.grootheest@caiway.nl>2008-02-18 19:41:26 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-18 19:41:26 -0500
commit0e7d8d480259319649f7a2c230622b98758d1c83 (patch)
treeb4f365ad69a2fd2380a9e640373a5d58e493e19e /drivers/ide/legacy/ht6560b.c
parent1a1990f5479b0c9055c133b7e0e7fedfcbe11512 (diff)
ht6560b: force prefetch for some devices
Prefetch needs to be set for some ide devices to work when connected to a ht6560b interface. This was not always done properly, causing a system with a HD and CD on the primary interface to not work properly. Or, in effect, hang hard. This patch forces prefetch on devices before checking whether it is necessary to change the settings in the interface This patch should also be applied to 2.4. I don't currently have a 2.4 tree around. (also change my email address) Signed-off-by: Jan Evert van Grootheest <janevert@caiway.nl> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/ht6560b.c')
-rw-r--r--drivers/ide/legacy/ht6560b.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 2701e7d6caff..78ca68e60f97 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -21,18 +21,21 @@
21 * "Prefetch" mode bit OFF for ide disks and 21 * "Prefetch" mode bit OFF for ide disks and
22 * ON for anything else. 22 * ON for anything else.
23 * 23 *
24 * Version 0.08 Need to force prefetch for CDs and other non-disk
25 * devices. (not sure which devices exactly need
26 * prefetch)
24 * 27 *
25 * HT-6560B EIDE-controller support 28 * HT-6560B EIDE-controller support
26 * To activate controller support use kernel parameter "ide0=ht6560b". 29 * To activate controller support use kernel parameter "ide0=ht6560b".
27 * Use hdparm utility to enable PIO mode support. 30 * Use hdparm utility to enable PIO mode support.
28 * 31 *
29 * Author: Mikko Ala-Fossi <maf@iki.fi> 32 * Author: Mikko Ala-Fossi <maf@iki.fi>
30 * Jan Evert van Grootheest <janevert@iae.nl> 33 * Jan Evert van Grootheest <janevert@caiway.nl>
31 * 34 *
32 * Try: http://www.maf.iki.fi/~maf/ht6560b/ 35 * Try: http://www.maf.iki.fi/~maf/ht6560b/
33 */ 36 */
34 37
35#define HT6560B_VERSION "v0.07" 38#define HT6560B_VERSION "v0.08"
36 39
37#include <linux/module.h> 40#include <linux/module.h>
38#include <linux/types.h> 41#include <linux/types.h>
@@ -130,15 +133,20 @@ static void ht6560b_selectproc (ide_drive_t *drive)
130 u8 select, timing; 133 u8 select, timing;
131 134
132 local_irq_save(flags); 135 local_irq_save(flags);
133 136
134 select = HT_CONFIG(drive); 137 select = HT_CONFIG(drive);
135 timing = HT_TIMING(drive); 138 timing = HT_TIMING(drive);
136 139
140 /*
141 * Need to enforce prefetch sometimes because otherwise
142 * it'll hang (hard).
143 */
144 if (drive->media != ide_disk || !drive->present)
145 select |= HT_PREFETCH_MODE;
146
137 if (select != current_select || timing != current_timing) { 147 if (select != current_select || timing != current_timing) {
138 current_select = select; 148 current_select = select;
139 current_timing = timing; 149 current_timing = timing;
140 if (drive->media != ide_disk || !drive->present)
141 select |= HT_PREFETCH_MODE;
142 (void)inb(HT_CONFIG_PORT); 150 (void)inb(HT_CONFIG_PORT);
143 (void)inb(HT_CONFIG_PORT); 151 (void)inb(HT_CONFIG_PORT);
144 (void)inb(HT_CONFIG_PORT); 152 (void)inb(HT_CONFIG_PORT);
@@ -188,11 +196,12 @@ static int __init try_to_init_ht6560b(void)
188 outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */ 196 outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */
189 (void) inb(0x1f7); /* IDE_STATUS_REG */ 197 (void) inb(0x1f7); /* IDE_STATUS_REG */
190 198
191 printk("\nht6560b " HT6560B_VERSION 199 printk("ht6560b " HT6560B_VERSION
192 ": chipset detected and initialized" 200 ": chipset detected and initialized"
193#ifdef DEBUG 201#ifdef DEBUG
194 " with debug enabled" 202 " with debug enabled"
195#endif 203#endif
204 "\n"
196 ); 205 );
197 return 1; 206 return 1;
198} 207}