Lines Matching full: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, int result) 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 fd->cur_cmd->result = result; in fdomain_finish_cmd()
210 fd->cur_cmd->scsi_done(fd->cur_cmd); in fdomain_finish_cmd()
211 fd->cur_cmd = NULL; in fdomain_finish_cmd()
216 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_read_data() local
220 while ((len = inw(fd->base + REG_FIFO_COUNT)) > 0) { in fdomain_read_data()
226 *ptr++ = inb(fd->base + REG_FIFO); in fdomain_read_data()
228 insw(fd->base + REG_FIFO, ptr, len >> 1); in fdomain_read_data()
236 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_write_data() local
238 int FIFO_Size = fd->chip == tmc18c30 ? 0x800 : 0x2000; in fdomain_write_data()
242 while ((len = FIFO_Size - inw(fd->base + REG_FIFO_COUNT)) > 512) { in fdomain_write_data()
253 outb(*ptr++, fd->base + REG_FIFO); in fdomain_write_data()
255 outsw(fd->base + REG_FIFO, ptr, len >> 1); in fdomain_write_data()
263 struct fdomain *fd = container_of(work, struct fdomain, work); in fdomain_work() local
264 struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host, in fdomain_work()
266 struct scsi_cmnd *cmd = fd->cur_cmd; in fdomain_work()
274 status = inb(fd->base + REG_ASTAT); in fdomain_work()
276 fdomain_finish_cmd(fd, DID_BUS_BUSY << 16); 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()
293 fdomain_finish_cmd(fd, DID_NO_CONNECT << 16); in fdomain_work()
297 outb(ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
300 outb(ICTL_FIFO | ICTL_REQ | FIFO_COUNT, fd->base + REG_ICTL); in fdomain_work()
301 outb(BCTL_BUSEN, fd->base + REG_BCTL); in fdomain_work()
306 status = inb(fd->base + REG_BSTAT); in fdomain_work()
312 fd->base + REG_SCSI_DATA); in fdomain_work()
315 if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { in fdomain_work()
318 PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
322 if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { in fdomain_work()
325 fd->base + REG_ACTL); in fdomain_work()
329 cmd->SCp.Status = inb(fd->base + REG_SCSI_DATA); in fdomain_work()
332 outb(MESSAGE_REJECT, fd->base + REG_SCSI_DATA); in fdomain_work()
335 cmd->SCp.Message = inb(fd->base + REG_SCSI_DATA); in fdomain_work()
342 if (fd->chip == tmc1800 && !cmd->SCp.have_data_in && in fdomain_work()
347 PARITY_MASK, fd->base + REG_ACTL); in fdomain_work()
351 fd->base + REG_ACTL); in fdomain_work()
362 fdomain_finish_cmd(fd, (cmd->SCp.Status & 0xff) | in fdomain_work()
368 fd->base + REG_ICTL); in fdomain_work()
369 outb(0, fd->base + REG_BCTL); in fdomain_work()
372 fd->base + REG_ICTL); in fdomain_work()
380 struct fdomain *fd = dev_id; in fdomain_irq() local
383 if ((inb(fd->base + REG_ASTAT) & ASTAT_IRQ) == 0) in fdomain_irq()
386 outb(0, fd->base + REG_ICTL); in fdomain_irq()
389 if (!fd->cur_cmd) /* Spurious interrupt */ in fdomain_irq()
392 schedule_work(&fd->work); in fdomain_irq()
399 struct fdomain *fd = shost_priv(cmd->device->host); in fdomain_queue() local
411 fd->cur_cmd = cmd; in fdomain_queue()
413 fdomain_make_bus_idle(fd); in fdomain_queue()
416 outb(0, fd->base + REG_ICTL); in fdomain_queue()
417 outb(0, fd->base + REG_BCTL); /* Disable data drivers */ in fdomain_queue()
419 outb(BIT(cmd->device->host->this_id), fd->base + REG_SCSI_DATA_NOACK); in fdomain_queue()
420 outb(ICTL_ARB, fd->base + REG_ICTL); in fdomain_queue()
422 outb(ACTL_ARB | ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL); in fdomain_queue()
432 struct fdomain *fd = shost_priv(sh); in fdomain_abort() local
435 if (!fd->cur_cmd) in fdomain_abort()
440 fdomain_make_bus_idle(fd); in fdomain_abort()
441 fd->cur_cmd->SCp.phase |= aborted; in fdomain_abort()
442 fd->cur_cmd->result = DID_ABORT << 16; in fdomain_abort()
445 fdomain_finish_cmd(fd, DID_ABORT << 16); in fdomain_abort()
453 struct fdomain *fd = shost_priv(sh); in fdomain_host_reset() local
457 fdomain_reset(fd->base); in fdomain_host_reset()
508 struct fdomain *fd; in fdomain_create() local
540 fd = shost_priv(sh); in fdomain_create()
541 fd->base = base; in fdomain_create()
542 fd->chip = chip; in fdomain_create()
543 INIT_WORK(&fd->work, fdomain_work); in fdomain_create()
548 if (request_irq(irq, fdomain_irq, irq_flags, "fdomain", fd)) in fdomain_create()
563 free_irq(irq, fd); in fdomain_create()
572 struct fdomain *fd = shost_priv(sh); in fdomain_destroy() local
574 cancel_work_sync(&fd->work); in fdomain_destroy()
577 free_irq(sh->irq, fd); in fdomain_destroy()
586 struct fdomain *fd = shost_priv(dev_get_drvdata(dev)); in fdomain_resume() local
588 fdomain_reset(fd->base); in fdomain_resume()