diff options
author | Olaf Hering <olaf@aepfle.de> | 2007-08-17 14:27:17 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-08-22 01:21:46 -0400 |
commit | 556ecf9be66f4d493e19bc71a7ce84366d512b71 (patch) | |
tree | 1d03d69ba1324ab5155cd9baf0f857699751846e /arch/powerpc | |
parent | 2ba4573cdaf98b0f3acb8795a66f412c1c41284a (diff) |
[POWERPC] Advertise correct IDE mode on Pegasos2
The built-in IDE controller is configured in legacy mode, but the PCI
registers advertise native mode. Force the PCI class into legacy
mode. This allows pata_via to access two drives.
The Pegasos specific irq enforcement in the via82cxxx driver must stay
because there is apparently no generic way to setup irq per channel.
Tested on Pegasos2 with firmware version 20040810, and two IDE disks.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 11 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/pci.c | 29 |
2 files changed, 37 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index a1d582e38627..29c2160bcbb5 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2046,6 +2046,7 @@ static void __init fixup_device_tree_maple(void) | |||
2046 | /* | 2046 | /* |
2047 | * Pegasos and BriQ lacks the "ranges" property in the isa node | 2047 | * Pegasos and BriQ lacks the "ranges" property in the isa node |
2048 | * Pegasos needs decimal IRQ 14/15, not hexadecimal | 2048 | * Pegasos needs decimal IRQ 14/15, not hexadecimal |
2049 | * Pegasos has the IDE configured in legacy mode, but advertised as native | ||
2049 | */ | 2050 | */ |
2050 | static void __init fixup_device_tree_chrp(void) | 2051 | static void __init fixup_device_tree_chrp(void) |
2051 | { | 2052 | { |
@@ -2083,9 +2084,13 @@ static void __init fixup_device_tree_chrp(void) | |||
2083 | prom_printf("Fixing up IDE interrupt on Pegasos...\n"); | 2084 | prom_printf("Fixing up IDE interrupt on Pegasos...\n"); |
2084 | prop[0] = 14; | 2085 | prop[0] = 14; |
2085 | prop[1] = 0x0; | 2086 | prop[1] = 0x0; |
2086 | prop[2] = 15; | 2087 | prom_setprop(ph, name, "interrupts", prop, 2*sizeof(u32)); |
2087 | prop[3] = 0x0; | 2088 | prom_printf("Fixing up IDE class-code on Pegasos...\n"); |
2088 | prom_setprop(ph, name, "interrupts", prop, 4*sizeof(u32)); | 2089 | rc = prom_getprop(ph, "class-code", prop, sizeof(u32)); |
2090 | if (rc == sizeof(u32)) { | ||
2091 | prop[0] &= ~0x5; | ||
2092 | prom_setprop(ph, name, "class-code", prop, sizeof(u32)); | ||
2093 | } | ||
2089 | } | 2094 | } |
2090 | } | 2095 | } |
2091 | #else | 2096 | #else |
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index 0c6dba9823e9..974952ed15cb 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
@@ -338,3 +338,32 @@ void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105) | |||
338 | } | 338 | } |
339 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, | 339 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, |
340 | chrp_pci_fixup_winbond_ata); | 340 | chrp_pci_fixup_winbond_ata); |
341 | |||
342 | /* Pegasos2 firmware version 20040810 configures the built-in IDE controller | ||
343 | * in legacy mode, but sets the PCI registers to PCI native mode. | ||
344 | * The chip can only operate in legacy mode, so force the PCI class into legacy | ||
345 | * mode as well. The same fixup must be done to the class-code property in | ||
346 | * the IDE node /pci@80000000/ide@C,1 | ||
347 | */ | ||
348 | static void chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide) | ||
349 | { | ||
350 | u8 progif; | ||
351 | struct pci_dev *viaisa; | ||
352 | |||
353 | if (!machine_is(chrp) || _chrp_type != _CHRP_Pegasos) | ||
354 | return; | ||
355 | if (viaide->irq != 14) | ||
356 | return; | ||
357 | |||
358 | viaisa = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); | ||
359 | if (!viaisa) | ||
360 | return; | ||
361 | printk("Fixing VIA IDE, force legacy mode on '%s'\n", viaide->dev.bus_id); | ||
362 | |||
363 | pci_read_config_byte(viaide, PCI_CLASS_PROG, &progif); | ||
364 | pci_write_config_byte(viaide, PCI_CLASS_PROG, progif & ~0x5); | ||
365 | viaide->class &= ~0x5; | ||
366 | |||
367 | pci_dev_put(viaisa); | ||
368 | } | ||
369 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, chrp_pci_fixup_vt8231_ata); | ||