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/siimage.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/siimage.c')
-rw-r--r-- | drivers/ide/pci/siimage.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index c9ecab8aeb61..3e4b99380709 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -735,14 +735,14 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif) | |||
735 | } | 735 | } |
736 | 736 | ||
737 | /** | 737 | /** |
738 | * ata66_siimage - check for 80 pin cable | 738 | * sil_cable_detect - cable detection |
739 | * @hwif: interface to check | 739 | * @hwif: interface to check |
740 | * | 740 | * |
741 | * Check for the presence of an ATA66 capable cable on the | 741 | * Check for the presence of an ATA66 capable cable on the |
742 | * interface. | 742 | * interface. |
743 | */ | 743 | */ |
744 | 744 | ||
745 | static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | 745 | static u8 __devinit sil_cable_detect(ide_hwif_t *hwif) |
746 | { | 746 | { |
747 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 747 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
748 | unsigned long addr = siimage_selreg(hwif, 0); | 748 | unsigned long addr = siimage_selreg(hwif, 0); |
@@ -769,25 +769,14 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
769 | { | 769 | { |
770 | u8 sata = is_sata(hwif); | 770 | u8 sata = is_sata(hwif); |
771 | 771 | ||
772 | hwif->set_pio_mode = &sil_set_pio_mode; | ||
773 | hwif->set_dma_mode = &sil_set_dma_mode; | ||
774 | hwif->quirkproc = &sil_quirkproc; | ||
775 | |||
776 | if (sata) { | 772 | if (sata) { |
777 | static int first = 1; | 773 | static int first = 1; |
778 | 774 | ||
779 | hwif->reset_poll = &sil_sata_reset_poll; | ||
780 | hwif->pre_reset = &sil_sata_pre_reset; | ||
781 | hwif->udma_filter = &sil_sata_udma_filter; | ||
782 | |||
783 | if (first) { | 775 | if (first) { |
784 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); | 776 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); |
785 | first = 0; | 777 | first = 0; |
786 | } | 778 | } |
787 | } else | 779 | } |
788 | hwif->udma_filter = &sil_pata_udma_filter; | ||
789 | |||
790 | hwif->cable_detect = ata66_siimage; | ||
791 | 780 | ||
792 | if (hwif->dma_base == 0) | 781 | if (hwif->dma_base == 0) |
793 | return; | 782 | return; |
@@ -802,21 +791,40 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
802 | } | 791 | } |
803 | } | 792 | } |
804 | 793 | ||
805 | #define DECLARE_SII_DEV(name_str) \ | 794 | static const struct ide_port_ops sil_pata_port_ops = { |
795 | .set_pio_mode = sil_set_pio_mode, | ||
796 | .set_dma_mode = sil_set_dma_mode, | ||
797 | .quirkproc = sil_quirkproc, | ||
798 | .udma_filter = sil_pata_udma_filter, | ||
799 | .cable_detect = sil_cable_detect, | ||
800 | }; | ||
801 | |||
802 | static const struct ide_port_ops sil_sata_port_ops = { | ||
803 | .set_pio_mode = sil_set_pio_mode, | ||
804 | .set_dma_mode = sil_set_dma_mode, | ||
805 | .reset_poll = sil_sata_reset_poll, | ||
806 | .pre_reset = sil_sata_pre_reset, | ||
807 | .quirkproc = sil_quirkproc, | ||
808 | .udma_filter = sil_sata_udma_filter, | ||
809 | .cable_detect = sil_cable_detect, | ||
810 | }; | ||
811 | |||
812 | #define DECLARE_SII_DEV(name_str, p_ops) \ | ||
806 | { \ | 813 | { \ |
807 | .name = name_str, \ | 814 | .name = name_str, \ |
808 | .init_chipset = init_chipset_siimage, \ | 815 | .init_chipset = init_chipset_siimage, \ |
809 | .init_iops = init_iops_siimage, \ | 816 | .init_iops = init_iops_siimage, \ |
810 | .init_hwif = init_hwif_siimage, \ | 817 | .init_hwif = init_hwif_siimage, \ |
818 | .port_ops = p_ops, \ | ||
811 | .pio_mask = ATA_PIO4, \ | 819 | .pio_mask = ATA_PIO4, \ |
812 | .mwdma_mask = ATA_MWDMA2, \ | 820 | .mwdma_mask = ATA_MWDMA2, \ |
813 | .udma_mask = ATA_UDMA6, \ | 821 | .udma_mask = ATA_UDMA6, \ |
814 | } | 822 | } |
815 | 823 | ||
816 | static const struct ide_port_info siimage_chipsets[] __devinitdata = { | 824 | static const struct ide_port_info siimage_chipsets[] __devinitdata = { |
817 | /* 0 */ DECLARE_SII_DEV("SiI680"), | 825 | /* 0 */ DECLARE_SII_DEV("SiI680", &sil_pata_port_ops), |
818 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), | 826 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA", &sil_sata_port_ops), |
819 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") | 827 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA", &sil_sata_port_ops) |
820 | }; | 828 | }; |
821 | 829 | ||
822 | /** | 830 | /** |