aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-03-19 11:01:53 -0400
committerGrant Likely <grant.likely@linaro.org>2014-03-19 11:01:53 -0400
commitca3992bc0c12e381deb84cd47ec1181a6d34660d (patch)
tree162006e862b9d856fdce1b19f0ba117dafb6ca58 /include
parent0829f6d1f69e4f2fae4062987ae6531a9af1a2e3 (diff)
parent2040b52768ebab6e7bd73af0dc63703269c62f17 (diff)
Merge branch 'devicetree/next-reserved-mem' into devicetree/next
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/vmlinux.lds.h11
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_reserved_mem.h53
3 files changed, 68 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bc2121fa9132..f10f64fcc815 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,16 @@
167#define CLK_OF_TABLES() 167#define CLK_OF_TABLES()
168#endif 168#endif
169 169
170#ifdef CONFIG_OF_RESERVED_MEM
171#define RESERVEDMEM_OF_TABLES() \
172 . = ALIGN(8); \
173 VMLINUX_SYMBOL(__reservedmem_of_table) = .; \
174 *(__reservedmem_of_table) \
175 *(__reservedmem_of_table_end)
176#else
177#define RESERVEDMEM_OF_TABLES()
178#endif
179
170#define KERNEL_DTB() \ 180#define KERNEL_DTB() \
171 STRUCT_ALIGN(); \ 181 STRUCT_ALIGN(); \
172 VMLINUX_SYMBOL(__dtb_start) = .; \ 182 VMLINUX_SYMBOL(__dtb_start) = .; \
@@ -490,6 +500,7 @@
490 TRACE_SYSCALLS() \ 500 TRACE_SYSCALLS() \
491 MEM_DISCARD(init.rodata) \ 501 MEM_DISCARD(init.rodata) \
492 CLK_OF_TABLES() \ 502 CLK_OF_TABLES() \
503 RESERVEDMEM_OF_TABLES() \
493 CLKSRC_OF_TABLES() \ 504 CLKSRC_OF_TABLES() \
494 KERNEL_DTB() \ 505 KERNEL_DTB() \
495 IRQCHIP_OF_MATCH_TABLE() 506 IRQCHIP_OF_MATCH_TABLE()
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 2b77058a7335..ddd7219af8ac 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -98,7 +98,10 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 98 int depth, void *data);
99extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 99extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
100 int depth, void *data); 100 int depth, void *data);
101extern void early_init_fdt_scan_reserved_mem(void);
101extern void early_init_dt_add_memory_arch(u64 base, u64 size); 102extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map);
102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
103extern u64 dt_mem_next_cell(int s, __be32 **cellp); 106extern u64 dt_mem_next_cell(int s, __be32 **cellp);
104 107
@@ -118,6 +121,7 @@ extern void unflatten_and_copy_device_tree(void);
118extern void early_init_devtree(void *); 121extern void early_init_devtree(void *);
119extern void early_get_first_memblock_info(void *, phys_addr_t *); 122extern void early_get_first_memblock_info(void *, phys_addr_t *);
120#else /* CONFIG_OF_FLATTREE */ 123#else /* CONFIG_OF_FLATTREE */
124static inline void early_init_fdt_scan_reserved_mem(void) {}
121static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 125static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
122static inline void unflatten_device_tree(void) {} 126static inline void unflatten_device_tree(void) {}
123static inline void unflatten_and_copy_device_tree(void) {} 127static inline void unflatten_and_copy_device_tree(void) {}
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
new file mode 100644
index 000000000000..9b1fbb7f29fc
--- /dev/null
+++ b/include/linux/of_reserved_mem.h
@@ -0,0 +1,53 @@
1#ifndef __OF_RESERVED_MEM_H
2#define __OF_RESERVED_MEM_H
3
4struct device;
5struct of_phandle_args;
6struct reserved_mem_ops;
7
8struct reserved_mem {
9 const char *name;
10 unsigned long fdt_node;
11 const struct reserved_mem_ops *ops;
12 phys_addr_t base;
13 phys_addr_t size;
14 void *priv;
15};
16
17struct reserved_mem_ops {
18 void (*device_init)(struct reserved_mem *rmem,
19 struct device *dev);
20 void (*device_release)(struct reserved_mem *rmem,
21 struct device *dev);
22};
23
24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
25 unsigned long node, const char *uname);
26
27#ifdef CONFIG_OF_RESERVED_MEM
28void fdt_init_reserved_mem(void);
29void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
30 phys_addr_t base, phys_addr_t size);
31
32#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
33 static const struct of_device_id __reservedmem_of_table_##name \
34 __used __section(__reservedmem_of_table) \
35 = { .compatible = compat, \
36 .data = (init == (reservedmem_of_init_fn)NULL) ? \
37 init : init }
38
39#else
40static inline void fdt_init_reserved_mem(void) { }
41static inline void fdt_reserved_mem_save_node(unsigned long node,
42 const char *uname, phys_addr_t base, phys_addr_t size) { }
43
44#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
45 static const struct of_device_id __reservedmem_of_table_##name \
46 __attribute__((unused)) \
47 = { .compatible = compat, \
48 .data = (init == (reservedmem_of_init_fn)NULL) ? \
49 init : init }
50
51#endif
52
53#endif /* __OF_RESERVED_MEM_H */