diff options
Diffstat (limited to 'drivers/ata/sata_inic162x.c')
-rw-r--r-- | drivers/ata/sata_inic162x.c | 73 |
1 files changed, 20 insertions, 53 deletions
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 59e65edc5820..d27bb9a2568f 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -109,21 +109,7 @@ struct inic_port_priv { | |||
109 | }; | 109 | }; |
110 | 110 | ||
111 | static struct scsi_host_template inic_sht = { | 111 | static struct scsi_host_template inic_sht = { |
112 | .module = THIS_MODULE, | 112 | ATA_BMDMA_SHT(DRV_NAME), |
113 | .name = DRV_NAME, | ||
114 | .ioctl = ata_scsi_ioctl, | ||
115 | .queuecommand = ata_scsi_queuecmd, | ||
116 | .can_queue = ATA_DEF_QUEUE, | ||
117 | .this_id = ATA_SHT_THIS_ID, | ||
118 | .sg_tablesize = LIBATA_MAX_PRD, | ||
119 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
120 | .emulated = ATA_SHT_EMULATED, | ||
121 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
122 | .proc_name = DRV_NAME, | ||
123 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
124 | .slave_configure = ata_scsi_slave_config, | ||
125 | .slave_destroy = ata_scsi_slave_destroy, | ||
126 | .bios_param = ata_std_bios_param, | ||
127 | }; | 113 | }; |
128 | 114 | ||
129 | static const int scr_map[] = { | 115 | static const int scr_map[] = { |
@@ -236,7 +222,7 @@ static void inic_bmdma_setup(struct ata_queued_cmd *qc) | |||
236 | writeb(pp->cached_prdctl, port_base + PORT_PRD_CTL); | 222 | writeb(pp->cached_prdctl, port_base + PORT_PRD_CTL); |
237 | 223 | ||
238 | /* issue r/w command */ | 224 | /* issue r/w command */ |
239 | ap->ops->exec_command(ap, &qc->tf); | 225 | ap->ops->sff_exec_command(ap, &qc->tf); |
240 | } | 226 | } |
241 | 227 | ||
242 | static void inic_bmdma_start(struct ata_queued_cmd *qc) | 228 | static void inic_bmdma_start(struct ata_queued_cmd *qc) |
@@ -266,11 +252,6 @@ static u8 inic_bmdma_status(struct ata_port *ap) | |||
266 | return ATA_DMA_INTR; | 252 | return ATA_DMA_INTR; |
267 | } | 253 | } |
268 | 254 | ||
269 | static void inic_irq_clear(struct ata_port *ap) | ||
270 | { | ||
271 | /* noop */ | ||
272 | } | ||
273 | |||
274 | static void inic_host_intr(struct ata_port *ap) | 255 | static void inic_host_intr(struct ata_port *ap) |
275 | { | 256 | { |
276 | void __iomem *port_base = inic_port_base(ap); | 257 | void __iomem *port_base = inic_port_base(ap); |
@@ -286,14 +267,14 @@ static void inic_host_intr(struct ata_port *ap) | |||
286 | ata_qc_from_tag(ap, ap->link.active_tag); | 267 | ata_qc_from_tag(ap, ap->link.active_tag); |
287 | 268 | ||
288 | if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { | 269 | if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { |
289 | ata_chk_status(ap); /* clear ATA interrupt */ | 270 | ap->ops->sff_check_status(ap); /* clear ATA interrupt */ |
290 | return; | 271 | return; |
291 | } | 272 | } |
292 | 273 | ||
293 | if (likely(ata_host_intr(ap, qc))) | 274 | if (likely(ata_sff_host_intr(ap, qc))) |
294 | return; | 275 | return; |
295 | 276 | ||
296 | ata_chk_status(ap); /* clear ATA interrupt */ | 277 | ap->ops->sff_check_status(ap); /* clear ATA interrupt */ |
297 | ata_port_printk(ap, KERN_WARNING, "unhandled " | 278 | ata_port_printk(ap, KERN_WARNING, "unhandled " |
298 | "interrupt, irq_stat=%x\n", irq_stat); | 279 | "interrupt, irq_stat=%x\n", irq_stat); |
299 | return; | 280 | return; |
@@ -370,12 +351,12 @@ static unsigned int inic_qc_issue(struct ata_queued_cmd *qc) | |||
370 | */ | 351 | */ |
371 | if (unlikely(qc->tf.command == ATA_CMD_ID_ATA || | 352 | if (unlikely(qc->tf.command == ATA_CMD_ID_ATA || |
372 | qc->tf.command == ATA_CMD_ID_ATAPI)) { | 353 | qc->tf.command == ATA_CMD_ID_ATAPI)) { |
373 | u8 stat = ata_chk_status(ap); | 354 | u8 stat = ap->ops->sff_check_status(ap); |
374 | if (stat == 0x7f || stat == 0xff) | 355 | if (stat == 0x7f || stat == 0xff) |
375 | return AC_ERR_HSM; | 356 | return AC_ERR_HSM; |
376 | } | 357 | } |
377 | 358 | ||
378 | return ata_qc_issue_prot(qc); | 359 | return ata_sff_qc_issue(qc); |
379 | } | 360 | } |
380 | 361 | ||
381 | static void inic_freeze(struct ata_port *ap) | 362 | static void inic_freeze(struct ata_port *ap) |
@@ -384,7 +365,7 @@ static void inic_freeze(struct ata_port *ap) | |||
384 | 365 | ||
385 | __inic_set_pirq_mask(ap, PIRQ_MASK_FREEZE); | 366 | __inic_set_pirq_mask(ap, PIRQ_MASK_FREEZE); |
386 | 367 | ||
387 | ata_chk_status(ap); | 368 | ap->ops->sff_check_status(ap); |
388 | writeb(0xff, port_base + PORT_IRQ_STAT); | 369 | writeb(0xff, port_base + PORT_IRQ_STAT); |
389 | 370 | ||
390 | readb(port_base + PORT_IRQ_STAT); /* flush */ | 371 | readb(port_base + PORT_IRQ_STAT); /* flush */ |
@@ -394,7 +375,7 @@ static void inic_thaw(struct ata_port *ap) | |||
394 | { | 375 | { |
395 | void __iomem *port_base = inic_port_base(ap); | 376 | void __iomem *port_base = inic_port_base(ap); |
396 | 377 | ||
397 | ata_chk_status(ap); | 378 | ap->ops->sff_check_status(ap); |
398 | writeb(0xff, port_base + PORT_IRQ_STAT); | 379 | writeb(0xff, port_base + PORT_IRQ_STAT); |
399 | 380 | ||
400 | __inic_set_pirq_mask(ap, PIRQ_MASK_OTHER); | 381 | __inic_set_pirq_mask(ap, PIRQ_MASK_OTHER); |
@@ -436,10 +417,8 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
436 | if (ata_link_online(link)) { | 417 | if (ata_link_online(link)) { |
437 | struct ata_taskfile tf; | 418 | struct ata_taskfile tf; |
438 | 419 | ||
439 | /* wait a while before checking status */ | 420 | /* wait for link to become ready */ |
440 | ata_wait_after_reset(ap, deadline); | 421 | rc = ata_sff_wait_after_reset(link, 1, deadline); |
441 | |||
442 | rc = ata_wait_ready(ap, deadline); | ||
443 | /* link occupied, -ENODEV too is an error */ | 422 | /* link occupied, -ENODEV too is an error */ |
444 | if (rc) { | 423 | if (rc) { |
445 | ata_link_printk(link, KERN_WARNING, "device not ready " | 424 | ata_link_printk(link, KERN_WARNING, "device not ready " |
@@ -447,10 +426,8 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
447 | return rc; | 426 | return rc; |
448 | } | 427 | } |
449 | 428 | ||
450 | ata_tf_read(ap, &tf); | 429 | ata_sff_tf_read(ap, &tf); |
451 | *class = ata_dev_classify(&tf); | 430 | *class = ata_dev_classify(&tf); |
452 | if (*class == ATA_DEV_UNKNOWN) | ||
453 | *class = ATA_DEV_NONE; | ||
454 | } | 431 | } |
455 | 432 | ||
456 | return 0; | 433 | return 0; |
@@ -471,8 +448,7 @@ static void inic_error_handler(struct ata_port *ap) | |||
471 | spin_unlock_irqrestore(ap->lock, flags); | 448 | spin_unlock_irqrestore(ap->lock, flags); |
472 | 449 | ||
473 | /* PIO and DMA engines have been stopped, perform recovery */ | 450 | /* PIO and DMA engines have been stopped, perform recovery */ |
474 | ata_do_eh(ap, ata_std_prereset, NULL, inic_hardreset, | 451 | ata_std_error_handler(ap); |
475 | ata_std_postreset); | ||
476 | } | 452 | } |
477 | 453 | ||
478 | static void inic_post_internal_cmd(struct ata_queued_cmd *qc) | 454 | static void inic_post_internal_cmd(struct ata_queued_cmd *qc) |
@@ -541,35 +517,26 @@ static int inic_port_start(struct ata_port *ap) | |||
541 | } | 517 | } |
542 | 518 | ||
543 | static struct ata_port_operations inic_port_ops = { | 519 | static struct ata_port_operations inic_port_ops = { |
544 | .tf_load = ata_tf_load, | 520 | .inherits = &ata_sff_port_ops, |
545 | .tf_read = ata_tf_read, | ||
546 | .check_status = ata_check_status, | ||
547 | .exec_command = ata_exec_command, | ||
548 | .dev_select = ata_std_dev_select, | ||
549 | |||
550 | .scr_read = inic_scr_read, | ||
551 | .scr_write = inic_scr_write, | ||
552 | 521 | ||
553 | .bmdma_setup = inic_bmdma_setup, | 522 | .bmdma_setup = inic_bmdma_setup, |
554 | .bmdma_start = inic_bmdma_start, | 523 | .bmdma_start = inic_bmdma_start, |
555 | .bmdma_stop = inic_bmdma_stop, | 524 | .bmdma_stop = inic_bmdma_stop, |
556 | .bmdma_status = inic_bmdma_status, | 525 | .bmdma_status = inic_bmdma_status, |
557 | |||
558 | .irq_clear = inic_irq_clear, | ||
559 | .irq_on = ata_irq_on, | ||
560 | |||
561 | .qc_prep = ata_qc_prep, | ||
562 | .qc_issue = inic_qc_issue, | 526 | .qc_issue = inic_qc_issue, |
563 | .data_xfer = ata_data_xfer, | ||
564 | 527 | ||
565 | .freeze = inic_freeze, | 528 | .freeze = inic_freeze, |
566 | .thaw = inic_thaw, | 529 | .thaw = inic_thaw, |
530 | .softreset = ATA_OP_NULL, /* softreset is broken */ | ||
531 | .hardreset = inic_hardreset, | ||
567 | .error_handler = inic_error_handler, | 532 | .error_handler = inic_error_handler, |
568 | .post_internal_cmd = inic_post_internal_cmd, | 533 | .post_internal_cmd = inic_post_internal_cmd, |
569 | .dev_config = inic_dev_config, | 534 | .dev_config = inic_dev_config, |
570 | 535 | ||
571 | .port_resume = inic_port_resume, | 536 | .scr_read = inic_scr_read, |
537 | .scr_write = inic_scr_write, | ||
572 | 538 | ||
539 | .port_resume = inic_port_resume, | ||
573 | .port_start = inic_port_start, | 540 | .port_start = inic_port_start, |
574 | }; | 541 | }; |
575 | 542 | ||
@@ -692,7 +659,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
692 | ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS); | 659 | ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS); |
693 | port->scr_addr = iomap[MMIO_BAR] + offset + PORT_SCR; | 660 | port->scr_addr = iomap[MMIO_BAR] + offset + PORT_SCR; |
694 | 661 | ||
695 | ata_std_ports(port); | 662 | ata_sff_std_ports(port); |
696 | 663 | ||
697 | ata_port_pbar_desc(ap, MMIO_BAR, -1, "mmio"); | 664 | ata_port_pbar_desc(ap, MMIO_BAR, -1, "mmio"); |
698 | ata_port_pbar_desc(ap, MMIO_BAR, offset, "port"); | 665 | ata_port_pbar_desc(ap, MMIO_BAR, offset, "port"); |