NCR5380.c (e4dec6806aceca768b74c1c6402e6d31ecf3c960) | NCR5380.c (1bb4600245d4d40245dd505ca17528e0b9a9ba8c) |
---|---|
1/* 2 * NCR 5380 generic driver routines. These should make it *trivial* 3 * to implement 5380 SCSI drivers under Linux with a non-trantor 4 * architecture. 5 * 6 * Note that these routines also work with NR53c400 family chips. 7 * 8 * Copyright 1993, Drew Eckhardt --- 443 unchanged lines hidden (view full) --- 452 "can_queue %d, cmd_per_lun %d, " 453 "sg_tablesize %d, this_id %d, " 454 "flags { %s%s%s}, " 455 "options { %s} ", 456 instance->hostt->name, instance->io_port, instance->n_io_port, 457 instance->base, instance->irq, 458 instance->can_queue, instance->cmd_per_lun, 459 instance->sg_tablesize, instance->this_id, | 1/* 2 * NCR 5380 generic driver routines. These should make it *trivial* 3 * to implement 5380 SCSI drivers under Linux with a non-trantor 4 * architecture. 5 * 6 * Note that these routines also work with NR53c400 family chips. 7 * 8 * Copyright 1993, Drew Eckhardt --- 443 unchanged lines hidden (view full) --- 452 "can_queue %d, cmd_per_lun %d, " 453 "sg_tablesize %d, this_id %d, " 454 "flags { %s%s%s}, " 455 "options { %s} ", 456 instance->hostt->name, instance->io_port, instance->n_io_port, 457 instance->base, instance->irq, 458 instance->can_queue, instance->cmd_per_lun, 459 instance->sg_tablesize, instance->this_id, |
460 hostdata->flags & FLAG_NO_DMA_FIXUP ? "NO_DMA_FIXUP " : "", | 460 hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "", |
461 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", 462 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "", 463#ifdef AUTOPROBE_IRQ 464 "AUTOPROBE_IRQ " 465#endif 466#ifdef DIFFERENTIAL 467 "DIFFERENTIAL " 468#endif --- 1006 unchanged lines hidden (view full) --- 1475 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p)); 1476 1477 /* 1478 * Note : on my sample board, watch-dog timeouts occurred when interrupts 1479 * were not disabled for the duration of a single DMA transfer, from 1480 * before the setting of DMA mode to after transfer of the last byte. 1481 */ 1482 | 461 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", 462 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "", 463#ifdef AUTOPROBE_IRQ 464 "AUTOPROBE_IRQ " 465#endif 466#ifdef DIFFERENTIAL 467 "DIFFERENTIAL " 468#endif --- 1006 unchanged lines hidden (view full) --- 1475 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p)); 1476 1477 /* 1478 * Note : on my sample board, watch-dog timeouts occurred when interrupts 1479 * were not disabled for the duration of a single DMA transfer, from 1480 * before the setting of DMA mode to after transfer of the last byte. 1481 */ 1482 |
1483 if (hostdata->flags & FLAG_NO_DMA_FIXUP) | 1483 if (hostdata->flags & FLAG_DMA_FIXUP) 1484 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY); 1485 else |
1484 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY | 1485 MR_ENABLE_EOP_INTR); | 1486 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY | 1487 MR_ENABLE_EOP_INTR); |
1486 else 1487 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY); | |
1488 1489 dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG)); 1490 1491 /* 1492 * On the PAS16 at least I/O recovery delays are not needed here. 1493 * Everyone else seems to want them. 1494 */ 1495 --- 39 unchanged lines hidden (view full) --- 1535 * problem. The chosen fix is to DMA fewer bytes, then check for the 1536 * condition before taking the NCR5380 out of DMA mode. One or two extra 1537 * bytes are transferred via PIO as necessary to fill out the original 1538 * request. 1539 */ 1540 1541 if (p & SR_IO) { 1542 foo = NCR5380_pread(instance, d, | 1488 1489 dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG)); 1490 1491 /* 1492 * On the PAS16 at least I/O recovery delays are not needed here. 1493 * Everyone else seems to want them. 1494 */ 1495 --- 39 unchanged lines hidden (view full) --- 1535 * problem. The chosen fix is to DMA fewer bytes, then check for the 1536 * condition before taking the NCR5380 out of DMA mode. One or two extra 1537 * bytes are transferred via PIO as necessary to fill out the original 1538 * request. 1539 */ 1540 1541 if (p & SR_IO) { 1542 foo = NCR5380_pread(instance, d, |
1543 hostdata->flags & FLAG_NO_DMA_FIXUP ? c : c - 1); 1544 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { | 1543 hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c); 1544 if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { |
1545 /* 1546 * The workaround was to transfer fewer bytes than we 1547 * intended to with the pseudo-DMA read function, wait for 1548 * the chip to latch the last byte, read it, and then disable 1549 * pseudo-DMA mode. 1550 * 1551 * After REQ is asserted, the NCR5380 asserts DRQ and ACK. 1552 * REQ is deasserted when ACK is asserted, and not reasserted --- 13 unchanged lines hidden (view full) --- 1566 SR_REQ, 0, HZ) < 0) { 1567 foo = -1; 1568 shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n"); 1569 } 1570 d[c - 1] = NCR5380_read(INPUT_DATA_REG); 1571 } 1572 } else { 1573 foo = NCR5380_pwrite(instance, d, c); | 1545 /* 1546 * The workaround was to transfer fewer bytes than we 1547 * intended to with the pseudo-DMA read function, wait for 1548 * the chip to latch the last byte, read it, and then disable 1549 * pseudo-DMA mode. 1550 * 1551 * After REQ is asserted, the NCR5380 asserts DRQ and ACK. 1552 * REQ is deasserted when ACK is asserted, and not reasserted --- 13 unchanged lines hidden (view full) --- 1566 SR_REQ, 0, HZ) < 0) { 1567 foo = -1; 1568 shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n"); 1569 } 1570 d[c - 1] = NCR5380_read(INPUT_DATA_REG); 1571 } 1572 } else { 1573 foo = NCR5380_pwrite(instance, d, c); |
1574 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { | 1574 if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { |
1575 /* 1576 * Wait for the last byte to be sent. If REQ is being asserted for 1577 * the byte we're interested, we'll ACK it and it will go false. 1578 */ 1579 if (NCR5380_poll_politely2(instance, 1580 BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, 1581 BUS_AND_STATUS_REG, BASR_PHASE_MATCH, 0, HZ) < 0) { 1582 foo = -1; --- 695 unchanged lines hidden --- | 1575 /* 1576 * Wait for the last byte to be sent. If REQ is being asserted for 1577 * the byte we're interested, we'll ACK it and it will go false. 1578 */ 1579 if (NCR5380_poll_politely2(instance, 1580 BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, 1581 BUS_AND_STATUS_REG, BASR_PHASE_MATCH, 0, HZ) < 0) { 1582 foo = -1; --- 695 unchanged lines hidden --- |