19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/pci.h>
25 #include <linux/device.h>
30 #define DRV_NAME "pata_artop"
31 #define DRV_VERSION "0.4.6"
50 static int artop62x0_pre_reset(
struct ata_link *
link,
unsigned long deadline)
52 static const struct pci_bits artop_enable_bits[] = {
53 { 0x4A
U, 1
U, 0x02
UL, 0x02UL },
54 { 0x4A
U, 1
U, 0x04
UL, 0x04UL },
62 !pci_test_config_bits(pdev, &artop_enable_bits[ap->
port_no]))
75 static int artop6260_cable_detect(
struct ata_port *ap)
79 pci_read_config_byte(pdev, 0x49, &tmp);
104 { 0x0000, 0x000A, 0x0008, 0x0303, 0x0301 },
105 { 0x0700, 0x070A, 0x0708, 0x0403, 0x0401 }
109 pci_write_config_word(pdev, 0x40 + 2 * dn, timing[
clock][pio]);
135 pci_read_config_byte(pdev, 0x54, &ultra);
136 ultra &= ~(3 << (2 *
dn));
137 pci_write_config_byte(pdev, 0x54, ultra);
158 { 0x00, 0x0A, 0x08, 0x33, 0x31 },
159 { 0x70, 0x7A, 0x78, 0x43, 0x41 }
163 pci_write_config_byte(pdev, 0x40 + dn, timing[
clock][pio]);
188 pci_read_config_byte(pdev, 0x44 + ap->
port_no, &ultra);
189 ultra &= ~(7 << (4 * adev->
devno));
190 pci_write_config_byte(pdev, 0x44 + ap->
port_no, ultra);
217 artop6210_load_piomode(ap, adev, pio);
219 pci_read_config_byte(pdev, 0x54, &ultra);
220 ultra &= ~(3 << (2 *
dn));
227 ultra |= (mode << (2 *
dn));
229 pci_write_config_byte(pdev, 0x54, ultra);
256 artop6260_load_piomode(ap, adev, pio);
259 pci_read_config_byte(pdev, 0x44 + ap->
port_no, &ultra);
260 ultra &= ~(7 << (4 * adev->
devno));
265 ultra |= (mode << (4 * adev->
devno));
267 pci_write_config_byte(pdev, 0x44 + ap->
port_no, ultra);
300 .inherits = &ata_bmdma_port_ops,
302 .set_piomode = artop6210_set_piomode,
303 .set_dmamode = artop6210_set_dmamode,
304 .prereset = artop62x0_pre_reset,
305 .qc_defer = artop6210_qc_defer,
309 .inherits = &ata_bmdma_port_ops,
310 .cable_detect = artop6260_cable_detect,
311 .set_piomode = artop6260_set_piomode,
312 .set_dmamode = artop6260_set_dmamode,
313 .prereset = artop62x0_pre_reset,
316 static void atp8xx_fixup(
struct pci_dev *pdev)
318 if (pdev->
device == 0x0005)
320 pci_write_config_byte(pdev, 0x54, 0);
321 else if (pdev->
device == 0x0008 || pdev->
device == 0x0009) {
328 pci_read_config_byte(pdev, 0x49, ®);
329 pci_write_config_byte(pdev, 0x49, reg & ~0x30);
339 pci_read_config_byte(pdev, 0x4a, ®);
340 pci_write_config_byte(pdev, 0x4a, (reg & ~0x01) | 0x80);
365 .port_ops = &artop6210_ops,
372 .port_ops = &artop6260_ops,
379 .port_ops = &artop6260_ops,
386 .port_ops = &artop6260_ops,
406 ppi[0] = &info_628x_fast;
413 return ata_pci_bmdma_init_one(pdev, ppi, &artop_sht,
NULL, 0);
427 static int atp8xx_reinit_one(
struct pci_dev *pdev)
432 rc = ata_pci_device_do_resume(pdev);
438 ata_host_resume(host);
445 .id_table = artop_pci_tbl,
446 .probe = artop_init_one,
447 .remove = ata_pci_remove_one,
449 .suspend = ata_pci_device_suspend,
450 .resume = atp8xx_reinit_one,