scsi: g_NCR5380: Re-work PDMA loops
authorOndrej Zary <linux@rainbow-software.org>
Mon, 3 Jul 2017 07:59:06 +0000 (03:59 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 7 Aug 2017 18:04:00 +0000 (14:04 -0400)
commit99a974e6b8b0734fd2f5d8185e640aba0d6da06f
treee6cd80216efa3409984f6f3634b096fd7fdcc3f8
parentab2ace2df9b20f0c1111560b275ad38ed36703fc
scsi: g_NCR5380: Re-work PDMA loops

The polling loops in pread() and pwrite() can easily become infinite
loops and hang the machine.

Merge the IRQ check into host buffer wait loop and add polling limit.

Also place a limit on polling for 53C80 registers accessibility.

[Use NCR5380_poll_politely2() for register polling. Rely on polling for
gated IRQ rather than polling for phase error, like the algorithm in the
53c400 datasheet. Move DTC436 workarounds into a separate patch.
Factor-out common code as wait_for_53c80_access(). Rework the residual
calculations. -- F.T.]

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/g_NCR5380.c