usb: gadget: Drop all gadget_is_*() functions
The only actually used gadget_is_*() functions are the one for DWC3
used in epautoconf.c usb_ep_autoconfig() and one for MUSB in ether.c.
The DWC3 one should be fixed in some separate patch.
Inline the gadget_is_dwc3() and stop using ifdefs in favor of
IS_ENABLED() macro.
The rest of gadget_is_*() calls in usb_ep_autoconfig() can never
be anything but 0, since those gadgets are not supported in U-Boot,
so remove all that unused code. Remove gadget_chips.h as well.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
Link: https://lore.kernel.org/r/20240609213449.194762-4-marek.vasut+renesas@mailbox.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 0a70035..09950ce 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -12,7 +12,6 @@
#include <linux/errno.h>
#include <linux/usb/gadget.h>
#include <asm/unaligned.h>
-#include "gadget_chips.h"
#define isdigit(c) ('0' <= (c) && (c) <= '9')
@@ -222,41 +221,9 @@
/* First, apply chip-specific "best usage" knowledge.
* This might make a good usb_gadget_ops hook ...
*/
- if (gadget_is_net2280(gadget) && type == USB_ENDPOINT_XFER_INT) {
- /* ep-e, ep-f are PIO with only 64 byte fifos */
- ep = find_ep(gadget, "ep-e");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
- ep = find_ep(gadget, "ep-f");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
-
- } else if (gadget_is_goku(gadget)) {
- if (USB_ENDPOINT_XFER_INT == type) {
- /* single buffering is enough */
- ep = find_ep(gadget, "ep3-bulk");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
- } else if (USB_ENDPOINT_XFER_BULK == type
- && (USB_DIR_IN & desc->bEndpointAddress)) {
- /* DMA may be available */
- ep = find_ep(gadget, "ep2-bulk");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
- }
-
- } else if (gadget_is_sh(gadget) && USB_ENDPOINT_XFER_INT == type) {
- /* single buffering is enough; maybe 8 byte fifo is too */
- ep = find_ep(gadget, "ep3in-bulk");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
-
- } else if (gadget_is_mq11xx(gadget) && USB_ENDPOINT_XFER_INT == type) {
- ep = find_ep(gadget, "ep1-bulk");
- if (ep && ep_matches(gadget, ep, desc))
- return ep;
-#ifndef CONFIG_SPL_BUILD
- } else if (gadget_is_dwc3(gadget)) {
+ if (!IS_ENABLED(CONFIG_SPL_BUILD) &&
+ IS_ENABLED(CONFIG_USB_DWC3_GADGET) &&
+ !strcmp("dwc3-gadget", gadget->name)) {
const char *name = NULL;
/*
* First try standard, common configuration: ep1in-bulk,
@@ -278,7 +245,6 @@
ep = find_ep(gadget, name);
if (ep && ep_matches(gadget, ep, desc))
return ep;
-#endif
}
if (gadget->ops->match_ep)