aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/sl82c105.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/sl82c105.c')
-rw-r--r--drivers/ide/pci/sl82c105.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index a7323d278c49..0947cab00595 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -52,12 +52,13 @@
52 * Convert a PIO mode and cycle time to the required on/off times 52 * Convert a PIO mode and cycle time to the required on/off times
53 * for the interface. This has protection against runaway timings. 53 * for the interface. This has protection against runaway timings.
54 */ 54 */
55static unsigned int get_pio_timings(ide_pio_data_t *p) 55static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio)
56{ 56{
57 unsigned int cmd_on, cmd_off; 57 unsigned int cmd_on, cmd_off;
58 u8 iordy = 0;
58 59
59 cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; 60 cmd_on = (ide_pio_timings[pio].active_time + 29) / 30;
60 cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; 61 cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30;
61 62
62 if (cmd_on == 0) 63 if (cmd_on == 0)
63 cmd_on = 1; 64 cmd_on = 1;
@@ -65,7 +66,10 @@ static unsigned int get_pio_timings(ide_pio_data_t *p)
65 if (cmd_off == 0) 66 if (cmd_off == 0)
66 cmd_off = 1; 67 cmd_off = 1;
67 68
68 return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); 69 if (pio > 2 || ide_dev_has_iordy(drive->id))
70 iordy = 0x40;
71
72 return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy;
69} 73}
70 74
71/* 75/*
@@ -75,14 +79,13 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
75{ 79{
76 struct pci_dev *dev = HWIF(drive)->pci_dev; 80 struct pci_dev *dev = HWIF(drive)->pci_dev;
77 int reg = 0x44 + drive->dn * 4; 81 int reg = 0x44 + drive->dn * 4;
78 ide_pio_data_t p;
79 u16 drv_ctrl; 82 u16 drv_ctrl;
80 83
81 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); 84 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio));
82 85
83 pio = ide_get_best_pio_mode(drive, pio, 5, &p); 86 pio = ide_get_best_pio_mode(drive, pio, 5);
84 87
85 drv_ctrl = get_pio_timings(&p); 88 drv_ctrl = get_pio_timings(drive, pio);
86 89
87 /* 90 /*
88 * Store the PIO timings so that we can restore them 91 * Store the PIO timings so that we can restore them
@@ -101,7 +104,8 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
101 } 104 }
102 105
103 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, 106 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name,
104 ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl); 107 ide_xfer_verbose(pio + XFER_PIO_0),
108 ide_pio_cycle_time(drive, pio), drv_ctrl);
105 109
106 return pio; 110 return pio;
107} 111}
@@ -449,10 +453,10 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = {
449 .name = "W82C105", 453 .name = "W82C105",
450 .init_chipset = init_chipset_sl82c105, 454 .init_chipset = init_chipset_sl82c105,
451 .init_hwif = init_hwif_sl82c105, 455 .init_hwif = init_hwif_sl82c105,
452 .channels = 2,
453 .autodma = NOAUTODMA, 456 .autodma = NOAUTODMA,
454 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 457 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
455 .bootable = ON_BOARD, 458 .bootable = ON_BOARD,
459 .pio_mask = ATA_PIO5,
456}; 460};
457 461
458static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) 462static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)