2 * IDE Chipset driver for the Compaq TriFlex IDE controller.
4 * Known to work with the Compaq Workstation 5x00 series.
6 * Copyright (C) 2002 Hewlett-Packard Development Group, L.P.
7 * Author: Torben Mathiasen <torben.mathiasen@hp.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Loosely based on the piix & svwks drivers.
25 * Not publically available.
28 #include <linux/types.h>
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/delay.h>
32 #include <linux/timer.h>
34 #include <linux/ioport.h>
35 #include <linux/blkdev.h>
36 #include <linux/hdreg.h>
37 #include <linux/pci.h>
38 #include <linux/ide.h>
39 #include <linux/init.h>
41 static void triflex_set_mode(ide_drive_t
*drive
, const u8 speed
)
43 ide_hwif_t
*hwif
= HWIF(drive
);
44 struct pci_dev
*dev
= to_pci_dev(hwif
->dev
);
45 u8 channel_offset
= hwif
->channel
? 0x74 : 0x70;
47 u32 triflex_timings
= 0;
48 u8 unit
= (drive
->select
.b
.unit
& 0x01);
50 pci_read_config_dword(dev
, channel_offset
, &triflex_timings
);
84 triflex_timings
&= ~(0xFFFF << (16 * unit
));
85 triflex_timings
|= (timing
<< (16 * unit
));
87 pci_write_config_dword(dev
, channel_offset
, triflex_timings
);
90 static void triflex_set_pio_mode(ide_drive_t
*drive
, const u8 pio
)
92 triflex_set_mode(drive
, XFER_PIO_0
+ pio
);
95 static void __devinit
init_hwif_triflex(ide_hwif_t
*hwif
)
97 hwif
->set_pio_mode
= &triflex_set_pio_mode
;
98 hwif
->set_dma_mode
= &triflex_set_mode
;
101 static const struct ide_port_info triflex_device __devinitdata
= {
103 .init_hwif
= init_hwif_triflex
,
104 .enablebits
= {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
105 .host_flags
= IDE_HFLAG_BOOTABLE
,
106 .pio_mask
= ATA_PIO4
,
107 .swdma_mask
= ATA_SWDMA2
,
108 .mwdma_mask
= ATA_MWDMA2
,
111 static int __devinit
triflex_init_one(struct pci_dev
*dev
,
112 const struct pci_device_id
*id
)
114 return ide_setup_pci_device(dev
, &triflex_device
);
117 static const struct pci_device_id triflex_pci_tbl
[] = {
118 { PCI_VDEVICE(COMPAQ
, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE
), 0 },
121 MODULE_DEVICE_TABLE(pci
, triflex_pci_tbl
);
123 static struct pci_driver driver
= {
124 .name
= "TRIFLEX_IDE",
125 .id_table
= triflex_pci_tbl
,
126 .probe
= triflex_init_one
,
129 static int __init
triflex_ide_init(void)
131 return ide_pci_register_driver(&driver
);
134 module_init(triflex_ide_init
);
136 MODULE_AUTHOR("Torben Mathiasen");
137 MODULE_DESCRIPTION("PCI driver module for Compaq Triflex IDE");
138 MODULE_LICENSE("GPL");