diff options
Diffstat (limited to 'arch/mips/bcm3384/setup.c')
-rw-r--r-- | arch/mips/bcm3384/setup.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/arch/mips/bcm3384/setup.c b/arch/mips/bcm3384/setup.c new file mode 100644 index 000000000000..d84b8400b874 --- /dev/null +++ b/arch/mips/bcm3384/setup.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
7 | * Copyright (C) 2014 Kevin Cernekee <cernekee@gmail.com> | ||
8 | */ | ||
9 | |||
10 | #include <linux/init.h> | ||
11 | #include <linux/bootmem.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/ioport.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_fdt.h> | ||
16 | #include <linux/of_platform.h> | ||
17 | #include <linux/smp.h> | ||
18 | #include <asm/addrspace.h> | ||
19 | #include <asm/bmips.h> | ||
20 | #include <asm/bootinfo.h> | ||
21 | #include <asm/prom.h> | ||
22 | #include <asm/smp-ops.h> | ||
23 | #include <asm/time.h> | ||
24 | |||
25 | void __init prom_init(void) | ||
26 | { | ||
27 | register_bmips_smp_ops(); | ||
28 | } | ||
29 | |||
30 | void __init prom_free_prom_memory(void) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | const char *get_system_type(void) | ||
35 | { | ||
36 | return "BCM3384"; | ||
37 | } | ||
38 | |||
39 | void __init plat_time_init(void) | ||
40 | { | ||
41 | struct device_node *np; | ||
42 | u32 freq; | ||
43 | |||
44 | np = of_find_node_by_name(NULL, "cpus"); | ||
45 | if (!np) | ||
46 | panic("missing 'cpus' DT node"); | ||
47 | if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0) | ||
48 | panic("missing 'mips-hpt-frequency' property"); | ||
49 | of_node_put(np); | ||
50 | |||
51 | mips_hpt_frequency = freq; | ||
52 | } | ||
53 | |||
54 | void __init plat_mem_setup(void) | ||
55 | { | ||
56 | void *dtb = __dtb_start; | ||
57 | |||
58 | set_io_port_base(0); | ||
59 | ioport_resource.start = 0; | ||
60 | ioport_resource.end = ~0; | ||
61 | |||
62 | /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ | ||
63 | if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) | ||
64 | dtb = phys_to_virt(fw_arg2); | ||
65 | |||
66 | __dt_setup_arch(dtb); | ||
67 | |||
68 | strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); | ||
69 | } | ||
70 | |||
71 | void __init device_tree_init(void) | ||
72 | { | ||
73 | struct device_node *np; | ||
74 | |||
75 | unflatten_and_copy_device_tree(); | ||
76 | |||
77 | /* Disable SMP boot unless both CPUs are listed in DT and !disabled */ | ||
78 | np = of_find_node_by_name(NULL, "cpus"); | ||
79 | if (np && of_get_available_child_count(np) <= 1) | ||
80 | bmips_smp_enabled = 0; | ||
81 | of_node_put(np); | ||
82 | } | ||
83 | |||
84 | int __init plat_of_setup(void) | ||
85 | { | ||
86 | return __dt_register_buses("brcm,bcm3384", "simple-bus"); | ||
87 | } | ||
88 | |||
89 | arch_initcall(plat_of_setup); | ||
90 | |||
91 | static int __init plat_dev_init(void) | ||
92 | { | ||
93 | of_clk_init(NULL); | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | device_initcall(plat_dev_init); | ||