mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-11 07:24:46 +00:00
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>
This commit is contained in:
parent
a3fab7d1fb
commit
4048219957
4 changed files with 2 additions and 96 deletions
20
cmd/usb.c
20
cmd/usb.c
|
@ -560,17 +560,6 @@ static int do_usbboot(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
}
|
||||
#endif /* CONFIG_USB_STORAGE */
|
||||
|
||||
static int do_usb_stop_keyboard(int force)
|
||||
{
|
||||
#if !defined CONFIG_DM_USB && defined CONFIG_USB_KEYBOARD
|
||||
if (usb_kbd_deregister(force) != 0) {
|
||||
printf("USB not stopped: usbkbd still using USB\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void do_usb_start(void)
|
||||
{
|
||||
bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
|
||||
|
@ -583,11 +572,6 @@ static void do_usb_start(void)
|
|||
/* try to recognize storage devices immediately */
|
||||
usb_stor_curr_dev = usb_stor_scan(1);
|
||||
# endif
|
||||
#ifndef CONFIG_DM_USB
|
||||
# ifdef CONFIG_USB_KEYBOARD
|
||||
drv_usb_kbd_init();
|
||||
# endif
|
||||
#endif /* !CONFIG_DM_USB */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DM_USB
|
||||
|
@ -633,8 +617,6 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||
|
||||
if (strncmp(argv[1], "reset", 5) == 0) {
|
||||
printf("resetting USB...\n");
|
||||
if (do_usb_stop_keyboard(1) != 0)
|
||||
return 1;
|
||||
usb_stop();
|
||||
do_usb_start();
|
||||
return 0;
|
||||
|
@ -642,8 +624,6 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||
if (strncmp(argv[1], "stop", 4) == 0) {
|
||||
if (argc != 2)
|
||||
console_assign(stdin, "serial");
|
||||
if (do_usb_stop_keyboard(0) != 0)
|
||||
return 1;
|
||||
printf("stopping USB..\n");
|
||||
usb_stop();
|
||||
return 0;
|
||||
|
|
|
@ -643,71 +643,6 @@ static int probe_usb_keyboard(struct usb_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(DM_USB)
|
||||
/* Search for keyboard and register it if found. */
|
||||
int drv_usb_kbd_init(void)
|
||||
{
|
||||
int error, i;
|
||||
|
||||
debug("%s: Probing for keyboard\n", __func__);
|
||||
/* Scan all USB Devices */
|
||||
for (i = 0; i < USB_MAX_DEVICE; i++) {
|
||||
struct usb_device *dev;
|
||||
|
||||
/* Get USB device. */
|
||||
dev = usb_get_dev_index(i);
|
||||
if (!dev)
|
||||
break;
|
||||
|
||||
if (dev->devnum == -1)
|
||||
continue;
|
||||
|
||||
error = probe_usb_keyboard(dev);
|
||||
if (!error)
|
||||
return 1;
|
||||
if (error && error != -ENOENT)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* No USB Keyboard found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Deregister the keyboard. */
|
||||
int usb_kbd_deregister(int force)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
|
||||
struct stdio_dev *dev;
|
||||
struct usb_device *usb_kbd_dev;
|
||||
struct usb_kbd_pdata *data;
|
||||
|
||||
dev = stdio_get_by_name(DEVNAME);
|
||||
if (dev) {
|
||||
usb_kbd_dev = (struct usb_device *)dev->priv;
|
||||
data = usb_kbd_dev->privptr;
|
||||
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||
if (iomux_replace_device(stdin, DEVNAME, force ? "nulldev" : ""))
|
||||
return 1;
|
||||
#endif
|
||||
if (stdio_deregister_dev(dev, force) != 0)
|
||||
return 1;
|
||||
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
|
||||
destroy_int_queue(usb_kbd_dev, data->intq);
|
||||
#endif
|
||||
free(data->new);
|
||||
free(data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_IS_ENABLED(DM_USB)
|
||||
|
||||
static int usb_kbd_probe(struct udevice *dev)
|
||||
{
|
||||
struct usb_device *udev = dev_get_parent_priv(dev);
|
||||
|
@ -788,5 +723,3 @@ static const struct usb_device_id kbd_id_table[] = {
|
|||
};
|
||||
|
||||
U_BOOT_USB_DEVICE(usb_kbd, kbd_id_table);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -99,7 +99,8 @@ config USB_STORAGE
|
|||
|
||||
config USB_KEYBOARD
|
||||
bool "USB Keyboard support"
|
||||
select DM_KEYBOARD if DM_USB
|
||||
depends on DM_USB
|
||||
select DM_KEYBOARD
|
||||
select SYS_STDIO_DEREGISTER
|
||||
---help---
|
||||
Say Y here if you want to use a USB keyboard for U-Boot command line
|
||||
|
|
|
@ -250,20 +250,12 @@ int usb_host_eth_scan(int mode);
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_KEYBOARD
|
||||
|
||||
/*
|
||||
* USB Keyboard reports are 8 bytes in boot protocol.
|
||||
* Appendix B of HID Device Class Definition 1.11
|
||||
*/
|
||||
#define USB_KBD_BOOT_REPORT_SIZE 8
|
||||
|
||||
int drv_usb_kbd_init(void);
|
||||
int usb_kbd_deregister(int force);
|
||||
|
||||
#endif
|
||||
/* routines */
|
||||
|
||||
/*
|
||||
* usb_init() - initialize the USB Controllers
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue