diff options
Diffstat (limited to 'arch/powerpc/kernel/prom_init.c')
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 520ef42f642e..4fb5938ce6d3 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2117,11 +2117,92 @@ static void __init fixup_device_tree_pmac(void) | |||
2117 | #define fixup_device_tree_pmac() | 2117 | #define fixup_device_tree_pmac() |
2118 | #endif | 2118 | #endif |
2119 | 2119 | ||
2120 | #ifdef CONFIG_PPC_EFIKA | ||
2121 | /* The current fw of the Efika has a device tree needs quite a few | ||
2122 | * fixups to be compliant with the mpc52xx bindings. It's currently | ||
2123 | * unknown if it will ever be compliant (come on bPlan ...) so we do fixups. | ||
2124 | * NOTE that we (barely) tolerate it because the EFIKA was out before | ||
2125 | * the bindings were finished, for any new boards -> RTFM ! */ | ||
2126 | |||
2127 | struct subst_entry { | ||
2128 | char *path; | ||
2129 | char *property; | ||
2130 | void *value; | ||
2131 | int value_len; | ||
2132 | }; | ||
2133 | |||
2134 | static void __init fixup_device_tree_efika(void) | ||
2135 | { | ||
2136 | /* Substitution table */ | ||
2137 | #define prop_cstr(x) x, sizeof(x) | ||
2138 | int prop_sound_irq[3] = { 2, 2, 0 }; | ||
2139 | int prop_bcomm_irq[3*16] = { 3,0,0, 3,1,0, 3,2,0, 3,3,0, | ||
2140 | 3,4,0, 3,5,0, 3,6,0, 3,7,0, | ||
2141 | 3,8,0, 3,9,0, 3,10,0, 3,11,0, | ||
2142 | 3,12,0, 3,13,0, 3,14,0, 3,15,0 }; | ||
2143 | struct subst_entry efika_subst_table[] = { | ||
2144 | { "/", "device_type", prop_cstr("efika") }, | ||
2145 | { "/builtin", "compatible", prop_cstr("soc") }, | ||
2146 | { "/builtin/ata", "compatible", prop_cstr("mpc5200b-ata\0mpc5200-ata"), }, | ||
2147 | { "/builtin/bestcomm", "compatible", prop_cstr("mpc5200b-bestcomm\0mpc5200-bestcomm") }, | ||
2148 | { "/builtin/bestcomm", "interrupts", prop_bcomm_irq, sizeof(prop_bcomm_irq) }, | ||
2149 | { "/builtin/ethernet", "compatible", prop_cstr("mpc5200b-fec\0mpc5200-fec") }, | ||
2150 | { "/builtin/pic", "compatible", prop_cstr("mpc5200b-pic\0mpc5200-pic") }, | ||
2151 | { "/builtin/serial", "compatible", prop_cstr("mpc5200b-psc-uart\0mpc5200-psc-uart") }, | ||
2152 | { "/builtin/sound", "compatible", prop_cstr("mpc5200b-psc-ac97\0mpc5200-psc-ac97") }, | ||
2153 | { "/builtin/sound", "interrupts", prop_sound_irq, sizeof(prop_sound_irq) }, | ||
2154 | { "/builtin/sram", "compatible", prop_cstr("mpc5200b-sram\0mpc5200-sram") }, | ||
2155 | { "/builtin/sram", "device_type", prop_cstr("sram") }, | ||
2156 | {} | ||
2157 | }; | ||
2158 | #undef prop_cstr | ||
2159 | |||
2160 | /* Vars */ | ||
2161 | u32 node; | ||
2162 | char prop[64]; | ||
2163 | int rv, i; | ||
2164 | |||
2165 | /* Check if we're really running on a EFIKA */ | ||
2166 | node = call_prom("finddevice", 1, 1, ADDR("/")); | ||
2167 | if (!PHANDLE_VALID(node)) | ||
2168 | return; | ||
2169 | |||
2170 | rv = prom_getprop(node, "model", prop, sizeof(prop)); | ||
2171 | if (rv == PROM_ERROR) | ||
2172 | return; | ||
2173 | if (strcmp(prop, "EFIKA5K2")) | ||
2174 | return; | ||
2175 | |||
2176 | prom_printf("Applying EFIKA device tree fixups\n"); | ||
2177 | |||
2178 | /* Process substitution table */ | ||
2179 | for (i=0; efika_subst_table[i].path; i++) { | ||
2180 | struct subst_entry *se = &efika_subst_table[i]; | ||
2181 | |||
2182 | node = call_prom("finddevice", 1, 1, ADDR(se->path)); | ||
2183 | if (!PHANDLE_VALID(node)) { | ||
2184 | prom_printf("fixup_device_tree_efika: ", | ||
2185 | "skipped entry %x - not found\n", i); | ||
2186 | continue; | ||
2187 | } | ||
2188 | |||
2189 | rv = prom_setprop(node, se->path, se->property, | ||
2190 | se->value, se->value_len ); | ||
2191 | if (rv == PROM_ERROR) | ||
2192 | prom_printf("fixup_device_tree_efika: ", | ||
2193 | "skipped entry %x - setprop error\n", i); | ||
2194 | } | ||
2195 | } | ||
2196 | #else | ||
2197 | #define fixup_device_tree_efika() | ||
2198 | #endif | ||
2199 | |||
2120 | static void __init fixup_device_tree(void) | 2200 | static void __init fixup_device_tree(void) |
2121 | { | 2201 | { |
2122 | fixup_device_tree_maple(); | 2202 | fixup_device_tree_maple(); |
2123 | fixup_device_tree_chrp(); | 2203 | fixup_device_tree_chrp(); |
2124 | fixup_device_tree_pmac(); | 2204 | fixup_device_tree_pmac(); |
2205 | fixup_device_tree_efika(); | ||
2125 | } | 2206 | } |
2126 | 2207 | ||
2127 | static void __init prom_find_boot_cpu(void) | 2208 | static void __init prom_find_boot_cpu(void) |