diff options
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index d52c54bb6a78..8a6b27b3bcc3 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/alim15x3.c Version 0.21 2007/02/03 | 2 | * linux/drivers/ide/pci/alim15x3.c Version 0.25 Jun 9 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer | 4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer |
5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer | 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer |
@@ -10,6 +10,7 @@ | |||
10 | * Copyright (C) 2002 Alan Cox <alan@redhat.com> | 10 | * Copyright (C) 2002 Alan Cox <alan@redhat.com> |
11 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> | 11 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> |
12 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | 12 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> |
13 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | ||
13 | * | 14 | * |
14 | * (U)DMA capable version of ali 1533/1543(C), 1535(D) | 15 | * (U)DMA capable version of ali 1533/1543(C), 1535(D) |
15 | * | 16 | * |
@@ -36,6 +37,7 @@ | |||
36 | #include <linux/hdreg.h> | 37 | #include <linux/hdreg.h> |
37 | #include <linux/ide.h> | 38 | #include <linux/ide.h> |
38 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/dmi.h> | ||
39 | 41 | ||
40 | #include <asm/io.h> | 42 | #include <asm/io.h> |
41 | 43 | ||
@@ -583,6 +585,35 @@ out: | |||
583 | return 0; | 585 | return 0; |
584 | } | 586 | } |
585 | 587 | ||
588 | /* | ||
589 | * Cable special cases | ||
590 | */ | ||
591 | |||
592 | static struct dmi_system_id cable_dmi_table[] = { | ||
593 | { | ||
594 | .ident = "HP Pavilion N5430", | ||
595 | .matches = { | ||
596 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
597 | DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"), | ||
598 | }, | ||
599 | }, | ||
600 | { } | ||
601 | }; | ||
602 | |||
603 | static int ali_cable_override(struct pci_dev *pdev) | ||
604 | { | ||
605 | /* Fujitsu P2000 */ | ||
606 | if (pdev->subsystem_vendor == 0x10CF && | ||
607 | pdev->subsystem_device == 0x10AF) | ||
608 | return 1; | ||
609 | |||
610 | /* Systems by DMI */ | ||
611 | if (dmi_check_system(cable_dmi_table)) | ||
612 | return 1; | ||
613 | |||
614 | return 0; | ||
615 | } | ||
616 | |||
586 | /** | 617 | /** |
587 | * ata66_ali15x3 - check for UDMA 66 support | 618 | * ata66_ali15x3 - check for UDMA 66 support |
588 | * @hwif: IDE interface | 619 | * @hwif: IDE interface |
@@ -597,34 +628,28 @@ out: | |||
597 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | 628 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) |
598 | { | 629 | { |
599 | struct pci_dev *dev = hwif->pci_dev; | 630 | struct pci_dev *dev = hwif->pci_dev; |
600 | unsigned int ata66 = 0; | ||
601 | u8 cable_80_pin[2] = { 0, 0 }; | ||
602 | |||
603 | unsigned long flags; | 631 | unsigned long flags; |
604 | u8 tmpbyte; | 632 | u8 cbl = ATA_CBL_PATA40, tmpbyte; |
605 | 633 | ||
606 | local_irq_save(flags); | 634 | local_irq_save(flags); |
607 | 635 | ||
608 | if (m5229_revision >= 0xC2) { | 636 | if (m5229_revision >= 0xC2) { |
609 | /* | 637 | /* |
610 | * Ultra66 cable detection (from Host View) | 638 | * m5229 80-pin cable detection (from Host View) |
611 | * m5229, 0x4a, bit0: primary, bit1: secondary 80 pin | 639 | * |
612 | */ | 640 | * 0x4a bit0 is 0 => primary channel has 80-pin |
613 | pci_read_config_byte(dev, 0x4a, &tmpbyte); | 641 | * 0x4a bit1 is 0 => secondary channel has 80-pin |
614 | /* | 642 | * |
615 | * 0x4a, bit0 is 0 => primary channel | 643 | * Certain laptops use short but suitable cables |
616 | * has 80-pin (from host view) | 644 | * and don't implement the detect logic. |
617 | */ | 645 | */ |
618 | if (!(tmpbyte & 0x01)) cable_80_pin[0] = 1; | 646 | if (ali_cable_override(dev)) |
619 | /* | 647 | cbl = ATA_CBL_PATA40_SHORT; |
620 | * 0x4a, bit1 is 0 => secondary channel | 648 | else { |
621 | * has 80-pin (from host view) | 649 | pci_read_config_byte(dev, 0x4a, &tmpbyte); |
622 | */ | 650 | if ((tmpbyte & (1 << hwif->channel)) == 0) |
623 | if (!(tmpbyte & 0x02)) cable_80_pin[1] = 1; | 651 | cbl = ATA_CBL_PATA80; |
624 | /* | 652 | } |
625 | * Allow ata66 if cable of current channel has 80 pins | ||
626 | */ | ||
627 | ata66 = (hwif->channel)?cable_80_pin[1]:cable_80_pin[0]; | ||
628 | } else { | 653 | } else { |
629 | /* | 654 | /* |
630 | * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 | 655 | * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 |
@@ -657,7 +682,7 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | |||
657 | 682 | ||
658 | local_irq_restore(flags); | 683 | local_irq_restore(flags); |
659 | 684 | ||
660 | return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 685 | return cbl; |
661 | } | 686 | } |
662 | 687 | ||
663 | /** | 688 | /** |