aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sis.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
commit48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (patch)
treeda3aa535c98cc0957851354ceb0fbff7482d7a9d /drivers/ata/pata_sis.c
parent1a1689344add3333d28d1b5495d8043a3877d01c (diff)
parent4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (diff)
Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into upstream
Diffstat (limited to 'drivers/ata/pata_sis.c')
-rw-r--r--drivers/ata/pata_sis.c70
1 files changed, 51 insertions, 19 deletions
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 916cedb3d755..560103d55b2e 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -32,7 +32,9 @@
32#include <scsi/scsi_host.h> 32#include <scsi/scsi_host.h>
33#include <linux/libata.h> 33#include <linux/libata.h>
34#include <linux/ata.h> 34#include <linux/ata.h>
35#include "libata.h"
35 36
37#undef DRV_NAME /* already defined in libata.h, for libata-core */
36#define DRV_NAME "pata_sis" 38#define DRV_NAME "pata_sis"
37#define DRV_VERSION "0.4.5" 39#define DRV_VERSION "0.4.5"
38 40
@@ -43,6 +45,34 @@ struct sis_chipset {
43 up code later */ 45 up code later */
44}; 46};
45 47
48struct sis_laptop {
49 u16 device;
50 u16 subvendor;
51 u16 subdevice;
52};
53
54static const struct sis_laptop sis_laptop[] = {
55 /* devid, subvendor, subdev */
56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
57 /* end marker */
58 { 0, }
59};
60
61static int sis_short_ata40(struct pci_dev *dev)
62{
63 const struct sis_laptop *lap = &sis_laptop[0];
64
65 while (lap->device) {
66 if (lap->device == dev->device &&
67 lap->subvendor == dev->subsystem_vendor &&
68 lap->subdevice == dev->subsystem_device)
69 return 1;
70 lap++;
71 }
72
73 return 0;
74}
75
46/** 76/**
47 * sis_port_base - return PCI configuration base for dev 77 * sis_port_base - return PCI configuration base for dev
48 * @adev: device 78 * @adev: device
@@ -79,7 +109,7 @@ static int sis_133_pre_reset(struct ata_port *ap)
79 109
80 /* The top bit of this register is the cable detect bit */ 110 /* The top bit of this register is the cable detect bit */
81 pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp); 111 pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp);
82 if (tmp & 0x8000) 112 if ((tmp & 0x8000) && !sis_short_ata40(pdev))
83 ap->cbl = ATA_CBL_PATA40; 113 ap->cbl = ATA_CBL_PATA40;
84 else 114 else
85 ap->cbl = ATA_CBL_PATA80; 115 ap->cbl = ATA_CBL_PATA80;
@@ -127,7 +157,7 @@ static int sis_66_pre_reset(struct ata_port *ap)
127 /* Older chips keep cable detect in bits 4/5 of reg 0x48 */ 157 /* Older chips keep cable detect in bits 4/5 of reg 0x48 */
128 pci_read_config_byte(pdev, 0x48, &tmp); 158 pci_read_config_byte(pdev, 0x48, &tmp);
129 tmp >>= ap->port_no; 159 tmp >>= ap->port_no;
130 if (tmp & 0x10) 160 if ((tmp & 0x10) && !sis_short_ata40(pdev))
131 ap->cbl = ATA_CBL_PATA40; 161 ap->cbl = ATA_CBL_PATA40;
132 else 162 else
133 ap->cbl = ATA_CBL_PATA80; 163 ap->cbl = ATA_CBL_PATA80;
@@ -573,14 +603,14 @@ static const struct ata_port_operations sis_133_ops = {
573 .bmdma_status = ata_bmdma_status, 603 .bmdma_status = ata_bmdma_status,
574 .qc_prep = ata_qc_prep, 604 .qc_prep = ata_qc_prep,
575 .qc_issue = ata_qc_issue_prot, 605 .qc_issue = ata_qc_issue_prot,
576 .data_xfer = ata_pio_data_xfer, 606 .data_xfer = ata_data_xfer,
577 607
578 .irq_handler = ata_interrupt, 608 .irq_handler = ata_interrupt,
579 .irq_clear = ata_bmdma_irq_clear, 609 .irq_clear = ata_bmdma_irq_clear,
610 .irq_on = ata_irq_on,
611 .irq_ack = ata_irq_ack,
580 612
581 .port_start = ata_port_start, 613 .port_start = ata_port_start,
582 .port_stop = ata_port_stop,
583 .host_stop = ata_host_stop,
584}; 614};
585 615
586static const struct ata_port_operations sis_133_early_ops = { 616static const struct ata_port_operations sis_133_early_ops = {
@@ -606,14 +636,14 @@ static const struct ata_port_operations sis_133_early_ops = {
606 .bmdma_status = ata_bmdma_status, 636 .bmdma_status = ata_bmdma_status,
607 .qc_prep = ata_qc_prep, 637 .qc_prep = ata_qc_prep,
608 .qc_issue = ata_qc_issue_prot, 638 .qc_issue = ata_qc_issue_prot,
609 .data_xfer = ata_pio_data_xfer, 639 .data_xfer = ata_data_xfer,
610 640
611 .irq_handler = ata_interrupt, 641 .irq_handler = ata_interrupt,
612 .irq_clear = ata_bmdma_irq_clear, 642 .irq_clear = ata_bmdma_irq_clear,
643 .irq_on = ata_irq_on,
644 .irq_ack = ata_irq_ack,
613 645
614 .port_start = ata_port_start, 646 .port_start = ata_port_start,
615 .port_stop = ata_port_stop,
616 .host_stop = ata_host_stop,
617}; 647};
618 648
619static const struct ata_port_operations sis_100_ops = { 649static const struct ata_port_operations sis_100_ops = {
@@ -640,14 +670,14 @@ static const struct ata_port_operations sis_100_ops = {
640 .bmdma_status = ata_bmdma_status, 670 .bmdma_status = ata_bmdma_status,
641 .qc_prep = ata_qc_prep, 671 .qc_prep = ata_qc_prep,
642 .qc_issue = ata_qc_issue_prot, 672 .qc_issue = ata_qc_issue_prot,
643 .data_xfer = ata_pio_data_xfer, 673 .data_xfer = ata_data_xfer,
644 674
645 .irq_handler = ata_interrupt, 675 .irq_handler = ata_interrupt,
646 .irq_clear = ata_bmdma_irq_clear, 676 .irq_clear = ata_bmdma_irq_clear,
677 .irq_on = ata_irq_on,
678 .irq_ack = ata_irq_ack,
647 679
648 .port_start = ata_port_start, 680 .port_start = ata_port_start,
649 .port_stop = ata_port_stop,
650 .host_stop = ata_host_stop,
651}; 681};
652 682
653static const struct ata_port_operations sis_66_ops = { 683static const struct ata_port_operations sis_66_ops = {
@@ -673,14 +703,14 @@ static const struct ata_port_operations sis_66_ops = {
673 .bmdma_status = ata_bmdma_status, 703 .bmdma_status = ata_bmdma_status,
674 .qc_prep = ata_qc_prep, 704 .qc_prep = ata_qc_prep,
675 .qc_issue = ata_qc_issue_prot, 705 .qc_issue = ata_qc_issue_prot,
676 .data_xfer = ata_pio_data_xfer, 706 .data_xfer = ata_data_xfer,
677 707
678 .irq_handler = ata_interrupt, 708 .irq_handler = ata_interrupt,
679 .irq_clear = ata_bmdma_irq_clear, 709 .irq_clear = ata_bmdma_irq_clear,
710 .irq_on = ata_irq_on,
711 .irq_ack = ata_irq_ack,
680 712
681 .port_start = ata_port_start, 713 .port_start = ata_port_start,
682 .port_stop = ata_port_stop,
683 .host_stop = ata_host_stop,
684}; 714};
685 715
686static const struct ata_port_operations sis_old_ops = { 716static const struct ata_port_operations sis_old_ops = {
@@ -706,14 +736,14 @@ static const struct ata_port_operations sis_old_ops = {
706 .bmdma_status = ata_bmdma_status, 736 .bmdma_status = ata_bmdma_status,
707 .qc_prep = ata_qc_prep, 737 .qc_prep = ata_qc_prep,
708 .qc_issue = ata_qc_issue_prot, 738 .qc_issue = ata_qc_issue_prot,
709 .data_xfer = ata_pio_data_xfer, 739 .data_xfer = ata_data_xfer,
710 740
711 .irq_handler = ata_interrupt, 741 .irq_handler = ata_interrupt,
712 .irq_clear = ata_bmdma_irq_clear, 742 .irq_clear = ata_bmdma_irq_clear,
743 .irq_on = ata_irq_on,
744 .irq_ack = ata_irq_ack,
713 745
714 .port_start = ata_port_start, 746 .port_start = ata_port_start,
715 .port_stop = ata_port_stop,
716 .host_stop = ata_host_stop,
717}; 747};
718 748
719static struct ata_port_info sis_info = { 749static struct ata_port_info sis_info = {
@@ -753,7 +783,7 @@ static struct ata_port_info sis_info100_early = {
753 .pio_mask = 0x1f, /* pio0-4 */ 783 .pio_mask = 0x1f, /* pio0-4 */
754 .port_ops = &sis_66_ops, 784 .port_ops = &sis_66_ops,
755}; 785};
756static struct ata_port_info sis_info133 = { 786struct ata_port_info sis_info133 = {
757 .sht = &sis_sht, 787 .sht = &sis_sht,
758 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 788 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
759 .pio_mask = 0x1f, /* pio0-4 */ 789 .pio_mask = 0x1f, /* pio0-4 */
@@ -768,6 +798,8 @@ static struct ata_port_info sis_info133_early = {
768 .port_ops = &sis_133_early_ops, 798 .port_ops = &sis_133_early_ops,
769}; 799};
770 800
801/* Privately shared with the SiS180 SATA driver, not for use elsewhere */
802EXPORT_SYMBOL_GPL(sis_info133);
771 803
772static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 804static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
773{ 805{
@@ -847,7 +879,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
847 struct sis_chipset *chipset = NULL; 879 struct sis_chipset *chipset = NULL;
848 880
849 static struct sis_chipset sis_chipsets[] = { 881 static struct sis_chipset sis_chipsets[] = {
850 882
851 { 0x0968, &sis_info133 }, 883 { 0x0968, &sis_info133 },
852 { 0x0966, &sis_info133 }, 884 { 0x0966, &sis_info133 },
853 { 0x0965, &sis_info133 }, 885 { 0x0965, &sis_info133 },