summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-05-16 11:30:21 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:39:15 -0700
commit4a297a7d176ebb30ac78003c5c917e7e77014136 (patch)
tree6e360719f1f77c7eaac4f3c119241ddd50f50fec
parenteaad280904fa98ddc6ad9ac3bbab2b2c37c1052e (diff)
fdt: silence console in response to device tree 'silent' option
This makes U-Boot honor the silent flag in the device tree config definition. config { ... silent_console = <1>; } BUG=chromium-os:11623 TEST=build and boot U-Boot on Seaboard Change-Id: Iafeda9d1dc05a263946eb10fb7a3b99582cdf527 Reviewed-on: http://gerrit.chromium.org/gerrit/961 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/fdt_decode.c23
-rw-r--r--drivers/serial/serial_fdt.c5
2 files changed, 27 insertions, 1 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c
index da4812b64e..6852dd273b 100644
--- a/common/fdt_decode.c
+++ b/common/fdt_decode.c
@@ -133,6 +133,27 @@ static int get_int_array(const void *blob, int node, const char *prop_name,
}
/**
+ * Look in the FDT for a config item with the given name and return its value
+ * as a 32-bit integer. The property must have at least 4 bytes of data. The
+ * value of the first cell is returned.
+ *
+ * @param blob FDT blob
+ * @param prop_name property name to look up
+ * @param default_val default value to return if the property is not found
+ * @return integer value, if found, or default_val if not
+ */
+static s32 get_config_int(const void *blob, const char *prop_name,
+ s32 default_val)
+{
+ int config_node;
+
+ config_node = fdt_path_offset(blob, "/config");
+ if (config_node < 0)
+ return default_val;
+ return get_int(blob, config_node, prop_name, default_val);
+}
+
+/**
* Look up a phandle and follow it to its node. Then return the offset
* of that node.
*
@@ -221,7 +242,7 @@ int fdt_decode_uart_console(const void *blob, struct fdt_uart *uart,
uart->divisor = get_int(blob, node, "divisor", -1);
uart->enabled = get_is_enabled(blob, node, 1);
uart->interrupt = get_int(blob, node, "interrupts", -1);
- uart->silent = get_int(blob, node, "silent", 0);
+ uart->silent = get_config_int(blob, "silent_console", 0);
uart->compat = fdt_decode_lookup(blob, node);
/* Calculate divisor if required */
diff --git a/drivers/serial/serial_fdt.c b/drivers/serial/serial_fdt.c
index eadc9b3e7f..9a53ff35bf 100644
--- a/drivers/serial/serial_fdt.c
+++ b/drivers/serial/serial_fdt.c
@@ -62,6 +62,11 @@ static int fserial_init(void)
default:
break;
}
+#ifdef CONFIG_SILENT_CONSOLE
+ /* if the console UART wants to be silent, do this now */
+ if (uart->silent)
+ gd->flags |= GD_FLG_SILENT;
+#endif
return 0;
}