2 * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
3 * Copyright (C) 1999-2001 Vojtech Pavlik
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #define XFER_PIO_5 0x0d
21 #define XFER_UDMA_SLOW 0x4f
26 short act8b
; /* t2 for 8-bit io */
27 short rec8b
; /* t2i for 8-bit io */
28 short cyc8b
; /* t0 for 8-bit io */
29 short active
; /* t2 or tD */
30 short recover
; /* t2i or tK */
32 short udma
; /* t2CYCTYP/2 */
35 extern struct ata_timing ata_timing
[];
37 #define IDE_TIMING_SETUP 0x01
38 #define IDE_TIMING_ACT8B 0x02
39 #define IDE_TIMING_REC8B 0x04
40 #define IDE_TIMING_CYC8B 0x08
41 #define IDE_TIMING_8BIT 0x0e
42 #define IDE_TIMING_ACTIVE 0x10
43 #define IDE_TIMING_RECOVER 0x20
44 #define IDE_TIMING_CYCLE 0x40
45 #define IDE_TIMING_UDMA 0x80
46 #define IDE_TIMING_ALL 0xff
48 #define FIT(v,x,y) max_t(int,min_t(int,v,y),x)
49 #define ENOUGH(v,unit) (((v)-1)/(unit)+1)
50 #define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
52 /* see hpt366.c for details */
53 #define XFER_UDMA_66_3 0x100
54 #define XFER_UDMA_66_4 0x200
56 #define XFER_MODE 0xff0
57 #define XFER_UDMA_133 0x800
58 #define XFER_UDMA_100 0x400
59 #define XFER_UDMA_66 0x300
60 #define XFER_UDMA 0x040
61 #define XFER_MWDMA 0x020
62 #define XFER_SWDMA 0x010
63 #define XFER_EPIO 0x001
64 #define XFER_PIO 0x000
66 #define XFER_UDMA_ALL 0xf40
67 #define XFER_UDMA_80W 0xf00
69 /* External interface to host chips channel timing setup.
71 * It's a bit elaborate due to the legacy we have to bear.
74 extern short ata_timing_mode(struct ata_device
*drive
, int map
);
75 extern void ata_timing_quantize(struct ata_timing
*t
, struct ata_timing
*q
,
77 extern void ata_timing_merge(struct ata_timing
*a
, struct ata_timing
*b
,
78 struct ata_timing
*m
, unsigned int what
);
79 void ata_timing_merge_8bit(struct ata_timing
*t
);
80 extern struct ata_timing
* ata_timing_data(short speed
);
81 extern int ata_timing_compute(struct ata_device
*drive
,
82 short speed
, struct ata_timing
*t
, int T
, int UT
);
83 extern u8
ata_best_pio_mode(struct ata_device
*drive
);