[PATCH] bsps/raspberrypi/console: Fix default console device

G S Niteesh Babu niteesh.gs at gmail.com
Sat May 1 13:35:07 UTC 2021


When no console argument is given, the driver defaults to pl011
this results in no output in case of Rpi3 whose primary uart is
miniuart.
This patch fixes that by defaulting to the primary uart when no
console option is provided.
---
 bsps/arm/raspberrypi/console/console-config.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/bsps/arm/raspberrypi/console/console-config.c b/bsps/arm/raspberrypi/console/console-config.c
index 6b8eb80aa4..bd3a8d34c2 100644
--- a/bsps/arm/raspberrypi/console/console-config.c
+++ b/bsps/arm/raspberrypi/console/console-config.c
@@ -165,10 +165,16 @@ static void console_select( void )
     }
   }else {
     /**
-     * If no command line option was given, default to PL011.
+     * If no console option was given we default to the primary uarts.
+     * The initialization of the uart's and BSP_output_char is already done
+     * in the uart_probe function called before this. So now we can safely
+     * compare BSP_output_char.
      */
-    BSP_output_char = output_char_pl011;
-    link(PL011, CONSOLE_DEVICE_NAME);
+    if (BSP_output_char == output_char_pl011) {
+      link(PL011, CONSOLE_DEVICE_NAME);
+    }else {
+      link(MINIUART, CONSOLE_DEVICE_NAME);
+    }
   }
 }
 
-- 
2.17.1



More information about the devel mailing list