Skip to contentSkip to conversation

usb: gadget: Remove final remnants of CONFIG_USB_DEVICE

PATCH In review Tom Rini 2 participants 5 messages Feb 27, 2025 – Mar 10, 2025

Subsystems (5)
Arm (32-bit) USB Kbuild Library code +1 more subsystems
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 usb: gadget: Remove final remnants of CONFIG_USB_DEVICE

The lone user of the legacy USB device framework have been removed for some time. Remove the final parts of the code that were missed.

---
Cc: Marek Vasut <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>

---
 Makefile                      |   1 -
 arch/arm/lib/bootm.c          |   4 -
 arch/riscv/lib/bootm.c        |   4 -
 drivers/usb/gadget/Makefile   |   4 -
 drivers/usb/gadget/core.c     | 621 ----------------------------------
 drivers/usb/gadget/ep0.c      | 619 ---------------------------------
 lib/efi_loader/efi_boottime.c |   2 -
 7 files changed, 1255 deletions(-)
 delete mode 100644 drivers/usb/gadget/core.c
 delete mode 100644 drivers/usb/gadget/ep0.c
Makefile +0 -1
index 5f90cea11d70..24db7fa38e3d 100644
@@ -878,7 +878,6 @@ libs-y += drivers/usb/dwc3/
 libs-y += drivers/usb/common/
 libs-y += drivers/usb/emul/
 libs-y += drivers/usb/eth/
-libs-$(CONFIG_USB_DEVICE) += drivers/usb/gadget/
 libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/
 libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/udc/
 libs-y += drivers/usb/host/
arch/arm/lib/bootm.c +0 -4
index 974cbfe8400e..7eb764e1f4eb 100644
@@ -61,10 +61,6 @@ static void announce_and_cleanup(int fake)
 	bootstage_report();
 #endif
 
