36 #include <linux/kernel.h>
37 #include <linux/module.h>
38 #include <linux/pci.h>
45 #define DRV_NAME "pata_triflex"
46 #define DRV_VERSION "0.2.8"
56 static int triflex_prereset(
struct ata_link *
link,
unsigned long deadline)
58 static const struct pci_bits triflex_enable_bits[] = {
59 { 0x80, 1, 0x01, 0x01 },
60 { 0x80, 1, 0x02, 0x02 }
66 if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->
port_no]))
86 static void triflex_load_timing(
struct ata_port *ap,
struct ata_device *adev,
int speed)
90 u32 triflex_timing, old_triflex_timing;
91 int channel_offset = ap->
port_no ? 0x74: 0x70;
92 unsigned int is_slave = (adev->
devno != 0);
95 pci_read_config_dword(pdev, channel_offset, &old_triflex_timing);
96 triflex_timing = old_triflex_timing;
101 timing = 0x0103;
break;
103 timing = 0x0203;
break;
105 timing = 0x0808;
break;
109 timing = 0x0F0F;
break;
111 timing = 0x0202;
break;
113 timing = 0x0204;
break;
115 timing = 0x0404;
break;
117 timing = 0x0508;
break;
119 timing = 0x0808;
break;
123 triflex_timing &= ~ (0xFFFF << (16 * is_slave));
124 triflex_timing |= (timing << (16 * is_slave));
126 if (triflex_timing != old_triflex_timing)
127 pci_write_config_dword(pdev, channel_offset, triflex_timing);
141 triflex_load_timing(ap, adev, adev->
pio_mode);
157 triflex_load_timing(qc->
ap, qc->
dev, qc->
dev->dma_mode);
174 triflex_load_timing(qc->
ap, qc->
dev, qc->
dev->pio_mode);
182 .inherits = &ata_bmdma_port_ops,
183 .bmdma_start = triflex_bmdma_start,
184 .bmdma_stop = triflex_bmdma_stop,
186 .set_piomode = triflex_set_piomode,
187 .prereset = triflex_prereset,
196 .port_ops = &triflex_port_ops
202 return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht,
NULL, 0);
217 rc = ata_host_suspend(host, mesg);
232 static struct pci_driver triflex_pci_driver = {
235 .probe = triflex_init_one,
236 .remove = ata_pci_remove_one,
238 .suspend = triflex_ata_pci_device_suspend,
239 .resume = ata_pci_device_resume,