diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:43 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:43 -0400 |
commit | 4764b68405ac918e9ac9939b1a2d1469102e5af7 (patch) | |
tree | 606d93fb1782c53c27f8703b38583559ab8b5d02 /drivers/ide/pci/sis5513.c | |
parent | eb7a07e8d6580ea498cac53acafe42c080af4d06 (diff) |
sis5513: fail early for unsupported chipsets
* Factor out chipset family detection from init_chipset_sis5513()
to sis_find_family().
* Use sis_find_family() in sis5513_init_one() to fail early if the
chipset is unsupported.
* Keep a local copy sis5513_chipset in sis5513_init_one()
and set .udma_mask according to chipset family.
* Remove no longer need ->ultra_mask setting from init_hwif_sis5513().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/sis5513.c')
-rw-r--r-- | drivers/ide/pci/sis5513.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 65ee2ccabed6..181b647e5ca9 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -359,9 +359,7 @@ static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) | |||
359 | return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5; | 359 | return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5; |
360 | } | 360 | } |
361 | 361 | ||
362 | /* Chip detection and general config */ | 362 | static int __devinit sis_find_family(struct pci_dev *dev) |
363 | static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev, | ||
364 | const char *name) | ||
365 | { | 363 | { |
366 | struct pci_dev *host; | 364 | struct pci_dev *host; |
367 | int i = 0; | 365 | int i = 0; |
@@ -442,14 +440,16 @@ static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev, | |||
442 | } | 440 | } |
443 | } | 441 | } |
444 | 442 | ||
445 | if (!chipset_family) | 443 | return chipset_family; |
446 | return -1; | 444 | } |
447 | 445 | ||
446 | static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev, | ||
447 | const char *name) | ||
448 | { | ||
448 | /* Make general config ops here | 449 | /* Make general config ops here |
449 | 1/ tell IDE channels to operate in Compatibility mode only | 450 | 1/ tell IDE channels to operate in Compatibility mode only |
450 | 2/ tell old chips to allow per drive IDE timings */ | 451 | 2/ tell old chips to allow per drive IDE timings */ |
451 | 452 | ||
452 | { | ||
453 | u8 reg; | 453 | u8 reg; |
454 | u16 regw; | 454 | u16 regw; |
455 | 455 | ||
@@ -495,7 +495,6 @@ static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev, | |||
495 | pci_write_config_byte(dev, 0x52, reg|0x08); | 495 | pci_write_config_byte(dev, 0x52, reg|0x08); |
496 | break; | 496 | break; |
497 | } | 497 | } |
498 | } | ||
499 | 498 | ||
500 | return 0; | 499 | return 0; |
501 | } | 500 | } |
@@ -546,8 +545,6 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) | |||
546 | 545 | ||
547 | static void __devinit init_hwif_sis5513(ide_hwif_t *hwif) | 546 | static void __devinit init_hwif_sis5513(ide_hwif_t *hwif) |
548 | { | 547 | { |
549 | u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; | ||
550 | |||
551 | hwif->set_pio_mode = &sis_set_pio_mode; | 548 | hwif->set_pio_mode = &sis_set_pio_mode; |
552 | hwif->set_dma_mode = &sis_set_dma_mode; | 549 | hwif->set_dma_mode = &sis_set_dma_mode; |
553 | 550 | ||
@@ -555,11 +552,6 @@ static void __devinit init_hwif_sis5513(ide_hwif_t *hwif) | |||
555 | hwif->udma_filter = sis5513_ata133_udma_filter; | 552 | hwif->udma_filter = sis5513_ata133_udma_filter; |
556 | 553 | ||
557 | hwif->cable_detect = ata66_sis5513; | 554 | hwif->cable_detect = ata66_sis5513; |
558 | |||
559 | if (hwif->dma_base == 0) | ||
560 | return; | ||
561 | |||
562 | hwif->ultra_mask = udma_rates[chipset_family]; | ||
563 | } | 555 | } |
564 | 556 | ||
565 | static const struct ide_port_info sis5513_chipset __devinitdata = { | 557 | static const struct ide_port_info sis5513_chipset __devinitdata = { |
@@ -574,7 +566,15 @@ static const struct ide_port_info sis5513_chipset __devinitdata = { | |||
574 | 566 | ||
575 | static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 567 | static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
576 | { | 568 | { |
577 | return ide_setup_pci_device(dev, &sis5513_chipset); | 569 | struct ide_port_info d = sis5513_chipset; |
570 | u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; | ||
571 | |||
572 | if (sis_find_family(dev) == 0) | ||
573 | return -ENOTSUPP; | ||
574 | |||
575 | d.udma_mask = udma_rates[chipset_family]; | ||
576 | |||
577 | return ide_setup_pci_device(dev, &d); | ||
578 | } | 578 | } |
579 | 579 | ||
580 | static const struct pci_device_id sis5513_pci_tbl[] = { | 580 | static const struct pci_device_id sis5513_pci_tbl[] = { |