15 #include <linux/kernel.h>
16 #include <linux/module.h>
17 #include <linux/pci.h>
24 #define DRV_NAME "pata_pdc202xx_old"
25 #define DRV_VERSION "0.4.3"
27 static int pdc2026x_cable_detect(
struct ata_port *ap)
32 pci_read_config_word(pdev, 0x50, &cis);
33 if (cis & (1 << (10 + ap->
port_no)))
38 static void pdc202xx_exec_command(
struct ata_port *ap,
47 static bool pdc202xx_irq_check(
struct ata_port *ap)
51 u8 sc1d =
inb(master + 0x1d);
83 static u16 pio_timing[5] = {
84 0x0913, 0x050C , 0x0308, 0x0206, 0x0104
88 pci_read_config_byte(pdev, port, &r_ap);
89 pci_read_config_byte(pdev, port + 1, &r_bp);
92 r_ap |= (pio_timing[
pio] >> 8);
93 r_bp |= (pio_timing[
pio] & 0xFF);
99 pci_write_config_byte(pdev, port, r_ap);
100 pci_write_config_byte(pdev, port + 1, r_bp);
130 static u8 udma_timing[6][2] = {
138 static u8 mdma_timing[3][2] = {
145 pci_read_config_byte(pdev, port + 1, &r_bp);
146 pci_read_config_byte(pdev, port + 2, &r_cp);
153 r_bp |= udma_timing[speed][0];
154 r_cp |= udma_timing[speed][1];
158 r_bp |= mdma_timing[speed][0];
159 r_cp |= mdma_timing[speed][1];
161 pci_write_config_byte(pdev, port + 1, r_bp);
162 pci_write_config_byte(pdev, port + 2, r_cp);
182 int sel66 = ap->
port_no ? 0x08: 0x02;
184 void __iomem *master = ap->
host->ports[0]->ioaddr.bmdma_addr;
198 pdc202xx_set_dmamode(ap, qc->
dev);
233 int sel66 = ap->
port_no ? 0x08: 0x02;
235 void __iomem *master = ap->
host->ports[0]->ioaddr.bmdma_addr;
236 void __iomem *clock = master + 0x11;
248 pdc202xx_set_piomode(ap, adev);
260 static void pdc2026x_dev_config(
struct ata_device *adev)
265 static int pdc2026x_port_start(
struct ata_port *ap)
271 iowrite8(burst | 0x01, bmdma + 0x1f);
273 return ata_bmdma_port_start(ap);
299 .inherits = &ata_bmdma_port_ops,
302 .set_piomode = pdc202xx_set_piomode,
303 .set_dmamode = pdc202xx_set_dmamode,
305 .sff_exec_command = pdc202xx_exec_command,
306 .sff_irq_check = pdc202xx_irq_check,
310 .inherits = &pdc2024x_port_ops,
313 .bmdma_start = pdc2026x_bmdma_start,
314 .bmdma_stop = pdc2026x_bmdma_stop,
316 .cable_detect = pdc2026x_cable_detect,
317 .dev_config = pdc2026x_dev_config,
319 .port_start = pdc2026x_port_start,
321 .sff_exec_command = pdc202xx_exec_command,
322 .sff_irq_check = pdc202xx_irq_check,
333 .port_ops = &pdc2024x_port_ops
340 .port_ops = &pdc2026x_port_ops
347 .port_ops = &pdc2026x_port_ops
363 return ata_pci_bmdma_init_one(dev, ppi, &pdc202xx_sht,
NULL, 0);
376 static struct pci_driver pdc202xx_pci_driver = {
378 .id_table = pdc202xx,
379 .probe = pdc202xx_init_one,
380 .remove = ata_pci_remove_one,
382 .suspend = ata_pci_device_suspend,
383 .resume = ata_pci_device_resume,