Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Koziolek and committed by
Jeff Garzik
a3cabb27 e14cbfa6

+64 -23
+44 -2
drivers/ata/pata_sis.c
··· 560 560 .port_start = ata_port_start, 561 561 }; 562 562 563 + static 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 + 563 597 static const struct ata_port_operations sis_133_early_ops = { 564 598 .port_disable = ata_port_disable, 565 599 .set_piomode = sis_100_set_piomode, ··· 767 733 .pio_mask = 0x1f, /* pio0-4 */ 768 734 .port_ops = &sis_66_ops, 769 735 }; 770 - const struct ata_port_info sis_info133 = { 736 + static const struct ata_port_info sis_info133 = { 771 737 .sht = &sis_sht, 772 738 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 773 739 .pio_mask = 0x1f, /* pio0-4 */ 774 740 .udma_mask = ATA_UDMA6, 775 741 .port_ops = &sis_133_ops, 742 + }; 743 + const struct ata_port_info sis_info133_for_sata = { 744 + .sht = &sis_sht, 745 + .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 746 + .pio_mask = 0x1f, /* pio0-4 */ 747 + .udma_mask = ATA_UDMA6, 748 + .port_ops = &sis_133_for_sata_ops, 776 749 }; 777 750 static const struct ata_port_info sis_info133_early = { 778 751 .sht = &sis_sht, ··· 790 749 }; 791 750 792 751 /* Privately shared with the SiS180 SATA driver, not for use elsewhere */ 793 - EXPORT_SYMBOL_GPL(sis_info133); 752 + EXPORT_SYMBOL_GPL(sis_info133_for_sata); 794 753 795 754 static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 796 755 { ··· 1016 975 static const struct pci_device_id sis_pci_tbl[] = { 1017 976 { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */ 1018 977 { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */ 978 + { PCI_VDEVICE(SI, 0x1180), }, /* SiS 1180 */ 1019 979 1020 980 { } 1021 981 };
+19 -20
drivers/ata/sata_sis.c
··· 72 72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ 73 73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ 74 74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ 75 - { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/966L */ 76 - { PCI_VDEVICE(SI, 0x1183), 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/968/680 */ 77 77 78 78 { } /* terminate list */ 79 79 }; ··· 161 161 case 0x0182: 162 162 case 0x0183: 163 163 case 0x1182: 164 - case 0x1183: 165 164 addr += SIS182_SATA1_OFS; 166 165 break; 167 166 } ··· 182 183 183 184 pci_read_config_dword(pdev, cfg_addr, &val); 184 185 185 - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 186 - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 186 + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 187 + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) 187 188 pci_read_config_dword(pdev, cfg_addr+0x10, &val2); 188 189 189 190 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ ··· 202 203 203 204 pci_write_config_dword(pdev, cfg_addr, val); 204 205 205 - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 206 - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 206 + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 207 + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) 207 208 pci_write_config_dword(pdev, cfg_addr+0x10, val); 208 209 } 209 210 ··· 223 224 224 225 val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); 225 226 226 - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 227 - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 227 + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 228 + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) 228 229 val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); 229 230 230 231 return (val | val2) & 0xfffffffb; ··· 244 245 sis_scr_cfg_write(ap, sc_reg, val); 245 246 else { 246 247 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 247 - if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 248 - (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 248 + if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 249 + (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) 249 250 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); 250 251 } 251 252 } ··· 292 293 /* The PATA-handling is provided by pata_sis */ 293 294 switch (pmr & 0x30) { 294 295 case 0x10: 295 - ppi[1] = &sis_info133; 296 + ppi[1] = &sis_info133_for_sata; 296 297 break; 297 298 298 299 case 0x30: 299 - ppi[0] = &sis_info133; 300 + ppi[0] = &sis_info133_for_sata; 300 301 break; 301 302 } 302 303 if ((pmr & SIS_PMR_COMBINED) == 0) { ··· 323 324 break; 324 325 325 326 case 0x1182: 327 + dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n"); 328 + pi.flags |= ATA_FLAG_SLAVE_POSS; 329 + break; 330 + 326 331 case 0x1183: 327 - pci_read_config_dword(pdev, 0x64, &val); 328 - if (val & 0x10000000) { 329 - dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); 330 - } else { 331 - dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n"); 332 - pi.flags |= ATA_FLAG_SLAVE_POSS; 333 - } 332 + dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); 333 + ppi[0] = &sis_info133_for_sata; 334 + ppi[1] = &sis_info133_for_sata; 334 335 break; 335 336 } 336 337
+1 -1
drivers/ata/sis.h
··· 2 2 struct ata_port_info; 3 3 4 4 /* pata_sis.c */ 5 - extern const struct ata_port_info sis_info133; 5 + extern const struct ata_port_info sis_info133_for_sata;