aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/pata_ali.c7
-rw-r--r--drivers/ide/Kconfig4
-rw-r--r--drivers/ide/ide-iops.c3
-rw-r--r--drivers/ide/pci/alim15x3.c7
-rw-r--r--drivers/ide/pci/hpt366.c138
-rw-r--r--drivers/ide/pci/pdc202xx_new.c9
-rw-r--r--drivers/ide/pci/via82cxxx.c15
-rw-r--r--drivers/ide/ppc/mpc8xx.c1
-rw-r--r--drivers/ide/setup-pci.c41
-rw-r--r--include/linux/ide.h13
10 files changed, 141 insertions, 97 deletions
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 94e5edc12ac9..71bdc3b3189c 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -48,6 +48,13 @@ static struct dmi_system_id cable_dmi_table[] = {
48 DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), 48 DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
49 }, 49 },
50 }, 50 },
51 {
52 .ident = "Toshiba Satelite S1800-814",
53 .matches = {
54 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
55 DMI_MATCH(DMI_PRODUCT_NAME, "S1800-814"),
56 },
57 },
51 { } 58 { }
52}; 59};
53 60
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 7adb61bad6ad..4200251ff635 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -781,7 +781,7 @@ endif
781 781
782config BLK_DEV_IDE_PMAC 782config BLK_DEV_IDE_PMAC
783 bool "Builtin PowerMac IDE support" 783 bool "Builtin PowerMac IDE support"
784 depends on PPC_PMAC && IDE=y 784 depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y
785 help 785 help
786 This driver provides support for the built-in IDE controller on 786 This driver provides support for the built-in IDE controller on
787 most of the recent Apple Power Macintoshes and PowerBooks. 787 most of the recent Apple Power Macintoshes and PowerBooks.
@@ -946,7 +946,7 @@ config BLK_DEV_Q40IDE
946 946
947config BLK_DEV_MPC8xx_IDE 947config BLK_DEV_MPC8xx_IDE
948 bool "MPC8xx IDE support" 948 bool "MPC8xx IDE support"
949 depends on 8xx && IDE=y && BLK_DEV_IDE=y 949 depends on 8xx && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE
950 select IDE_GENERIC 950 select IDE_GENERIC
951 help 951 help
952 This option provides support for IDE on Motorola MPC8xx Systems. 952 This option provides support for IDE on Motorola MPC8xx Systems.
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index f4cd2700cae5..646a54e233d3 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -615,8 +615,7 @@ u8 eighty_ninty_three (ide_drive_t *drive)
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb) 615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
616 goto no_80w; 616 goto no_80w;
617 617
618 /* Check for SATA but only if we are ATA5 or higher */ 618 if (ide_dev_is_sata(id))
619 if (id->hw_config == 0 && (id->major_rev_num & 0x7FE0))
620 return 1; 619 return 1;
621 620
622 /* 621 /*
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 025689de50e9..11ecb618007c 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -596,6 +596,13 @@ static struct dmi_system_id cable_dmi_table[] = {
596 DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), 596 DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
597 }, 597 },
598 }, 598 },
599 {
600 .ident = "Toshiba Satellite S1800-814",
601 .matches = {
602 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
603 DMI_MATCH(DMI_PRODUCT_NAME, "S1800-814"),
604 },
605 },
599 { } 606 { }
600}; 607};
601 608
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 2cd74c345a6c..39f1c89f7c86 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.10 Jun 29, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.12 Aug 19, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -68,7 +68,8 @@
68 * HPT37x chip family; save space by introducing the separate transfer mode 68 * HPT37x chip family; save space by introducing the separate transfer mode
69 * table in which the mode lookup is done 69 * table in which the mode lookup is done
70 * - use f_CNT value saved by the HighPoint BIOS as reading it directly gives 70 * - use f_CNT value saved by the HighPoint BIOS as reading it directly gives
71 * the wrong PCI frequency since DPLL has already been calibrated by BIOS 71 * the wrong PCI frequency since DPLL has already been calibrated by BIOS;
72 * read it only from the function 0 of HPT374 chips
72 * - fix the hotswap code: it caused RESET- to glitch when tristating the bus, 73 * - fix the hotswap code: it caused RESET- to glitch when tristating the bus,
73 * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead 74 * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead
74 * - pass to init_chipset() handlers a copy of the IDE PCI device structure as 75 * - pass to init_chipset() handlers a copy of the IDE PCI device structure as
@@ -113,6 +114,7 @@
113 * unify HPT36x/37x timing setup code and the speedproc handlers by joining 114 * unify HPT36x/37x timing setup code and the speedproc handlers by joining
114 * the register setting lists into the table indexed by the clock selected 115 * the register setting lists into the table indexed by the clock selected
115 * - set the correct hwif->ultra_mask for each individual chip 116 * - set the correct hwif->ultra_mask for each individual chip
117 * - add UltraDMA mode filtering for the HPT37[24] based SATA cards
116 * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com> 118 * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com>
117 */ 119 */
118 120
@@ -517,42 +519,44 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list)
517} 519}
518 520
519/* 521/*
520 * Note for the future; the SATA hpt37x we must set 522 * The Marvell bridge chips used on the HighPoint SATA cards do not seem
521 * either PIO or UDMA modes 0,4,5 523 * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes...
522 */ 524 */
523 525
524static u8 hpt3xx_udma_filter(ide_drive_t *drive) 526static u8 hpt3xx_udma_filter(ide_drive_t *drive)
525{ 527{
526 struct hpt_info *info = pci_get_drvdata(HWIF(drive)->pci_dev); 528 ide_hwif_t *hwif = HWIF(drive);
527 u8 mask; 529 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev);
530 u8 mask = hwif->ultra_mask;
528 531
529 switch (info->chip_type) { 532 switch (info->chip_type) {
530 case HPT370A:
531 if (!HPT370_ALLOW_ATA100_5 ||
532 check_in_drive_list(drive, bad_ata100_5))
533 return 0x1f;
534 else
535 return 0x3f;
536 case HPT370:
537 if (!HPT370_ALLOW_ATA100_5 ||
538 check_in_drive_list(drive, bad_ata100_5))
539 mask = 0x1f;
540 else
541 mask = 0x3f;
542 break;
543 case HPT36x: 533 case HPT36x:
544 if (!HPT366_ALLOW_ATA66_4 || 534 if (!HPT366_ALLOW_ATA66_4 ||
545 check_in_drive_list(drive, bad_ata66_4)) 535 check_in_drive_list(drive, bad_ata66_4))
546 mask = 0x0f; 536 mask = ATA_UDMA3;
547 else
548 mask = 0x1f;
549 537
550 if (!HPT366_ALLOW_ATA66_3 || 538 if (!HPT366_ALLOW_ATA66_3 ||
551 check_in_drive_list(drive, bad_ata66_3)) 539 check_in_drive_list(drive, bad_ata66_3))
552 mask = 0x07; 540 mask = ATA_UDMA2;
541 break;
542 case HPT370:
543 if (!HPT370_ALLOW_ATA100_5 ||
544 check_in_drive_list(drive, bad_ata100_5))
545 mask = ATA_UDMA4;
553 break; 546 break;
547 case HPT370A:
548 if (!HPT370_ALLOW_ATA100_5 ||
549 check_in_drive_list(drive, bad_ata100_5))
550 return ATA_UDMA4;
551 case HPT372 :
552 case HPT372A:
553 case HPT372N:
554 case HPT374 :
555 if (ide_dev_is_sata(drive->id))
556 mask &= ~0x0e;
557 /* Fall thru */
554 default: 558 default:
555 return 0x7f; 559 return mask;
556 } 560 }
557 561
558 return check_in_drive_list(drive, bad_ata33) ? 0x00 : mask; 562 return check_in_drive_list(drive, bad_ata33) ? 0x00 : mask;
@@ -981,6 +985,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
981 struct hpt_info *info = kmalloc(sizeof(struct hpt_info), GFP_KERNEL); 985 struct hpt_info *info = kmalloc(sizeof(struct hpt_info), GFP_KERNEL);
982 unsigned long io_base = pci_resource_start(dev, 4); 986 unsigned long io_base = pci_resource_start(dev, 4);
983 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ 987 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */
988 u8 chip_type;
984 enum ata_clock clock; 989 enum ata_clock clock;
985 990
986 if (info == NULL) { 991 if (info == NULL) {
@@ -992,7 +997,8 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
992 * Copy everything from a static "template" structure 997 * Copy everything from a static "template" structure
993 * to just allocated per-chip hpt_info structure. 998 * to just allocated per-chip hpt_info structure.
994 */ 999 */
995 *info = *(struct hpt_info *)pci_get_drvdata(dev); 1000 memcpy(info, pci_get_drvdata(dev), sizeof(struct hpt_info));
1001 chip_type = info->chip_type;
996 1002
997 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 1003 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4));
998 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); 1004 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78);
@@ -1002,7 +1008,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1002 /* 1008 /*
1003 * First, try to estimate the PCI clock frequency... 1009 * First, try to estimate the PCI clock frequency...
1004 */ 1010 */
1005 if (info->chip_type >= HPT370) { 1011 if (chip_type >= HPT370) {
1006 u8 scr1 = 0; 1012 u8 scr1 = 0;
1007 u16 f_cnt = 0; 1013 u16 f_cnt = 0;
1008 u32 temp = 0; 1014 u32 temp = 0;
@@ -1016,7 +1022,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1016 * HighPoint does this for HPT372A. 1022 * HighPoint does this for HPT372A.
1017 * NOTE: This register is only writeable via I/O space. 1023 * NOTE: This register is only writeable via I/O space.
1018 */ 1024 */
1019 if (info->chip_type == HPT372A) 1025 if (chip_type == HPT372A)
1020 outb(0x0e, io_base + 0x9c); 1026 outb(0x0e, io_base + 0x9c);
1021 1027
1022 /* 1028 /*
@@ -1034,13 +1040,28 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1034 * First try reading the register in which the HighPoint BIOS 1040 * First try reading the register in which the HighPoint BIOS
1035 * saves f_CNT value before reprogramming the DPLL from its 1041 * saves f_CNT value before reprogramming the DPLL from its
1036 * default setting (which differs for the various chips). 1042 * default setting (which differs for the various chips).
1037 * NOTE: This register is only accessible via I/O space.
1038 * 1043 *
1039 * In case the signature check fails, we'll have to resort to 1044 * NOTE: This register is only accessible via I/O space;
1040 * reading the f_CNT register itself in hopes that nobody has 1045 * HPT374 BIOS only saves it for the function 0, so we have to
1041 * touched the DPLL yet... 1046 * always read it from there -- no need to check the result of
1047 * pci_get_slot() for the function 0 as the whole device has
1048 * been already "pinned" (via function 1) in init_setup_hpt374()
1049 */
1050 if (chip_type == HPT374 && (PCI_FUNC(dev->devfn) & 1)) {
1051 struct pci_dev *dev1 = pci_get_slot(dev->bus,
1052 dev->devfn - 1);
1053 unsigned long io_base = pci_resource_start(dev1, 4);
1054
1055 temp = inl(io_base + 0x90);
1056 pci_dev_put(dev1);
1057 } else
1058 temp = inl(io_base + 0x90);
1059
1060 /*
1061 * In case the signature check fails, we'll have to
1062 * resort to reading the f_CNT register itself in hopes
1063 * that nobody has touched the DPLL yet...
1042 */ 1064 */
1043 temp = inl(io_base + 0x90);
1044 if ((temp & 0xFFFFF000) != 0xABCDE000) { 1065 if ((temp & 0xFFFFF000) != 0xABCDE000) {
1045 int i; 1066 int i;
1046 1067
@@ -1120,7 +1141,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1120 * We also don't like using the DPLL because this causes glitches 1141 * We also don't like using the DPLL because this causes glitches
1121 * on PRST-/SRST- when the state engine gets reset... 1142 * on PRST-/SRST- when the state engine gets reset...
1122 */ 1143 */
1123 if (info->chip_type >= HPT374 || info->settings[clock] == NULL) { 1144 if (chip_type >= HPT374 || info->settings[clock] == NULL) {
1124 u16 f_low, delta = pci_clk < 50 ? 2 : 4; 1145 u16 f_low, delta = pci_clk < 50 ? 2 : 4;
1125 int adjust; 1146 int adjust;
1126 1147
@@ -1190,7 +1211,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1190 /* Point to this chip's own instance of the hpt_info structure. */ 1211 /* Point to this chip's own instance of the hpt_info structure. */
1191 pci_set_drvdata(dev, info); 1212 pci_set_drvdata(dev, info);
1192 1213
1193 if (info->chip_type >= HPT370) { 1214 if (chip_type >= HPT370) {
1194 u8 mcr1, mcr4; 1215 u8 mcr1, mcr4;
1195 1216
1196 /* 1217 /*
@@ -1209,7 +1230,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1209 * the MISC. register to stretch the UltraDMA Tss timing. 1230 * the MISC. register to stretch the UltraDMA Tss timing.
1210 * NOTE: This register is only writeable via I/O space. 1231 * NOTE: This register is only writeable via I/O space.
1211 */ 1232 */
1212 if (info->chip_type == HPT371N && clock == ATA_CLOCK_66MHZ) 1233 if (chip_type == HPT371N && clock == ATA_CLOCK_66MHZ)
1213 1234
1214 outb(inb(io_base + 0x9c) | 0x04, io_base + 0x9c); 1235 outb(inb(io_base + 0x9c) | 0x04, io_base + 0x9c);
1215 1236
@@ -1218,25 +1239,24 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1218 1239
1219static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1240static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1220{ 1241{
1221 struct pci_dev *dev = hwif->pci_dev; 1242 struct pci_dev *dev = hwif->pci_dev;
1222 struct hpt_info *info = pci_get_drvdata(dev); 1243 struct hpt_info *info = pci_get_drvdata(dev);
1223 int serialize = HPT_SERIALIZE_IO; 1244 int serialize = HPT_SERIALIZE_IO;
1224 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; 1245 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02;
1225 u8 chip_type = info->chip_type; 1246 u8 chip_type = info->chip_type;
1226 u8 new_mcr, old_mcr = 0; 1247 u8 new_mcr, old_mcr = 0;
1227 1248
1228 /* Cache the channel's MISC. control registers' offset */ 1249 /* Cache the channel's MISC. control registers' offset */
1229 hwif->select_data = hwif->channel ? 0x54 : 0x50; 1250 hwif->select_data = hwif->channel ? 0x54 : 0x50;
1230 1251
1231 hwif->tuneproc = &hpt3xx_tune_drive; 1252 hwif->tuneproc = &hpt3xx_tune_drive;
1232 hwif->speedproc = &hpt3xx_tune_chipset; 1253 hwif->speedproc = &hpt3xx_tune_chipset;
1233 hwif->quirkproc = &hpt3xx_quirkproc; 1254 hwif->quirkproc = &hpt3xx_quirkproc;
1234 hwif->intrproc = &hpt3xx_intrproc; 1255 hwif->intrproc = &hpt3xx_intrproc;
1235 hwif->maskproc = &hpt3xx_maskproc; 1256 hwif->maskproc = &hpt3xx_maskproc;
1236 hwif->busproc = &hpt3xx_busproc; 1257 hwif->busproc = &hpt3xx_busproc;
1237 1258
1238 if (chip_type <= HPT370A) 1259 hwif->udma_filter = &hpt3xx_udma_filter;
1239 hwif->udma_filter = &hpt3xx_udma_filter;
1240 1260
1241 /* 1261 /*
1242 * HPT3xxN chips have some complications: 1262 * HPT3xxN chips have some complications:
@@ -1486,19 +1506,19 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1486 d->host_flags |= IDE_HFLAG_SINGLE; 1506 d->host_flags |= IDE_HFLAG_SINGLE;
1487 d->enablebits[0].mask = d->enablebits[0].val = 0x10; 1507 d->enablebits[0].mask = d->enablebits[0].val = 0x10;
1488 1508
1489 d->udma_mask = HPT366_ALLOW_ATA66_3 ? 1509 d->udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ?
1490 (HPT366_ALLOW_ATA66_4 ? 0x1f : 0x0f) : 0x07; 1510 ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2;
1491 break; 1511 break;
1492 case 3: 1512 case 3:
1493 case 4: 1513 case 4:
1494 d->udma_mask = HPT370_ALLOW_ATA100_5 ? 0x3f : 0x1f; 1514 d->udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4;
1495 break; 1515 break;
1496 default: 1516 default:
1497 rev = 6; 1517 rev = 6;
1498 /* fall thru */ 1518 /* fall thru */
1499 case 5: 1519 case 5:
1500 case 6: 1520 case 6:
1501 d->udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f; 1521 d->udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5;
1502 break; 1522 break;
1503 } 1523 }
1504 1524
@@ -1559,7 +1579,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1559 .init_dma = init_dma_hpt366, 1579 .init_dma = init_dma_hpt366,
1560 .autodma = AUTODMA, 1580 .autodma = AUTODMA,
1561 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1581 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1562 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1582 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1563 .bootable = OFF_BOARD, 1583 .bootable = OFF_BOARD,
1564 .extra = 240, 1584 .extra = 240,
1565 .pio_mask = ATA_PIO4, 1585 .pio_mask = ATA_PIO4,
@@ -1571,7 +1591,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1571 .init_dma = init_dma_hpt366, 1591 .init_dma = init_dma_hpt366,
1572 .autodma = AUTODMA, 1592 .autodma = AUTODMA,
1573 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1593 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1574 .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1594 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1575 .bootable = OFF_BOARD, 1595 .bootable = OFF_BOARD,
1576 .extra = 240, 1596 .extra = 240,
1577 .pio_mask = ATA_PIO4, 1597 .pio_mask = ATA_PIO4,
@@ -1583,7 +1603,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1583 .init_dma = init_dma_hpt366, 1603 .init_dma = init_dma_hpt366,
1584 .autodma = AUTODMA, 1604 .autodma = AUTODMA,
1585 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1605 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1586 .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1606 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1587 .bootable = OFF_BOARD, 1607 .bootable = OFF_BOARD,
1588 .extra = 240, 1608 .extra = 240,
1589 .pio_mask = ATA_PIO4, 1609 .pio_mask = ATA_PIO4,
@@ -1595,7 +1615,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1595 .init_dma = init_dma_hpt366, 1615 .init_dma = init_dma_hpt366,
1596 .autodma = AUTODMA, 1616 .autodma = AUTODMA,
1597 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1617 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1598 .udma_mask = 0x3f, 1618 .udma_mask = ATA_UDMA5,
1599 .bootable = OFF_BOARD, 1619 .bootable = OFF_BOARD,
1600 .extra = 240, 1620 .extra = 240,
1601 .pio_mask = ATA_PIO4, 1621 .pio_mask = ATA_PIO4,
@@ -1607,7 +1627,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1607 .init_dma = init_dma_hpt366, 1627 .init_dma = init_dma_hpt366,
1608 .autodma = AUTODMA, 1628 .autodma = AUTODMA,
1609 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1629 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1610 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1630 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1611 .bootable = OFF_BOARD, 1631 .bootable = OFF_BOARD,
1612 .extra = 240, 1632 .extra = 240,
1613 .pio_mask = ATA_PIO4, 1633 .pio_mask = ATA_PIO4,
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index f6db2f37efad..7b0e479c355c 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -9,7 +9,7 @@
9 * Split from: 9 * Split from:
10 * linux/drivers/ide/pdc202xx.c Version 0.35 Mar. 30, 2002 10 * linux/drivers/ide/pdc202xx.c Version 0.35 Mar. 30, 2002
11 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> 11 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
12 * Copyright (C) 2005-2006 MontaVista Software, Inc. 12 * Copyright (C) 2005-2007 MontaVista Software, Inc.
13 * Portions Copyright (C) 1999 Promise Technology, Inc. 13 * Portions Copyright (C) 1999 Promise Technology, Inc.
14 * Author: Frank Tiernan (frankt@promise.com) 14 * Author: Frank Tiernan (frankt@promise.com)
15 * Released under terms of General Public License 15 * Released under terms of General Public License
@@ -341,7 +341,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
341 */ 341 */
342 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + 342 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
343 (end_time.tv_usec - start_time.tv_usec); 343 (end_time.tv_usec - start_time.tv_usec);
344 pll_input = ((start_count - end_count) & 0x3ffffff) / 10 * 344 pll_input = ((start_count - end_count) & 0x3fffffff) / 10 *
345 (10000000 / usec_elapsed); 345 (10000000 / usec_elapsed);
346 346
347 DBG("start[%ld] end[%ld]\n", start_count, end_count); 347 DBG("start[%ld] end[%ld]\n", start_count, end_count);
@@ -535,7 +535,7 @@ static int __devinit init_setup_pdc20270(struct pci_dev *dev,
535 (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) { 535 (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
536 if (PCI_SLOT(dev->devfn) & 2) 536 if (PCI_SLOT(dev->devfn) & 2)
537 return -ENODEV; 537 return -ENODEV;
538 d->extra = 0; 538
539 while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) { 539 while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
540 if ((findev->vendor == dev->vendor) && 540 if ((findev->vendor == dev->vendor) &&
541 (findev->device == dev->device) && 541 (findev->device == dev->device) &&
@@ -544,7 +544,8 @@ static int __devinit init_setup_pdc20270(struct pci_dev *dev,
544 findev->irq = dev->irq; 544 findev->irq = dev->irq;
545 } 545 }
546 ret = ide_setup_pci_devices(dev, findev, d); 546 ret = ide_setup_pci_devices(dev, findev, d);
547 pci_dev_put(findev); 547 if (ret < 0)
548 pci_dev_put(findev);
548 return ret; 549 return ret;
549 } 550 }
550 } 551 }
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 8c539381d622..a7be7795e6af 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * Version 3.46 3 * Version 3.47
4 * 4 *
5 * VIA IDE driver for Linux. Supported southbridges: 5 * VIA IDE driver for Linux. Supported southbridges:
6 * 6 *
@@ -430,19 +430,26 @@ static struct dmi_system_id cable_dmi_table[] = {
430 { } 430 { }
431}; 431};
432 432
433static int via_cable_override(void) 433static int via_cable_override(struct pci_dev *pdev)
434{ 434{
435 /* Systems by DMI */ 435 /* Systems by DMI */
436 if (dmi_check_system(cable_dmi_table)) 436 if (dmi_check_system(cable_dmi_table))
437 return 1; 437 return 1;
438
439 /* Arima W730-K8/Targa Visionary 811/... */
440 if (pdev->subsystem_vendor == 0x161F &&
441 pdev->subsystem_device == 0x2032)
442 return 1;
443
438 return 0; 444 return 0;
439} 445}
440 446
441static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) 447static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
442{ 448{
443 struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); 449 struct pci_dev *pdev = hwif->pci_dev;
450 struct via82cxxx_dev *vdev = pci_get_drvdata(pdev);
444 451
445 if (via_cable_override()) 452 if (via_cable_override(pdev))
446 return ATA_CBL_PATA40_SHORT; 453 return ATA_CBL_PATA40_SHORT;
447 454
448 if ((vdev->via_80w >> hwif->channel) & 1) 455 if ((vdev->via_80w >> hwif->channel) & 1)
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 8859fe2f5ac2..dab79afa9b22 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -32,7 +32,6 @@
32#include <asm/mpc8xx.h> 32#include <asm/mpc8xx.h>
33#include <asm/mmu.h> 33#include <asm/mmu.h>
34#include <asm/processor.h> 34#include <asm/processor.h>
35#include <asm/residual.h>
36#include <asm/io.h> 35#include <asm/io.h>
37#include <asm/pgtable.h> 36#include <asm/pgtable.h>
38#include <asm/ide.h> 37#include <asm/ide.h>
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 30e596c0f120..1129f8c30840 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -816,19 +816,15 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
816 struct list_head *l; 816 struct list_head *l;
817 struct pci_driver *d; 817 struct pci_driver *d;
818 818
819 list_for_each(l, &ide_pci_drivers) 819 list_for_each(l, &ide_pci_drivers) {
820 {
821 d = list_entry(l, struct pci_driver, node); 820 d = list_entry(l, struct pci_driver, node);
822 if(d->id_table) 821 if (d->id_table) {
823 { 822 const struct pci_device_id *id = pci_match_id(d->id_table,
824 const struct pci_device_id *id = pci_match_id(d->id_table, dev); 823 dev);
825 if(id != NULL) 824 if (id != NULL && d->probe(dev, id) >= 0) {
826 { 825 dev->driver = d;
827 if(d->probe(dev, id) >= 0) 826 pci_dev_get(dev);
828 { 827 return 1;
829 dev->driver = d;
830 return 1;
831 }
832 } 828 }
833 } 829 }
834 } 830 }
@@ -851,15 +847,13 @@ void __init ide_scan_pcibus (int scan_direction)
851 struct list_head *l, *n; 847 struct list_head *l, *n;
852 848
853 pre_init = 0; 849 pre_init = 0;
854 if (!scan_direction) { 850 if (!scan_direction)
855 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 851 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
856 ide_scan_pcidev(dev); 852 ide_scan_pcidev(dev);
857 } 853 else
858 } else { 854 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev))
859 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 855 != NULL)
860 ide_scan_pcidev(dev); 856 ide_scan_pcidev(dev);
861 }
862 }
863 857
864 /* 858 /*
865 * Hand the drivers over to the PCI layer now we 859 * Hand the drivers over to the PCI layer now we
@@ -869,12 +863,9 @@ void __init ide_scan_pcibus (int scan_direction)
869 list_for_each_safe(l, n, &ide_pci_drivers) { 863 list_for_each_safe(l, n, &ide_pci_drivers) {
870 list_del(l); 864 list_del(l);
871 d = list_entry(l, struct pci_driver, node); 865 d = list_entry(l, struct pci_driver, node);
872 if (__pci_register_driver(d, d->driver.owner, 866 if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name))
873 d->driver.mod_name)) { 867 printk(KERN_ERR "%s: failed to register driver for %s\n",
874 printk(KERN_ERR "%s: failed to register driver " 868 __FUNCTION__, d->driver.mod_name);
875 "for %s\n", __FUNCTION__,
876 d->driver.mod_name);
877 }
878 } 869 }
879} 870}
880#endif 871#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index c792b4fd1588..b9f66c10caa0 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1378,6 +1378,19 @@ static inline int ide_dev_has_iordy(struct hd_driveid *id)
1378 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; 1378 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
1379} 1379}
1380 1380
1381static inline int ide_dev_is_sata(struct hd_driveid *id)
1382{
1383 /*
1384 * See if word 93 is 0 AND drive is at least ATA-5 compatible
1385 * verifying that word 80 by casting it to a signed type --
1386 * this trick allows us to filter out the reserved values of
1387 * 0x0000 and 0xffff along with the earlier ATA revisions...
1388 */
1389 if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
1390 return 1;
1391 return 0;
1392}
1393
1381u8 ide_dump_status(ide_drive_t *, const char *, u8); 1394u8 ide_dump_status(ide_drive_t *, const char *, u8);
1382 1395
1383typedef struct ide_pio_timings_s { 1396typedef struct ide_pio_timings_s {