]> xenbits.xensource.com Git - xen.git/commitdiff
xen/char: dt-uart: Allow the user to give a path to the node
authorJulien Grall <julien.grall@linaro.org>
Wed, 28 Aug 2013 14:47:15 +0000 (15:47 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 6 Sep 2013 13:08:28 +0000 (14:08 +0100)
On some board, there is no alias to the UART. To avoid modification in
the device tree, dt-uart should also search device by path.

To distinguish an alias from a path, dt-uart will check the first character.
If it's a / then it's path, otherwise it's an alias.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/drivers/char/dt-uart.c

index 93bb0f5845f4dc1cbd64639818c12eb0a8fe7910..d7204fb4cd1de757c6884cd78df8fe8af5ed0dd3 100644 (file)
 
 /*
  * Configure UART port with a string:
- * alias,options
+ * path,options
  *
- * @alias: alias used in the device tree for the UART
+ * @path: full path used in the device tree for the UART. If the path
+ * doesn't start with '/', we assuming that it's an alias.
  * @options: UART speficic options (see in each UART driver)
  */
 static char __initdata opt_dtuart[30] = "";
@@ -38,7 +39,7 @@ void __init dt_uart_init(void)
 {
     struct dt_device_node *dev;
     int ret;
-    const char *devalias = opt_dtuart;
+    const char *devpath = opt_dtuart;
     char *options;
 
     if ( !console_has("dtuart") || !strcmp(opt_dtuart, "") )
@@ -53,12 +54,15 @@ void __init dt_uart_init(void)
     else
         options = "";
 
-    early_printk("Looking for UART console %s\n", devalias);
-    dev = dt_find_node_by_alias(devalias);
+    early_printk("Looking for UART console %s\n", devpath);
+    if ( *devpath == '/' )
+        dev = dt_find_node_by_path(devpath);
+    else
+        dev = dt_find_node_by_alias(devpath);
 
     if ( !dev )
     {
-        early_printk("Unable to find device \"%s\"\n", devalias);
+        early_printk("Unable to find device \"%s\"\n", devpath);
         return;
     }