Lines Matching +full:long +full:- +full:term

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 1997-2005 Russell King
12 * 01-10-1997 RMK Created, READONLY version
13 * 15-02-1998 RMK READ/WRITE version
15 * 14-03-1998 RMK Updated DMA support
17 * 15-04-1998 RMK Only do PIO if FAS216 will allow it.
18 * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h
19 * 02-04-2000 RMK 0.0.3 Fixed NO_IRQ/NO_DMA problem, updated for new
31 #include <linux/dma-mapping.h>
62 * Use term=0,1,0,0,0 to turn terminators on/off
64 static int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 }; variable
79 * Params : ec - expansion card structure
80 * : irqnr - interrupt number
85 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqenable()
87 info->control |= EESOX_INTR_ENABLE; in eesoxscsi_irqenable()
89 writeb(info->control, info->ctl_port); in eesoxscsi_irqenable()
94 * Params : ec - expansion card structure
95 * : irqnr - interrupt number
100 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqdisable()
102 info->control &= ~EESOX_INTR_ENABLE; in eesoxscsi_irqdisable()
104 writeb(info->control, info->ctl_port); in eesoxscsi_irqdisable()
114 * Params : host - card to turn on/off
115 * : on_off - !0 to turn on, 0 to turn off
120 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_terminator_ctl()
121 unsigned long flags; in eesoxscsi_terminator_ctl()
123 spin_lock_irqsave(host->host_lock, flags); in eesoxscsi_terminator_ctl()
125 info->control |= EESOX_TERM_ENABLE; in eesoxscsi_terminator_ctl()
127 info->control &= ~EESOX_TERM_ENABLE; in eesoxscsi_terminator_ctl()
129 writeb(info->control, info->ctl_port); in eesoxscsi_terminator_ctl()
130 spin_unlock_irqrestore(host->host_lock, flags); in eesoxscsi_terminator_ctl()
135 * Params : irq - interrupt number
136 * dev_id - user-defined (Scsi_Host structure)
143 return fas216_intr(&info->info); in eesoxscsi_intr()
148 * Params : host - host
149 * SCpnt - command
150 * direction - DMA on to/off of card
151 * min_type - minimum DMA support that we must have for this transfer
158 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_setup()
160 int dmach = info->info.scsi.dma; in eesoxscsi_dma_setup()
163 (min_type == fasdma_real_all || SCp->this_residual >= 512)) { in eesoxscsi_dma_setup()
166 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); in eesoxscsi_dma_setup()
176 dma_map_sg(dev, info->sg, bufs, map_dir); in eesoxscsi_dma_setup()
179 set_dma_sg(dmach, info->sg, bufs); in eesoxscsi_dma_setup()
197 register const unsigned long mask = 0xffff; in eesoxscsi_buffer_in()
231 status -= 2; in eesoxscsi_buffer_in()
232 length -= 2; in eesoxscsi_buffer_in()
236 unsigned long l1, l2; in eesoxscsi_buffer_in()
246 length -= 8; in eesoxscsi_buffer_in()
251 unsigned long l1; in eesoxscsi_buffer_in()
258 length -= 4; in eesoxscsi_buffer_in()
265 length -= 2; in eesoxscsi_buffer_in()
299 status = 16 - status; in eesoxscsi_buffer_out()
310 status -= 2; in eesoxscsi_buffer_out()
311 length -= 2; in eesoxscsi_buffer_out()
315 unsigned long l1, l2; in eesoxscsi_buffer_out()
326 length -= 8; in eesoxscsi_buffer_out()
331 unsigned long l1; in eesoxscsi_buffer_out()
338 length -= 4; in eesoxscsi_buffer_out()
345 length -= 2; in eesoxscsi_buffer_out()
354 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_pseudo()
356 eesoxscsi_buffer_in(SCp->ptr, SCp->this_residual, info->base); in eesoxscsi_dma_pseudo()
358 eesoxscsi_buffer_out(SCp->ptr, SCp->this_residual, info->base); in eesoxscsi_dma_pseudo()
364 * Params : host - host
365 * SCpnt - command
370 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_stop()
371 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_dma_stop()
372 disable_dma(info->info.scsi.dma); in eesoxscsi_dma_stop()
377 * Params : host - driver host structure to return info for.
382 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_info()
386 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in eesoxscsi_info()
387 VERSION, info->control & EESOX_TERM_ENABLE ? "n" : "ff"); in eesoxscsi_info()
394 * Params : host - host to setup
395 * : buffer - buffer containing string describing operation
396 * : length - length of string
397 * Returns : -EINVAL, or 0
406 length -= 9; in eesoxscsi_set_proc_info()
408 if (length >= 5 && strncmp(buffer, "term=", 5) == 0) { in eesoxscsi_set_proc_info()
414 ret = -EINVAL; in eesoxscsi_set_proc_info()
416 ret = -EINVAL; in eesoxscsi_set_proc_info()
418 ret = -EINVAL; in eesoxscsi_set_proc_info()
427 info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_show_info()
430 fas216_print_host(&info->info, m); in eesoxscsi_show_info()
431 seq_printf(m, "Term : o%s\n", in eesoxscsi_show_info()
432 info->control & EESOX_TERM_ENABLE ? "n" : "ff"); in eesoxscsi_show_info()
434 fas216_print_stats(&info->info, m); in eesoxscsi_show_info()
435 fas216_print_devices(&info->info, m); in eesoxscsi_show_info()
443 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_show_term()
445 return sprintf(buf, "%d\n", info->control & EESOX_TERM_ENABLE ? 1 : 0); in eesoxscsi_show_term()
452 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_store_term()
453 unsigned long flags; in eesoxscsi_store_term()
456 spin_lock_irqsave(host->host_lock, flags); in eesoxscsi_store_term()
458 info->control |= EESOX_TERM_ENABLE; in eesoxscsi_store_term()
460 info->control &= ~EESOX_TERM_ENABLE; in eesoxscsi_store_term()
462 writeb(info->control, info->ctl_port); in eesoxscsi_store_term()
463 spin_unlock_irqrestore(host->host_lock, flags); in eesoxscsi_store_term()
503 ret = -ENOMEM; in eesoxscsi_probe()
510 ret = -ENOMEM; in eesoxscsi_probe()
516 info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_probe()
517 info->ec = ec; in eesoxscsi_probe()
518 info->base = base; in eesoxscsi_probe()
519 info->ctl_port = base + EESOX_CONTROL; in eesoxscsi_probe()
520 info->control = term[ec->slot_no] ? EESOX_TERM_ENABLE : 0; in eesoxscsi_probe()
521 writeb(info->control, info->ctl_port); in eesoxscsi_probe()
523 info->info.scsi.io_base = base + EESOX_FAS216_OFFSET; in eesoxscsi_probe()
524 info->info.scsi.io_shift = EESOX_FAS216_SHIFT; in eesoxscsi_probe()
525 info->info.scsi.irq = ec->irq; in eesoxscsi_probe()
526 info->info.scsi.dma = ec->dma; in eesoxscsi_probe()
527 info->info.ifcfg.clockrate = 40; /* MHz */ in eesoxscsi_probe()
528 info->info.ifcfg.select_timeout = 255; in eesoxscsi_probe()
529 info->info.ifcfg.asyncperiod = 200; /* ns */ in eesoxscsi_probe()
530 info->info.ifcfg.sync_max_depth = 7; in eesoxscsi_probe()
531 info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK; in eesoxscsi_probe()
532 info->info.ifcfg.disconnect_ok = 1; in eesoxscsi_probe()
533 info->info.ifcfg.wide_max_size = 0; in eesoxscsi_probe()
534 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; in eesoxscsi_probe()
535 info->info.dma.setup = eesoxscsi_dma_setup; in eesoxscsi_probe()
536 info->info.dma.pseudo = eesoxscsi_dma_pseudo; in eesoxscsi_probe()
537 info->info.dma.stop = eesoxscsi_dma_stop; in eesoxscsi_probe()
539 ec->irqaddr = base + EESOX_DMASTAT; in eesoxscsi_probe()
540 ec->irqmask = EESOX_STAT_INTR; in eesoxscsi_probe()
544 device_create_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_probe()
550 ret = request_irq(ec->irq, eesoxscsi_intr, 0, "eesoxscsi", info); in eesoxscsi_probe()
553 host->host_no, ec->irq, ret); in eesoxscsi_probe()
557 if (info->info.scsi.dma != NO_DMA) { in eesoxscsi_probe()
558 if (request_dma(info->info.scsi.dma, "eesox")) { in eesoxscsi_probe()
560 host->host_no, info->info.scsi.dma); in eesoxscsi_probe()
561 info->info.scsi.dma = NO_DMA; in eesoxscsi_probe()
563 set_dma_speed(info->info.scsi.dma, 180); in eesoxscsi_probe()
564 info->info.ifcfg.capabilities |= FASCAP_DMA; in eesoxscsi_probe()
565 info->info.ifcfg.cntl3 |= CNTL3_BS8; in eesoxscsi_probe()
569 ret = fas216_add(host, &ec->dev); in eesoxscsi_probe()
573 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_probe()
574 free_dma(info->info.scsi.dma); in eesoxscsi_probe()
575 free_irq(ec->irq, info); in eesoxscsi_probe()
581 device_remove_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_probe()
594 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_remove()
599 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_remove()
600 free_dma(info->info.scsi.dma); in eesoxscsi_remove()
601 free_irq(ec->irq, info); in eesoxscsi_remove()
603 device_remove_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_remove()
639 module_param_array(term, int, NULL, 0);
640 MODULE_PARM_DESC(term, "SCSI bus termination");