32 #include <linux/kernel.h>
33 #include <linux/module.h>
34 #include <linux/pci.h>
41 #define DRV_NAME "pata_sc1200"
42 #define DRV_VERSION "0.2.6"
44 #define SC1200_REV_A 0x00
45 #define SC1200_REV_B1 0x01
46 #define SC1200_REV_B3 0x02
47 #define SC1200_REV_C1 0x03
48 #define SC1200_REV_D1 0x04
57 static int sc1200_clock(
void)
61 u8 silicon_rev =
inb(0x903D);
70 pci_clock =
inw(0x901E);
88 static const u32 pio_timings[4][5] = {
90 { 0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010 },
92 { 0xd1329172, 0x71212171, 0x30200080, 0x20102010, 0x00100010 },
94 { 0xfaa3f4f3, 0xc23232b2, 0x513101c1, 0x31213121, 0x10211021 },
96 { 0xfff4fff4, 0xf35353d3, 0x814102f1, 0x42314231, 0x11311131 }
104 pci_read_config_dword(pdev, reg + 4, &format);
106 format += sc1200_clock();
107 pci_write_config_dword(pdev, reg + 8 * adev->
devno,
108 pio_timings[format][mode]);
122 static const u32 udma_timing[3][3] = {
123 { 0x00921250, 0x00911140, 0x00911030 },
124 { 0x00932470, 0x00922260, 0x00922140 },
125 { 0x009436A1, 0x00933481, 0x00923261 }
128 static const u32 mwdma_timing[3][3] = {
129 { 0x00077771, 0x00012121, 0x00002020 },
130 { 0x000BBBB2, 0x00024241, 0x00013131 },
131 { 0x000FFFF3, 0x00035352, 0x00015151 }
134 int clock = sc1200_clock();
145 if (adev->
devno == 0) {
148 pci_read_config_dword(pdev, reg + 4, &timings);
149 timings &= 0x80000000
UL;
151 pci_write_config_dword(pdev, reg + 4, timings);
153 pci_write_config_dword(pdev, reg + 12, format);
173 if (ata_dma_enabled(adev) && adev != prev && prev !=
NULL) {
175 if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
176 (ata_using_udma(prev) && !ata_using_udma(adev)))
178 sc1200_set_dmamode(ap, adev);
181 return ata_bmdma_qc_issue(qc);
215 .inherits = &ata_bmdma_port_ops,
216 .qc_prep = ata_bmdma_dumb_qc_prep,
217 .qc_issue = sc1200_qc_issue,
218 .qc_defer = sc1200_qc_defer,
220 .set_piomode = sc1200_set_piomode,
221 .set_dmamode = sc1200_set_dmamode,
240 .port_ops = &sc1200_port_ops
244 return ata_pci_bmdma_init_one(dev, ppi, &sc1200_sht,
NULL, 0);
253 static struct pci_driver sc1200_pci_driver = {
256 .probe = sc1200_init_one,
257 .remove = ata_pci_remove_one,
259 .suspend = ata_pci_device_suspend,
260 .resume = ata_pci_device_resume,