aboutsummaryrefslogtreecommitdiffstats
path: root/arch/metag
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/metag
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/metag')
-rw-r--r--arch/metag/include/asm/mach/arch.h2
-rw-r--r--arch/metag/include/asm/prom.h23
-rw-r--r--arch/metag/include/asm/setup.h1
-rw-r--r--arch/metag/kernel/devtree.c83
-rw-r--r--arch/metag/kernel/setup.c7
-rw-r--r--arch/metag/mm/init.c9
6 files changed, 24 insertions, 101 deletions
diff --git a/arch/metag/include/asm/mach/arch.h b/arch/metag/include/asm/mach/arch.h
index 12c5664fea6e..433f94624fa2 100644
--- a/arch/metag/include/asm/mach/arch.h
+++ b/arch/metag/include/asm/mach/arch.h
@@ -53,7 +53,7 @@ struct machine_desc {
53/* 53/*
54 * Current machine - only accessible during boot. 54 * Current machine - only accessible during boot.
55 */ 55 */
56extern struct machine_desc *machine_desc; 56extern const struct machine_desc *machine_desc;
57 57
58/* 58/*
59 * Machine type table - also only accessible during boot 59 * Machine type table - also only accessible during boot
diff --git a/arch/metag/include/asm/prom.h b/arch/metag/include/asm/prom.h
deleted file mode 100644
index d2aa35d2228e..000000000000
--- a/arch/metag/include/asm/prom.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/metag/include/asm/prom.h
3 *
4 * Copyright (C) 2012 Imagination Technologies Ltd.
5 *
6 * Based on ARM version:
7 * Copyright (C) 2009 Canonical Ltd. <jeremy.kerr@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14#ifndef __ASM_METAG_PROM_H
15#define __ASM_METAG_PROM_H
16
17#include <asm/setup.h>
18#define HAVE_ARCH_DEVTREE_FIXUPS
19
20extern struct machine_desc *setup_machine_fdt(void *dt);
21extern void copy_fdt(void);
22
23#endif /* __ASM_METAG_PROM_H */
diff --git a/arch/metag/include/asm/setup.h b/arch/metag/include/asm/setup.h
index e13083b15dd0..e9fdee9452b1 100644
--- a/arch/metag/include/asm/setup.h
+++ b/arch/metag/include/asm/setup.h
@@ -3,6 +3,7 @@
3 3
4#include <uapi/asm/setup.h> 4#include <uapi/asm/setup.h>
5 5
6extern const struct machine_desc *setup_machine_fdt(void *dt);
6void per_cpu_trap_init(unsigned long); 7void per_cpu_trap_init(unsigned long);
7extern void __init dump_machine_table(void); 8extern void __init dump_machine_table(void);
8#endif /* _ASM_METAG_SETUP_H */ 9#endif /* _ASM_METAG_SETUP_H */
diff --git a/arch/metag/kernel/devtree.c b/arch/metag/kernel/devtree.c
index 7cd02529636e..18dd7aea9fdc 100644
--- a/arch/metag/kernel/devtree.c
+++ b/arch/metag/kernel/devtree.c
@@ -34,6 +34,19 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
34 return alloc_bootmem_align(size, align); 34 return alloc_bootmem_align(size, align);
35} 35}
36 36
37static const void * __init arch_get_next_mach(const char *const **match)
38{
39 static const struct machine_desc *mdesc = __arch_info_begin;
40 const struct machine_desc *m = mdesc;
41
42 if (m >= __arch_info_end)
43 return NULL;
44
45 mdesc++;
46 *match = m->dt_compat;
47 return m;
48}
49
37/** 50/**
38 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 51 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
39 * @dt: virtual address pointer to dt blob 52 * @dt: virtual address pointer to dt blob
@@ -41,74 +54,18 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
41 * If a dtb was passed to the kernel, then use it to choose the correct 54 * If a dtb was passed to the kernel, then use it to choose the correct
42 * machine_desc and to setup the system. 55 * machine_desc and to setup the system.
43 */ 56 */
44struct machine_desc * __init setup_machine_fdt(void *dt) 57const struct machine_desc * __init setup_machine_fdt(void *dt)
45{ 58{
46 struct boot_param_header *devtree = dt; 59 const struct machine_desc *mdesc;
47 struct machine_desc *mdesc, *mdesc_best = NULL;
48 unsigned int score, mdesc_score = ~1;
49 unsigned long dt_root;
50 const char *model;
51 60
52 /* check device tree validity */ 61 /* check device tree validity */
53 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 62 if (!early_init_dt_scan(dt))
54 return NULL; 63 return NULL;
55 64
56 /* Search the mdescs for the 'best' compatible value match */ 65 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
57 initial_boot_params = devtree; 66 if (!mdesc)
58 dt_root = of_get_flat_dt_root();
59
60 for_each_machine_desc(mdesc) {
61 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
62 if (score > 0 && score < mdesc_score) {
63 mdesc_best = mdesc;
64 mdesc_score = score;
65 }
66 }
67 if (!mdesc_best) {
68 const char *prop;
69 long size;
70
71 pr_err("\nError: unrecognized/unsupported device tree compatible list:\n[ ");
72
73 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
74 if (prop) {
75 while (size > 0) {
76 printk("'%s' ", prop);
77 size -= strlen(prop) + 1;
78 prop += strlen(prop) + 1;
79 }
80 }
81 printk("]\n\n");
82
83 dump_machine_table(); /* does not return */ 67 dump_machine_table(); /* does not return */
84 } 68 pr_info("Machine name: %s\n", mdesc->name);
85
86 model = of_get_flat_dt_prop(dt_root, "model", NULL);
87 if (!model)
88 model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
89 if (!model)
90 model = "<unknown>";
91 pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
92
93 /* Retrieve various information from the /chosen node */
94 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
95
96 return mdesc_best;
97}
98 69
99/** 70 return mdesc;
100 * copy_fdt - Copy device tree into non-init memory.
101 *
102 * We must copy the flattened device tree blob into non-init memory because the
103 * unflattened device tree will reference the strings in it directly.
104 */
105void __init copy_fdt(void)
106{
107 void *alloc = early_init_dt_alloc_memory_arch(
108 be32_to_cpu(initial_boot_params->totalsize), 0x40);
109 if (alloc) {
110 memcpy(alloc, initial_boot_params,
111 be32_to_cpu(initial_boot_params->totalsize));
112 initial_boot_params = alloc;
113 }
114} 71}
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index e639bae09645..129c7cdda1ce 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -42,7 +42,6 @@
42#include <asm/mmu.h> 42#include <asm/mmu.h>
43#include <asm/mmzone.h> 43#include <asm/mmzone.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/prom.h>
46#include <asm/sections.h> 45#include <asm/sections.h>
47#include <asm/setup.h> 46#include <asm/setup.h>
48#include <asm/traps.h> 47#include <asm/traps.h>
@@ -115,7 +114,7 @@ extern u32 __dtb_start[];
115extern struct console dash_console; 114extern struct console dash_console;
116#endif 115#endif
117 116
118struct machine_desc *machine_desc __initdata; 117const struct machine_desc *machine_desc __initdata;
119 118
120/* 119/*
121 * Map a Linux CPU number to a hardware thread ID 120 * Map a Linux CPU number to a hardware thread ID
@@ -404,9 +403,7 @@ void __init setup_arch(char **cmdline_p)
404 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); 403 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id();
405 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); 404 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id();
406 405
407 /* Copy device tree blob into non-init memory before unflattening */ 406 unflatten_and_copy_device_tree();
408 copy_fdt();
409 unflatten_device_tree();
410 407
411#ifdef CONFIG_SMP 408#ifdef CONFIG_SMP
412 smp_init_cpus(); 409 smp_init_cpus();
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 123919534b80..249fff66add3 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -12,7 +12,6 @@
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13#include <linux/memblock.h> 13#include <linux/memblock.h>
14#include <linux/initrd.h> 14#include <linux/initrd.h>
15#include <linux/of_fdt.h>
16 15
17#include <asm/setup.h> 16#include <asm/setup.h>
18#include <asm/page.h> 17#include <asm/page.h>
@@ -405,11 +404,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
405 "initrd"); 404 "initrd");
406} 405}
407#endif 406#endif
408
409#ifdef CONFIG_OF_FLATTREE
410void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
411{
412 pr_err("%s(%llx, %llx)\n",
413 __func__, start, end);
414}
415#endif /* CONFIG_OF_FLATTREE */