aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/sis5513.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
commitac95beedf8bc97b24f9540d4da9952f07221c023 (patch)
treec29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/pci/sis5513.c
parent4a27214d7be31e122db4102166f49ec15958e8e9 (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/sis5513.c')
-rw-r--r--drivers/ide/pci/sis5513.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 181b647e5ca9..4b0b85d8faf5 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -347,7 +347,7 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed)
347 sis_program_timings(drive, speed); 347 sis_program_timings(drive, speed);
348} 348}
349 349
350static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) 350static u8 sis_ata133_udma_filter(ide_drive_t *drive)
351{ 351{
352 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 352 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
353 u32 regdw = 0; 353 u32 regdw = 0;
@@ -514,7 +514,7 @@ static const struct sis_laptop sis_laptop[] = {
514 { 0, } 514 { 0, }
515}; 515};
516 516
517static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) 517static u8 __devinit sis_cable_detect(ide_hwif_t *hwif)
518{ 518{
519 struct pci_dev *pdev = to_pci_dev(hwif->dev); 519 struct pci_dev *pdev = to_pci_dev(hwif->dev);
520 const struct sis_laptop *lap = &sis_laptop[0]; 520 const struct sis_laptop *lap = &sis_laptop[0];
@@ -543,21 +543,22 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif)
543 return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 543 return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
544} 544}
545 545
546static void __devinit init_hwif_sis5513(ide_hwif_t *hwif) 546static const struct ide_port_ops sis_port_ops = {
547{ 547 .set_pio_mode = sis_set_pio_mode,
548 hwif->set_pio_mode = &sis_set_pio_mode; 548 .set_dma_mode = sis_set_dma_mode,
549 hwif->set_dma_mode = &sis_set_dma_mode; 549 .cable_detect = sis_cable_detect,
550 550};
551 if (chipset_family >= ATA_133)
552 hwif->udma_filter = sis5513_ata133_udma_filter;
553 551
554 hwif->cable_detect = ata66_sis5513; 552static const struct ide_port_ops sis_ata133_port_ops = {
555} 553 .set_pio_mode = sis_set_pio_mode,
554 .set_dma_mode = sis_set_dma_mode,
555 .udma_filter = sis_ata133_udma_filter,
556 .cable_detect = sis_cable_detect,
557};
556 558
557static const struct ide_port_info sis5513_chipset __devinitdata = { 559static const struct ide_port_info sis5513_chipset __devinitdata = {
558 .name = "SIS5513", 560 .name = "SIS5513",
559 .init_chipset = init_chipset_sis5513, 561 .init_chipset = init_chipset_sis5513,
560 .init_hwif = init_hwif_sis5513,
561 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} }, 562 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} },
562 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA, 563 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA,
563 .pio_mask = ATA_PIO4, 564 .pio_mask = ATA_PIO4,
@@ -572,6 +573,11 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_devi
572 if (sis_find_family(dev) == 0) 573 if (sis_find_family(dev) == 0)
573 return -ENOTSUPP; 574 return -ENOTSUPP;
574 575
576 if (chipset_family >= ATA_133)
577 d.port_ops = &sis_ata133_port_ops;
578 else
579 d.port_ops = &sis_port_ops;
580
575 d.udma_mask = udma_rates[chipset_family]; 581 d.udma_mask = udma_rates[chipset_family];
576 582
577 return ide_setup_pci_device(dev, &d); 583 return ide_setup_pci_device(dev, &d);