diff options
Diffstat (limited to 'drivers/ide/sl82c105.c')
| -rw-r--r-- | drivers/ide/sl82c105.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index 0924abff52ff..d698da470d6f 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c | |||
| @@ -61,8 +61,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) | |||
| 61 | if (cmd_off == 0) | 61 | if (cmd_off == 0) |
| 62 | cmd_off = 1; | 62 | cmd_off = 1; |
| 63 | 63 | ||
| 64 | if ((pio > 2 || ata_id_has_iordy(drive->id)) && | 64 | if (ide_pio_need_iordy(drive, pio)) |
| 65 | !(pio > 4 && ata_id_is_cfa(drive->id))) | ||
| 66 | iordy = 0x40; | 65 | iordy = 0x40; |
| 67 | 66 | ||
| 68 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; | 67 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; |
| @@ -74,6 +73,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) | |||
| 74 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | 73 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) |
| 75 | { | 74 | { |
| 76 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | 75 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
| 76 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | ||
| 77 | int reg = 0x44 + drive->dn * 4; | 77 | int reg = 0x44 + drive->dn * 4; |
| 78 | u16 drv_ctrl; | 78 | u16 drv_ctrl; |
| 79 | 79 | ||
| @@ -83,8 +83,9 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 83 | * Store the PIO timings so that we can restore them | 83 | * Store the PIO timings so that we can restore them |
| 84 | * in case DMA will be turned off... | 84 | * in case DMA will be turned off... |
| 85 | */ | 85 | */ |
| 86 | drive->drive_data &= 0xffff0000; | 86 | timings &= 0xffff0000; |
| 87 | drive->drive_data |= drv_ctrl; | 87 | timings |= drv_ctrl; |
| 88 | ide_set_drivedata(drive, (void *)timings); | ||
| 88 | 89 | ||
| 89 | pci_write_config_word(dev, reg, drv_ctrl); | 90 | pci_write_config_word(dev, reg, drv_ctrl); |
| 90 | pci_read_config_word (dev, reg, &drv_ctrl); | 91 | pci_read_config_word (dev, reg, &drv_ctrl); |
| @@ -100,6 +101,7 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 100 | static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) | 101 | static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) |
| 101 | { | 102 | { |
| 102 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; | 103 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; |
| 104 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | ||
| 103 | u16 drv_ctrl; | 105 | u16 drv_ctrl; |
| 104 | 106 | ||
| 105 | DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", | 107 | DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", |
| @@ -111,8 +113,19 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
| 111 | * Store the DMA timings so that we can actually program | 113 | * Store the DMA timings so that we can actually program |
| 112 | * them when DMA will be turned on... | 114 | * them when DMA will be turned on... |
| 113 | */ | 115 | */ |
| 114 | drive->drive_data &= 0x0000ffff; | 116 | timings &= 0x0000ffff; |
| 115 | drive->drive_data |= (unsigned long)drv_ctrl << 16; | 117 | timings |= (unsigned long)drv_ctrl << 16; |
| 118 | ide_set_drivedata(drive, (void *)timings); | ||
| 119 | } | ||
| 120 | |||
| 121 | static int sl82c105_test_irq(ide_hwif_t *hwif) | ||
| 122 | { | ||
| 123 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
| 124 | u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; | ||
| 125 | |||
| 126 | pci_read_config_dword(dev, 0x40, &val); | ||
| 127 | |||
| 128 | return (val & mask) ? 1 : 0; | ||
| 116 | } | 129 | } |
| 117 | 130 | ||
| 118 | /* | 131 | /* |
| @@ -185,7 +198,8 @@ static void sl82c105_dma_start(ide_drive_t *drive) | |||
| 185 | 198 | ||
| 186 | DBG(("%s(drive:%s)\n", __func__, drive->name)); | 199 | DBG(("%s(drive:%s)\n", __func__, drive->name)); |
| 187 | 200 | ||
| 188 | pci_write_config_word(dev, reg, drive->drive_data >> 16); | 201 | pci_write_config_word(dev, reg, |
| 202 | (unsigned long)ide_get_drivedata(drive) >> 16); | ||
| 189 | 203 | ||
| 190 | sl82c105_reset_host(dev); | 204 | sl82c105_reset_host(dev); |
| 191 | ide_dma_start(drive); | 205 | ide_dma_start(drive); |
| @@ -210,7 +224,8 @@ static int sl82c105_dma_end(ide_drive_t *drive) | |||
| 210 | 224 | ||
| 211 | ret = ide_dma_end(drive); | 225 | ret = ide_dma_end(drive); |
| 212 | 226 | ||
| 213 | pci_write_config_word(dev, reg, drive->drive_data); | 227 | pci_write_config_word(dev, reg, |
| 228 | (unsigned long)ide_get_drivedata(drive)); | ||
| 214 | 229 | ||
| 215 | return ret; | 230 | return ret; |
| 216 | } | 231 | } |
| @@ -289,6 +304,7 @@ static const struct ide_port_ops sl82c105_port_ops = { | |||
| 289 | .set_pio_mode = sl82c105_set_pio_mode, | 304 | .set_pio_mode = sl82c105_set_pio_mode, |
| 290 | .set_dma_mode = sl82c105_set_dma_mode, | 305 | .set_dma_mode = sl82c105_set_dma_mode, |
| 291 | .resetproc = sl82c105_resetproc, | 306 | .resetproc = sl82c105_resetproc, |
| 307 | .test_irq = sl82c105_test_irq, | ||
| 292 | }; | 308 | }; |
| 293 | 309 | ||
| 294 | static const struct ide_dma_ops sl82c105_dma_ops = { | 310 | static const struct ide_dma_ops sl82c105_dma_ops = { |
