diff options
Diffstat (limited to 'drivers/ata/pata_artop.c')
-rw-r--r-- | drivers/ata/pata_artop.c | 125 |
1 files changed, 17 insertions, 108 deletions
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index d4218310327b..0f513bc11193 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -52,22 +52,7 @@ static int artop6210_pre_reset(struct ata_link *link, unsigned long deadline) | |||
52 | if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | 52 | if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) |
53 | return -ENOENT; | 53 | return -ENOENT; |
54 | 54 | ||
55 | return ata_std_prereset(link, deadline); | 55 | return ata_sff_prereset(link, deadline); |
56 | } | ||
57 | |||
58 | /** | ||
59 | * artop6210_error_handler - Probe specified port on PATA host controller | ||
60 | * @ap: Port to probe | ||
61 | * | ||
62 | * LOCKING: | ||
63 | * None (inherited from caller). | ||
64 | */ | ||
65 | |||
66 | static void artop6210_error_handler(struct ata_port *ap) | ||
67 | { | ||
68 | ata_bmdma_drive_eh(ap, artop6210_pre_reset, | ||
69 | ata_std_softreset, NULL, | ||
70 | ata_std_postreset); | ||
71 | } | 56 | } |
72 | 57 | ||
73 | /** | 58 | /** |
@@ -93,7 +78,7 @@ static int artop6260_pre_reset(struct ata_link *link, unsigned long deadline) | |||
93 | if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | 78 | if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) |
94 | return -ENOENT; | 79 | return -ENOENT; |
95 | 80 | ||
96 | return ata_std_prereset(link, deadline); | 81 | return ata_sff_prereset(link, deadline); |
97 | } | 82 | } |
98 | 83 | ||
99 | /** | 84 | /** |
@@ -114,21 +99,6 @@ static int artop6260_cable_detect(struct ata_port *ap) | |||
114 | } | 99 | } |
115 | 100 | ||
116 | /** | 101 | /** |
117 | * artop6260_error_handler - Probe specified port on PATA host controller | ||
118 | * @ap: Port to probe | ||
119 | * | ||
120 | * LOCKING: | ||
121 | * None (inherited from caller). | ||
122 | */ | ||
123 | |||
124 | static void artop6260_error_handler(struct ata_port *ap) | ||
125 | { | ||
126 | ata_bmdma_drive_eh(ap, artop6260_pre_reset, | ||
127 | ata_std_softreset, NULL, | ||
128 | ata_std_postreset); | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * artop6210_load_piomode - Load a set of PATA PIO timings | 102 | * artop6210_load_piomode - Load a set of PATA PIO timings |
133 | * @ap: Port whose timings we are configuring | 103 | * @ap: Port whose timings we are configuring |
134 | * @adev: Device | 104 | * @adev: Device |
@@ -314,85 +284,23 @@ static void artop6260_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
314 | } | 284 | } |
315 | 285 | ||
316 | static struct scsi_host_template artop_sht = { | 286 | static struct scsi_host_template artop_sht = { |
317 | .module = THIS_MODULE, | 287 | ATA_BMDMA_SHT(DRV_NAME), |
318 | .name = DRV_NAME, | ||
319 | .ioctl = ata_scsi_ioctl, | ||
320 | .queuecommand = ata_scsi_queuecmd, | ||
321 | .can_queue = ATA_DEF_QUEUE, | ||
322 | .this_id = ATA_SHT_THIS_ID, | ||
323 | .sg_tablesize = LIBATA_MAX_PRD, | ||
324 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
325 | .emulated = ATA_SHT_EMULATED, | ||
326 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
327 | .proc_name = DRV_NAME, | ||
328 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
329 | .slave_configure = ata_scsi_slave_config, | ||
330 | .slave_destroy = ata_scsi_slave_destroy, | ||
331 | .bios_param = ata_std_bios_param, | ||
332 | }; | 288 | }; |
333 | 289 | ||
334 | static const struct ata_port_operations artop6210_ops = { | 290 | static struct ata_port_operations artop6210_ops = { |
291 | .inherits = &ata_bmdma_port_ops, | ||
292 | .cable_detect = ata_cable_40wire, | ||
335 | .set_piomode = artop6210_set_piomode, | 293 | .set_piomode = artop6210_set_piomode, |
336 | .set_dmamode = artop6210_set_dmamode, | 294 | .set_dmamode = artop6210_set_dmamode, |
337 | .mode_filter = ata_pci_default_filter, | 295 | .prereset = artop6210_pre_reset, |
338 | |||
339 | .tf_load = ata_tf_load, | ||
340 | .tf_read = ata_tf_read, | ||
341 | .check_status = ata_check_status, | ||
342 | .exec_command = ata_exec_command, | ||
343 | .dev_select = ata_std_dev_select, | ||
344 | |||
345 | .freeze = ata_bmdma_freeze, | ||
346 | .thaw = ata_bmdma_thaw, | ||
347 | .error_handler = artop6210_error_handler, | ||
348 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
349 | .cable_detect = ata_cable_40wire, | ||
350 | |||
351 | .bmdma_setup = ata_bmdma_setup, | ||
352 | .bmdma_start = ata_bmdma_start, | ||
353 | .bmdma_stop = ata_bmdma_stop, | ||
354 | .bmdma_status = ata_bmdma_status, | ||
355 | .qc_prep = ata_qc_prep, | ||
356 | .qc_issue = ata_qc_issue_prot, | ||
357 | |||
358 | .data_xfer = ata_data_xfer, | ||
359 | |||
360 | .irq_handler = ata_interrupt, | ||
361 | .irq_clear = ata_bmdma_irq_clear, | ||
362 | .irq_on = ata_irq_on, | ||
363 | |||
364 | .port_start = ata_sff_port_start, | ||
365 | }; | 296 | }; |
366 | 297 | ||
367 | static const struct ata_port_operations artop6260_ops = { | 298 | static struct ata_port_operations artop6260_ops = { |
299 | .inherits = &ata_bmdma_port_ops, | ||
300 | .cable_detect = artop6260_cable_detect, | ||
368 | .set_piomode = artop6260_set_piomode, | 301 | .set_piomode = artop6260_set_piomode, |
369 | .set_dmamode = artop6260_set_dmamode, | 302 | .set_dmamode = artop6260_set_dmamode, |
370 | 303 | .prereset = artop6260_pre_reset, | |
371 | .tf_load = ata_tf_load, | ||
372 | .tf_read = ata_tf_read, | ||
373 | .check_status = ata_check_status, | ||
374 | .exec_command = ata_exec_command, | ||
375 | .dev_select = ata_std_dev_select, | ||
376 | |||
377 | .freeze = ata_bmdma_freeze, | ||
378 | .thaw = ata_bmdma_thaw, | ||
379 | .error_handler = artop6260_error_handler, | ||
380 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
381 | .cable_detect = artop6260_cable_detect, | ||
382 | |||
383 | .bmdma_setup = ata_bmdma_setup, | ||
384 | .bmdma_start = ata_bmdma_start, | ||
385 | .bmdma_stop = ata_bmdma_stop, | ||
386 | .bmdma_status = ata_bmdma_status, | ||
387 | .qc_prep = ata_qc_prep, | ||
388 | .qc_issue = ata_qc_issue_prot, | ||
389 | .data_xfer = ata_data_xfer, | ||
390 | |||
391 | .irq_handler = ata_interrupt, | ||
392 | .irq_clear = ata_bmdma_irq_clear, | ||
393 | .irq_on = ata_irq_on, | ||
394 | |||
395 | .port_start = ata_sff_port_start, | ||
396 | }; | 304 | }; |
397 | 305 | ||
398 | 306 | ||
@@ -414,7 +322,6 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
414 | { | 322 | { |
415 | static int printed_version; | 323 | static int printed_version; |
416 | static const struct ata_port_info info_6210 = { | 324 | static const struct ata_port_info info_6210 = { |
417 | .sht = &artop_sht, | ||
418 | .flags = ATA_FLAG_SLAVE_POSS, | 325 | .flags = ATA_FLAG_SLAVE_POSS, |
419 | .pio_mask = 0x1f, /* pio0-4 */ | 326 | .pio_mask = 0x1f, /* pio0-4 */ |
420 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 327 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -422,7 +329,6 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
422 | .port_ops = &artop6210_ops, | 329 | .port_ops = &artop6210_ops, |
423 | }; | 330 | }; |
424 | static const struct ata_port_info info_626x = { | 331 | static const struct ata_port_info info_626x = { |
425 | .sht = &artop_sht, | ||
426 | .flags = ATA_FLAG_SLAVE_POSS, | 332 | .flags = ATA_FLAG_SLAVE_POSS, |
427 | .pio_mask = 0x1f, /* pio0-4 */ | 333 | .pio_mask = 0x1f, /* pio0-4 */ |
428 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 334 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -430,7 +336,6 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
430 | .port_ops = &artop6260_ops, | 336 | .port_ops = &artop6260_ops, |
431 | }; | 337 | }; |
432 | static const struct ata_port_info info_628x = { | 338 | static const struct ata_port_info info_628x = { |
433 | .sht = &artop_sht, | ||
434 | .flags = ATA_FLAG_SLAVE_POSS, | 339 | .flags = ATA_FLAG_SLAVE_POSS, |
435 | .pio_mask = 0x1f, /* pio0-4 */ | 340 | .pio_mask = 0x1f, /* pio0-4 */ |
436 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 341 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -438,7 +343,6 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
438 | .port_ops = &artop6260_ops, | 343 | .port_ops = &artop6260_ops, |
439 | }; | 344 | }; |
440 | static const struct ata_port_info info_628x_fast = { | 345 | static const struct ata_port_info info_628x_fast = { |
441 | .sht = &artop_sht, | ||
442 | .flags = ATA_FLAG_SLAVE_POSS, | 346 | .flags = ATA_FLAG_SLAVE_POSS, |
443 | .pio_mask = 0x1f, /* pio0-4 */ | 347 | .pio_mask = 0x1f, /* pio0-4 */ |
444 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 348 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -446,11 +350,16 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
446 | .port_ops = &artop6260_ops, | 350 | .port_ops = &artop6260_ops, |
447 | }; | 351 | }; |
448 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 352 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
353 | int rc; | ||
449 | 354 | ||
450 | if (!printed_version++) | 355 | if (!printed_version++) |
451 | dev_printk(KERN_DEBUG, &pdev->dev, | 356 | dev_printk(KERN_DEBUG, &pdev->dev, |
452 | "version " DRV_VERSION "\n"); | 357 | "version " DRV_VERSION "\n"); |
453 | 358 | ||
359 | rc = pcim_enable_device(pdev); | ||
360 | if (rc) | ||
361 | return rc; | ||
362 | |||
454 | if (id->driver_data == 0) { /* 6210 variant */ | 363 | if (id->driver_data == 0) { /* 6210 variant */ |
455 | ppi[0] = &info_6210; | 364 | ppi[0] = &info_6210; |
456 | ppi[1] = &ata_dummy_port_info; | 365 | ppi[1] = &ata_dummy_port_info; |
@@ -491,7 +400,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
491 | 400 | ||
492 | BUG_ON(ppi[0] == NULL); | 401 | BUG_ON(ppi[0] == NULL); |
493 | 402 | ||
494 | return ata_pci_init_one(pdev, ppi); | 403 | return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL); |
495 | } | 404 | } |
496 | 405 | ||
497 | static const struct pci_device_id artop_pci_tbl[] = { | 406 | static const struct pci_device_id artop_pci_tbl[] = { |