Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ncr5380: Fix wait for 53C80 registers registers after PDMA

The check for 53C80 registers accessibility was commented out because
it was broken (inverted). Fix and enable it.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Ondrej Zary and committed by
Martin K. Petersen
42fc6370 aeb51152

+6 -31
+6 -31
drivers/scsi/g_NCR5380.c
··· 609 609 if (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) 610 610 printk("53C400r: no 53C80 gated irq after transfer"); 611 611 612 - #if 0 613 - /* 614 - * DON'T DO THIS - THEY NEVER ARRIVE! 615 - */ 616 - printk("53C400r: Waiting for 53C80 registers\n"); 617 - while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG) 612 + /* wait for 53C80 registers to be available */ 613 + while (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG)) 618 614 ; 619 - #endif 615 + 620 616 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) 621 617 printk(KERN_ERR "53C400r: no end dma signal\n"); 622 618 ··· 634 638 struct NCR5380_hostdata *hostdata = shost_priv(instance); 635 639 int blocks = len / 128; 636 640 int start = 0; 637 - int i; 638 641 639 642 NCR5380_write(hostdata->c400_ctl_status, CSR_BASE); 640 643 NCR5380_write(hostdata->c400_blk_cnt, blocks); ··· 682 687 blocks--; 683 688 } 684 689 685 - #if 0 686 - printk("53C400w: waiting for registers to be available\n"); 687 - THEY NEVER DO ! while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG); 688 - printk("53C400w: Got em\n"); 689 - #endif 690 - 691 - /* Let's wait for this instead - could be ugly */ 692 - /* All documentation says to check for this. Maybe my hardware is too 693 - * fast. Waiting for it seems to work fine! KLL 694 - */ 695 - while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) { 690 + /* wait for 53C80 registers to be available */ 691 + while (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG)) { 696 692 udelay(4); /* DTC436 chip hangs without this */ 697 693 /* FIXME - no timeout */ 698 694 } 699 695 700 - /* 701 - * I know. i is certainly != 0 here but the loop is new. See previous 702 - * comment. 703 - */ 704 - if (i) { 705 - if (!((i = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_END_DMA_TRANSFER)) 706 - printk(KERN_ERR "53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i); 707 - } else 708 - printk(KERN_ERR "53C400w: no 53C80 gated irq after transfer (last block)\n"); 709 - 710 - #if 0 711 696 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) { 712 697 printk(KERN_ERR "53C400w: no end dma signal\n"); 713 698 } 714 - #endif 699 + 715 700 while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT)) 716 701 ; // TIMEOUT 717 702 return 0;