Lines Matching +full:pio +full:- +full:transfer

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * A rewrite of the pcmcia-cs add-on driver for newer (circa 1997)
8 * The pcmcia-cs add-on version of this driver is not supported
36 * data in PIO mode. Note this can be changed via "sysfs".
72 #define SYNC_MODE 0 /* Synchronous transfer mode */
85 #define TC_LSB 0x00 /* transfer counter lsb */
86 #define TC_MSB 0x01 /* transfer counter msb */
94 #define SYNCPRD 0x06 /* synchronous transfer period */
103 #define TC_HIGH 0x0E /* transfer counter high */
110 #define PIO_FIFO 0x04 /* PIO FIFO registers (r/w) */
114 #define PIO_STATUS 0x08 /* PIO status (r/w) */
117 #define PIO_FLAG 0x0B /* PIO flag interrupt enable (r/w) */
188 * Repository for per-instance host data.
227 outb(0x05, io_port + SYNCPRD); /* Synchronous transfer period */ in chip_init()
284 reqlen -= len & 0xfc; in SYM53C500_pio_read()
286 while (len--) { in SYM53C500_pio_read()
288 reqlen--; in SYM53C500_pio_read()
335 reqlen -= len & 0xfc; in SYM53C500_pio_write()
337 while (len--) { in SYM53C500_pio_write()
339 reqlen--; in SYM53C500_pio_write()
356 int port_base = dev->io_port; in SYM53C500_intr()
358 (struct sym53c500_data *)dev->hostdata; in SYM53C500_intr()
359 struct scsi_cmnd *curSC = data->current_SC; in SYM53C500_intr()
361 int fast_pio = data->fast_pio; in SYM53C500_intr()
363 spin_lock_irqsave(dev->host_lock, flags); in SYM53C500_intr()
378 printk(", pio=%02x\n", pio_status); in SYM53C500_intr()
383 curSC->result = DID_RESET << 16; in SYM53C500_intr()
388 printk("SYM53C500: Warning: PIO error!\n"); in SYM53C500_intr()
389 curSC->result = DID_ERROR << 16; in SYM53C500_intr()
395 curSC->result = DID_PARITY << 16; in SYM53C500_intr()
401 curSC->result = DID_ERROR << 16; in SYM53C500_intr()
407 if (scp->phase != message_in) { /* Unexpected disconnect */ in SYM53C500_intr()
408 curSC->result = DID_NO_CONNECT << 16; in SYM53C500_intr()
410 curSC->result = (scp->status & 0xff) | in SYM53C500_intr()
411 ((scp->message & 0xff) << 8) | (DID_OK << 16); in SYM53C500_intr()
417 case 0x00: /* DATA-OUT */ in SYM53C500_intr()
418 if (int_reg & 0x10) { /* Target requesting info transfer */ in SYM53C500_intr()
422 scp->phase = data_out; in SYM53C500_intr()
423 VDEB(printk("SYM53C500: Data-Out phase\n")); in SYM53C500_intr()
425 LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ in SYM53C500_intr()
430 sg_virt(sg), sg->length); in SYM53C500_intr()
436 case 0x01: /* DATA-IN */ in SYM53C500_intr()
437 if (int_reg & 0x10) { /* Target requesting info transfer */ in SYM53C500_intr()
441 scp->phase = data_in; in SYM53C500_intr()
442 VDEB(printk("SYM53C500: Data-In phase\n")); in SYM53C500_intr()
444 LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ in SYM53C500_intr()
449 sg_virt(sg), sg->length); in SYM53C500_intr()
456 scp->phase = command_ph; in SYM53C500_intr()
461 scp->phase = status_ph; in SYM53C500_intr()
472 case 0x06: /* MESSAGE-OUT */ in SYM53C500_intr()
473 DEB(printk("SYM53C500: Message-Out phase\n")); in SYM53C500_intr()
474 scp->phase = message_out; in SYM53C500_intr()
479 case 0x07: /* MESSAGE-IN */ in SYM53C500_intr()
480 VDEB(printk("SYM53C500: Message-In phase\n")); in SYM53C500_intr()
481 scp->phase = message_in; in SYM53C500_intr()
483 scp->status = inb(port_base + SCSI_FIFO); in SYM53C500_intr()
484 scp->message = inb(port_base + SCSI_FIFO); in SYM53C500_intr()
487 DEB(printk("Status = %02x Message = %02x\n", scp->status, scp->message)); in SYM53C500_intr()
489 if (scp->message == SAVE_POINTERS || scp->message == DISCONNECT) { in SYM53C500_intr()
497 spin_unlock_irqrestore(dev->host_lock, flags); in SYM53C500_intr()
501 scp->phase = idle; in SYM53C500_intr()
509 struct scsi_info_t *info = link->priv; in SYM53C500_release()
510 struct Scsi_Host *shost = info->host; in SYM53C500_release()
512 dev_dbg(&link->dev, "SYM53C500_release\n"); in SYM53C500_release()
523 if (shost->irq) in SYM53C500_release()
524 free_irq(shost->irq, shost); in SYM53C500_release()
525 if (shost->io_port && shost->n_io_port) in SYM53C500_release()
526 release_region(shost->io_port, shost->n_io_port); in SYM53C500_release()
538 (struct sym53c500_data *)SChost->hostdata; in SYM53C500_info()
542 "SYM53C500 at 0x%lx, IRQ %d, %s PIO mode.", in SYM53C500_info()
543 SChost->io_port, SChost->irq, data->fast_pio ? "fast" : "slow"); in SYM53C500_info()
551 int port_base = SCpnt->device->host->io_port; in SYM53C500_queue_lck()
553 (struct sym53c500_data *)SCpnt->device->host->hostdata; in SYM53C500_queue_lck()
558 SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id, in SYM53C500_queue_lck()
559 (u8)SCpnt->device->lun, scsi_bufflen(SCpnt))); in SYM53C500_queue_lck()
561 VDEB(for (i = 0; i < SCpnt->cmd_len; i++) in SYM53C500_queue_lck()
562 printk("cmd[%d]=%02x ", i, SCpnt->cmnd[i])); in SYM53C500_queue_lck()
565 data->current_SC = SCpnt; in SYM53C500_queue_lck()
566 scp->phase = command_ph; in SYM53C500_queue_lck()
567 scp->status = 0; in SYM53C500_queue_lck()
568 scp->message = 0; in SYM53C500_queue_lck()
575 for (i = 0; i < SCpnt->cmd_len; i++) { in SYM53C500_queue_lck()
576 outb(SCpnt->cmnd[i], port_base + SCSI_FIFO); in SYM53C500_queue_lck()
588 int port_base = SCpnt->device->host->io_port; in DEF_SCSI_QCMD()
591 spin_lock_irq(SCpnt->device->host->host_lock); in DEF_SCSI_QCMD()
593 spin_unlock_irq(SCpnt->device->host->host_lock); in DEF_SCSI_QCMD()
625 (struct sym53c500_data *)SHp->hostdata; in SYM53C500_show_pio()
627 return snprintf(buf, 4, "%d\n", data->fast_pio); in SYM53C500_show_pio()
634 int pio; in SYM53C500_store_pio() local
637 (struct sym53c500_data *)SHp->hostdata; in SYM53C500_store_pio()
639 pio = simple_strtoul(buf, NULL, 0); in SYM53C500_store_pio()
640 if (pio == 0 || pio == 1) { in SYM53C500_store_pio()
641 data->fast_pio = pio; in SYM53C500_store_pio()
645 return -EINVAL; in SYM53C500_store_pio()
688 p_dev->io_lines = 10; in SYM53C500_config_check()
689 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; in SYM53C500_config_check()
690 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; in SYM53C500_config_check()
692 if (p_dev->resource[0]->start == 0) in SYM53C500_config_check()
693 return -ENODEV; in SYM53C500_config_check()
701 struct scsi_info_t *info = link->priv; in SYM53C500_config()
708 dev_dbg(&link->dev, "SYM53C500_config\n"); in SYM53C500_config()
710 info->manf_id = link->manf_id; in SYM53C500_config()
716 if (!link->irq) in SYM53C500_config()
726 * section dealing with manufacturer IDs can be scrapped. --rct in SYM53C500_config()
728 if ((info->manf_id == MANFID_MACNICA) || in SYM53C500_config()
729 (info->manf_id == MANFID_PIONEER) || in SYM53C500_config()
730 (info->manf_id == 0x0098)) { in SYM53C500_config()
732 outb(0xb4, link->resource[0]->start + 0xd); in SYM53C500_config()
733 outb(0x24, link->resource[0]->start + 0x9); in SYM53C500_config()
734 outb(0x04, link->resource[0]->start + 0xd); in SYM53C500_config()
738 * irq_level == 0 implies tpnt->can_queue == 0, which in SYM53C500_config()
747 port_base = link->resource[0]->start; in SYM53C500_config()
748 irq_level = link->irq; in SYM53C500_config()
761 data = (struct sym53c500_data *)host->hostdata; in SYM53C500_config()
777 host->unique_id = port_base; in SYM53C500_config()
778 host->irq = irq_level; in SYM53C500_config()
779 host->io_port = port_base; in SYM53C500_config()
780 host->n_io_port = 0x10; in SYM53C500_config()
781 host->dma_channel = -1; in SYM53C500_config()
787 data->fast_pio = USE_FAST_PIO; in SYM53C500_config()
789 info->host = host; in SYM53C500_config()
805 return -ENODEV; in SYM53C500_config()
809 return -ENODEV; in SYM53C500_config()
814 struct scsi_info_t *info = link->priv; in sym53c500_resume()
817 if ((info->manf_id == MANFID_MACNICA) || in sym53c500_resume()
818 (info->manf_id == MANFID_PIONEER) || in sym53c500_resume()
819 (info->manf_id == 0x0098)) { in sym53c500_resume()
820 outb(0x80, link->resource[0]->start + 0xd); in sym53c500_resume()
821 outb(0x24, link->resource[0]->start + 0x9); in sym53c500_resume()
822 outb(0x04, link->resource[0]->start + 0xd); in sym53c500_resume()
828 SYM53C500_int_host_reset(link->resource[0]->start); in sym53c500_resume()
836 dev_dbg(&link->dev, "SYM53C500_detach\n"); in SYM53C500_detach()
840 kfree(link->priv); in SYM53C500_detach()
841 link->priv = NULL; in SYM53C500_detach()
849 dev_dbg(&link->dev, "SYM53C500_attach()\n"); in SYM53C500_probe()
854 return -ENOMEM; in SYM53C500_probe()
855 info->p_dev = link; in SYM53C500_probe()
856 link->priv = info; in SYM53C500_probe()
857 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; in SYM53C500_probe()