aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ata_piix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ata_piix.c')
-rw-r--r--drivers/ata/ata_piix.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a2c5756c69b6..55d306a3e538 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -93,7 +93,7 @@
93#include <linux/libata.h> 93#include <linux/libata.h>
94 94
95#define DRV_NAME "ata_piix" 95#define DRV_NAME "ata_piix"
96#define DRV_VERSION "2.10ac1" 96#define DRV_VERSION "2.11"
97 97
98enum { 98enum {
99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -155,11 +155,11 @@ struct piix_host_priv {
155static int piix_init_one (struct pci_dev *pdev, 155static int piix_init_one (struct pci_dev *pdev,
156 const struct pci_device_id *ent); 156 const struct pci_device_id *ent);
157static void piix_pata_error_handler(struct ata_port *ap); 157static void piix_pata_error_handler(struct ata_port *ap);
158static void ich_pata_error_handler(struct ata_port *ap);
159static void piix_sata_error_handler(struct ata_port *ap); 158static void piix_sata_error_handler(struct ata_port *ap);
160static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); 159static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
161static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); 160static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
162static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev); 161static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev);
162static int ich_pata_cable_detect(struct ata_port *ap);
163 163
164static unsigned int in_module_init = 1; 164static unsigned int in_module_init = 1;
165 165
@@ -305,6 +305,7 @@ static const struct ata_port_operations piix_pata_ops = {
305 .thaw = ata_bmdma_thaw, 305 .thaw = ata_bmdma_thaw,
306 .error_handler = piix_pata_error_handler, 306 .error_handler = piix_pata_error_handler,
307 .post_internal_cmd = ata_bmdma_post_internal_cmd, 307 .post_internal_cmd = ata_bmdma_post_internal_cmd,
308 .cable_detect = ata_cable_40wire,
308 309
309 .irq_handler = ata_interrupt, 310 .irq_handler = ata_interrupt,
310 .irq_clear = ata_bmdma_irq_clear, 311 .irq_clear = ata_bmdma_irq_clear,
@@ -336,8 +337,9 @@ static const struct ata_port_operations ich_pata_ops = {
336 337
337 .freeze = ata_bmdma_freeze, 338 .freeze = ata_bmdma_freeze,
338 .thaw = ata_bmdma_thaw, 339 .thaw = ata_bmdma_thaw,
339 .error_handler = ich_pata_error_handler, 340 .error_handler = piix_pata_error_handler,
340 .post_internal_cmd = ata_bmdma_post_internal_cmd, 341 .post_internal_cmd = ata_bmdma_post_internal_cmd,
342 .cable_detect = ich_pata_cable_detect,
341 343
342 .irq_handler = ata_interrupt, 344 .irq_handler = ata_interrupt,
343 .irq_clear = ata_bmdma_irq_clear, 345 .irq_clear = ata_bmdma_irq_clear,
@@ -586,7 +588,7 @@ static const struct ich_laptop ich_laptop[] = {
586}; 588};
587 589
588/** 590/**
589 * piix_pata_cbl_detect - Probe host controller cable detect info 591 * ich_pata_cable_detect - Probe host controller cable detect info
590 * @ap: Port for which cable detect info is desired 592 * @ap: Port for which cable detect info is desired
591 * 593 *
592 * Read 80c cable indicator from ATA PCI device's PCI config 594 * Read 80c cable indicator from ATA PCI device's PCI config
@@ -596,23 +598,18 @@ static const struct ich_laptop ich_laptop[] = {
596 * None (inherited from caller). 598 * None (inherited from caller).
597 */ 599 */
598 600
599static void ich_pata_cbl_detect(struct ata_port *ap) 601static int ich_pata_cable_detect(struct ata_port *ap)
600{ 602{
601 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 603 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
602 const struct ich_laptop *lap = &ich_laptop[0]; 604 const struct ich_laptop *lap = &ich_laptop[0];
603 u8 tmp, mask; 605 u8 tmp, mask;
604 606
605 /* no 80c support in host controller? */
606 if ((ap->udma_mask & ~ATA_UDMA_MASK_40C) == 0)
607 goto cbl40;
608
609 /* Check for specials - Acer Aspire 5602WLMi */ 607 /* Check for specials - Acer Aspire 5602WLMi */
610 while (lap->device) { 608 while (lap->device) {
611 if (lap->device == pdev->device && 609 if (lap->device == pdev->device &&
612 lap->subvendor == pdev->subsystem_vendor && 610 lap->subvendor == pdev->subsystem_vendor &&
613 lap->subdevice == pdev->subsystem_device) { 611 lap->subdevice == pdev->subsystem_device) {
614 ap->cbl = ATA_CBL_PATA40_SHORT; 612 return ATA_CBL_PATA40_SHORT;
615 return;
616 } 613 }
617 lap++; 614 lap++;
618 } 615 }
@@ -621,20 +618,14 @@ static void ich_pata_cbl_detect(struct ata_port *ap)
621 mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; 618 mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;
622 pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); 619 pci_read_config_byte(pdev, PIIX_IOCFG, &tmp);
623 if ((tmp & mask) == 0) 620 if ((tmp & mask) == 0)
624 goto cbl40; 621 return ATA_CBL_PATA40;
625 622 return ATA_CBL_PATA80;
626 ap->cbl = ATA_CBL_PATA80;
627 return;
628
629cbl40:
630 ap->cbl = ATA_CBL_PATA40;
631} 623}
632 624
633/** 625/**
634 * piix_pata_prereset - prereset for PATA host controller 626 * piix_pata_prereset - prereset for PATA host controller
635 * @ap: Target port 627 * @ap: Target port
636 * 628 *
637 *
638 * LOCKING: 629 * LOCKING:
639 * None (inherited from caller). 630 * None (inherited from caller).
640 */ 631 */
@@ -644,8 +635,6 @@ static int piix_pata_prereset(struct ata_port *ap)
644 635
645 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) 636 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
646 return -ENOENT; 637 return -ENOENT;
647
648 ap->cbl = ATA_CBL_PATA40;
649 return ata_std_prereset(ap); 638 return ata_std_prereset(ap);
650} 639}
651 640
@@ -656,30 +645,6 @@ static void piix_pata_error_handler(struct ata_port *ap)
656} 645}
657 646
658 647
659/**
660 * ich_pata_prereset - prereset for PATA host controller
661 * @ap: Target port
662 *
663 *
664 * LOCKING:
665 * None (inherited from caller).
666 */
667static int ich_pata_prereset(struct ata_port *ap)
668{
669 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
670
671 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
672 return -ENOENT;
673 ich_pata_cbl_detect(ap);
674 return ata_std_prereset(ap);
675}
676
677static void ich_pata_error_handler(struct ata_port *ap)
678{
679 ata_bmdma_drive_eh(ap, ich_pata_prereset, ata_std_softreset, NULL,
680 ata_std_postreset);
681}
682
683static void piix_sata_error_handler(struct ata_port *ap) 648static void piix_sata_error_handler(struct ata_port *ap)
684{ 649{
685 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL, 650 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,