aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 12:44:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 12:44:08 -0400
commita54dfb1a845c38a97686268d8c4086a63d9493aa (patch)
tree3b31c81672fa89102aae929cc6c1e48e6e9382f4 /scripts
parenteb0ad9c06d51edb5d18a7007fd4d77a8805b2ba7 (diff)
parent36165f55055781a0e4bf32d775241796414504b0 (diff)
Merge tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux
Pull devicetree updates from Rob Herring: - Import of latest upstream device tree compiler (dtc) - New function of_get_child_by_name - Support for #size-cells of 0 and #addr-cells of >2 - Couple of DT binding documentation updates Fix up trivial conflicts due to of_get_child_by_name() having been added next to the new of_get_next_available_child(). * tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux: MAINTAINERS: add scripts/dtc under Devicetree maintainers dtc: import latest upstream dtc dt: Document general interrupt controller bindings dt/s3c64xx/spi: Use of_get_child_by_name to get a named child dt: introduce of_get_child_by_name to get child node by name of: i2c: add support for wakeup-source property of/address: Handle #address-cells > 2 specially DT: export of_irq_to_resource_table() devicetree: serial: Add documentation for imx serial devicetree: pwm: mxs-pwm.txt: Fix reg field annotation of: Allow busses with #size-cells=0
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dtc/Makefile.dtc13
-rw-r--r--scripts/dtc/checks.c203
-rw-r--r--scripts/dtc/data.c124
-rw-r--r--scripts/dtc/dtc-lexer.l65
-rw-r--r--scripts/dtc/dtc-lexer.lex.c_shipped503
-rw-r--r--scripts/dtc/dtc-parser.tab.c_shipped780
-rw-r--r--scripts/dtc/dtc-parser.tab.h_shipped47
-rw-r--r--scripts/dtc/dtc-parser.y255
-rw-r--r--scripts/dtc/dtc.c21
-rw-r--r--scripts/dtc/dtc.h51
-rw-r--r--scripts/dtc/fdtdump.c162
-rw-r--r--scripts/dtc/fdtget.c366
-rw-r--r--scripts/dtc/fdtput.c362
-rw-r--r--scripts/dtc/flattree.c3
-rw-r--r--scripts/dtc/libfdt/Makefile.libfdt6
-rw-r--r--scripts/dtc/libfdt/fdt.c61
-rw-r--r--scripts/dtc/libfdt/fdt_empty_tree.c84
-rw-r--r--scripts/dtc/libfdt/fdt_ro.c275
-rw-r--r--scripts/dtc/libfdt/fdt_rw.c29
-rw-r--r--scripts/dtc/libfdt/fdt_sw.c11
-rw-r--r--scripts/dtc/libfdt/fdt_wip.c41
-rw-r--r--scripts/dtc/libfdt/libfdt.h440
-rw-r--r--scripts/dtc/libfdt/libfdt_env.h16
-rw-r--r--scripts/dtc/libfdt/libfdt_internal.h2
-rw-r--r--scripts/dtc/livetree.c128
-rw-r--r--scripts/dtc/srcpos.c98
-rw-r--r--scripts/dtc/srcpos.h31
-rw-r--r--scripts/dtc/treesource.c2
-rw-r--r--scripts/dtc/util.c272
-rw-r--r--scripts/dtc/util.h97
30 files changed, 3847 insertions, 701 deletions
<
diff --git a/scripts/dtc/Makefile.dtc b/scripts/dtc/Makefile.dtc
index 6ddf9ecac669..bece49b35535 100644
--- a/scripts/dtc/Makefile.dtc
+++ b/scripts/dtc/Makefile.dtc
@@ -3,7 +3,16 @@
3# This is not a complete Makefile of itself. Instead, it is designed to 3# This is not a complete Makefile of itself. Instead, it is designed to
4# be easily embeddable into other systems of Makefiles. 4# be easily embeddable into other systems of Makefiles.
5# 5#
6DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.c \ 6DTC_SRCS = \
7 checks.c 7 checks.c \
8 data.c \
9 dtc.c \
10 flattree.c \
11 fstree.c \
12 livetree.c \
13 srcpos.c \
14 treesource.c \
15 util.c
16
8DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c 17DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
9DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o) 18DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
index a662a0044798..ee96a2519eff 100644
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -31,12 +31,6 @@
31#define TRACE(c, fmt, ...) do { } while (0) 31#define TRACE(c, fmt, ...) do { } while (0)
32#endif 32#endif
33 33
34enum checklevel {
35 IGNORE = 0,
36 WARN = 1,
37 ERROR = 2,
38};
39
40enum checkstatus { 34enum checkstatus {
41 UNCHECKED = 0, 35 UNCHECKED = 0,
42 PREREQ, 36 PREREQ,
@@ -57,14 +51,14 @@ struct check {
57 node_check_fn node_fn; 51 node_check_fn node_fn;
58 prop_check_fn prop_fn; 52 prop_check_fn prop_fn;
59 void *data; 53 void *data;
60 enum checklevel level; 54 bool warn, error;
61 enum checkstatus status; 55 enum checkstatus status;
62 int inprogress; 56 int inprogress;
63 int num_prereqs; 57 int num_prereqs;
64 struct check **prereq; 58 struct check **prereq;
65}; 59};
66 60
67#define CHECK(nm, tfn, nfn, pfn, d, lvl, ...) \ 61#define CHECK_ENTRY(nm, tfn, nfn, pfn, d, w, e, ...) \
68 static struct check *nm##_prereqs[] = { __VA_ARGS__ }; \ 62 static struct check *nm##_prereqs[] = { __VA_ARGS__ }; \
69 static struct check nm = { \ 63 static struct check nm = { \
70 .name = #nm, \ 64 .name = #nm, \
@@ -72,20 +66,37 @@ struct check {
72 .node_fn = (nfn), \ 66 .node_fn = (nfn), \
73 .prop_fn = (pfn), \ 67 .prop_fn = (pfn), \
74 .data = (d), \ 68 .data = (d), \
75 .level = (lvl), \ 69 .warn = (w), \
70 .error = (e), \
76 .status = UNCHECKED, \ 71 .status = UNCHECKED, \
77 .num_prereqs = ARRAY_SIZE(nm##_prereqs), \ 72 .num_prereqs = ARRAY_SIZE(nm##_prereqs), \
78 .prereq = nm##_prereqs, \ 73 .prereq = nm##_prereqs, \
79 }; 74 };
80 75#define WARNING(nm, tfn, nfn, pfn, d, ...) \
81#define TREE_CHECK(nm, d, lvl, ...) \ 76 CHECK_ENTRY(nm, tfn, nfn, pfn, d, true, false, __VA_ARGS__)
82 CHECK(nm, check_##nm, NULL, NULL, d, lvl, __VA_ARGS__) 77#define ERROR(nm, tfn, nfn, pfn, d, ...) \
83#define NODE_CHECK(nm, d, lvl, ...) \ 78 CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, true, __VA_ARGS__)
84 CHECK(nm, NULL, check_##nm, NULL, d, lvl, __VA_ARGS__) 79#define CHECK(nm, tfn, nfn, pfn, d, ...) \
85#define PROP_CHECK(nm, d, lvl, ...) \ 80 CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, false, __VA_ARGS__)
86 CHECK(nm, NULL, NULL, check_##nm, d, lvl, __VA_ARGS__) 81
87#define BATCH_CHECK(nm, lvl, ...) \ 82#define TREE_WARNING(nm, d, ...) \
88 CHECK(nm, NULL, NULL, NULL, NULL, lvl, __VA_ARGS__) 83 WARNING(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
84#define TREE_ERROR(nm, d, ...) \
85 ERROR(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
86#define TREE_CHECK(nm, d, ...) \
87 CHECK(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
88#define NODE_WARNING(nm, d, ...) \
89 WARNING(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
90#define NODE_ERROR(nm, d, ...) \
91 ERROR(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
92#define NODE_CHECK(nm, d, ...) \
93 CHECK(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
94#define PROP_WARNING(nm, d, ...) \
95 WARNING(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
96#define PROP_ERROR(nm, d, ...) \
97 ERROR(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
98#define PROP_CHECK(nm, d, ...) \
99 CHECK(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
89 100
90#ifdef __GNUC__ 101#ifdef __GNUC__
91static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3))); 102static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
@@ -95,13 +106,13 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
95 va_list ap; 106 va_list ap;
96 va_start(ap, fmt); 107 va_start(ap, fmt);
97 108
98 if ((c->level < WARN) || (c->level <= quiet)) 109 if ((c->warn && (quiet < 1))
99 return; /* Suppress message */ 110 || (c->error && (quiet < 2))) {
100 111 fprintf(stderr, "%s (%s): ",
101 fprintf(stderr, "%s (%s): ", 112 (c->error) ? "ERROR" : "Warning", c->name);
102 (c->level == ERROR) ? "ERROR" : "Warning", c->name); 113 vfprintf(stderr, fmt, ap);
103 vfprintf(stderr, fmt, ap); 114 fprintf(stderr, "\n");
104 fprintf(stderr, "\n"); 115 }
105} 116}
106 117
107#define FAIL(c, ...) \ 118#define FAIL(c, ...) \
@@ -167,7 +178,7 @@ static int run_check(struct check *c, struct node *dt)
167 178
168out: 179out:
169 c->inprogress = 0; 180 c->inprogress = 0;
170 if ((c->status != PASSED) && (c->level == ERROR)) 181 if ((c->status != PASSED) && (c->error))
171 error = 1; 182 error = 1;
172 return error; 183 return error;
173} 184}