Lines Matching +full:dma +full:- +full:info
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
14 * added DMA support and hardware definitions
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>
35 #include <asm/dma.h>
73 FAS216_Info info; member
78 struct scatterlist sg[NR_SG]; /* Scatter DMA list */
83 * Params : ec - expansion card structure
84 * : irqnr - interrupt number
89 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqenable() local
91 info->control |= EESOX_INTR_ENABLE; in eesoxscsi_irqenable()
93 writeb(info->control, info->ctl_port); in eesoxscsi_irqenable()
98 * Params : ec - expansion card structure
99 * : irqnr - interrupt number
104 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqdisable() local
106 info->control &= ~EESOX_INTR_ENABLE; in eesoxscsi_irqdisable()
108 writeb(info->control, info->ctl_port); in eesoxscsi_irqdisable()
118 * Params : host - card to turn on/off
119 * : on_off - !0 to turn on, 0 to turn off
124 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_terminator_ctl() local
127 spin_lock_irqsave(host->host_lock, flags); in eesoxscsi_terminator_ctl()
129 info->control |= EESOX_TERM_ENABLE; in eesoxscsi_terminator_ctl()
131 info->control &= ~EESOX_TERM_ENABLE; in eesoxscsi_terminator_ctl()
133 writeb(info->control, info->ctl_port); in eesoxscsi_terminator_ctl()
134 spin_unlock_irqrestore(host->host_lock, flags); in eesoxscsi_terminator_ctl()
139 * Params : irq - interrupt number
140 * dev_id - user-defined (Scsi_Host structure)
145 struct eesoxscsi_info *info = dev_id; in eesoxscsi_intr() local
147 return fas216_intr(&info->info); in eesoxscsi_intr()
151 * Purpose : initialises DMA/PIO
152 * Params : host - host
153 * SCpnt - command
154 * direction - DMA on to/off of card
155 * min_type - minimum DMA support that we must have for this transfer
162 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_setup() local
164 int dmach = info->info.scsi.dma; in eesoxscsi_dma_setup()
167 (min_type == fasdma_real_all || SCp->this_residual >= 512)) { in eesoxscsi_dma_setup()
170 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); in eesoxscsi_dma_setup()
180 dma_map_sg(dev, info->sg, bufs, map_dir); in eesoxscsi_dma_setup()
183 set_dma_sg(dmach, info->sg, bufs); in eesoxscsi_dma_setup()
189 * We don't do DMA, we only do slow PIO in eesoxscsi_dma_setup()
191 * Some day, we will do Pseudo DMA in eesoxscsi_dma_setup()
214 * DMA request active? in eesoxscsi_buffer_in()
235 status -= 2; in eesoxscsi_buffer_in()
236 length -= 2; in eesoxscsi_buffer_in()
250 length -= 8; in eesoxscsi_buffer_in()
262 length -= 4; in eesoxscsi_buffer_in()
269 length -= 2; in eesoxscsi_buffer_in()
291 * DMA request active? in eesoxscsi_buffer_out()
303 status = 16 - status; in eesoxscsi_buffer_out()
314 status -= 2; in eesoxscsi_buffer_out()
315 length -= 2; in eesoxscsi_buffer_out()
330 length -= 8; in eesoxscsi_buffer_out()
342 length -= 4; in eesoxscsi_buffer_out()
349 length -= 2; in eesoxscsi_buffer_out()
358 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_pseudo() local
360 eesoxscsi_buffer_in(SCp->ptr, SCp->this_residual, info->base); in eesoxscsi_dma_pseudo()
362 eesoxscsi_buffer_out(SCp->ptr, SCp->this_residual, info->base); in eesoxscsi_dma_pseudo()
367 * Purpose : stops DMA/PIO
368 * Params : host - host
369 * SCpnt - command
374 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_dma_stop() local
375 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_dma_stop()
376 disable_dma(info->info.scsi.dma); in eesoxscsi_dma_stop()
381 * Params : host - driver host structure to return info for.
386 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_info() local
390 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in eesoxscsi_info()
391 VERSION, info->control & EESOX_TERM_ENABLE ? "n" : "ff"); in eesoxscsi_info()
398 * Params : host - host to setup
399 * : buffer - buffer containing string describing operation
400 * : length - length of string
401 * Returns : -EINVAL, or 0
410 length -= 9; in eesoxscsi_set_proc_info()
418 ret = -EINVAL; in eesoxscsi_set_proc_info()
420 ret = -EINVAL; in eesoxscsi_set_proc_info()
422 ret = -EINVAL; in eesoxscsi_set_proc_info()
429 struct eesoxscsi_info *info; in eesoxscsi_show_info() local
431 info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_show_info()
434 fas216_print_host(&info->info, m); in eesoxscsi_show_info()
436 info->control & EESOX_TERM_ENABLE ? "n" : "ff"); in eesoxscsi_show_info()
438 fas216_print_stats(&info->info, m); in eesoxscsi_show_info()
439 fas216_print_devices(&info->info, m); in eesoxscsi_show_info()
447 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_show_term() local
449 return sprintf(buf, "%d\n", info->control & EESOX_TERM_ENABLE ? 1 : 0); in eesoxscsi_show_term()
456 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_store_term() local
460 spin_lock_irqsave(host->host_lock, flags); in eesoxscsi_store_term()
462 info->control |= EESOX_TERM_ENABLE; in eesoxscsi_store_term()
464 info->control &= ~EESOX_TERM_ENABLE; in eesoxscsi_store_term()
466 writeb(info->control, info->ctl_port); in eesoxscsi_store_term()
467 spin_unlock_irqrestore(host->host_lock, flags); in eesoxscsi_store_term()
481 .info = eesoxscsi_info,
498 struct eesoxscsi_info *info; in eesoxscsi_probe() local
508 ret = -ENOMEM; in eesoxscsi_probe()
515 ret = -ENOMEM; in eesoxscsi_probe()
521 info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_probe()
522 info->ec = ec; in eesoxscsi_probe()
523 info->base = base; in eesoxscsi_probe()
524 info->ctl_port = base + EESOX_CONTROL; in eesoxscsi_probe()
525 info->control = term[ec->slot_no] ? EESOX_TERM_ENABLE : 0; in eesoxscsi_probe()
526 writeb(info->control, info->ctl_port); in eesoxscsi_probe()
528 info->info.scsi.io_base = base + EESOX_FAS216_OFFSET; in eesoxscsi_probe()
529 info->info.scsi.io_shift = EESOX_FAS216_SHIFT; in eesoxscsi_probe()
530 info->info.scsi.irq = ec->irq; in eesoxscsi_probe()
531 info->info.scsi.dma = ec->dma; in eesoxscsi_probe()
532 info->info.ifcfg.clockrate = 40; /* MHz */ in eesoxscsi_probe()
533 info->info.ifcfg.select_timeout = 255; in eesoxscsi_probe()
534 info->info.ifcfg.asyncperiod = 200; /* ns */ in eesoxscsi_probe()
535 info->info.ifcfg.sync_max_depth = 7; in eesoxscsi_probe()
536 info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK; in eesoxscsi_probe()
537 info->info.ifcfg.disconnect_ok = 1; in eesoxscsi_probe()
538 info->info.ifcfg.wide_max_size = 0; in eesoxscsi_probe()
539 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; in eesoxscsi_probe()
540 info->info.dma.setup = eesoxscsi_dma_setup; in eesoxscsi_probe()
541 info->info.dma.pseudo = eesoxscsi_dma_pseudo; in eesoxscsi_probe()
542 info->info.dma.stop = eesoxscsi_dma_stop; in eesoxscsi_probe()
544 ec->irqaddr = base + EESOX_DMASTAT; in eesoxscsi_probe()
545 ec->irqmask = EESOX_STAT_INTR; in eesoxscsi_probe()
547 ecard_setirq(ec, &eesoxscsi_ops, info); in eesoxscsi_probe()
549 device_create_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_probe()
555 ret = request_irq(ec->irq, eesoxscsi_intr, 0, "eesoxscsi", info); in eesoxscsi_probe()
558 host->host_no, ec->irq, ret); in eesoxscsi_probe()
562 if (info->info.scsi.dma != NO_DMA) { in eesoxscsi_probe()
563 if (request_dma(info->info.scsi.dma, "eesox")) { in eesoxscsi_probe()
564 printk("scsi%d: DMA%d not free, DMA disabled\n", in eesoxscsi_probe()
565 host->host_no, info->info.scsi.dma); in eesoxscsi_probe()
566 info->info.scsi.dma = NO_DMA; in eesoxscsi_probe()
568 set_dma_speed(info->info.scsi.dma, 180); in eesoxscsi_probe()
569 info->info.ifcfg.capabilities |= FASCAP_DMA; in eesoxscsi_probe()
570 info->info.ifcfg.cntl3 |= CNTL3_BS8; in eesoxscsi_probe()
574 ret = fas216_add(host, &ec->dev); in eesoxscsi_probe()
578 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_probe()
579 free_dma(info->info.scsi.dma); in eesoxscsi_probe()
580 free_irq(ec->irq, info); in eesoxscsi_probe()
586 device_remove_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_probe()
599 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; in eesoxscsi_remove() local
604 if (info->info.scsi.dma != NO_DMA) in eesoxscsi_remove()
605 free_dma(info->info.scsi.dma); in eesoxscsi_remove()
606 free_irq(ec->irq, info); in eesoxscsi_remove()
608 device_remove_file(&ec->dev, &dev_attr_bus_term); in eesoxscsi_remove()