aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Koziolek <uwe.koziolek@gmx.net>2007-06-14 17:40:43 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-02 10:17:42 -0400
commita3cabb271ea66739704497102536fb01bb72fe37 (patch)
tree0a6dc5d93bfe11c98f86f2fe516d385830937f92
parente14cbfa630cd3ab2631ee21b718b290928f47868 (diff)
libata: PATA-mode fixes for sis_sata
Changed PATA handler for PATA-ports used by sata_sis. This patch was originally submitted by Jeff Garzik. Added PCI-ID 1180 for SiS966 Controller in pata_sis. The 1180 mode is fully compatible to other SiS PATA-controller. The PCI-ID 1183 is SATA in PATA-emulation, but not fully compatible to SiS5513/5518. sata_sis.c is forwarding this ID to pata_sis. 1183 is not working if simply added to pata_sis. This handling fixes issues with SiS968. Signed-off-by: Uwe Koziolek <uwe.koziolek@gmx.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/pata_sis.c46
-rw-r--r--drivers/ata/sata_sis.c39
-rw-r--r--drivers/ata/sis.h2
3 files changed, 64 insertions, 23 deletions
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index ec3ae9375015..cfe4ec6eb3d5 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -560,6 +560,40 @@ static const struct ata_port_operations sis_133_ops = {
560 .port_start = ata_port_start, 560 .port_start = ata_port_start,
561}; 561};
562 562
563static const struct ata_port_operations sis_133_for_sata_ops = {
564 .port_disable = ata_port_disable,
565 .set_piomode = sis_133_set_piomode,
566 .set_dmamode = sis_133_set_dmamode,
567 .mode_filter = ata_pci_default_filter,
568
569 .tf_load = ata_tf_load,
570 .tf_read = ata_tf_read,
571 .check_status = ata_check_status,
572 .exec_command = ata_exec_command,
573 .dev_select = ata_std_dev_select,
574
575 .freeze = ata_bmdma_freeze,
576 .thaw = ata_bmdma_thaw,
577 .error_handler = ata_bmdma_error_handler,
578 .post_internal_cmd = ata_bmdma_post_internal_cmd,
579 .cable_detect = sis_133_cable_detect,
580
581 .bmdma_setup = ata_bmdma_setup,
582 .bmdma_start = ata_bmdma_start,
583 .bmdma_stop = ata_bmdma_stop,
584 .bmdma_status = ata_bmdma_status,
585 .qc_prep = ata_qc_prep,
586 .qc_issue = ata_qc_issue_prot,
587 .data_xfer = ata_data_xfer,
588
589 .irq_handler = ata_interrupt,
590 .irq_clear = ata_bmdma_irq_clear,
591 .irq_on = ata_irq_on,
592 .irq_ack = ata_irq_ack,
593
594 .port_start = ata_port_start,
595};
596
563static const struct ata_port_operations sis_133_early_ops = { 597static const struct ata_port_operations sis_133_early_ops = {
564 .port_disable = ata_port_disable, 598 .port_disable = ata_port_disable,
565 .set_piomode = sis_100_set_piomode, 599 .set_piomode = sis_100_set_piomode,
@@ -733,13 +767,20 @@ static const struct ata_port_info sis_info100_early = {
733 .pio_mask = 0x1f, /* pio0-4 */ 767 .pio_mask = 0x1f, /* pio0-4 */
734 .port_ops = &sis_66_ops, 768 .port_ops = &sis_66_ops,
735}; 769};
736const struct ata_port_info sis_info133 = { 770static const struct ata_port_info sis_info133 = {
737 .sht = &sis_sht, 771 .sht = &sis_sht,
738 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 772 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
739 .pio_mask = 0x1f, /* pio0-4 */ 773 .pio_mask = 0x1f, /* pio0-4 */
740 .udma_mask = ATA_UDMA6, 774 .udma_mask = ATA_UDMA6,
741 .port_ops = &sis_133_ops, 775 .port_ops = &sis_133_ops,
742}; 776};
777const struct ata_port_info sis_info133_for_sata = {
778 .sht = &sis_sht,
779 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
780 .pio_mask = 0x1f, /* pio0-4 */
781 .udma_mask = ATA_UDMA6,
782 .port_ops = &sis_133_for_sata_ops,
783};
743static const struct ata_port_info sis_info133_early = { 784static const struct ata_port_info sis_info133_early = {
744 .sht = &sis_sht, 785 .sht = &sis_sht,
745 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 786 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@@ -749,7 +790,7 @@ static const struct ata_port_info sis_info133_early = {
749}; 790};
750 791
751/* Privately shared with the SiS180 SATA driver, not for use elsewhere */ 792/* Privately shared with the SiS180 SATA driver, not for use elsewhere */
752EXPORT_SYMBOL_GPL(sis_info133); 793EXPORT_SYMBOL_GPL(sis_info133_for_sata);
753 794
754static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 795static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
755{ 796{
@@ -975,6 +1016,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
975static const struct pci_device_id sis_pci_tbl[] = { 1016static const struct pci_device_id sis_pci_tbl[] = {
976 { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */ 1017 { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */
977 { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */ 1018 { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */
1019 { PCI_VDEVICE(SI, 0x1180), }, /* SiS 1180 */
978 1020
979 { } 1021 { }
980}; 1022};
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 221099d1d08f..f111c984a359 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -72,8 +72,8 @@ static const struct pci_device_id sis_pci_tbl[] = {
72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ 72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */
73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ 73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */
74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ 74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */
75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/966L */ 75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */
76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L */ 76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */
77 77
78 { } /* terminate list */ 78 { } /* terminate list */
79}; 79};
@@ -161,7 +161,6 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
161 case 0x0182: 161 case 0x0182:
162 case 0x0183: 162 case 0x0183:
163 case 0x1182: 163 case 0x1182:
164 case 0x1183:
165 addr += SIS182_SATA1_OFS; 164 addr += SIS182_SATA1_OFS;
166 break; 165 break;
167 } 166 }
@@ -183,8 +182,8 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
183 182
184 pci_read_config_dword(pdev, cfg_addr, &val); 183 pci_read_config_dword(pdev, cfg_addr, &val);
185 184
186 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 185 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
187 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 186 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
188 pci_read_config_dword(pdev, cfg_addr+0x10, &val2); 187 pci_read_config_dword(pdev, cfg_addr+0x10, &val2);
189 188
190 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ 189 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */
@@ -203,8 +202,8 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val
203 202
204 pci_write_config_dword(pdev, cfg_addr, val); 203 pci_write_config_dword(pdev, cfg_addr, val);
205 204
206 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 205 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
207 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 206 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
208 pci_write_config_dword(pdev, cfg_addr+0x10, val); 207 pci_write_config_dword(pdev, cfg_addr+0x10, val);
209} 208}
210 209
@@ -224,8 +223,8 @@ static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
224 223
225 val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); 224 val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4));
226 225
227 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 226 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
228 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 227 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
229 val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); 228 val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10);
230 229
231 return (val | val2) & 0xfffffffb; 230 return (val | val2) & 0xfffffffb;
@@ -245,8 +244,8 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
245 sis_scr_cfg_write(ap, sc_reg, val); 244 sis_scr_cfg_write(ap, sc_reg, val);
246 else { 245 else {
247 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 246 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4));
248 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 247 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
249 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 248 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
250 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); 249 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10);
251 } 250 }
252} 251}
@@ -293,11 +292,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
293 /* The PATA-handling is provided by pata_sis */ 292 /* The PATA-handling is provided by pata_sis */
294 switch (pmr & 0x30) { 293 switch (pmr & 0x30) {
295 case 0x10: 294 case 0x10:
296 ppi[1] = &sis_info133; 295 ppi[1] = &sis_info133_for_sata;
297 break; 296 break;
298 297
299 case 0x30: 298 case 0x30:
300 ppi[0] = &sis_info133; 299 ppi[0] = &sis_info133_for_sata;
301 break; 300 break;
302 } 301 }
303 if ((pmr & SIS_PMR_COMBINED) == 0) { 302 if ((pmr & SIS_PMR_COMBINED) == 0) {
@@ -324,14 +323,14 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
324 break; 323 break;
325 324
326 case 0x1182: 325 case 0x1182:
326 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n");
327 pi.flags |= ATA_FLAG_SLAVE_POSS;
328 break;
329
327 case 0x1183: 330 case 0x1183:
328 pci_read_config_dword(pdev, 0x64, &val); 331 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n");
329 if (val & 0x10000000) { 332 ppi[0] = &sis_info133_for_sata;
330 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); 333 ppi[1] = &sis_info133_for_sata;
331 } else {
332 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n");
333 pi.flags |= ATA_FLAG_SLAVE_POSS;
334 }
335 break; 334 break;
336 } 335 }
337 336
diff --git a/drivers/ata/sis.h b/drivers/ata/sis.h
index 0f2208d8d5ef..f7f3eebe666c 100644
--- a/drivers/ata/sis.h
+++ b/drivers/ata/sis.h
@@ -2,4 +2,4 @@
2struct ata_port_info; 2struct ata_port_info;
3 3
4/* pata_sis.c */ 4/* pata_sis.c */
5extern const struct ata_port_info sis_info133; 5extern const struct ata_port_info sis_info133_for_sata;