--- drivers/ide/sl82c105.c 16 Aug 2001 13:50:23 -0000 1.3 +++ drivers/ide/sl82c105.c 17 Dec 2001 19:14:28 -0000 @@ -156,6 +156,29 @@ } /* + * Reset the controller. + * If we are using INTC under a w83c553 we need to use a magic test + * bit to do this. Return zero if successful (or applicable). + * + */ +static int sl82c105_hard_reset(ide_drive_t *drive) +{ + ide_hwif_t *hwif = HWIF(drive); + struct pci_dev *dev = hwif->pci_dev; + unsigned int reg; + + pci_read_config_dword(dev, 0x40, ®); /* LEGIRQ register */ + if (reg & (1<<11)) { /* Using INTC? */ + printk("sl82c105: resetting device\n"); + pci_read_config_dword(dev, 0x7e, ®); + pci_write_config_word(dev, 0x7e, reg | (1<<2)); + pci_write_config_word(dev, 0x7e, reg & (~(1<<2))); + return 0; + } + return 1; +} + +/* * Our own dmaproc, only to intercept ide_dma_check */ static int sl82c105_dmaproc(ide_dma_action_t func, ide_drive_t *drive) @@ -171,6 +194,11 @@ case ide_dma_off: config_for_pio(drive, 4, 0); break; + case ide_dma_lostirq: + case ide_dma_timeout: + if (sl82c105_hard_reset(drive) == 0) + return 0; + break; default: break; }