aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 02:52:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 02:52:17 -0500
commit10d0c9705e80bbd3d587c5fad24599aabaca6688 (patch)
tree9456083a1b04b8d98da08d88e937cfeff80e2a7d /arch/arc
parent85b656cf1560e27a89354a23f2c10ba229d2f173 (diff)
parentc11eede69b6ad0ac44ebc1e021a8d2699c5f1f8f (diff)
Merge tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull devicetree updates from Rob Herring: "DeviceTree updates for 3.13. This is a bit larger pull request than usual for this cycle with lots of clean-up. - Cross arch clean-up and consolidation of early DT scanning code. - Clean-up and removal of arch prom.h headers. Makes arch specific prom.h optional on all but Sparc. - Addition of interrupts-extended property for devices connected to multiple interrupt controllers. - Refactoring of DT interrupt parsing code in preparation for deferred probe of interrupts. - ARM cpu and cpu topology bindings documentation. - Various DT vendor binding documentation updates" * tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits) powerpc: add missing explicit OF includes for ppc dt/irq: add empty of_irq_count for !OF_IRQ dt: disable self-tests for !OF_IRQ of: irq: Fix interrupt-map entry matching MIPS: Netlogic: replace early_init_devtree() call of: Add Panasonic Corporation vendor prefix of: Add Chunghwa Picture Tubes Ltd. vendor prefix of: Add AU Optronics Corporation vendor prefix of/irq: Fix potential buffer overflow of/irq: Fix bug in interrupt parsing refactor. of: set dma_mask to point to coherent_dma_mask of: add vendor prefix for PHYTEC Messtechnik GmbH DT: sort vendor-prefixes.txt of: Add vendor prefix for Cadence of: Add empty for_each_available_child_of_node() macro definition arm/versatile: Fix versatile irq specifications. of/irq: create interrupts-extended property microblaze/pci: Drop PowerPC-ism from irq parsing of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code. of/irq: Use irq_of_parse_and_map() ...
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/mach_desc.h17
-rw-r--r--arch/arc/include/asm/prom.h14
-rw-r--r--arch/arc/kernel/devtree.c97
-rw-r--r--arch/arc/kernel/setup.c6
-rw-r--r--arch/arc/mm/init.c7
5 files changed, 25 insertions, 116 deletions
diff --git a/arch/arc/include/asm/mach_desc.h b/arch/arc/include/asm/mach_desc.h
index 9998dc846ebb..e8993a2be6c2 100644
--- a/arch/arc/include/asm/mach_desc.h
+++ b/arch/arc/include/asm/mach_desc.h
@@ -51,22 +51,12 @@ struct machine_desc {
51/* 51/*
52 * Current machine - only accessible during boot. 52 * Current machine - only accessible during boot.
53 */ 53 */
54extern struct machine_desc *machine_desc; 54extern const struct machine_desc *machine_desc;
55 55
56/* 56/*
57 * Machine type table - also only accessible during boot 57 * Machine type table - also only accessible during boot
58 */ 58 */
59extern struct machine_desc __arch_info_begin[], __arch_info_end[]; 59extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
60#define for_each_machine_desc(p) \
61 for (p = __arch_info_begin; p < __arch_info_end; p++)
62
63static inline struct machine_desc *default_machine_desc(void)
64{
65 /* the default machine is the last one linked in */
66 if (__arch_info_end - 1 < __arch_info_begin)
67 return NULL;
68 return __arch_info_end - 1;
69}
70 60
71/* 61/*
72 * Set of macros to define architecture features. 62 * Set of macros to define architecture features.
@@ -81,7 +71,6 @@ __attribute__((__section__(".arch.info.init"))) = { \
81#define MACHINE_END \ 71#define MACHINE_END \
82}; 72};
83 73
84extern struct machine_desc *setup_machine_fdt(void *dt); 74extern const struct machine_desc *setup_machine_fdt(void *dt);
85extern void __init copy_devtree(void);
86 75
87#endif 76#endif
diff --git a/arch/arc/include/asm/prom.h b/arch/arc/include/asm/prom.h
deleted file mode 100644
index 692d0d0789a7..000000000000
--- a/arch/arc/include/asm/prom.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_PROM_H_
10#define _ASM_ARC_PROM_H_
11
12#define HAVE_ARCH_DEVTREE_FIXUPS
13
14#endif
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index 2340af0e1d6f..b6dc4e21fd32 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -14,10 +14,22 @@
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <asm/prom.h>
18#include <asm/clk.h> 17#include <asm/clk.h>
19#include <asm/mach_desc.h> 18#include <asm/mach_desc.h>
20 19
20static const void * __init arch_get_next_mach(const char *const **match)
21{
22 static const struct machine_desc *mdesc = __arch_info_begin;
23 const struct machine_desc *m = mdesc;
24
25 if (m >= __arch_info_end)
26 return NULL;
27
28 mdesc++;
29 *match = m->dt_compat;
30 return m;
31}
32
21/** 33/**
22 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 34 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
23 * @dt: virtual address pointer to dt blob 35 * @dt: virtual address pointer to dt blob
@@ -25,93 +37,24 @@
25 * If a dtb was passed to the kernel, then use it to choose the correct 37 * If a dtb was passed to the kernel, then use it to choose the correct
26 * machine_desc and to setup the system. 38 * machine_desc and to setup the system.
27 */ 39 */
28struct machine_desc * __init setup_machine_fdt(void *dt) 40const struct machine_desc * __init setup_machine_fdt(void *dt)
29{ 41{
30 struct boot_param_header *devtree = dt; 42 const struct machine_desc *mdesc;
31 struct machine_desc *mdesc = NULL, *mdesc_best = NULL;
32 unsigned int score, mdesc_score = ~1;
33 unsigned long dt_root; 43 unsigned long dt_root;
34 const char *model, *compat;
35 void *clk; 44 void *clk;
36 char manufacturer[16];
37 unsigned long len; 45 unsigned long len;
38 46
39 /* check device tree validity */ 47 if (!early_init_dt_scan(dt))
40 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
41 return NULL; 48 return NULL;
42 49
43 initial_boot_params = devtree; 50 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
44 dt_root = of_get_flat_dt_root(); 51 if (!mdesc)
45
46 /*
47 * The kernel could be multi-platform enabled, thus could have many
48 * "baked-in" machine descriptors. Search thru all for the best
49 * "compatible" string match.
50 */
51 for_each_machine_desc(mdesc) {
52 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
53 if (score > 0 && score < mdesc_score) {
54 mdesc_best = mdesc;
55 mdesc_score = score;
56 }
57 }
58 if (!mdesc_best) {
59 const char *prop;
60 long size;
61
62 pr_err("\n unrecognized device tree list:\n[ ");
63
64 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
65 if (prop) {
66 while (size > 0) {
67 printk("'%s' ", prop);
68 size -= strlen(prop) + 1;
69 prop += strlen(prop) + 1;
70 }
71 }
72 printk("]\n\n");
73
74 machine_halt(); 52 machine_halt();
75 }
76
77 /* compat = "<manufacturer>,<model>" */
78 compat = mdesc_best->dt_compat[0];
79
80 model = strchr(compat, ',');
81 if (model)
82 model++;
83
84 strlcpy(manufacturer, compat, model ? model - compat : strlen(compat));
85
86 pr_info("Board \"%s\" from %s (Manufacturer)\n", model, manufacturer);
87
88 /* Retrieve various information from the /chosen node */
89 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
90
91 /* Initialize {size,address}-cells info */
92 of_scan_flat_dt(early_init_dt_scan_root, NULL);
93
94 /* Setup memory, calling early_init_dt_add_memory_arch */
95 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
96 53
54 dt_root = of_get_flat_dt_root();
97 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len); 55 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len);
98 if (clk) 56 if (clk)
99 arc_set_core_freq(of_read_ulong(clk, len/4)); 57 arc_set_core_freq(of_read_ulong(clk, len/4));
100 58
101 return mdesc_best; 59 return mdesc;
102}
103
104/*
105 * Copy the flattened DT out of .init since unflattening doesn't copy strings
106 * and the normal DT APIs refs them from orig flat DT
107 */
108void __init copy_devtree(void)
109{
110 void *alloc = early_init_dt_alloc_memory_arch(
111 be32_to_cpu(initial_boot_params->totalsize), 64);
112 if (alloc) {
113 memcpy(alloc, initial_boot_params,
114 be32_to_cpu(initial_boot_params->totalsize));
115 initial_boot_params = alloc;
116 }
117} 60}
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index d9e15f16633e..643eae4436e0 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -21,7 +21,6 @@
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/prom.h>
25#include <asm/unwind.h> 24#include <asm/unwind.h>
26#include <asm/clk.h> 25#include <asm/clk.h>
27#include <asm/mach_desc.h> 26#include <asm/mach_desc.h>
@@ -31,7 +30,7 @@
31int running_on_hw = 1; /* vs. on ISS */ 30int running_on_hw = 1; /* vs. on ISS */
32 31
33char __initdata command_line[COMMAND_LINE_SIZE]; 32char __initdata command_line[COMMAND_LINE_SIZE];
34struct machine_desc *machine_desc; 33const struct machine_desc *machine_desc;
35 34
36struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 35struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
37 36
@@ -345,8 +344,7 @@ void __init setup_arch(char **cmdline_p)
345 setup_arch_memory(); 344 setup_arch_memory();
346 345
347 /* copy flat DT out of .init and then unflatten it */ 346 /* copy flat DT out of .init and then unflatten it */
348 copy_devtree(); 347 unflatten_and_copy_device_tree();
349 unflatten_device_tree();
350 348
351 /* Can be issue if someone passes cmd line arg "ro" 349 /* Can be issue if someone passes cmd line arg "ro"
352 * But that is unlikely so keeping it as it is 350 * But that is unlikely so keeping it as it is
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 81279ec73a6a..55e0a85bea78 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -125,10 +125,3 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
125 free_reserved_area((void *)start, (void *)end, -1, "initrd"); 125 free_reserved_area((void *)start, (void *)end, -1, "initrd");
126} 126}
127#endif 127#endif
128
129#ifdef CONFIG_OF_FLATTREE
130void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
131{
132 pr_err("%s(%llx, %llx)\n", __func__, start, end);
133}
134#endif /* CONFIG_OF_FLATTREE */