aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-09 23:29:22 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-10 10:39:54 -0500
commit6d98bda79bea0e1be26c0767d0e9923ad3b72f2e (patch)
tree3f6e5c772a6a1872ee07daade9f7c9a8ad889edc /arch/powerpc
parent7fd272550bd43cc1d7289ef0ab2fa50de137e767 (diff)
powerpc: Fix IDE legacy vs. native fixups
PowerMac and CHRP/BriQ platforms have quirks to switch some IDE controllers from legacy mode to fully native mode. Those quirks however will not work properly anymore due to a change to the generic code to better handle legacy IDE resources. This fixes it by moving those quirk to "early" quirks (so they run before resources are probed for the devices) and clearing all BARs after the conversion to force a reallocation of sane values. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/chrp/pci.c21
-rw-r--r--arch/powerpc/platforms/powermac/pci.c11
2 files changed, 24 insertions, 8 deletions
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index e43465d34d29..0340a342f772 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -317,8 +317,12 @@ chrp_find_bridges(void)
317/* SL82C105 IDE Control/Status Register */ 317/* SL82C105 IDE Control/Status Register */
318#define SL82C105_IDECSR 0x40 318#define SL82C105_IDECSR 0x40
319 319
320/* Fixup for Winbond ATA quirk, required for briq */ 320/* Fixup for Winbond ATA quirk, required for briq mostly because the
321void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105) 321 * 8259 is configured for level sensitive IRQ 14 and so wants the
322 * ATA controller to be set to fully native mode or bad things
323 * will happen.
324 */
325static void __devinit chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105)
322{ 326{
323 u8 progif; 327 u8 progif;
324 328
@@ -334,10 +338,15 @@ void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105)
334 sl82c105->class |= 0x05; 338 sl82c105->class |= 0x05;
335 /* Disable SL82C105 second port */ 339 /* Disable SL82C105 second port */
336 pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003); 340 pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003);
341 /* Clear IO BARs, they will be reassigned */
342 pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_0, 0);
343 pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_1, 0);
344 pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_2, 0);
345 pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_3, 0);
337 } 346 }
338} 347}
339DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, 348DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
340 chrp_pci_fixup_winbond_ata); 349 chrp_pci_fixup_winbond_ata);
341 350
342/* Pegasos2 firmware version 20040810 configures the built-in IDE controller 351/* Pegasos2 firmware version 20040810 configures the built-in IDE controller
343 * in legacy mode, but sets the PCI registers to PCI native mode. 352 * in legacy mode, but sets the PCI registers to PCI native mode.
@@ -345,7 +354,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
345 * mode as well. The same fixup must be done to the class-code property in 354 * mode as well. The same fixup must be done to the class-code property in
346 * the IDE node /pci@80000000/ide@C,1 355 * the IDE node /pci@80000000/ide@C,1
347 */ 356 */
348static void chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide) 357static void __devinit chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide)
349{ 358{
350 u8 progif; 359 u8 progif;
351 struct pci_dev *viaisa; 360 struct pci_dev *viaisa;
@@ -366,4 +375,4 @@ static void chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide)
366 375
367 pci_dev_put(viaisa); 376 pci_dev_put(viaisa);
368} 377}
369DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, chrp_pci_fixup_vt8231_ata); 378DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, chrp_pci_fixup_vt8231_ata);
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index ec49099830d5..f852ae3e0ee4 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1243,15 +1243,22 @@ void pmac_pci_fixup_pciata(struct pci_dev* dev)
1243 good: 1243 good:
1244 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 1244 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
1245 if ((progif & 5) != 5) { 1245 if ((progif & 5) != 5) {
1246 printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", 1246 printk(KERN_INFO "PCI: %s Forcing PCI IDE into native mode\n",
1247 pci_name(dev)); 1247 pci_name(dev));
1248 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); 1248 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5);
1249 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 1249 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) ||
1250 (progif & 5) != 5) 1250 (progif & 5) != 5)
1251 printk(KERN_ERR "Rewrite of PROGIF failed !\n"); 1251 printk(KERN_ERR "Rewrite of PROGIF failed !\n");
1252 else {
1253 /* Clear IO BARs, they will be reassigned */
1254 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0);
1255 pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
1256 pci_write_config_dword(dev, PCI_BASE_ADDRESS_2, 0);
1257 pci_write_config_dword(dev, PCI_BASE_ADDRESS_3, 0);
1258 }
1252 } 1259 }
1253} 1260}
1254DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata); 1261DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
1255#endif 1262#endif
1256 1263
1257/* 1264/*