diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-12-25 12:49:00 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:21:35 -0400 |
commit | 5f2d44591fb374ae346a3df682d722b68552adc2 (patch) | |
tree | 22bd5d017c3b9fe25a25587ebb65b05abf37cbe1 /arch/mips/bmips/setup.c | |
parent | eb2236ea580bb21c954c889cc3dc05b3e98238cd (diff) |
MIPS: bcm3384: Rename "bcm3384" target to "bmips"
This platform is configured primarily through device tree, and we can
reuse the same code to support a bunch of other chips. Change the name
to reflect this.
[ralf@linux-mips.org: Fix conflicts with other patches.]
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Cc: f.fainelli@gmail.com
Cc: jaedon.shin@gmail.com
Cc: abrestic@chromium.org
Cc: tglx@linutronix.de
Cc: jason@lakedaemon.net
Cc: jogo@openwrt.org
Cc: computersforpeace@gmail.com
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8838/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/bmips/setup.c')
-rw-r--r-- | arch/mips/bmips/setup.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c new file mode 100644 index 000000000000..5099109b2325 --- /dev/null +++ b/arch/mips/bmips/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 "Generic BMIPS kernel"; | ||
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); | ||