Lines Matching refs:ap
223 static void sata_rcar_freeze(struct ata_port *ap) in sata_rcar_freeze() argument
225 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_freeze()
230 ata_sff_freeze(ap); in sata_rcar_freeze()
233 static void sata_rcar_thaw(struct ata_port *ap) in sata_rcar_thaw() argument
235 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_thaw()
241 ata_sff_thaw(ap); in sata_rcar_thaw()
266 static u8 sata_rcar_check_status(struct ata_port *ap) in sata_rcar_check_status() argument
268 return ioread32(ap->ioaddr.status_addr); in sata_rcar_check_status()
271 static u8 sata_rcar_check_altstatus(struct ata_port *ap) in sata_rcar_check_altstatus() argument
273 return ioread32(ap->ioaddr.altstatus_addr); in sata_rcar_check_altstatus()
276 static void sata_rcar_set_devctl(struct ata_port *ap, u8 ctl) in sata_rcar_set_devctl() argument
278 iowrite32(ctl, ap->ioaddr.ctl_addr); in sata_rcar_set_devctl()
281 static void sata_rcar_dev_select(struct ata_port *ap, unsigned int device) in sata_rcar_dev_select() argument
283 iowrite32(ATA_DEVICE_OBS, ap->ioaddr.device_addr); in sata_rcar_dev_select()
284 ata_sff_pause(ap); /* needed; also flushes, for mmio */ in sata_rcar_dev_select()
287 static unsigned int sata_rcar_ata_devchk(struct ata_port *ap, in sata_rcar_ata_devchk() argument
290 struct ata_ioports *ioaddr = &ap->ioaddr; in sata_rcar_ata_devchk()
293 sata_rcar_dev_select(ap, device); in sata_rcar_ata_devchk()
316 struct ata_port *ap = link->ap; in sata_rcar_wait_after_reset() local
318 ata_msleep(ap, ATA_WAIT_AFTER_RESET); in sata_rcar_wait_after_reset()
323 static int sata_rcar_bus_softreset(struct ata_port *ap, unsigned long deadline) in sata_rcar_bus_softreset() argument
325 struct ata_ioports *ioaddr = &ap->ioaddr; in sata_rcar_bus_softreset()
327 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); in sata_rcar_bus_softreset()
330 iowrite32(ap->ctl, ioaddr->ctl_addr); in sata_rcar_bus_softreset()
332 iowrite32(ap->ctl | ATA_SRST, ioaddr->ctl_addr); in sata_rcar_bus_softreset()
334 iowrite32(ap->ctl, ioaddr->ctl_addr); in sata_rcar_bus_softreset()
335 ap->last_ctl = ap->ctl; in sata_rcar_bus_softreset()
338 return sata_rcar_wait_after_reset(&ap->link, deadline); in sata_rcar_bus_softreset()
344 struct ata_port *ap = link->ap; in sata_rcar_softreset() local
350 if (sata_rcar_ata_devchk(ap, 0)) in sata_rcar_softreset()
355 rc = sata_rcar_bus_softreset(ap, deadline); in sata_rcar_softreset()
369 static void sata_rcar_tf_load(struct ata_port *ap, in sata_rcar_tf_load() argument
372 struct ata_ioports *ioaddr = &ap->ioaddr; in sata_rcar_tf_load()
375 if (tf->ctl != ap->last_ctl) { in sata_rcar_tf_load()
377 ap->last_ctl = tf->ctl; in sata_rcar_tf_load()
378 ata_wait_idle(ap); in sata_rcar_tf_load()
414 ata_wait_idle(ap); in sata_rcar_tf_load()
417 static void sata_rcar_tf_read(struct ata_port *ap, struct ata_taskfile *tf) in sata_rcar_tf_read() argument
419 struct ata_ioports *ioaddr = &ap->ioaddr; in sata_rcar_tf_read()
421 tf->command = sata_rcar_check_status(ap); in sata_rcar_tf_read()
437 ap->last_ctl = tf->ctl; in sata_rcar_tf_read()
441 static void sata_rcar_exec_command(struct ata_port *ap, in sata_rcar_exec_command() argument
444 DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); in sata_rcar_exec_command()
446 iowrite32(tf->command, ap->ioaddr.command_addr); in sata_rcar_exec_command()
447 ata_sff_pause(ap); in sata_rcar_exec_command()
454 struct ata_port *ap = dev->link->ap; in sata_rcar_data_xfer() local
455 void __iomem *data_addr = ap->ioaddr.data_addr; in sata_rcar_data_xfer()
491 struct ata_port *ap; in sata_rcar_drain_fifo() local
497 ap = qc->ap; in sata_rcar_drain_fifo()
499 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) && in sata_rcar_drain_fifo()
501 ioread32(ap->ioaddr.data_addr); in sata_rcar_drain_fifo()
505 ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count); in sata_rcar_drain_fifo()
514 *val = ioread32(link->ap->ioaddr.scr_addr + (sc_reg << 2)); in sata_rcar_scr_read()
524 iowrite32(val, link->ap->ioaddr.scr_addr + (sc_reg << 2)); in sata_rcar_scr_write()
530 struct ata_port *ap = qc->ap; in sata_rcar_bmdma_fill_sg() local
531 struct ata_bmdma_prd *prd = ap->bmdma_prd; in sata_rcar_bmdma_fill_sg()
564 struct ata_port *ap = qc->ap; in sata_rcar_bmdma_setup() local
566 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_bmdma_setup()
572 iowrite32(ap->bmdma_prd_dma, base + ATAPI_DTB_ADR_REG); in sata_rcar_bmdma_setup()
586 ap->ops->sff_exec_command(ap, &qc->tf); in sata_rcar_bmdma_setup()
591 struct ata_port *ap = qc->ap; in sata_rcar_bmdma_start() local
592 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_bmdma_start()
605 struct ata_port *ap = qc->ap; in sata_rcar_bmdma_stop() local
606 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_bmdma_stop()
619 ata_sff_dma_pause(ap); in sata_rcar_bmdma_stop()
622 static u8 sata_rcar_bmdma_status(struct ata_port *ap) in sata_rcar_bmdma_status() argument
624 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_bmdma_status()
676 static void sata_rcar_serr_interrupt(struct ata_port *ap) in sata_rcar_serr_interrupt() argument
678 struct sata_rcar_priv *priv = ap->host->private_data; in sata_rcar_serr_interrupt()
679 struct ata_eh_info *ehi = &ap->link.eh_info; in sata_rcar_serr_interrupt()
702 ata_port_freeze(ap); in sata_rcar_serr_interrupt()
704 ata_port_abort(ap); in sata_rcar_serr_interrupt()
707 static void sata_rcar_ata_interrupt(struct ata_port *ap) in sata_rcar_ata_interrupt() argument
712 qc = ata_qc_from_tag(ap, ap->link.active_tag); in sata_rcar_ata_interrupt()
714 handled |= ata_bmdma_port_intr(ap, qc); in sata_rcar_ata_interrupt()
718 sata_rcar_check_status(ap); in sata_rcar_ata_interrupt()
727 struct ata_port *ap; in sata_rcar_interrupt() local
740 ap = host->ports[0]; in sata_rcar_interrupt()
743 sata_rcar_ata_interrupt(ap); in sata_rcar_interrupt()
746 sata_rcar_serr_interrupt(ap); in sata_rcar_interrupt()
757 struct ata_port *ap = host->ports[0]; in sata_rcar_setup_port() local
758 struct ata_ioports *ioaddr = &ap->ioaddr; in sata_rcar_setup_port()
762 ap->ops = &sata_rcar_port_ops; in sata_rcar_setup_port()
763 ap->pio_mask = ATA_PIO4; in sata_rcar_setup_port()
764 ap->udma_mask = ATA_UDMA6; in sata_rcar_setup_port()
765 ap->flags |= ATA_FLAG_SATA; in sata_rcar_setup_port()
768 ap->flags |= ATA_FLAG_NO_DIPM; in sata_rcar_setup_port()