diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
commit | ac95beedf8bc97b24f9540d4da9952f07221c023 (patch) | |
tree | c29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/pci/it821x.c | |
parent | 4a27214d7be31e122db4102166f49ec15958e8e9 (diff) |
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to
'struct ide_port_ops'.
* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
and ide_hwif_t.
* Update host drivers and core code accordingly.
While at it:
* Rename ata66_*() cable detect functions to *_cable_detect() to match
the standard naming. (Suggested by Sergei Shtylyov)
v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/it821x.c')
-rw-r--r-- | drivers/ide/pci/it821x.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index a38ec47423a0..7f4db1c0a4fc 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -418,7 +418,7 @@ static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | /** | 420 | /** |
421 | * ata66_it821x - check for 80 pin cable | 421 | * it821x_cable_detect - cable detection |
422 | * @hwif: interface to check | 422 | * @hwif: interface to check |
423 | * | 423 | * |
424 | * Check for the presence of an ATA66 capable cable on the | 424 | * Check for the presence of an ATA66 capable cable on the |
@@ -426,7 +426,7 @@ static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
426 | * the needed logic onboard. | 426 | * the needed logic onboard. |
427 | */ | 427 | */ |
428 | 428 | ||
429 | static u8 __devinit ata66_it821x(ide_hwif_t *hwif) | 429 | static u8 __devinit it821x_cable_detect(ide_hwif_t *hwif) |
430 | { | 430 | { |
431 | /* The reference driver also only does disk side */ | 431 | /* The reference driver also only does disk side */ |
432 | return ATA_CBL_PATA80; | 432 | return ATA_CBL_PATA80; |
@@ -527,8 +527,6 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
527 | struct it821x_dev *idev = itdevs[hwif->channel]; | 527 | struct it821x_dev *idev = itdevs[hwif->channel]; |
528 | u8 conf; | 528 | u8 conf; |
529 | 529 | ||
530 | hwif->quirkproc = &it821x_quirkproc; | ||
531 | |||
532 | ide_set_hwifdata(hwif, idev); | 530 | ide_set_hwifdata(hwif, idev); |
533 | 531 | ||
534 | pci_read_config_byte(dev, 0x50, &conf); | 532 | pci_read_config_byte(dev, 0x50, &conf); |
@@ -563,17 +561,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
563 | } | 561 | } |
564 | 562 | ||
565 | if (idev->smart == 0) { | 563 | if (idev->smart == 0) { |
566 | hwif->set_pio_mode = &it821x_set_pio_mode; | ||
567 | hwif->set_dma_mode = &it821x_set_dma_mode; | ||
568 | |||
569 | /* MWDMA/PIO clock switching for pass through mode */ | 564 | /* MWDMA/PIO clock switching for pass through mode */ |
570 | hwif->dma_start = &it821x_dma_start; | 565 | hwif->dma_start = &it821x_dma_start; |
571 | hwif->ide_dma_end = &it821x_dma_end; | 566 | hwif->ide_dma_end = &it821x_dma_end; |
572 | } else | 567 | } else |
573 | hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; | 568 | hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; |
574 | 569 | ||
575 | hwif->cable_detect = ata66_it821x; | ||
576 | |||
577 | if (hwif->dma_base == 0) | 570 | if (hwif->dma_base == 0) |
578 | return; | 571 | return; |
579 | 572 | ||
@@ -613,12 +606,20 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha | |||
613 | return 0; | 606 | return 0; |
614 | } | 607 | } |
615 | 608 | ||
609 | static const struct ide_port_ops it821x_port_ops = { | ||
610 | /* it821x_set_{pio,dma}_mode() are only used in pass-through mode */ | ||
611 | .set_pio_mode = it821x_set_pio_mode, | ||
612 | .set_dma_mode = it821x_set_dma_mode, | ||
613 | .quirkproc = it821x_quirkproc, | ||
614 | .cable_detect = it821x_cable_detect, | ||
615 | }; | ||
616 | 616 | ||
617 | #define DECLARE_ITE_DEV(name_str) \ | 617 | #define DECLARE_ITE_DEV(name_str) \ |
618 | { \ | 618 | { \ |
619 | .name = name_str, \ | 619 | .name = name_str, \ |
620 | .init_chipset = init_chipset_it821x, \ | 620 | .init_chipset = init_chipset_it821x, \ |
621 | .init_hwif = init_hwif_it821x, \ | 621 | .init_hwif = init_hwif_it821x, \ |
622 | .port_ops = &it821x_port_ops, \ | ||
622 | .pio_mask = ATA_PIO4, \ | 623 | .pio_mask = ATA_PIO4, \ |
623 | } | 624 | } |
624 | 625 | ||