"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: Drop old non-DM code

The driver model deadline for USB was in 2019, so drop the old USB
keyboard code, to avoid needing to deal with the extra code path.

Drop the unnecessary #ifdef around USB_KBD_BOOT_REPORT_SIZE while we
are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

authored by

Simon Glass and committed by
Tom Rini
40482199 a3fab7d1

+2 -96
-20
cmd/usb.c
··· 560 560 } 561 561 #endif /* CONFIG_USB_STORAGE */ 562 562 563 - static int do_usb_stop_keyboard(int force) 564 - { 565 - #if !defined CONFIG_DM_USB && defined CONFIG_USB_KEYBOARD 566 - if (usb_kbd_deregister(force) != 0) { 567 - printf("USB not stopped: usbkbd still using USB\n"); 568 - return 1; 569 - } 570 - #endif 571 - return 0; 572 - } 573 - 574 563 static void do_usb_start(void) 575 564 { 576 565 bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start"); ··· 583 572 /* try to recognize storage devices immediately */ 584 573 usb_stor_curr_dev = usb_stor_scan(1); 585 574 # endif 586 - #ifndef CONFIG_DM_USB 587 - # ifdef CONFIG_USB_KEYBOARD 588 - drv_usb_kbd_init(); 589 - # endif 590 - #endif /* !CONFIG_DM_USB */ 591 575 } 592 576 593 577 #ifdef CONFIG_DM_USB ··· 633 617 634 618 if (strncmp(argv[1], "reset", 5) == 0) { 635 619 printf("resetting USB...\n"); 636 - if (do_usb_stop_keyboard(1) != 0) 637 - return 1; 638 620 usb_stop(); 639 621 do_usb_start(); 640 622 return 0; ··· 642 624 if (strncmp(argv[1], "stop", 4) == 0) { 643 625 if (argc != 2) 644 626 console_assign(stdin, "serial"); 645 - if (do_usb_stop_keyboard(0) != 0) 646 - return 1; 647 627 printf("stopping USB..\n"); 648 628 usb_stop(); 649 629 return 0;
-67
common/usb_kbd.c
··· 643 643 return 0; 644 644 } 645 645 646 - #if !CONFIG_IS_ENABLED(DM_USB) 647 - /* Search for keyboard and register it if found. */ 648 - int drv_usb_kbd_init(void) 649 - { 650 - int error, i; 651 - 652 - debug("%s: Probing for keyboard\n", __func__); 653 - /* Scan all USB Devices */ 654 - for (i = 0; i < USB_MAX_DEVICE; i++) { 655 - struct usb_device *dev; 656 - 657 - /* Get USB device. */ 658 - dev = usb_get_dev_index(i); 659 - if (!dev) 660 - break; 661 - 662 - if (dev->devnum == -1) 663 - continue; 664 - 665 - error = probe_usb_keyboard(dev); 666 - if (!error) 667 - return 1; 668 - if (error && error != -ENOENT) 669 - return error; 670 - } 671 - 672 - /* No USB Keyboard found */ 673 - return -1; 674 - } 675 - 676 - /* Deregister the keyboard. */ 677 - int usb_kbd_deregister(int force) 678 - { 679 - #if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) 680 - struct stdio_dev *dev; 681 - struct usb_device *usb_kbd_dev; 682 - struct usb_kbd_pdata *data; 683 - 684 - dev = stdio_get_by_name(DEVNAME); 685 - if (dev) { 686 - usb_kbd_dev = (struct usb_device *)dev->priv; 687 - data = usb_kbd_dev->privptr; 688 - #if CONFIG_IS_ENABLED(CONSOLE_MUX) 689 - if (iomux_replace_device(stdin, DEVNAME, force ? "nulldev" : "")) 690 - return 1; 691 - #endif 692 - if (stdio_deregister_dev(dev, force) != 0) 693 - return 1; 694 - #ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE 695 - destroy_int_queue(usb_kbd_dev, data->intq); 696 - #endif 697 - free(data->new); 698 - free(data); 699 - } 700 - 701 - return 0; 702 - #else 703 - return 1; 704 - #endif 705 - } 706 - 707 - #endif 708 - 709 - #if CONFIG_IS_ENABLED(DM_USB) 710 - 711 646 static int usb_kbd_probe(struct udevice *dev) 712 647 { 713 648 struct usb_device *udev = dev_get_parent_priv(dev); ··· 788 723 }; 789 724 790 725 U_BOOT_USB_DEVICE(usb_kbd, kbd_id_table); 791 - 792 - #endif
+2 -1
drivers/usb/Kconfig
··· 99 99 100 100 config USB_KEYBOARD 101 101 bool "USB Keyboard support" 102 - select DM_KEYBOARD if DM_USB 102 + depends on DM_USB 103 + select DM_KEYBOARD 103 104 select SYS_STDIO_DEREGISTER 104 105 ---help--- 105 106 Say Y here if you want to use a USB keyboard for U-Boot command line
-8
include/usb.h
··· 250 250 251 251 #endif 252 252 253 - #ifdef CONFIG_USB_KEYBOARD 254 - 255 253 /* 256 254 * USB Keyboard reports are 8 bytes in boot protocol. 257 255 * Appendix B of HID Device Class Definition 1.11 258 256 */ 259 257 #define USB_KBD_BOOT_REPORT_SIZE 8 260 - 261 - int drv_usb_kbd_init(void); 262 - int usb_kbd_deregister(int force); 263 - 264 - #endif 265 - /* routines */ 266 258 267 259 /* 268 260 * usb_init() - initialize the USB Controllers