Lines Matching refs:ap
156 static int pdc_common_port_start(struct ata_port *ap);
157 static int pdc_sata_port_start(struct ata_port *ap);
159 static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
160 static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
163 static void pdc_irq_clear(struct ata_port *ap);
165 static void pdc_freeze(struct ata_port *ap);
166 static void pdc_sata_freeze(struct ata_port *ap);
167 static void pdc_thaw(struct ata_port *ap);
168 static void pdc_sata_thaw(struct ata_port *ap);
173 static void pdc_error_handler(struct ata_port *ap);
175 static int pdc_pata_cable_detect(struct ata_port *ap);
176 static int pdc_sata_cable_detect(struct ata_port *ap);
331 static int pdc_common_port_start(struct ata_port *ap) in pdc_common_port_start() argument
333 struct device *dev = ap->host->dev; in pdc_common_port_start()
338 rc = ata_bmdma_port_start(ap); in pdc_common_port_start()
350 ap->private_data = pp; in pdc_common_port_start()
355 static int pdc_sata_port_start(struct ata_port *ap) in pdc_sata_port_start() argument
359 rc = pdc_common_port_start(ap); in pdc_sata_port_start()
364 if (ap->flags & PDC_FLAG_GEN_II) { in pdc_sata_port_start()
365 void __iomem *sata_mmio = ap->ioaddr.scr_addr; in pdc_sata_port_start()
376 static void pdc_fpdma_clear_interrupt_flag(struct ata_port *ap) in pdc_fpdma_clear_interrupt_flag() argument
378 void __iomem *sata_mmio = ap->ioaddr.scr_addr; in pdc_fpdma_clear_interrupt_flag()
391 static void pdc_fpdma_reset(struct ata_port *ap) in pdc_fpdma_reset() argument
393 void __iomem *sata_mmio = ap->ioaddr.scr_addr; in pdc_fpdma_reset()
406 pdc_fpdma_clear_interrupt_flag(ap); in pdc_fpdma_reset()
409 static void pdc_not_at_command_packet_phase(struct ata_port *ap) in pdc_not_at_command_packet_phase() argument
411 void __iomem *sata_mmio = ap->ioaddr.scr_addr; in pdc_not_at_command_packet_phase()
425 static void pdc_clear_internal_debug_record_error_register(struct ata_port *ap) in pdc_clear_internal_debug_record_error_register() argument
427 void __iomem *sata_mmio = ap->ioaddr.scr_addr; in pdc_clear_internal_debug_record_error_register()
433 static void pdc_reset_port(struct ata_port *ap) in pdc_reset_port() argument
435 void __iomem *ata_ctlstat_mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; in pdc_reset_port()
439 if (ap->flags & PDC_FLAG_GEN_II) in pdc_reset_port()
440 pdc_not_at_command_packet_phase(ap); in pdc_reset_port()
461 if (sata_scr_valid(&ap->link) && (ap->flags & PDC_FLAG_GEN_II)) { in pdc_reset_port()
462 pdc_fpdma_reset(ap); in pdc_reset_port()
463 pdc_clear_internal_debug_record_error_register(ap); in pdc_reset_port()
467 static int pdc_pata_cable_detect(struct ata_port *ap) in pdc_pata_cable_detect() argument
470 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_pata_cable_detect()
478 static int pdc_sata_cable_detect(struct ata_port *ap) in pdc_sata_cable_detect() argument
488 *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4)); in pdc_sata_scr_read()
497 writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4)); in pdc_sata_scr_write()
503 struct ata_port *ap = qc->ap; in pdc_atapi_pkt() local
504 dma_addr_t sg_table = ap->bmdma_prd_dma; in pdc_atapi_pkt()
507 struct pdc_port_priv *pp = ap->private_data; in pdc_atapi_pkt()
533 if (sata_scr_valid(&ap->link)) in pdc_atapi_pkt()
591 struct ata_port *ap = qc->ap; in pdc_fill_sg() local
592 struct ata_bmdma_prd *prd = ap->bmdma_prd; in pdc_fill_sg()
654 struct pdc_port_priv *pp = qc->ap->private_data; in pdc_qc_prep()
664 i = pdc_pkt_header(&qc->tf, qc->ap->bmdma_prd_dma, in pdc_qc_prep()
699 static unsigned int pdc_sata_nr_ports(const struct ata_port *ap) in pdc_sata_nr_ports() argument
701 return (ap->flags & PDC_FLAG_4_PORTS) ? 4 : 2; in pdc_sata_nr_ports()
704 static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap) in pdc_sata_ata_port_to_ata_no() argument
706 const struct ata_host *host = ap->host; in pdc_sata_ata_port_to_ata_no()
707 unsigned int nr_ports = pdc_sata_nr_ports(ap); in pdc_sata_ata_port_to_ata_no()
710 for (i = 0; i < nr_ports && host->ports[i] != ap; ++i) in pdc_sata_ata_port_to_ata_no()
713 return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); in pdc_sata_ata_port_to_ata_no()
716 static void pdc_freeze(struct ata_port *ap) in pdc_freeze() argument
718 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_freeze()
728 static void pdc_sata_freeze(struct ata_port *ap) in pdc_sata_freeze() argument
730 struct ata_host *host = ap->host; in pdc_sata_freeze()
733 unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); in pdc_sata_freeze()
748 pdc_freeze(ap); in pdc_sata_freeze()
751 static void pdc_thaw(struct ata_port *ap) in pdc_thaw() argument
753 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_thaw()
766 static void pdc_sata_thaw(struct ata_port *ap) in pdc_sata_thaw() argument
768 struct ata_host *host = ap->host; in pdc_sata_thaw()
771 unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); in pdc_sata_thaw()
774 pdc_thaw(ap); in pdc_sata_thaw()
789 pdc_reset_port(link->ap); in pdc_pata_softreset()
793 static unsigned int pdc_ata_port_to_ata_no(const struct ata_port *ap) in pdc_ata_port_to_ata_no() argument
795 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_ata_port_to_ata_no()
796 void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; in pdc_ata_port_to_ata_no()
802 static void pdc_hard_reset_port(struct ata_port *ap) in pdc_hard_reset_port() argument
804 void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; in pdc_hard_reset_port()
806 unsigned int ata_no = pdc_ata_port_to_ata_no(ap); in pdc_hard_reset_port()
807 struct pdc_host_priv *hpriv = ap->host->private_data; in pdc_hard_reset_port()
827 if (link->ap->flags & PDC_FLAG_GEN_II) in pdc_sata_hardreset()
828 pdc_not_at_command_packet_phase(link->ap); in pdc_sata_hardreset()
830 pdc_hard_reset_port(link->ap); in pdc_sata_hardreset()
831 pdc_reset_port(link->ap); in pdc_sata_hardreset()
840 static void pdc_error_handler(struct ata_port *ap) in pdc_error_handler() argument
842 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in pdc_error_handler()
843 pdc_reset_port(ap); in pdc_error_handler()
845 ata_sff_error_handler(ap); in pdc_error_handler()
850 struct ata_port *ap = qc->ap; in pdc_post_internal_cmd() local
854 pdc_reset_port(ap); in pdc_post_internal_cmd()
857 static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, in pdc_error_intr() argument
860 struct ata_eh_info *ehi = &ap->link.eh_info; in pdc_error_intr()
877 if (sata_scr_valid(&ap->link)) { in pdc_error_intr()
880 pdc_sata_scr_read(&ap->link, SCR_ERROR, &serror); in pdc_error_intr()
886 pdc_reset_port(ap); in pdc_error_intr()
888 ata_port_abort(ap); in pdc_error_intr()
891 static unsigned int pdc_host_intr(struct ata_port *ap, in pdc_host_intr() argument
895 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_host_intr()
899 if (ap->flags & PDC_FLAG_GEN_II) in pdc_host_intr()
905 pdc_error_intr(ap, qc, port_status, err_mask); in pdc_host_intr()
914 qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); in pdc_host_intr()
919 ap->stats.idle_irq++; in pdc_host_intr()
926 static void pdc_irq_clear(struct ata_port *ap) in pdc_irq_clear() argument
928 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_irq_clear()
936 struct ata_port *ap; in pdc_interrupt() local
986 ap = host->ports[i]; in pdc_interrupt()
992 struct ata_eh_info *ehi = &ap->link.eh_info; in pdc_interrupt()
996 ata_port_freeze(ap); in pdc_interrupt()
1006 qc = ata_qc_from_tag(ap, ap->link.active_tag); in pdc_interrupt()
1008 handled += pdc_host_intr(ap, qc); in pdc_interrupt()
1021 struct ata_port *ap = qc->ap; in pdc_packet_start() local
1022 struct pdc_port_priv *pp = ap->private_data; in pdc_packet_start()
1023 void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; in pdc_packet_start()
1024 void __iomem *ata_mmio = ap->ioaddr.cmd_addr; in pdc_packet_start()
1025 unsigned int port_no = ap->port_no; in pdc_packet_start()
1028 VPRINTK("ENTER, ap %p\n", ap); in pdc_packet_start()
1060 static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) in pdc_tf_load_mmio() argument
1063 ata_sff_tf_load(ap, tf); in pdc_tf_load_mmio()
1066 static void pdc_exec_command_mmio(struct ata_port *ap, in pdc_exec_command_mmio() argument
1070 ata_sff_exec_command(ap, tf); in pdc_exec_command_mmio()
1109 static void pdc_ata_setup_port(struct ata_port *ap, in pdc_ata_setup_port() argument
1112 ap->ioaddr.cmd_addr = base; in pdc_ata_setup_port()
1113 ap->ioaddr.data_addr = base; in pdc_ata_setup_port()
1114 ap->ioaddr.feature_addr = in pdc_ata_setup_port()
1115 ap->ioaddr.error_addr = base + 0x4; in pdc_ata_setup_port()
1116 ap->ioaddr.nsect_addr = base + 0x8; in pdc_ata_setup_port()
1117 ap->ioaddr.lbal_addr = base + 0xc; in pdc_ata_setup_port()
1118 ap->ioaddr.lbam_addr = base + 0x10; in pdc_ata_setup_port()
1119 ap->ioaddr.lbah_addr = base + 0x14; in pdc_ata_setup_port()
1120 ap->ioaddr.device_addr = base + 0x18; in pdc_ata_setup_port()
1121 ap->ioaddr.command_addr = in pdc_ata_setup_port()
1122 ap->ioaddr.status_addr = base + 0x1c; in pdc_ata_setup_port()
1123 ap->ioaddr.altstatus_addr = in pdc_ata_setup_port()
1124 ap->ioaddr.ctl_addr = base + 0x38; in pdc_ata_setup_port()
1125 ap->ioaddr.scr_addr = scr_addr; in pdc_ata_setup_port()
1235 struct ata_port *ap = host->ports[i]; in pdc_ata_init_one() local
1240 pdc_ata_setup_port(ap, host_mmio + ata_offset, host_mmio + scr_offset); in pdc_ata_init_one()
1242 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); in pdc_ata_init_one()
1243 ata_port_pbar_desc(ap, PDC_MMIO_BAR, ata_offset, "ata"); in pdc_ata_init_one()