summaryrefslogtreecommitdiffstats
path: root/drivers/block/qd6580.c
blob: d7b2784d1985b442c8a4e4ca255886e79b1b6614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 *  linux/drivers/block/qd6580.c       Version 0.02  Feb 09, 1996
 *
 *  Copyright (C) 1996  Linus Torvalds & author (see below)
 */

/*
 * QDI QD6580 EIDE controller fast support by Colten Edwards.
 * No net access, but (maybe) can be reached at pje120@cs.usask.ca
 */

#undef REALLY_SLOW_IO           /* most systems can safely undef this */

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/mm.h>
#include <linux/ioport.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/ide.h>

#include <asm/io.h>

#include "ide_modes.h"

/*
 * Register 0xb3 looks like:
 *	0x4f is fast		mode3 ?
 *	0x3f is medium		mode2 ?
 *	0x2f is slower		mode1 ?
 *	0x1f is slower yet	mode0 ?
 *	0x0f ???		???
 *
 * Don't know whether this sets BOTH drives, or just the first drive.
 * Don't know if there is a separate setting for the second drive.
 *
 * Feel free to patch this if you have one of these beasts
 * and can work out the answers!
 *
 * I/O ports are 0xb0 0xb2 and 0xb3
 *
 * More research on qd6580 being done by willmore@cig.mot.com (David)
 *	-- this is apparently a *dual* IDE interface
 */

static void tune_qd6580 (ide_drive_t *drive, byte pio)
{
	unsigned long flags;

	pio = ide_get_best_pio_mode(drive, pio, 3, NULL);

	save_flags(flags);	/* all CPUs */
	cli();			/* all CPUs */
	outb_p(0x8d,0xb0);
	outb_p(0x0 ,0xb2);
	outb_p(((pio+1)<<4)|0x0f,0xb3);
	inb(0x3f6);
	restore_flags(flags);	/* all CPUs */
}

void init_qd6580 (void)
{
	ide_hwifs[0].chipset = ide_qd6580;
	ide_hwifs[1].chipset = ide_qd6580;
	ide_hwifs[0].tuneproc = &tune_qd6580;
	ide_hwifs[0].mate = &ide_hwifs[1];
	ide_hwifs[1].mate = &ide_hwifs[0];
	ide_hwifs[1].channel = 1;
}