aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_sis.c
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 /drivers/ata/sata_sis.c
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>
Diffstat (limited to 'drivers/ata/sata_sis.c')
-rw-r--r--drivers/ata/sata_sis.c39
1 files changed, 19 insertions, 20 deletions
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