Lines Matching full:ap
103 static void pata_s3c_set_piomode(struct ata_port *ap, struct ata_device *adev) in pata_s3c_set_piomode() argument
105 struct s3c_ide_info *info = ap->host->private_data; in pata_s3c_set_piomode()
175 static void pata_s3c_tf_load(struct ata_port *ap, in pata_s3c_tf_load() argument
178 struct ata_ioports *ioaddr = &ap->ioaddr; in pata_s3c_tf_load()
181 if (tf->ctl != ap->last_ctl) { in pata_s3c_tf_load()
182 ata_outb(ap->host, tf->ctl, ioaddr->ctl_addr); in pata_s3c_tf_load()
183 ap->last_ctl = tf->ctl; in pata_s3c_tf_load()
184 ata_wait_idle(ap); in pata_s3c_tf_load()
188 ata_outb(ap->host, tf->hob_feature, ioaddr->feature_addr); in pata_s3c_tf_load()
189 ata_outb(ap->host, tf->hob_nsect, ioaddr->nsect_addr); in pata_s3c_tf_load()
190 ata_outb(ap->host, tf->hob_lbal, ioaddr->lbal_addr); in pata_s3c_tf_load()
191 ata_outb(ap->host, tf->hob_lbam, ioaddr->lbam_addr); in pata_s3c_tf_load()
192 ata_outb(ap->host, tf->hob_lbah, ioaddr->lbah_addr); in pata_s3c_tf_load()
196 ata_outb(ap->host, tf->feature, ioaddr->feature_addr); in pata_s3c_tf_load()
197 ata_outb(ap->host, tf->nsect, ioaddr->nsect_addr); in pata_s3c_tf_load()
198 ata_outb(ap->host, tf->lbal, ioaddr->lbal_addr); in pata_s3c_tf_load()
199 ata_outb(ap->host, tf->lbam, ioaddr->lbam_addr); in pata_s3c_tf_load()
200 ata_outb(ap->host, tf->lbah, ioaddr->lbah_addr); in pata_s3c_tf_load()
204 ata_outb(ap->host, tf->device, ioaddr->device_addr); in pata_s3c_tf_load()
206 ata_wait_idle(ap); in pata_s3c_tf_load()
212 static void pata_s3c_tf_read(struct ata_port *ap, struct ata_taskfile *tf) in pata_s3c_tf_read() argument
214 struct ata_ioports *ioaddr = &ap->ioaddr; in pata_s3c_tf_read()
216 tf->feature = ata_inb(ap->host, ioaddr->error_addr); in pata_s3c_tf_read()
217 tf->nsect = ata_inb(ap->host, ioaddr->nsect_addr); in pata_s3c_tf_read()
218 tf->lbal = ata_inb(ap->host, ioaddr->lbal_addr); in pata_s3c_tf_read()
219 tf->lbam = ata_inb(ap->host, ioaddr->lbam_addr); in pata_s3c_tf_read()
220 tf->lbah = ata_inb(ap->host, ioaddr->lbah_addr); in pata_s3c_tf_read()
221 tf->device = ata_inb(ap->host, ioaddr->device_addr); in pata_s3c_tf_read()
224 ata_outb(ap->host, tf->ctl | ATA_HOB, ioaddr->ctl_addr); in pata_s3c_tf_read()
225 tf->hob_feature = ata_inb(ap->host, ioaddr->error_addr); in pata_s3c_tf_read()
226 tf->hob_nsect = ata_inb(ap->host, ioaddr->nsect_addr); in pata_s3c_tf_read()
227 tf->hob_lbal = ata_inb(ap->host, ioaddr->lbal_addr); in pata_s3c_tf_read()
228 tf->hob_lbam = ata_inb(ap->host, ioaddr->lbam_addr); in pata_s3c_tf_read()
229 tf->hob_lbah = ata_inb(ap->host, ioaddr->lbah_addr); in pata_s3c_tf_read()
230 ata_outb(ap->host, tf->ctl, ioaddr->ctl_addr); in pata_s3c_tf_read()
231 ap->last_ctl = tf->ctl; in pata_s3c_tf_read()
238 static void pata_s3c_exec_command(struct ata_port *ap, in pata_s3c_exec_command() argument
241 ata_outb(ap->host, tf->command, ap->ioaddr.command_addr); in pata_s3c_exec_command()
242 ata_sff_pause(ap); in pata_s3c_exec_command()
248 static u8 pata_s3c_check_status(struct ata_port *ap) in pata_s3c_check_status() argument
250 return ata_inb(ap->host, ap->ioaddr.status_addr); in pata_s3c_check_status()
256 static u8 pata_s3c_check_altstatus(struct ata_port *ap) in pata_s3c_check_altstatus() argument
258 return ata_inb(ap->host, ap->ioaddr.altstatus_addr); in pata_s3c_check_altstatus()
267 struct ata_port *ap = qc->dev->link->ap; in pata_s3c_data_xfer() local
268 struct s3c_ide_info *info = ap->host->private_data; in pata_s3c_data_xfer()
269 void __iomem *data_addr = ap->ioaddr.data_addr; in pata_s3c_data_xfer()
289 dev_err(ap->dev, "unexpected trailing data\n"); in pata_s3c_data_xfer()
297 static void pata_s3c_dev_select(struct ata_port *ap, unsigned int device) in pata_s3c_dev_select() argument
304 ata_outb(ap->host, tmp, ap->ioaddr.device_addr); in pata_s3c_dev_select()
305 ata_sff_pause(ap); in pata_s3c_dev_select()
311 static unsigned int pata_s3c_devchk(struct ata_port *ap, in pata_s3c_devchk() argument
314 struct ata_ioports *ioaddr = &ap->ioaddr; in pata_s3c_devchk()
317 pata_s3c_dev_select(ap, device); in pata_s3c_devchk()
319 ata_outb(ap->host, 0x55, ioaddr->nsect_addr); in pata_s3c_devchk()
320 ata_outb(ap->host, 0xaa, ioaddr->lbal_addr); in pata_s3c_devchk()
322 ata_outb(ap->host, 0xaa, ioaddr->nsect_addr); in pata_s3c_devchk()
323 ata_outb(ap->host, 0x55, ioaddr->lbal_addr); in pata_s3c_devchk()
325 ata_outb(ap->host, 0x55, ioaddr->nsect_addr); in pata_s3c_devchk()
326 ata_outb(ap->host, 0xaa, ioaddr->lbal_addr); in pata_s3c_devchk()
328 nsect = ata_inb(ap->host, ioaddr->nsect_addr); in pata_s3c_devchk()
329 lbal = ata_inb(ap->host, ioaddr->lbal_addr); in pata_s3c_devchk()
345 ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); in pata_s3c_wait_after_reset()
361 static int pata_s3c_bus_softreset(struct ata_port *ap, in pata_s3c_bus_softreset() argument
364 struct ata_ioports *ioaddr = &ap->ioaddr; in pata_s3c_bus_softreset()
367 ata_outb(ap->host, ap->ctl, ioaddr->ctl_addr); in pata_s3c_bus_softreset()
369 ata_outb(ap->host, ap->ctl | ATA_SRST, ioaddr->ctl_addr); in pata_s3c_bus_softreset()
371 ata_outb(ap->host, ap->ctl, ioaddr->ctl_addr); in pata_s3c_bus_softreset()
372 ap->last_ctl = ap->ctl; in pata_s3c_bus_softreset()
374 return pata_s3c_wait_after_reset(&ap->link, deadline); in pata_s3c_bus_softreset()
383 struct ata_port *ap = link->ap; in pata_s3c_softreset() local
389 if (pata_s3c_devchk(ap, 0)) in pata_s3c_softreset()
393 pata_s3c_dev_select(ap, 0); in pata_s3c_softreset()
396 rc = pata_s3c_bus_softreset(ap, deadline); in pata_s3c_softreset()
404 classes[0] = ata_sff_dev_classify(&ap->link.device[0], in pata_s3c_softreset()
413 static void pata_s3c_set_devctl(struct ata_port *ap, u8 ctl) in pata_s3c_set_devctl() argument
415 ata_outb(ap->host, ctl, ap->ioaddr.ctl_addr); in pata_s3c_set_devctl()
498 struct ata_port *ap; in pata_s3c_probe() local
535 ap = host->ports[0]; in pata_s3c_probe()
536 ap->pio_mask = ATA_PIO4; in pata_s3c_probe()
539 ap->ops = &pata_s3c_port_ops; in pata_s3c_probe()
544 ap->ops = &pata_s5p_port_ops; in pata_s3c_probe()
551 ap->flags |= ATA_FLAG_PIO_POLLING; in pata_s3c_probe()
553 ata_port_desc(ap, "no IRQ, using PIO polling\n"); in pata_s3c_probe()
556 ap->ioaddr.cmd_addr = info->ide_addr + S3C_ATA_CMD; in pata_s3c_probe()
557 ap->ioaddr.data_addr = info->ide_addr + S3C_ATA_PIO_DTR; in pata_s3c_probe()
558 ap->ioaddr.error_addr = info->ide_addr + S3C_ATA_PIO_FED; in pata_s3c_probe()
559 ap->ioaddr.feature_addr = info->ide_addr + S3C_ATA_PIO_FED; in pata_s3c_probe()
560 ap->ioaddr.nsect_addr = info->ide_addr + S3C_ATA_PIO_SCR; in pata_s3c_probe()
561 ap->ioaddr.lbal_addr = info->ide_addr + S3C_ATA_PIO_LLR; in pata_s3c_probe()
562 ap->ioaddr.lbam_addr = info->ide_addr + S3C_ATA_PIO_LMR; in pata_s3c_probe()
563 ap->ioaddr.lbah_addr = info->ide_addr + S3C_ATA_PIO_LHR; in pata_s3c_probe()
564 ap->ioaddr.device_addr = info->ide_addr + S3C_ATA_PIO_DVR; in pata_s3c_probe()
565 ap->ioaddr.status_addr = info->ide_addr + S3C_ATA_PIO_CSD; in pata_s3c_probe()
566 ap->ioaddr.command_addr = info->ide_addr + S3C_ATA_PIO_CSD; in pata_s3c_probe()
567 ap->ioaddr.altstatus_addr = info->ide_addr + S3C_ATA_PIO_DAD; in pata_s3c_probe()
568 ap->ioaddr.ctl_addr = info->ide_addr + S3C_ATA_PIO_DAD; in pata_s3c_probe()
570 ata_port_desc(ap, "mmio cmd 0x%llx ", in pata_s3c_probe()