-#ifdef CONFIG_USB_DEVICE
-	udc_disconnect();
-#endif
-
 	board_quiesce_devices();
 
 	printf("\nStarting kernel ...%s\n\n", fake ?
arch/riscv/lib/bootm.c +0 -4
index 76c610bcee03..9544907ab1eb 100644
@@ -46,10 +46,6 @@ static void announce_and_cleanup(int fake)
 	bootstage_report();
 #endif
 
-#ifdef CONFIG_USB_DEVICE
-	udc_disconnect();
-#endif
-
 	board_quiesce_devices();
 
 	/*
drivers/usb/gadget/Makefile +0 -4
index 4bda224ff1ac..db5f8895a33a 100644
@@ -35,7 +35,3 @@ endif
 endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
-
-# Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
-# This is really only N900 and USBTTY now.
-obj-$(CONFIG_USB_DEVICE) += core.o ep0.o
drivers/usb/gadget/core.c deleted +0 -621

621 lines not on this page · raw message

drivers/usb/gadget/ep0.c deleted +0 -619

619 lines not on this page · raw message

lib/efi_loader/efi_boottime.c +0 -2
index 5164cb15986c..b0f8831531e2 100644
@@ -2233,8 +2233,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	if (!efi_st_keep_devices) {
 		bootm_disable_interrupts();
-		if (IS_ENABLED(CONFIG_USB_DEVICE))
-			udc_disconnect();
 		board_quiesce_devices();
 		dm_remove_devices_active();
 	}
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 usb: gadget: Remove the legacy usbtty driver

The lone user of this driver has been removed for some time. Remove this driver as well.

---
Cc: Marek Vasut <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>

---
 common/stdio.c           |   3 -
 drivers/serial/Makefile  |   3 -
 drivers/serial/ns16550.c |   8 +-
 drivers/serial/usbtty.c  | 983 ---------------------------------------
 drivers/serial/usbtty.h  |  49 --
 include/serial.h         |  20 -
 include/stdio_dev.h      |   1 -
 lib/Makefile             |   4 -
 8 files changed, 2 insertions(+), 1069 deletions(-)
 delete mode 100644 drivers/serial/usbtty.c
 delete mode 100644 drivers/serial/usbtty.h
common/stdio.c +0 -3
index a61220ce4b9c..3eeb289dd8bf 100644
@@ -357,9 +357,6 @@ int stdio_add_devices(void)
 
 	drv_system_init();
 	serial_stdio_init();
-#ifdef CONFIG_USB_TTY
-	drv_usbtty_init();
-#endif
 #ifdef CONFIG_USB_FUNCTION_ACM
 	drv_usbacm_init ();
 #endif
drivers/serial/Makefile +0 -3
index ebe692a99635..2ef8ba20cf52 100644
@@ -63,7 +63,4 @@ obj-$(CONFIG_XEN_SERIAL) += serial_xen.o
 obj-$(CONFIG_XTENSA_SEMIHOSTING_SERIAL) += serial_xtensa_semihosting.o
 obj-$(CONFIG_S5P4418_PL011_SERIAL) += serial_s5p4418_pl011.o
 
-ifndef CONFIG_XPL_BUILD
-obj-$(CONFIG_USB_TTY) += usbtty.o
-endif
 obj-$(CONFIG_UART4_SERIAL) += serial_adi_uart4.o
drivers/serial/ns16550.c +2 -6
index 0e267d097c53..0cccaaf4b902 100644
@@ -294,13 +294,9 @@ void ns16550_putc(struct ns16550 *com_port, char c)
 #if !CONFIG_IS_ENABLED(NS16550_MIN_FUNCTIONS)
 char ns16550_getc(struct ns16550 *com_port)
 {
-	while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
-#if !defined(CONFIG_XPL_BUILD) && defined(CONFIG_USB_TTY)
-		extern void usbtty_poll(void);
-		usbtty_poll();
-#endif
+	while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0)
 		schedule();
-	}
+
 	return serial_in(&com_port->rbr);
 }
 
drivers/serial/usbtty.c deleted +0 -983

983 lines not on this page · raw message

drivers/serial/usbtty.h deleted +0 -49

49 lines not on this page · raw message

include/serial.h +0 -20
index e5f6d984d28b..0a707ca730d6 100644
@@ -48,26 +48,6 @@ extern int serial_assign(const char *name);
 extern void serial_reinit_all(void);
 int serial_initialize(void);
 
-/* For usbtty */
-#ifdef CONFIG_USB_TTY
-
-struct stdio_dev;
-
-int usbtty_getc(struct stdio_dev *dev);
-void usbtty_putc(struct stdio_dev *dev, const char c);
-void usbtty_puts(struct stdio_dev *dev, const char *str);
-int usbtty_tstc(struct stdio_dev *dev);
-
-#else
-
-/* stubs */
-#define usbtty_getc(dev) 0
-#define usbtty_putc(dev, a)
-#define usbtty_puts(dev, a)
-#define usbtty_tstc(dev) 0
-
-#endif /* CONFIG_USB_TTY */
-
 struct udevice;
 
 enum serial_par {
include/stdio_dev.h +0 -1
index 4e3c4708f807..f7f9c10199ee 100644
@@ -101,7 +101,6 @@ struct stdio_dev *stdio_clone(struct stdio_dev *dev);
 int drv_lcd_init(void);
 int drv_video_init(void);
 int drv_keyboard_init(void);
-int drv_usbtty_init(void);
 int drv_usbacm_init(void);
 int drv_nc_init(void);
 int drv_jtag_console_init(void);
lib/Makefile +0 -4
index a7bc2f3134a7..a30ce1595d5d 100644
@@ -28,11 +28,7 @@ obj-y += charset.o
 endif
 endif
 
-ifdef CONFIG_USB_TTY
-obj-y += circbuf.o
-else
 obj-$(CONFIG_CIRCBUF) += circbuf.o
-endif
 
 obj-y += crc8.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] usb: gadget: Remove the legacy usbtty driver

Hi Tom,

Thank you for the patch.

Quoted 7 lines · Tom Rini

The lone user of this driver has been removed for some time. Remove this driver as well.

---
Cc: Marek Vasut <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>

Quoted 12 lines
---
 common/stdio.c           |   3 -
 drivers/serial/Makefile  |   3 -
 drivers/serial/ns16550.c |   8 +-
 drivers/serial/usbtty.c  | 983 ---------------------------------------
 drivers/serial/usbtty.h  |  49 --
 include/serial.h         |  20 -
 include/stdio_dev.h      |   1 -
 lib/Makefile             |   4 -
 8 files changed, 2 insertions(+), 1069 deletions(-)
 delete mode 100644 drivers/serial/usbtty.c
 delete mode 100644 drivers/serial/usbtty.h

More code dead code removal, great!

Quoted 1 line

[...]

Reviewed-by on v1 1/2
#3 lore raw
In reply to Tom Rini

Hi Tom,

Thank you for the patch.

Quoted 7 lines · Tom Rini

The lone user of the legacy USB device framework have been removed for some time. Remove the final parts of the code that were missed.

---
Cc: Marek Vasut <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>

Quoted 11 lines
---
 Makefile                      |   1 -
 arch/arm/lib/bootm.c          |   4 -
 arch/riscv/lib/bootm.c        |   4 -
 drivers/usb/gadget/Makefile   |   4 -
 drivers/usb/gadget/core.c     | 621 ----------------------------------
 drivers/usb/gadget/ep0.c      | 619 ---------------------------------
 lib/efi_loader/efi_boottime.c |   2 -
 7 files changed, 1255 deletions(-)
 delete mode 100644 drivers/usb/gadget/core.c
 delete mode 100644 drivers/usb/gadget/ep0.c

I'm always happy to see dead code go. Thanks for doing this!

Quoted 1 line

[...]

#4 lore raw
In reply to Tom Rini

Hi,

Quoted 4 lines · Tom Rini

The lone user of the legacy USB device framework have been removed for some time. Remove the final parts of the code that were missed.

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu-next)

[1/2] usb: gadget: Remove final remnants of CONFIG_USB_DEVICE

      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/7f061aba9af99d2e911418939f0dbd5b79911a1e
[2/2] usb: gadget: Remove the legacy usbtty driver
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/6689b0c955f1ec885ed1acafc7c5d7c1565dbe63

--
Mattijs