aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:19:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:19:14 -0400
commit51f00a471ce8f359627dd99aeac322947a0e491b (patch)
treede3f0c26359d7846fc5d6d0fdd147e225d979add /arch/mips
parenta7f505c6b15fb35c0de8136e370d2927ce29452c (diff)
parent97ff46cb69da22037346670ae515217c658ace02 (diff)
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: mtd/m25p80: add support to parse the partitions by OF node of/irq: of_irq.c needs to include linux/irq.h of/mips: Cleanup some include directives/files. of/mips: Add device tree support to MIPS of/flattree: Eliminate need to provide early_init_dt_scan_chosen_arch of/device: Rework to use common platform_device_alloc() for allocating devices of/xsysace: Fix OF probing on little-endian systems of: use __be32 types for big-endian device tree data of/irq: remove references to NO_IRQ in drivers/of/platform.c of/promtree: add package-to-path support to pdt of/promtree: add of_pdt namespace to pdt code of/promtree: no longer call prom_ functions directly; use an ops structure of/promtree: make drivers/of/pdt.c no longer sparc-only sparc: break out some PROM device-tree building code out into drivers/of of/sparc: convert various prom_* functions to use phandle sparc: stop exporting openprom.h header powerpc, of_serial: Endianness issues setting up the serial ports of: MTD: Fix OF probing on little-endian systems of: GPIO: Fix OF probing on little-endian systems
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig7
-rw-r--r--arch/mips/include/asm/irq.h5
-rw-r--r--arch/mips/include/asm/prom.h31
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/prom.c112
-rw-r--r--arch/mips/kernel/setup.c2
6 files changed, 159 insertions, 0 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 784cf822963a..46cae2b163e4 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2128,6 +2128,13 @@ config SECCOMP
2128 2128
2129 If unsure, say Y. Only embedded should say N here. 2129 If unsure, say Y. Only embedded should say N here.
2130 2130
2131config USE_OF
2132 bool "Flattened Device Tree support"
2133 select OF
2134 select OF_FLATTREE
2135 help
2136 Include support for flattened device tree machine descriptions.
2137
2131endmenu 2138endmenu
2132 2139
2133config LOCKDEP_SUPPORT 2140config LOCKDEP_SUPPORT
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index dea4aed6478f..b003ed52ed17 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -16,6 +16,11 @@
16 16
17#include <irq.h> 17#include <irq.h>
18 18
19static inline void irq_dispose_mapping(unsigned int virq)
20{
21 return;
22}
23
19#ifdef CONFIG_I8259 24#ifdef CONFIG_I8259
20static inline int irq_canonicalize(int irq) 25static inline int irq_canonicalize(int irq)
21{ 26{
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
new file mode 100644
index 000000000000..f29b862d9db3
--- /dev/null
+++ b/arch/mips/include/asm/prom.h
@@ -0,0 +1,31 @@
1/*
2 * arch/mips/include/asm/prom.h
3 *
4 * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
5 *
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 *
10 */
11#ifndef __ASM_MIPS_PROM_H
12#define __ASM_MIPS_PROM_H
13
14#ifdef CONFIG_OF
15#include <asm/bootinfo.h>
16
17/* which is compatible with the flattened device tree (FDT) */
18#define cmd_line arcs_cmdline
19
20extern int early_init_dt_scan_memory_arch(unsigned long node,
21 const char *uname, int depth, void *data);
22
23extern int reserve_mem_mach(unsigned long addr, unsigned long size);
24extern void free_mem_mach(unsigned long addr, unsigned long size);
25
26extern void device_tree_init(void);
27#else /* CONFIG_OF */
28static inline void device_tree_init(void) { }
29#endif /* CONFIG_OF */
30
31#endif /* _ASM_MIPS_PROM_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 06f848299785..80884983270d 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -96,6 +96,8 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
96obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 96obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
97obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o 97obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
98 98
99obj-$(CONFIG_OF) += prom.o
100
99CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 101CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
100 102
101obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 103obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
new file mode 100644
index 000000000000..e000b278f024
--- /dev/null
+++ b/arch/mips/kernel/prom.c
@@ -0,0 +1,112 @@
1/*
2 * MIPS support for CONFIG_OF device tree support
3 *
4 * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
5 *
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 */
10
11#include <linux/init.h>
12#include <linux/module.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>
22
23#include <asm/page.h>
24#include <asm/prom.h>
25
26int __init early_init_dt_scan_memory_arch(unsigned long node,
27 const char *uname, int depth,
28 void *data)
29{
30 return early_init_dt_scan_memory(node, uname, depth, data);
31}
32
33void __init early_init_dt_add_memory_arch(u64 base, u64 size)
34{
35 return add_memory_region(base, size, BOOT_MEM_RAM);
36}
37
38int __init reserve_mem_mach(unsigned long addr, unsigned long size)
39{
40 return reserve_bootmem(addr, size, BOOTMEM_DEFAULT);
41}
42
43void __init free_mem_mach(unsigned long addr, unsigned long size)
44{
45 return free_bootmem(addr, size);
46}
47
48u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
49{
50 return virt_to_phys(
51 __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS))
52 );
53}
54
55#ifdef CONFIG_BLK_DEV_INITRD
56void __init early_init_dt_setup_initrd_arch(unsigned long start,
57 unsigned long end)
58{
59 initrd_start = (unsigned long)__va(start);
60 initrd_end = (unsigned long)__va(end);
61 initrd_below_start_ok = 1;
62}
63#endif
64
65/*
66 * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq#
67 *
68 * Currently the mapping mechanism is trivial; simple flat hwirq numbers are
69 * mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not
70 * supported.
71 */
72unsigned int irq_create_of_mapping(struct device_node *controller,
73 const u32 *intspec, unsigned int intsize)
74{
75 return intspec[0];
76}
77EXPORT_SYMBOL_GPL(irq_create_of_mapping);
78
79void __init early_init_devtree(void *params)
80{
81 /* Setup flat device-tree pointer */
82 initial_boot_params = params;
83
84 /* Retrieve various informations from the /chosen node of the
85 * device-tree, including the platform type, initrd location and
86 * size, and more ...
87 */
88 of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
89
90 /* Scan memory nodes */
91 of_scan_flat_dt(early_init_dt_scan_root, NULL);
92 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
93}
94
95void __init device_tree_init(void)
96{
97 unsigned long base, size;
98
99 if (!initial_boot_params)
100 return;
101
102 base = virt_to_phys((void *)initial_boot_params);
103 size = initial_boot_params->totalsize;
104
105 /* Before we do anything, lets reserve the dt blob */
106 reserve_mem_mach(base, size);
107
108 unflatten_device_tree();
109
110 /* free the space reserved for the dt blob */
111 free_mem_mach(base, size);
112}
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 85aef3fc6716..a6b900f2962b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -31,6 +31,7 @@
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/smp-ops.h> 32#include <asm/smp-ops.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/prom.h>
34 35
35struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly; 36struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
36 37
@@ -487,6 +488,7 @@ static void __init arch_mem_init(char **cmdline_p)
487 } 488 }
488 489
489 bootmem_init(); 490 bootmem_init();
491 device_tree_init();
490 sparse_init(); 492 sparse_init();
491 paging_init(); 493 paging_init();
492} 494}