devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] fdt: Tidy up a few fdtdec problems
@ 2011-11-24  3:54 Simon Glass
  2011-11-24  3:54 ` [PATCH 03/14] arm: fdt: Ensure that an embedded fdt is word-aligned Simon Glass
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Simon Glass @ 2011-11-24  3:54 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Devicetree Discuss, Albert ARIBAUD, Tom Warren

This fixes three trivial issues in fdtdec.c:
1. fdtdec_get_is_enabled() doesn't really need a default value
2. The fdt must be word-aligned, since otherwise it will fail on ARM
3. The compat_names[] array is missing its first element

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 include/fdtdec.h |    8 ++++----
 lib/fdtdec.c     |    7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index d871cdd..9018181 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -112,14 +112,14 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
  * Checks whether a node is enabled.
  * This looks for a 'status' property. If this exists, then returns 1 if
  * the status is 'ok' and 0 otherwise. If there is no status property,
- * it returns the default value.
+ * it returns 1 on the assumption that anything mentioned should be enabled
+ * by default.
  *
  * @param blob	FDT blob
  * @param node	node to examine
- * @param default_val	default value to return if no 'status' property exists
- * @return integer value 0/1, if found, or default_val if not
+ * @return integer value 0 (not enabled) or 1 (enabled)
  */
-int fdtdec_get_is_enabled(const void *blob, int node, int default_val);
+int fdtdec_get_is_enabled(const void *blob, int node);
 
 /**
  * Checks whether we have a valid fdt available to control U-Boot, and panic
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0f87163..d1321a8 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -33,6 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 #define COMPAT(id, name) name
 static const char * const compat_names[COMPAT_COUNT] = {
+	COMPAT(UNKNOWN, "<none>"),
 };
 
 /**
@@ -84,14 +85,14 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
 	return default_val;
 }
 
-int fdtdec_get_is_enabled(const void *blob, int node, int default_val)
+int fdtdec_get_is_enabled(const void *blob, int node)
 {
 	const char *cell;
 
 	cell = fdt_getprop(blob, node, "status", NULL);
 	if (cell)
 		return 0 == strcmp(cell, "ok");
-	return default_val;
+	return 1;
 }
 
 enum fdt_compat_id fd_dec_lookup(const void *blob, int node)
@@ -140,7 +141,7 @@ int fdtdec_next_alias(const void *blob, const char *name,
 int fdtdec_check_fdt(void)
 {
 	/* We must have an fdt */
-	if (fdt_check_header(gd->fdt_blob))
+	if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob))
 		panic("No valid fdt found - please append one to U-Boot\n"
 			"binary or define CONFIG_OF_EMBED\n");
 	return 0;
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2011-12-12 18:42 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24  3:54 [PATCH 01/14] fdt: Tidy up a few fdtdec problems Simon Glass
2011-11-24  3:54 ` [PATCH 03/14] arm: fdt: Ensure that an embedded fdt is word-aligned Simon Glass
2011-11-24  3:54 ` [PATCH 06/14] tegra: fdt: Add device tree file for Tegra2 Seaboard Simon Glass
     [not found] ` <1322106896-23054-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-11-24  3:54   ` [PATCH 02/14] fdt: Add functions to access phandles, arrays and bools Simon Glass
     [not found]     ` <1322106896-23054-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-11-28 18:41       ` Stephen Warren
     [not found]         ` <4ED3D5DC.10502-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-11-29  5:12           ` David Gibson
2011-12-02  1:01         ` Simon Glass
     [not found]           ` <CAPnjgZ29tsNXd1+1eXdTHRjgh_MQJrXoc23_oqO9UPJ73mu7ZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-02 15:55             ` Stephen Warren
2011-12-02 16:38               ` Simon Glass
2011-12-02  3:33         ` Jerry Van Baren
2011-12-02  4:58           ` Simon Glass
2011-12-02 17:22             ` Jerry Van Baren
2011-12-02 18:12               ` Simon Glass
2011-11-24  3:54   ` [PATCH 04/14] arm: fdt: Add skeleton device tree file Simon Glass
2011-11-24  3:54   ` [PATCH 05/14] tegra: fdt: Add Tegra2x " Simon Glass
     [not found]     ` <1322106896-23054-6-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-11-28 18:56       ` Stephen Warren
2011-12-02  1:24         ` Simon Glass
     [not found]           ` <CAPnjgZ11cFm15E9MHXno_YGp0NxdOHhGBavYbQBP5Nu_TOtx7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-02 15:58             ` Stephen Warren
2011-12-02 16:47               ` Simon Glass
2011-11-24  3:54   ` [PATCH 07/14] tegra: fdt: Add initial device tree definitions for USB ports Simon Glass
2011-11-24  3:54   ` [PATCH 14/14] tegra: fdt: Enable FDT support for Seaboard Simon Glass
2011-11-28 18:33   ` [PATCH 01/14] fdt: Tidy up a few fdtdec problems Stephen Warren
     [not found]     ` <4ED3D3F2.8070302-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-11-29  1:10       ` David Gibson
2011-12-01 20:59     ` Simon Glass
     [not found] ` <1322106896-23054-11-git-send-email-sjg@chromium.org>
     [not found]   ` <4ED3DF1D.6080009@nvidia.com>
     [not found]     ` <CAPnjgZ1-yxq-O-vsy1gNJ8AOzh7Sz9j5PG9Tx1sKpnAxhApJAQ@mail.gmail.com>
     [not found]       ` <4EDD38AC.30908@nvidia.com>
     [not found]         ` <CAPnjgZ0MTaPa4pq1VXk_XbmuDyWTfy-H33W4deNVn2ALUrcW_A@mail.gmail.com>
     [not found]           ` <4EDD429E.8010507@nvidia.com>
     [not found]             ` <CAPnjgZ2G220G-i3PPtS4XJYY0ornWFOoK3=b93jG-6GE_g2O5w@mail.gmail.com>
     [not found]               ` <4EDD5F1B.5060205@nvidia.com>
     [not found]                 ` <CAPnjgZ2h7F228q=pXuf7M9vTASurY3R5an_QV-mrETLf8nzA1A@mail.gmail.com>
     [not found]                   ` <4EDE7E1C.2090203@nvidia.com>
     [not found]                     ` <CAPnjgZ1G+mv6uv8SrdMm7DoqFjeeyVHYv6nbQxn9qixfbQMGvA@mail.gmail.com>
     [not found]                       ` <CAPnjgZ1G+mv6uv8SrdMm7DoqFjeeyVHYv6nbQxn9qixfbQMGvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-07 23:46                         ` [PATCH 10/14] tegra: usb: Add support for USB peripheral Stephen Warren
2011-12-08 21:24                           ` Simon Glass
     [not found]                             ` <CAPnjgZ0AuBNkYKN0JHQyc7DdzwUSZivR+Dv2BkiFsKQBNMeP8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-12 18:18                               ` Stephen Warren
2011-12-12 18:42                                 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).