diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-24 21:20:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-24 21:20:42 -0400 |
commit | 91396c1e2d73a041d86935fb8371e8d48b48b663 (patch) | |
tree | 7000d66835f33dbc0e47954851daa71a88bb5b85 | |
parent | 9059b454248a060ab39346c5d079f56089ab3868 (diff) | |
parent | cf5792d20cdc9a88abf9984a2224f57de1952926 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
pata_via: Handle laptops via DMI
libata: -ENODEV during prereset isn't an error
libata: don't consider 0xff as port empty if SStatus is available
ata_piix: add short 40c quirk for Acer Aspire 2030, take #2
pata_sis: Fix and clean up some timing setups
hpt3x2n: Correct revision boundary
-rw-r--r-- | drivers/ata/ata_piix.c | 1 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_hpt3x2n.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_sis.c | 46 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 29 |
5 files changed, 57 insertions, 27 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 0458811010fd..9c07b88631be 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -578,6 +578,7 @@ static const struct ich_laptop ich_laptop[] = { | |||
578 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ | 578 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ |
579 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ | 579 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ |
580 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 580 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
581 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ | ||
581 | /* end marker */ | 582 | /* end marker */ |
582 | { 0, } | 583 | { 0, } |
583 | }; | 584 | }; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a6de57e02047..3ca9c610c110 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3022,7 +3022,7 @@ int ata_wait_ready(struct ata_port *ap, unsigned long deadline) | |||
3022 | 3022 | ||
3023 | if (!(status & ATA_BUSY)) | 3023 | if (!(status & ATA_BUSY)) |
3024 | return 0; | 3024 | return 0; |
3025 | if (status == 0xff) | 3025 | if (!ata_port_online(ap) && status == 0xff) |
3026 | return -ENODEV; | 3026 | return -ENODEV; |
3027 | if (time_after(now, deadline)) | 3027 | if (time_after(now, deadline)) |
3028 | return -EBUSY; | 3028 | return -EBUSY; |
@@ -3368,7 +3368,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline) | |||
3368 | */ | 3368 | */ |
3369 | if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) { | 3369 | if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) { |
3370 | rc = ata_wait_ready(ap, deadline); | 3370 | rc = ata_wait_ready(ap, deadline); |
3371 | if (rc) { | 3371 | if (rc && rc != -ENODEV) { |
3372 | ata_port_printk(ap, KERN_WARNING, "device not ready " | 3372 | ata_port_printk(ap, KERN_WARNING, "device not ready " |
3373 | "(errno=%d), forcing hardreset\n", rc); | 3373 | "(errno=%d), forcing hardreset\n", rc); |
3374 | ehc->i.action |= ATA_EH_HARDRESET; | 3374 | ehc->i.action |= ATA_EH_HARDRESET; |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index f25154aed75d..e947433cb37d 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -521,8 +521,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
521 | /* 371N if rev > 1 */ | 521 | /* 371N if rev > 1 */ |
522 | break; | 522 | break; |
523 | case PCI_DEVICE_ID_TTI_HPT372: | 523 | case PCI_DEVICE_ID_TTI_HPT372: |
524 | /* 372N if rev >= 1*/ | 524 | /* 372N if rev >= 2*/ |
525 | if (class_rev == 0) | 525 | if (class_rev < 2) |
526 | return -ENODEV; | 526 | return -ENODEV; |
527 | break; | 527 | break; |
528 | case PCI_DEVICE_ID_TTI_HPT302: | 528 | case PCI_DEVICE_ID_TTI_HPT302: |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index f2231267e011..ec3ae9375015 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -73,14 +73,14 @@ static int sis_short_ata40(struct pci_dev *dev) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * sis_port_base - return PCI configuration base for dev | 76 | * sis_old_port_base - return PCI configuration base for dev |
77 | * @adev: device | 77 | * @adev: device |
78 | * | 78 | * |
79 | * Returns the base of the PCI configuration registers for this port | 79 | * Returns the base of the PCI configuration registers for this port |
80 | * number. | 80 | * number. |
81 | */ | 81 | */ |
82 | 82 | ||
83 | static int sis_port_base(struct ata_device *adev) | 83 | static int sis_old_port_base(struct ata_device *adev) |
84 | { | 84 | { |
85 | return 0x40 + (4 * adev->ap->port_no) + (2 * adev->devno); | 85 | return 0x40 + (4 * adev->ap->port_no) + (2 * adev->devno); |
86 | } | 86 | } |
@@ -211,7 +211,7 @@ static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev) | |||
211 | static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) | 211 | static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) |
212 | { | 212 | { |
213 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 213 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
214 | int port = sis_port_base(adev); | 214 | int port = sis_old_port_base(adev); |
215 | u8 t1, t2; | 215 | u8 t1, t2; |
216 | int speed = adev->pio_mode - XFER_PIO_0; | 216 | int speed = adev->pio_mode - XFER_PIO_0; |
217 | 217 | ||
@@ -248,7 +248,7 @@ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
248 | static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) | 248 | static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) |
249 | { | 249 | { |
250 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 250 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
251 | int port = sis_port_base(adev); | 251 | int port = sis_old_port_base(adev); |
252 | int speed = adev->pio_mode - XFER_PIO_0; | 252 | int speed = adev->pio_mode - XFER_PIO_0; |
253 | 253 | ||
254 | const u8 actrec[] = { 0x00, 0x67, 0x44, 0x33, 0x31 }; | 254 | const u8 actrec[] = { 0x00, 0x67, 0x44, 0x33, 0x31 }; |
@@ -328,7 +328,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
328 | { | 328 | { |
329 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 329 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
330 | int speed = adev->dma_mode - XFER_MW_DMA_0; | 330 | int speed = adev->dma_mode - XFER_MW_DMA_0; |
331 | int drive_pci = sis_port_base(adev); | 331 | int drive_pci = sis_old_port_base(adev); |
332 | u16 timing; | 332 | u16 timing; |
333 | 333 | ||
334 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; | 334 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; |
@@ -367,7 +367,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
367 | { | 367 | { |
368 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 368 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
369 | int speed = adev->dma_mode - XFER_MW_DMA_0; | 369 | int speed = adev->dma_mode - XFER_MW_DMA_0; |
370 | int drive_pci = sis_port_base(adev); | 370 | int drive_pci = sis_old_port_base(adev); |
371 | u16 timing; | 371 | u16 timing; |
372 | 372 | ||
373 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; | 373 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; |
@@ -378,12 +378,12 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
378 | if (adev->dma_mode < XFER_UDMA_0) { | 378 | if (adev->dma_mode < XFER_UDMA_0) { |
379 | /* bits 3-0 hold recovery timing bits 8-10 active timing and | 379 | /* bits 3-0 hold recovery timing bits 8-10 active timing and |
380 | the higer bits are dependant on the device, bit 15 udma */ | 380 | the higer bits are dependant on the device, bit 15 udma */ |
381 | timing &= ~ 0x870F; | 381 | timing &= ~0x870F; |
382 | timing |= mwdma_bits[speed]; | 382 | timing |= mwdma_bits[speed]; |
383 | } else { | 383 | } else { |
384 | /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ | 384 | /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ |
385 | speed = adev->dma_mode - XFER_UDMA_0; | 385 | speed = adev->dma_mode - XFER_UDMA_0; |
386 | timing &= ~0x6000; | 386 | timing &= ~0xF000; |
387 | timing |= udma_bits[speed]; | 387 | timing |= udma_bits[speed]; |
388 | } | 388 | } |
389 | pci_write_config_word(pdev, drive_pci, timing); | 389 | pci_write_config_word(pdev, drive_pci, timing); |
@@ -405,22 +405,22 @@ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
405 | { | 405 | { |
406 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 406 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
407 | int speed = adev->dma_mode - XFER_MW_DMA_0; | 407 | int speed = adev->dma_mode - XFER_MW_DMA_0; |
408 | int drive_pci = sis_port_base(adev); | 408 | int drive_pci = sis_old_port_base(adev); |
409 | u16 timing; | 409 | u8 timing; |
410 | 410 | ||
411 | const u16 udma_bits[] = { 0x8B00, 0x8700, 0x8500, 0x8300, 0x8200, 0x8100}; | 411 | const u8 udma_bits[] = { 0x8B, 0x87, 0x85, 0x83, 0x82, 0x81}; |
412 | 412 | ||
413 | pci_read_config_word(pdev, drive_pci, &timing); | 413 | pci_read_config_byte(pdev, drive_pci + 1, &timing); |
414 | 414 | ||
415 | if (adev->dma_mode < XFER_UDMA_0) { | 415 | if (adev->dma_mode < XFER_UDMA_0) { |
416 | /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ | 416 | /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ |
417 | } else { | 417 | } else { |
418 | /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ | 418 | /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */ |
419 | speed = adev->dma_mode - XFER_UDMA_0; | 419 | speed = adev->dma_mode - XFER_UDMA_0; |
420 | timing &= ~0x0F00; | 420 | timing &= ~0x8F; |
421 | timing |= udma_bits[speed]; | 421 | timing |= udma_bits[speed]; |
422 | } | 422 | } |
423 | pci_write_config_word(pdev, drive_pci, timing); | 423 | pci_write_config_byte(pdev, drive_pci + 1, timing); |
424 | } | 424 | } |
425 | 425 | ||
426 | /** | 426 | /** |
@@ -440,22 +440,22 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a | |||
440 | { | 440 | { |
441 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 441 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
442 | int speed = adev->dma_mode - XFER_MW_DMA_0; | 442 | int speed = adev->dma_mode - XFER_MW_DMA_0; |
443 | int drive_pci = sis_port_base(adev); | 443 | int drive_pci = sis_old_port_base(adev); |
444 | u16 timing; | 444 | u8 timing; |
445 | 445 | /* Low 4 bits are timing */ | |
446 | static const u16 udma_bits[] = { 0x8F00, 0x8A00, 0x8700, 0x8500, 0x8300, 0x8200, 0x8100}; | 446 | static const u8 udma_bits[] = { 0x8F, 0x8A, 0x87, 0x85, 0x83, 0x82, 0x81}; |
447 | 447 | ||
448 | pci_read_config_word(pdev, drive_pci, &timing); | 448 | pci_read_config_byte(pdev, drive_pci + 1, &timing); |
449 | 449 | ||
450 | if (adev->dma_mode < XFER_UDMA_0) { | 450 | if (adev->dma_mode < XFER_UDMA_0) { |
451 | /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ | 451 | /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ |
452 | } else { | 452 | } else { |
453 | /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ | 453 | /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */ |
454 | speed = adev->dma_mode - XFER_UDMA_0; | 454 | speed = adev->dma_mode - XFER_UDMA_0; |
455 | timing &= ~0x0F00; | 455 | timing &= ~0x8F; |
456 | timing |= udma_bits[speed]; | 456 | timing |= udma_bits[speed]; |
457 | } | 457 | } |
458 | pci_write_config_word(pdev, drive_pci, timing); | 458 | pci_write_config_byte(pdev, drive_pci + 1, timing); |
459 | } | 459 | } |
460 | 460 | ||
461 | /** | 461 | /** |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index e4c71f76bd55..708dfc0c716b 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
61 | #include <scsi/scsi_host.h> | 61 | #include <scsi/scsi_host.h> |
62 | #include <linux/libata.h> | 62 | #include <linux/libata.h> |
63 | #include <linux/dmi.h> | ||
63 | 64 | ||
64 | #define DRV_NAME "pata_via" | 65 | #define DRV_NAME "pata_via" |
65 | #define DRV_VERSION "0.3.1" | 66 | #define DRV_VERSION "0.3.1" |
@@ -122,6 +123,31 @@ static const struct via_isa_bridge { | |||
122 | { NULL } | 123 | { NULL } |
123 | }; | 124 | }; |
124 | 125 | ||
126 | |||
127 | /* | ||
128 | * Cable special cases | ||
129 | */ | ||
130 | |||
131 | static struct dmi_system_id cable_dmi_table[] = { | ||
132 | { | ||
133 | .ident = "Acer Ferrari 3400", | ||
134 | .matches = { | ||
135 | DMI_MATCH(DMI_BOARD_VENDOR, "Acer,Inc."), | ||
136 | DMI_MATCH(DMI_BOARD_NAME, "Ferrari 3400"), | ||
137 | }, | ||
138 | }, | ||
139 | { } | ||
140 | }; | ||
141 | |||
142 | static int via_cable_override(struct pci_dev *pdev) | ||
143 | { | ||
144 | /* Systems by DMI */ | ||
145 | if (dmi_check_system(cable_dmi_table)) | ||
146 | return 1; | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | |||
125 | /** | 151 | /** |
126 | * via_cable_detect - cable detection | 152 | * via_cable_detect - cable detection |
127 | * @ap: ATA port | 153 | * @ap: ATA port |
@@ -139,6 +165,9 @@ static int via_cable_detect(struct ata_port *ap) { | |||
139 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 165 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
140 | u32 ata66; | 166 | u32 ata66; |
141 | 167 | ||
168 | if (via_cable_override(pdev)) | ||
169 | return ATA_CBL_PATA40_SHORT; | ||
170 | |||
142 | /* Early chips are 40 wire */ | 171 | /* Early chips are 40 wire */ |
143 | if ((config->flags & VIA_UDMA) < VIA_UDMA_66) | 172 | if ((config->flags & VIA_UDMA) < VIA_UDMA_66) |
144 | return ATA_CBL_PATA40; | 173 | return ATA_CBL_PATA40; |