aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2012-02-15 19:25:47 -0500
committerKumar Gala <galak@kernel.crashing.org>2012-03-16 11:46:33 -0400
commit4951896aad0b73a8163eb23d44818993237bc0cf (patch)
tree0e30431ff99cf89620b1bb5864ccd6823a3d400b /arch/powerpc
parent4a170d0198330b8615778f6f0e265cdaadfd54b4 (diff)
powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled
The Freescale P1022 has a unique pin muxing "feature" where the DIU video controller's video signals are muxed with 24 of the local bus address signals. When the DIU is enabled, the bulk of the local bus is disabled, preventing access to memory-mapped devices like NOR flash and the pixis FPGA. Therefore, if the DIU is going to be enabled, then memory-mapped devices on the localbus, like NOR flash, need to be disabled. This also means that the localbus is not a 'simple-bus' any more, so remove that string from the compatible node. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-post.dtsi6
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c71
2 files changed, 76 insertions, 1 deletions
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
index de4521531f6..06216b8c0af 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
@@ -35,7 +35,11 @@
35&lbc { 35&lbc {
36 #address-cells = <2>; 36 #address-cells = <2>;
37 #size-cells = <1>; 37 #size-cells = <1>;
38 compatible = "fsl,p1022-elbc", "fsl,elbc", "simple-bus"; 38 /*
39 * The localbus on the P1022 is not a simple-bus because of the eLBC
40 * pin muxing when the DIU is enabled.
41 */
42 compatible = "fsl,p1022-elbc", "fsl,elbc";
39 interrupts = <19 2 0 0>; 43 interrupts = <19 2 0 0>;
40}; 44};
41 45
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 63ba7905396..e211b0d756f 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -249,6 +249,49 @@ void __init p1022_ds_pic_init(void)
249 mpic_init(mpic); 249 mpic_init(mpic);
250} 250}
251 251
252#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
253
254/*
255 * Disables a node in the device tree.
256 *
257 * This function is called before kmalloc() is available, so the 'new' object
258 * should be allocated in the global area. The easiest way is to do that is
259 * to allocate one static local variable for each call to this function.
260 */
261static void __init disable_one_node(struct device_node *np, struct property *new)
262{
263 struct property *old;
264
265 old = of_find_property(np, new->name, NULL);
266 if (old)
267 prom_update_property(np, new, old);
268 else
269 prom_add_property(np, new);
270}
271
272/* TRUE if there is a "video=fslfb" command-line parameter. */
273static bool fslfb;
274
275/*
276 * Search for a "video=fslfb" command-line parameter, and set 'fslfb' to
277 * true if we find it.
278 *
279 * We need to use early_param() instead of __setup() because the normal
280 * __setup() gets called to late. However, early_param() gets called very
281 * early, before the device tree is unflattened, so all we can do now is set a
282 * global variable. Later on, p1022_ds_setup_arch() will use that variable
283 * to determine if we need to update the device tree.
284 */
285static int __init early_video_setup(char *options)
286{
287 fslfb = (strncmp(options, "fslfb:", 6) == 0);
288
289 return 0;
290}
291early_param("video", early_video_setup);
292
293#endif
294
252/* 295/*
253 * Setup the architecture 296 * Setup the architecture
254 */ 297 */
@@ -286,6 +329,34 @@ static void __init p1022_ds_setup_arch(void)
286 diu_ops.set_monitor_port = p1022ds_set_monitor_port; 329 diu_ops.set_monitor_port = p1022ds_set_monitor_port;
287 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock; 330 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock;
288 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port; 331 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;
332
333 /*
334 * Disable the NOR flash node if there is video=fslfb... command-line
335 * parameter. When the DIU is active, NOR flash is unavailable, so we
336 * have to disable the node before the MTD driver loads.
337 */
338 if (fslfb) {
339 struct device_node *np =
340 of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
341
342 if (np) {
343 np = of_find_compatible_node(np, NULL, "cfi-flash");
344 if (np) {
345 static struct property nor_status = {
346 .name = "status",
347 .value = "disabled",
348 .length = sizeof("disabled"),
349 };
350
351 pr_info("p1022ds: disabling %s node",
352 np->full_name);
353 disable_one_node(np, &nor_status);
354 of_node_put(np);
355 }
356 }
357
358 }
359
289#endif 360#endif
290 361
291 mpc85xx_smp_init(); 362 mpc85xx_smp_init();