X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fide-dma.c;h=d0e7b537353e38ea1bb23ff6f0604f0d93777752;hb=8e882ba111bb52fbb42c34a265afb97ddd4fcea1;hp=64fd78ba281083adeab928da2e7790d726112e94;hpb=062f9f024dcdb927cfd35c9ee8a68f59cbb1136f;p=linux-2.6-omap-h63xx.git diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 64fd78ba281..d0e7b537353 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -1,15 +1,13 @@ /* - * linux/drivers/ide/ide-dma.c Version 4.10 June 9, 2000 + * Copyright (C) 1995-1998 Mark Lord + * Copyright (C) 1999-2000 Andre Hedrick + * Copyright (C) 2004, 2007 Bartlomiej Zolnierkiewicz * - * Copyright (c) 1999-2000 Andre Hedrick * May be copied or modified under the terms of the GNU General Public License */ /* * Special Thanks to Mark for his Six years of work. - * - * Copyright (c) 1995-1998 Mark Lord - * May be copied or modified under the terms of the GNU General Public License */ /* @@ -149,7 +147,8 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive) u8 stat = 0, dma_stat = 0; dma_stat = HWIF(drive)->ide_dma_end(drive); - stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */ + stat = ide_read_status(drive); + if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { if (!dma_stat) { struct request *rq = HWGROUP(drive)->rq; @@ -199,7 +198,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) EXPORT_SYMBOL_GPL(ide_build_sglist); -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI +#ifdef CONFIG_BLK_DEV_IDEDMA_SFF /** * ide_build_dmatable - build IDE DMA table * @@ -317,7 +316,7 @@ void ide_destroy_dmatable (ide_drive_t *drive) EXPORT_SYMBOL_GPL(ide_destroy_dmatable); -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI +#ifdef CONFIG_BLK_DEV_IDEDMA_SFF /** * config_drive_for_dma - attempt to activate IDE DMA * @drive: the drive to place in DMA mode @@ -425,7 +424,7 @@ void ide_dma_host_set(ide_drive_t *drive, int on) } EXPORT_SYMBOL_GPL(ide_dma_host_set); -#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ +#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ /** * ide_dma_off_quietly - Generic DMA kill @@ -475,7 +474,7 @@ void ide_dma_on(ide_drive_t *drive) drive->hwif->dma_host_set(drive, 1); } -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI +#ifdef CONFIG_BLK_DEV_IDEDMA_SFF /** * ide_dma_setup - begin a DMA phase * @drive: target device @@ -592,7 +591,7 @@ static int __ide_dma_test_irq(ide_drive_t *drive) } #else static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } -#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ +#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ int __ide_dma_bad_drive (ide_drive_t *drive) { @@ -821,7 +820,27 @@ int ide_set_dma(ide_drive_t *drive) return 0; } -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI +void ide_check_dma_crc(ide_drive_t *drive) +{ + u8 mode; + + ide_dma_off_quietly(drive); + drive->crc_count = 0; + mode = drive->current_speed; + /* + * Don't try non Ultra-DMA modes without iCRC's. Force the + * device to PIO and make the user enable SWDMA/MWDMA modes. + */ + if (mode > XFER_UDMA_0 && mode <= XFER_UDMA_7) + mode--; + else + mode = XFER_PIO_4; + ide_set_xfer_rate(drive, mode); + if (drive->current_speed >= XFER_SW_DMA_0) + ide_dma_on(drive); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA_SFF void ide_dma_lost_irq (ide_drive_t *drive) { printk("%s: DMA interrupt recovery\n", drive->name); @@ -983,4 +1002,4 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base) } EXPORT_SYMBOL_GPL(ide_setup_dma); -#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ +#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */