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

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 1997-2005 Russell King
8 * 30-08-1997 RMK 0.0.0 Created, READONLY version.
9 * 22-01-1998 RMK 0.0.1 Updated to 2.1.80.
10 * 15-04-1998 RMK 0.0.1 Only do PIO if FAS216 will allow it.
11 * 02-05-1998 RMK 0.0.2 Updated & added DMA support.
12 * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h
13 * 18-08-1998 RMK 0.0.3 Fixed synchronous transfer depth.
14 * 02-04-2000 RMK 0.0.4 Updated for new error handling code.
25 #include <linux/dma-mapping.h>
67 * Use term=0,1,0,0,0 to turn terminators on/off
69 static int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 }; variable
86 * Params : ec - expansion card structure
87 * : irqnr - interrupt number
92 struct cumanascsi2_info *info = ec->irq_data; in cumanascsi_2_irqenable()
93 writeb(ALATCH_ENA_INT, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_irqenable()
98 * Params : ec - expansion card structure
99 * : irqnr - interrupt number
104 struct cumanascsi2_info *info = ec->irq_data; in cumanascsi_2_irqdisable()
105 writeb(ALATCH_DIS_INT, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_irqdisable()
115 * Params : host - card to turn on/off
116 * : on_off - !0 to turn on, 0 to turn off
121 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_terminator_ctl()
124 info->terms = 1; in cumanascsi_2_terminator_ctl()
125 writeb(ALATCH_ENA_TERM, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_terminator_ctl()
127 info->terms = 0; in cumanascsi_2_terminator_ctl()
128 writeb(ALATCH_DIS_TERM, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_terminator_ctl()
134 * Params : irq - interrupt number
135 * dev_id - user-defined (Scsi_Host structure)
142 return fas216_intr(&info->info); in cumanascsi_2_intr()
147 * Params : host - host
148 * SCpnt - command
149 * direction - DMA on to/off of card
150 * min_type - minimum DMA support that we must have for this transfer
157 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_dma_setup()
159 int dmach = info->info.scsi.dma; in cumanascsi_2_dma_setup()
161 writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_dma_setup()
164 (min_type == fasdma_real_all || SCp->this_residual >= 512)) { in cumanascsi_2_dma_setup()
167 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); in cumanascsi_2_dma_setup()
179 dma_map_sg(dev, info->sg, bufs, map_dir); in cumanascsi_2_dma_setup()
182 set_dma_sg(dmach, info->sg, bufs); in cumanascsi_2_dma_setup()
183 writeb(alatch_dir, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_dma_setup()
186 writeb(ALATCH_ENA_DMA, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_dma_setup()
187 writeb(ALATCH_DIS_BIT32, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_dma_setup()
201 * Params : host - host
202 * SCpnt - command
203 * direction - DMA on to/off of card
204 * transfer - minimum number of bytes we expect to transfer
210 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_dma_pseudo()
214 length = SCp->this_residual; in cumanascsi_2_dma_pseudo()
215 addr = SCp->ptr; in cumanascsi_2_dma_pseudo()
220 unsigned long word; in cumanascsi_2_dma_pseudo()
221 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); in cumanascsi_2_dma_pseudo()
230 writew(word, info->base + CUMANASCSI2_PSEUDODMA); in cumanascsi_2_dma_pseudo()
232 length -= 2; in cumanascsi_2_dma_pseudo()
240 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); in cumanascsi_2_dma_pseudo()
248 readsw(info->base + CUMANASCSI2_PSEUDODMA, in cumanascsi_2_dma_pseudo()
251 length -= 256; in cumanascsi_2_dma_pseudo()
256 unsigned long word; in cumanascsi_2_dma_pseudo()
257 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); in cumanascsi_2_dma_pseudo()
265 word = readw(info->base + CUMANASCSI2_PSEUDODMA); in cumanascsi_2_dma_pseudo()
267 if (--length > 0) { in cumanascsi_2_dma_pseudo()
269 length --; in cumanascsi_2_dma_pseudo()
277 * Params : host - host
278 * SCpnt - command
283 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_dma_stop()
284 if (info->info.scsi.dma != NO_DMA) { in cumanascsi_2_dma_stop()
285 writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH); in cumanascsi_2_dma_stop()
286 disable_dma(info->info.scsi.dma); in cumanascsi_2_dma_stop()
292 * Params : host - driver host structure to return info for.
297 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_info()
301 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in cumanascsi_2_info()
302 VERSION, info->terms ? "n" : "ff"); in cumanascsi_2_info()
309 * Params : host - host to setup
310 * : buffer - buffer containing string describing operation
311 * : length - length of string
312 * Returns : -EINVAL, or 0
321 length -= 11; in cumanascsi_2_set_proc_info()
323 if (length >= 5 && strncmp(buffer, "term=", 5) == 0) { in cumanascsi_2_set_proc_info()
329 ret = -EINVAL; in cumanascsi_2_set_proc_info()
331 ret = -EINVAL; in cumanascsi_2_set_proc_info()
334 ret = -EINVAL; in cumanascsi_2_set_proc_info()
343 info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi_2_show_info()
346 fas216_print_host(&info->info, m); in cumanascsi_2_show_info()
347 seq_printf(m, "Term : o%s\n", in cumanascsi_2_show_info()
348 info->terms ? "n" : "ff"); in cumanascsi_2_show_info()
350 fas216_print_stats(&info->info, m); in cumanascsi_2_show_info()
351 fas216_print_devices(&info->info, m); in cumanascsi_2_show_info()
387 ret = -ENOMEM; in cumanascsi2_probe()
394 ret = -ENOMEM; in cumanascsi2_probe()
400 info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi2_probe()
401 info->ec = ec; in cumanascsi2_probe()
402 info->base = base; in cumanascsi2_probe()
404 cumanascsi_2_terminator_ctl(host, term[ec->slot_no]); in cumanascsi2_probe()
406 info->info.scsi.io_base = base + CUMANASCSI2_FAS216_OFFSET; in cumanascsi2_probe()
407 info->info.scsi.io_shift = CUMANASCSI2_FAS216_SHIFT; in cumanascsi2_probe()
408 info->info.scsi.irq = ec->irq; in cumanascsi2_probe()
409 info->info.scsi.dma = ec->dma; in cumanascsi2_probe()
410 info->info.ifcfg.clockrate = 40; /* MHz */ in cumanascsi2_probe()
411 info->info.ifcfg.select_timeout = 255; in cumanascsi2_probe()
412 info->info.ifcfg.asyncperiod = 200; /* ns */ in cumanascsi2_probe()
413 info->info.ifcfg.sync_max_depth = 7; in cumanascsi2_probe()
414 info->info.ifcfg.cntl3 = CNTL3_BS8 | CNTL3_FASTSCSI | CNTL3_FASTCLK; in cumanascsi2_probe()
415 info->info.ifcfg.disconnect_ok = 1; in cumanascsi2_probe()
416 info->info.ifcfg.wide_max_size = 0; in cumanascsi2_probe()
417 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; in cumanascsi2_probe()
418 info->info.dma.setup = cumanascsi_2_dma_setup; in cumanascsi2_probe()
419 info->info.dma.pseudo = cumanascsi_2_dma_pseudo; in cumanascsi2_probe()
420 info->info.dma.stop = cumanascsi_2_dma_stop; in cumanascsi2_probe()
422 ec->irqaddr = info->base + CUMANASCSI2_STATUS; in cumanascsi2_probe()
423 ec->irqmask = STATUS_INT; in cumanascsi2_probe()
431 ret = request_irq(ec->irq, cumanascsi_2_intr, in cumanascsi2_probe()
435 host->host_no, ec->irq, ret); in cumanascsi2_probe()
439 if (info->info.scsi.dma != NO_DMA) { in cumanascsi2_probe()
440 if (request_dma(info->info.scsi.dma, "cumanascsi2")) { in cumanascsi2_probe()
442 host->host_no, info->info.scsi.dma); in cumanascsi2_probe()
443 info->info.scsi.dma = NO_DMA; in cumanascsi2_probe()
445 set_dma_speed(info->info.scsi.dma, 180); in cumanascsi2_probe()
446 info->info.ifcfg.capabilities |= FASCAP_DMA; in cumanascsi2_probe()
450 ret = fas216_add(host, &ec->dev); in cumanascsi2_probe()
454 if (info->info.scsi.dma != NO_DMA) in cumanascsi2_probe()
455 free_dma(info->info.scsi.dma); in cumanascsi2_probe()
456 free_irq(ec->irq, info); in cumanascsi2_probe()
474 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; in cumanascsi2_remove()
479 if (info->info.scsi.dma != NO_DMA) in cumanascsi2_remove()
480 free_dma(info->info.scsi.dma); in cumanascsi2_remove()
481 free_irq(ec->irq, info); in cumanascsi2_remove()
516 MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines");
517 module_param_array(term, int, NULL, 0);
518 MODULE_PARM_DESC(term, "SCSI bus termination");