]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
video: cfb_console: Allow VGA device to work without i8042 keyboard
authorBin Meng <bmeng.cn@gmail.com>
Mon, 24 Aug 2015 08:00:07 +0000 (01:00 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 09:29:47 +0000 (11:29 +0200)
So far if CONFIG_VGA_AS_SINGLE_DEVICE is not defined, the VGA device
will try to initialize a keyboard device (for x86, it is i8042). But
if i8042 controller initialization fails (eg: there is no keyboard
connected to the PS/2 port), drv_video_init() just simply returns.
This kills the opportunity of using a usb keyboard later with the vga
console, as the vga initialization part is actually ok, only keyboard
part fails. Change the code logic to allow this.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
drivers/video/cfb_console.c

index 30e0317bb254b8e3d0d65453b6ee8303795fc635..aa7ca8646db1a0527122974373d4ac58fc4cddf2 100644 (file)
@@ -2247,16 +2247,17 @@ __weak int board_video_skip(void)
 
 int drv_video_init(void)
 {
 
 int drv_video_init(void)
 {
-       int skip_dev_init;
        struct stdio_dev console_dev;
        bool have_keyboard;
        struct stdio_dev console_dev;
        bool have_keyboard;
+       bool __maybe_unused keyboard_ok = false;
 
        /* Check if video initialization should be skipped */
        if (board_video_skip())
                return 0;
 
        /* Init video chip - returns with framebuffer cleared */
 
        /* Check if video initialization should be skipped */
        if (board_video_skip())
                return 0;
 
        /* Init video chip - returns with framebuffer cleared */
-       skip_dev_init = (video_init() == -1);
+       if (video_init() == -1)
+               return 0;
 
        if (board_cfb_skip())
                return 0;
 
        if (board_cfb_skip())
                return 0;
@@ -2272,11 +2273,9 @@ int drv_video_init(void)
        if (have_keyboard) {
                debug("KBD: Keyboard init ...\n");
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
        if (have_keyboard) {
                debug("KBD: Keyboard init ...\n");
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
-               skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1);
+               keyboard_ok = !(VIDEO_KBD_INIT_FCT == -1);
 #endif
        }
 #endif
        }
-       if (skip_dev_init)
-               return 0;
 
        /* Init vga device */
        memset(&console_dev, 0, sizeof(console_dev));
 
        /* Init vga device */
        memset(&console_dev, 0, sizeof(console_dev));
@@ -2287,7 +2286,7 @@ int drv_video_init(void)
        console_dev.puts = video_puts;  /* 'puts' function */
 
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
        console_dev.puts = video_puts;  /* 'puts' function */
 
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
-       if (have_keyboard) {
+       if (have_keyboard && keyboard_ok) {
                /* Also init console device */
                console_dev.flags |= DEV_FLAGS_INPUT;
                console_dev.tstc = VIDEO_TSTC_FCT;      /* 'tstc' function */
                /* Also init console device */
                console_dev.flags |= DEV_FLAGS_INPUT;
                console_dev.tstc = VIDEO_TSTC_FCT;      /* 'tstc' function */