aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_optidma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_optidma.c')
-rw-r--r--drivers/ata/pata_optidma.c103
1 files changed, 12 insertions, 91 deletions
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index f9b485a487ae..4cd744456313 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -64,22 +64,7 @@ static int optidma_pre_reset(struct ata_link *link, unsigned long deadline)
64 if (ap->port_no && !pci_test_config_bits(pdev, &optidma_enable_bits)) 64 if (ap->port_no && !pci_test_config_bits(pdev, &optidma_enable_bits))
65 return -ENOENT; 65 return -ENOENT;
66 66
67 return ata_std_prereset(link, deadline); 67 return ata_sff_prereset(link, deadline);
68}
69
70/**
71 * optidma_probe_reset - probe reset
72 * @ap: ATA port
73 *
74 * Perform the ATA probe and bus reset sequence plus specific handling
75 * for this hardware. The Opti needs little handling - we have no UDMA66
76 * capability that needs cable detection. All we must do is check the port
77 * is enabled.
78 */
79
80static void optidma_error_handler(struct ata_port *ap)
81{
82 ata_bmdma_drive_eh(ap, optidma_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
83} 68}
84 69
85/** 70/**
@@ -350,89 +335,22 @@ static int optidma_set_mode(struct ata_link *link, struct ata_device **r_failed)
350} 335}
351 336
352static struct scsi_host_template optidma_sht = { 337static struct scsi_host_template optidma_sht = {
353 .module = THIS_MODULE, 338 ATA_BMDMA_SHT(DRV_NAME),
354 .name = DRV_NAME,
355 .ioctl = ata_scsi_ioctl,
356 .queuecommand = ata_scsi_queuecmd,
357 .can_queue = ATA_DEF_QUEUE,
358 .this_id = ATA_SHT_THIS_ID,
359 .sg_tablesize = LIBATA_MAX_PRD,
360 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
361 .emulated = ATA_SHT_EMULATED,
362 .use_clustering = ATA_SHT_USE_CLUSTERING,
363 .proc_name = DRV_NAME,
364 .dma_boundary = ATA_DMA_BOUNDARY,
365 .slave_configure = ata_scsi_slave_config,
366 .slave_destroy = ata_scsi_slave_destroy,
367 .bios_param = ata_std_bios_param,
368}; 339};
369 340
370static struct ata_port_operations optidma_port_ops = { 341static struct ata_port_operations optidma_port_ops = {
342 .inherits = &ata_bmdma_port_ops,
343 .cable_detect = ata_cable_40wire,
371 .set_piomode = optidma_set_pio_mode, 344 .set_piomode = optidma_set_pio_mode,
372 .set_dmamode = optidma_set_dma_mode, 345 .set_dmamode = optidma_set_dma_mode,
373
374 .tf_load = ata_tf_load,
375 .tf_read = ata_tf_read,
376 .check_status = ata_check_status,
377 .exec_command = ata_exec_command,
378 .dev_select = ata_std_dev_select,
379
380 .freeze = ata_bmdma_freeze,
381 .thaw = ata_bmdma_thaw,
382 .post_internal_cmd = ata_bmdma_post_internal_cmd,
383 .error_handler = optidma_error_handler,
384 .set_mode = optidma_set_mode, 346 .set_mode = optidma_set_mode,
385 .cable_detect = ata_cable_40wire, 347 .prereset = optidma_pre_reset,
386
387 .bmdma_setup = ata_bmdma_setup,
388 .bmdma_start = ata_bmdma_start,
389 .bmdma_stop = ata_bmdma_stop,
390 .bmdma_status = ata_bmdma_status,
391
392 .qc_prep = ata_qc_prep,
393 .qc_issue = ata_qc_issue_prot,
394
395 .data_xfer = ata_data_xfer,
396
397 .irq_handler = ata_interrupt,
398 .irq_clear = ata_bmdma_irq_clear,
399 .irq_on = ata_irq_on,
400
401 .port_start = ata_sff_port_start,
402}; 348};
403 349
404static struct ata_port_operations optiplus_port_ops = { 350static struct ata_port_operations optiplus_port_ops = {
351 .inherits = &optidma_port_ops,
405 .set_piomode = optiplus_set_pio_mode, 352 .set_piomode = optiplus_set_pio_mode,
406 .set_dmamode = optiplus_set_dma_mode, 353 .set_dmamode = optiplus_set_dma_mode,
407
408 .tf_load = ata_tf_load,
409 .tf_read = ata_tf_read,
410 .check_status = ata_check_status,
411 .exec_command = ata_exec_command,
412 .dev_select = ata_std_dev_select,
413
414 .freeze = ata_bmdma_freeze,
415 .thaw = ata_bmdma_thaw,
416 .post_internal_cmd = ata_bmdma_post_internal_cmd,
417 .error_handler = optidma_error_handler,
418 .set_mode = optidma_set_mode,
419 .cable_detect = ata_cable_40wire,
420
421 .bmdma_setup = ata_bmdma_setup,
422 .bmdma_start = ata_bmdma_start,
423 .bmdma_stop = ata_bmdma_stop,
424 .bmdma_status = ata_bmdma_status,
425
426 .qc_prep = ata_qc_prep,
427 .qc_issue = ata_qc_issue_prot,
428
429 .data_xfer = ata_data_xfer,
430
431 .irq_handler = ata_interrupt,
432 .irq_clear = ata_bmdma_irq_clear,
433 .irq_on = ata_irq_on,
434
435 .port_start = ata_sff_port_start,
436}; 354};
437 355
438/** 356/**
@@ -481,14 +399,12 @@ done_nomsg: /* Wrong chip revision */
481static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) 399static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
482{ 400{
483 static const struct ata_port_info info_82c700 = { 401 static const struct ata_port_info info_82c700 = {
484 .sht = &optidma_sht,
485 .flags = ATA_FLAG_SLAVE_POSS, 402 .flags = ATA_FLAG_SLAVE_POSS,
486 .pio_mask = 0x1f, 403 .pio_mask = 0x1f,
487 .mwdma_mask = 0x07, 404 .mwdma_mask = 0x07,
488 .port_ops = &optidma_port_ops 405 .port_ops = &optidma_port_ops
489 }; 406 };
490 static const struct ata_port_info info_82c700_udma = { 407 static const struct ata_port_info info_82c700_udma = {
491 .sht = &optidma_sht,
492 .flags = ATA_FLAG_SLAVE_POSS, 408 .flags = ATA_FLAG_SLAVE_POSS,
493 .pio_mask = 0x1f, 409 .pio_mask = 0x1f,
494 .mwdma_mask = 0x07, 410 .mwdma_mask = 0x07,
@@ -497,10 +413,15 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
497 }; 413 };
498 const struct ata_port_info *ppi[] = { &info_82c700, NULL }; 414 const struct ata_port_info *ppi[] = { &info_82c700, NULL };
499 static int printed_version; 415 static int printed_version;
416 int rc;
500 417
501 if (!printed_version++) 418 if (!printed_version++)
502 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 419 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
503 420
421 rc = pcim_enable_device(dev);
422 if (rc)
423 return rc;
424
504 /* Fixed location chipset magic */ 425 /* Fixed location chipset magic */
505 inw(0x1F1); 426 inw(0x1F1);
506 inw(0x1F1); 427 inw(0x1F1);
@@ -509,7 +430,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
509 if (optiplus_with_udma(dev)) 430 if (optiplus_with_udma(dev))
510 ppi[0] = &info_82c700_udma; 431 ppi[0] = &info_82c700_udma;
511 432
512 return ata_pci_init_one(dev, ppi); 433 return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL);
513} 434}
514 435
515static const struct pci_device_id optidma[] = { 436static const struct pci_device_id optidma[] = {