Staging: Panel: panel: Fixed checkpatch line length warnings
[linux/fpc-iii.git] / arch / mips / kernel / prom.c
blob5712bb5322454f1a98d169e58490e77b62e149be
1 /*
2 * MIPS support for CONFIG_OF device tree support
4 * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/init.h>
12 #include <linux/export.h>
13 #include <linux/errno.h>
14 #include <linux/types.h>
15 #include <linux/bootmem.h>
16 #include <linux/initrd.h>
17 #include <linux/debugfs.h>
18 #include <linux/of.h>
19 #include <linux/of_fdt.h>
20 #include <linux/of_irq.h>
21 #include <linux/of_platform.h>
23 #include <asm/page.h>
24 #include <asm/prom.h>
26 static char mips_machine_name[64] = "Unknown";
28 __init void mips_set_machine_name(const char *name)
30 if (name == NULL)
31 return;
33 strncpy(mips_machine_name, name, sizeof(mips_machine_name));
34 pr_info("MIPS: machine is %s\n", mips_get_machine_name());
37 char *mips_get_machine_name(void)
39 return mips_machine_name;
42 #ifdef CONFIG_OF
43 int __init early_init_dt_scan_memory_arch(unsigned long node,
44 const char *uname, int depth,
45 void *data)
47 return early_init_dt_scan_memory(node, uname, depth, data);
50 void __init early_init_dt_add_memory_arch(u64 base, u64 size)
52 return add_memory_region(base, size, BOOT_MEM_RAM);
55 void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
57 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
60 #ifdef CONFIG_BLK_DEV_INITRD
61 void __init early_init_dt_setup_initrd_arch(unsigned long start,
62 unsigned long end)
64 initrd_start = (unsigned long)__va(start);
65 initrd_end = (unsigned long)__va(end);
66 initrd_below_start_ok = 1;
68 #endif
70 int __init early_init_dt_scan_model(unsigned long node, const char *uname,
71 int depth, void *data)
73 if (!depth) {
74 char *model = of_get_flat_dt_prop(node, "model", NULL);
76 if (model)
77 mips_set_machine_name(model);
79 return 0;
82 void __init early_init_devtree(void *params)
84 /* Setup flat device-tree pointer */
85 initial_boot_params = params;
87 /* Retrieve various informations from the /chosen node of the
88 * device-tree, including the platform type, initrd location and
89 * size, and more ...
91 of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);
94 /* Scan memory nodes */
95 of_scan_flat_dt(early_init_dt_scan_root, NULL);
96 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
98 /* try to load the mips machine name */
99 of_scan_flat_dt(early_init_dt_scan_model, NULL);
102 void __init __dt_setup_arch(struct boot_param_header *bph)
104 if (be32_to_cpu(bph->magic) != OF_DT_HEADER) {
105 pr_err("DTB has bad magic, ignoring builtin OF DTB\n");
107 return;
110 initial_boot_params = bph;
112 early_init_devtree(initial_boot_params);
114 #endif