19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/pci.h>
28 #define DRV_NAME "pata_sl82c105"
29 #define DRV_VERSION "0.3.3"
52 static int sl82c105_pre_reset(
struct ata_link *
link,
unsigned long deadline)
54 static const struct pci_bits sl82c105_enable_bits[] = {
55 { 0x40, 1, 0x01, 0x01 },
56 { 0x40, 1, 0x10, 0x10 }
61 if (ap->
port_no && !pci_test_config_bits(pdev, &sl82c105_enable_bits[ap->
port_no]))
81 static u16 pio_timing[5] = {
82 0x50D, 0x407, 0x304, 0x242, 0x240
87 pci_write_config_word(pdev, timing, pio_timing[pio]);
89 pci_read_config_word(pdev, timing, &dummy);
118 static u16 dma_timing[3] = {
122 int timing = 0x44 + (8 * ap->
port_no) + (4 * adev->
devno);
125 pci_write_config_word(pdev, timing, dma_timing[dma]);
127 pci_read_config_word(pdev, timing, &dummy);
140 static void sl82c105_reset_engine(
struct ata_port *ap)
145 pci_read_config_word(pdev, 0x7E, &val);
146 pci_write_config_word(pdev, 0x7E, val | 4);
147 pci_write_config_word(pdev, 0x7E, val & ~4);
166 sl82c105_reset_engine(ap);
170 sl82c105_configure_dmamode(ap, qc->
dev);
195 sl82c105_reset_engine(ap);
200 sl82c105_set_piomode(ap, qc->
dev);
231 static bool sl82c105_sff_irq_check(
struct ata_port *ap)
236 pci_read_config_dword(pdev, 0x40, &val);
246 .inherits = &ata_bmdma_port_ops,
247 .qc_defer = sl82c105_qc_defer,
248 .bmdma_start = sl82c105_bmdma_start,
249 .bmdma_stop = sl82c105_bmdma_stop,
251 .set_piomode = sl82c105_set_piomode,
252 .prereset = sl82c105_pre_reset,
253 .sff_irq_check = sl82c105_sff_irq_check,
265 static int sl82c105_bridge_revision(
struct pci_dev *pdev)
293 static void sl82c105_fixup(
struct pci_dev *pdev)
297 pci_read_config_dword(pdev, 0x40, &val);
299 pci_write_config_dword(pdev, 0x40, val);
308 .port_ops = &sl82c105_port_ops
313 .port_ops = &sl82c105_port_ops
325 rev = sl82c105_bridge_revision(dev);
329 "pata_sl82c105: Unable to find bridge, disabling DMA\n");
332 "pata_sl82c105: Early bridge revision, no DMA available\n");
338 return ata_pci_bmdma_init_one(dev, ppi, &sl82c105_sht,
NULL, 0);
342 static int sl82c105_reinit_one(
struct pci_dev *pdev)
347 rc = ata_pci_device_do_resume(pdev);
351 sl82c105_fixup(pdev);
353 ata_host_resume(host);
364 static struct pci_driver sl82c105_pci_driver = {
366 .id_table = sl82c105,
367 .probe = sl82c105_init_one,
368 .remove = ata_pci_remove_one,
370 .suspend = ata_pci_device_suspend,
371 .resume = sl82c105_reinit_one,