diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2006-05-25 17:36:53 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-26 08:39:00 -0400 |
commit | 54f4ee183aea859eb09f141dad3fc3c6f4fe0446 (patch) | |
tree | 94bfc121c036460c64f7a72f9a46152ee6fdd263 | |
parent | 8e30a9a299ca30b6c4072c2182238d5f5dd1590d (diff) |
[PATCH] powerpc: fix RTC/NVRAM accesses on Maple
Due to a firmware device tree bug, RTC and NVRAM accesses (including
halt/reboot) on Maple have been broken since January, when an untested
build fix went in. This code patches the device tree in Linux.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 2d80653aa2af..41e9ab40cd54 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2057,10 +2057,45 @@ static void __init flatten_device_tree(void) | |||
2057 | 2057 | ||
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | 2060 | #ifdef CONFIG_PPC_MAPLE | |
2061 | static void __init fixup_device_tree(void) | 2061 | /* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges property. |
2062 | * The values are bad, and it doesn't even have the right number of cells. */ | ||
2063 | static void __init fixup_device_tree_maple(void) | ||
2062 | { | 2064 | { |
2065 | phandle isa; | ||
2066 | u32 isa_ranges[6]; | ||
2067 | |||
2068 | isa = call_prom("finddevice", 1, 1, ADDR("/ht@0/isa@4")); | ||
2069 | if (!PHANDLE_VALID(isa)) | ||
2070 | return; | ||
2071 | |||
2072 | if (prom_getprop(isa, "ranges", isa_ranges, sizeof(isa_ranges)) | ||
2073 | == PROM_ERROR) | ||
2074 | return; | ||
2075 | |||
2076 | if (isa_ranges[0] != 0x1 || | ||
2077 | isa_ranges[1] != 0xf4000000 || | ||
2078 | isa_ranges[2] != 0x00010000) | ||
2079 | return; | ||
2080 | |||
2081 | prom_printf("fixing up bogus ISA range on Maple...\n"); | ||
2082 | |||
2083 | isa_ranges[0] = 0x1; | ||
2084 | isa_ranges[1] = 0x0; | ||
2085 | isa_ranges[2] = 0x01002000; /* IO space; PCI device = 4 */ | ||
2086 | isa_ranges[3] = 0x0; | ||
2087 | isa_ranges[4] = 0x0; | ||
2088 | isa_ranges[5] = 0x00010000; | ||
2089 | prom_setprop(isa, "/ht@0/isa@4", "ranges", | ||
2090 | isa_ranges, sizeof(isa_ranges)); | ||
2091 | } | ||
2092 | #else | ||
2093 | #define fixup_device_tree_maple() | ||
2094 | #endif | ||
2095 | |||
2063 | #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) | 2096 | #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) |
2097 | static void __init fixup_device_tree_pmac(void) | ||
2098 | { | ||
2064 | phandle u3, i2c, mpic; | 2099 | phandle u3, i2c, mpic; |
2065 | u32 u3_rev; | 2100 | u32 u3_rev; |
2066 | u32 interrupts[2]; | 2101 | u32 interrupts[2]; |
@@ -2097,9 +2132,16 @@ static void __init fixup_device_tree(void) | |||
2097 | parent = (u32)mpic; | 2132 | parent = (u32)mpic; |
2098 | prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent", | 2133 | prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent", |
2099 | &parent, sizeof(parent)); | 2134 | &parent, sizeof(parent)); |
2100 | #endif | ||
2101 | } | 2135 | } |
2136 | #else | ||
2137 | #define fixup_device_tree_pmac() | ||
2138 | #endif | ||
2102 | 2139 | ||
2140 | static void __init fixup_device_tree(void) | ||
2141 | { | ||
2142 | fixup_device_tree_maple(); | ||
2143 | fixup_device_tree_pmac(); | ||
2144 | } | ||
2103 | 2145 | ||
2104 | static void __init prom_find_boot_cpu(void) | 2146 | static void __init prom_find_boot_cpu(void) |
2105 | { | 2147 | { |