Lines Matching refs:fd

118 static inline void fdomain_make_bus_idle(struct fdomain *fd)  in fdomain_make_bus_idle()  argument
120 outb(0, fd->base + REG_BCTL); in fdomain_make_bus_idle()
121 outb(0, fd->base + REG_MCTL); in fdomain_make_bus_idle()
122 if (fd->chip == tmc18c50 || fd->chip == tmc18c30) in fdomain_make_bus_idle()
125 fd->base + REG_ACTL); in fdomain_make_bus_idle()
127 outb(ACTL_RESET | PARITY_MASK, fd->base + REG_ACTL); in fdomain_make_bus_idle()
181 struct fdomain *fd = shost_priv(sh); in fdomain_select() local
183 outb(BCTL_BUSEN | BCTL_SEL, fd->base + REG_BCTL); in fdomain_select()
184 outb(BIT(sh->this_id) | BIT(target), fd->base + REG_SCSI_DATA_NOACK); in fdomain_select()
187 outb(PARITY_MASK, fd->base + REG_ACTL); in fdomain_select()
192 status = inb(fd->base + REG_BSTAT); in fdomain_select()
196 outb(BCTL_BUSEN, fd->base + REG_BCTL); in fdomain_select()
201 fdomain_make_bus_idle(fd); in fdomain_select()
205 static void fdomain_finish_cmd(struct fdomain *fd) in fdomain_finish_cmd() argument
207 outb(0, fd->base + REG_ICTL); in fdomain_finish_cmd()
208 fdomain_make_bus_idle(fd); in fdomain_finish_cmd()
209 scsi_done(fd->cur_cmd); in fdomain_finish_cmd()
210 fd->cur_cmd = NULL; in fdomain_finish_cmd()
215 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_read_data() local
219 while ((len = inw(fd->base + REG_FIFO_COUNT)) > 0) { in fdomain_read_data()
225 *ptr++ = inb(fd->base + REG_FIFO); in fdomain_read_data()
227 insw(fd->base + REG_FIFO, ptr, len >> 1); in fdomain_read_data()
235 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_write_data() local
237 int FIFO_Size = fd->chip == tmc18c30 ? 0x800 : 0x2000; in fdomain_write_data()
241 while ((len = FIFO_Size - inw(fd->base + REG_FIFO_COUNT)) > 512) { in fdomain_write_data()
252 outb(*ptr++, fd->base + REG_FIFO); in fdomain_write_data()
254 outsw(fd->base + REG_FIFO, ptr, len >> 1); in fdomain_write_data()
262 struct fdomain *fd = container_of(work, struct fdomain, work); in fdomain_work() local
263 struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host, in fdomain_work()
265 struct scsi_cmnd *cmd = fd->cur_cmd; in fdomain_work()
273 status = inb(fd->base + REG_ASTAT); in fdomain_work()
276 fdomain_finish_cmd(fd); in fdomain_work()
281 outb(ICTL_SEL | FIFO_COUNT, fd->base + REG_ICTL); in fdomain_work()
282 outb(BCTL_BUSEN | BCTL_SEL, fd->base + REG_BCTL); in fdomain_work()
284 fd->base + REG_SCSI_DATA_NOACK); in fdomain_work()
286 outb(ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
289 status = inb(fd->base + REG_BSTAT); in fdomain_work()
294 fdomain_finish_cmd(fd); in fdomain_work()
298 outb(ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
301 outb(ICTL_FIFO | ICTL_REQ | FIFO_COUNT, fd->base + REG_ICTL); in fdomain_work()
302 outb(BCTL_BUSEN, fd->base + REG_BCTL); in fdomain_work()
307 status = inb(fd->base + REG_BSTAT); in fdomain_work()
313 fd->base + REG_SCSI_DATA); in fdomain_work()
316 if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { in fdomain_work()
319 PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
323 if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { in fdomain_work()
326 fd->base + REG_ACTL); in fdomain_work()
330 cmd->SCp.Status = inb(fd->base + REG_SCSI_DATA); in fdomain_work()
333 outb(MESSAGE_REJECT, fd->base + REG_SCSI_DATA); in fdomain_work()
336 cmd->SCp.Message = inb(fd->base + REG_SCSI_DATA); in fdomain_work()
343 if (fd->chip == tmc1800 && !cmd->SCp.have_data_in && in fdomain_work()
348 PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
352 fd->base + REG_ACTL); in fdomain_work()
366 fdomain_finish_cmd(fd); in fdomain_work()
370 fd->base + REG_ICTL); in fdomain_work()
371 outb(0, fd->base + REG_BCTL); in fdomain_work()
374 fd->base + REG_ICTL); in fdomain_work()
382 struct fdomain *fd = dev_id; in fdomain_irq() local
385 if ((inb(fd->base + REG_ASTAT) & ASTAT_IRQ) == 0) in fdomain_irq()
388 outb(0, fd->base + REG_ICTL); in fdomain_irq()
391 if (!fd->cur_cmd) /* Spurious interrupt */ in fdomain_irq()
394 schedule_work(&fd->work); in fdomain_irq()
401 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_queue() local
413 fd->cur_cmd = cmd; in fdomain_queue()
415 fdomain_make_bus_idle(fd); in fdomain_queue()
418 outb(0, fd->base + REG_ICTL); in fdomain_queue()
419 outb(0, fd->base + REG_BCTL); /* Disable data drivers */ in fdomain_queue()
421 outb(BIT(cmd->device->host->this_id), fd->base + REG_SCSI_DATA_NOACK); in fdomain_queue()
422 outb(ICTL_ARB, fd->base + REG_ICTL); in fdomain_queue()
424 outb(ACTL_ARB | ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL); in fdomain_queue()
434 struct fdomain *fd = shost_priv(sh); in fdomain_abort() local
437 if (!fd->cur_cmd) in fdomain_abort()
442 fdomain_make_bus_idle(fd); in fdomain_abort()
443 fd->cur_cmd->SCp.phase |= aborted; in fdomain_abort()
446 set_host_byte(fd->cur_cmd, DID_ABORT); in fdomain_abort()
447 fdomain_finish_cmd(fd); in fdomain_abort()
455 struct fdomain *fd = shost_priv(sh); in fdomain_host_reset() local
459 fdomain_reset(fd->base); in fdomain_host_reset()
510 struct fdomain *fd; in fdomain_create() local
542 fd = shost_priv(sh); in fdomain_create()
543 fd->base = base; in fdomain_create()
544 fd->chip = chip; in fdomain_create()
545 INIT_WORK(&fd->work, fdomain_work); in fdomain_create()
550 if (request_irq(irq, fdomain_irq, irq_flags, "fdomain", fd)) in fdomain_create()
565 free_irq(irq, fd); in fdomain_create()
574 struct fdomain *fd = shost_priv(sh); in fdomain_destroy() local
576 cancel_work_sync(&fd->work); in fdomain_destroy()
579 free_irq(sh->irq, fd); in fdomain_destroy()
588 struct fdomain *fd = shost_priv(dev_get_drvdata(dev)); in fdomain_resume() local
590 fdomain_reset(fd->base); in fdomain_resume()