]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: qemu: Enable usb keyboard as an input device
authorBin Meng <bmeng@tinylab.org>
Sun, 23 Jul 2023 04:40:41 +0000 (12:40 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Wed, 2 Aug 2023 08:32:44 +0000 (16:32 +0800)
This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard
as one of the input devices.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
board/emulation/qemu-riscv/Kconfig
board/emulation/qemu-riscv/qemu-riscv.c
doc/board/emulation/qemu-riscv.rst
include/configs/qemu-riscv.h

index 7220c55350e675c1437c35c1476bab2c23046930..b503578d274d6389e93c126c66b445de78433f99 100644 (file)
@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        imply VIDEO_BOCHS
        imply SYS_WHITE_ON_BLACK
        imply PRE_CONSOLE_BUFFER
+       imply USB
+       imply USB_XHCI_HCD
+       imply USB_XHCI_PCI
+       imply USB_KEYBOARD
+       imply CMD_USB
 
 endif
index f39f3be3663ac37a179d9ecca7e034baa5e1a279..181abbbf97d845da2eba212f1039f4ff3c2c3f3c 100644 (file)
@@ -12,6 +12,7 @@
 #include <log.h>
 #include <spl.h>
 #include <init.h>
+#include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
@@ -41,6 +42,10 @@ int board_init(void)
 
 int board_late_init(void)
 {
+       /* start usb so that usb keyboard can be used as input device */
+       if (CONFIG_IS_ENABLED(USB_KEYBOARD))
+               usb_init();
+
        return 0;
 }
 
index 9d21f3270c61a40778f1b332e87edc1455597c4e..61137bcbf1c5c2e482aa9c7f48903592a2ac40e7 100644 (file)
@@ -138,6 +138,11 @@ and adding::
 
     -serial stdio -device VGA
 
+In addition, a usb keyboard can be attached to an emulated xHCI controller in
+RISC-V virt machine as an option of input devices by adding::
+
+    -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0
+
 Running with KVM
 ----------------
 
index d5146e70f7bd2196725f5ebf3df5d065a9c95c32..584559cfa323d635c6a49b937a577810f9a8a7e5 100644 (file)
@@ -17,7 +17,7 @@
 
 /* Environment options */
 
-#define CFG_STD_DEVICES_SETTINGS       "stdin=serial\0" \
+#define CFG_STD_DEVICES_SETTINGS       "stdin=serial,usbkbd\0" \
                                        "stdout=serial,vidconsole\0" \
                                        "stderr=serial,vidconsole\0"