summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/cdns3/cdns3-ti.c1
-rw-r--r--drivers/usb/cdns3/core.c25
-rw-r--r--drivers/usb/cdns3/gadget-export.h2
-rw-r--r--drivers/usb/cdns3/gadget.c11
-rw-r--r--drivers/usb/common/common.c1
-rw-r--r--drivers/usb/common/fsl-dt-fixup.c1
-rw-r--r--drivers/usb/common/fsl-errata.c1
-rw-r--r--drivers/usb/dwc3/Kconfig14
-rw-r--r--drivers/usb/dwc3/Makefile1
-rw-r--r--drivers/usb/dwc3/core.c1
-rw-r--r--drivers/usb/dwc3/dwc3-am62.c125
-rw-r--r--drivers/usb/dwc3/dwc3-generic.c25
-rw-r--r--drivers/usb/dwc3/dwc3-layerscape.c22
-rw-r--r--drivers/usb/dwc3/dwc3-meson-g12a.c3
-rw-r--r--drivers/usb/dwc3/dwc3-meson-gxl.c19
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c1
-rw-r--r--drivers/usb/dwc3/ep0.c1
-rw-r--r--drivers/usb/dwc3/gadget.c35
-rw-r--r--drivers/usb/dwc3/samsung_usb_phy.c3
-rw-r--r--drivers/usb/dwc3/ti_usb_phy.c1
-rw-r--r--drivers/usb/emul/sandbox_flash.c1
-rw-r--r--drivers/usb/emul/sandbox_hub.c1
-rw-r--r--drivers/usb/emul/sandbox_keyb.c1
-rw-r--r--drivers/usb/emul/usb-emul-uclass.c1
-rw-r--r--drivers/usb/eth/asix.c2
-rw-r--r--drivers/usb/eth/asix88179.c8
-rw-r--r--drivers/usb/eth/mcs7830.c1
-rw-r--r--drivers/usb/eth/r8152.c1
-rw-r--r--drivers/usb/eth/r8152_fw.c1
-rw-r--r--drivers/usb/eth/smsc95xx.c1
-rw-r--r--drivers/usb/eth/usb_ether.c1
-rw-r--r--drivers/usb/gadget/at91_udc.c1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c1
-rw-r--r--drivers/usb/gadget/bcm_udc_otg_phy.c1
-rw-r--r--drivers/usb/gadget/ci_udc.c1
-rw-r--r--drivers/usb/gadget/config.c3
-rw-r--r--drivers/usb/gadget/core.c12
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg.c21
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg_phy.c1
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg_regs.h1
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c5
-rw-r--r--drivers/usb/gadget/ep0.c5
-rw-r--r--drivers/usb/gadget/ep0.h2
-rw-r--r--drivers/usb/gadget/epautoconf.c83
-rw-r--r--drivers/usb/gadget/ether.c30
-rw-r--r--drivers/usb/gadget/f_acm.c1
-rw-r--r--drivers/usb/gadget/f_dfu.c1
-rw-r--r--drivers/usb/gadget/f_fastboot.c1
-rw-r--r--drivers/usb/gadget/f_mass_storage.c20
-rw-r--r--drivers/usb/gadget/f_rockusb.c1
-rw-r--r--drivers/usb/gadget/f_sdp.c2
-rw-r--r--drivers/usb/gadget/f_thor.c1
-rw-r--r--drivers/usb/gadget/g_dnl.c18
-rw-r--r--drivers/usb/gadget/gadget_chips.h210
-rw-r--r--drivers/usb/gadget/max3420_udc.c20
-rw-r--r--drivers/usb/gadget/ndis.h2
-rw-r--r--drivers/usb/gadget/rndis.c4
-rw-r--r--drivers/usb/gadget/rndis.h1
-rw-r--r--drivers/usb/gadget/storage_common.c3
-rw-r--r--drivers/usb/gadget/udc/udc-core.c1
-rw-r--r--drivers/usb/gadget/udc/udc-uclass.c25
-rw-r--r--drivers/usb/gadget/usbstring.c1
-rw-r--r--drivers/usb/host/dwc2.c1
-rw-r--r--drivers/usb/host/dwc3-of-simple.c1
-rw-r--r--drivers/usb/host/dwc3-sti-glue.c1
-rw-r--r--drivers/usb/host/ehci-atmel.c1
-rw-r--r--drivers/usb/host/ehci-exynos.c1
-rw-r--r--drivers/usb/host/ehci-fsl.c1
-rw-r--r--drivers/usb/host/ehci-generic.c1
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/host/ehci-marvell.c1
-rw-r--r--drivers/usb/host/ehci-msm.c38
-rw-r--r--drivers/usb/host/ehci-mx5.c2
-rw-r--r--drivers/usb/host/ehci-mx6.c1
-rw-r--r--drivers/usb/host/ehci-mxs.c1
-rw-r--r--drivers/usb/host/ehci-npcm.c1
-rw-r--r--drivers/usb/host/ehci-omap.c2
-rw-r--r--drivers/usb/host/ehci-pci.c1
-rw-r--r--drivers/usb/host/ehci-tegra.c1
-rw-r--r--drivers/usb/host/ehci-vf.c1
-rw-r--r--drivers/usb/host/ehci-zynq.c1
-rw-r--r--drivers/usb/host/ohci-at91.c1
-rw-r--r--drivers/usb/host/ohci-da8xx.c1
-rw-r--r--drivers/usb/host/ohci-generic.c1
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-lpc32xx.c1
-rw-r--r--drivers/usb/host/ohci-npcm.c1
-rw-r--r--drivers/usb/host/ohci-pci.c1
-rw-r--r--drivers/usb/host/ohci.h6
-rw-r--r--drivers/usb/host/r8a66597-hcd.c1
-rw-r--r--drivers/usb/host/usb-sandbox.c8
-rw-r--r--drivers/usb/host/usb-uclass.c1
-rw-r--r--drivers/usb/host/usb_bootdev.c1
-rw-r--r--drivers/usb/host/xhci-brcm.c1
-rw-r--r--drivers/usb/host/xhci-dwc3.c1
-rw-r--r--drivers/usb/host/xhci-exynos5.c1
-rw-r--r--drivers/usb/host/xhci-fsl.c1
-rw-r--r--drivers/usb/host/xhci-mem.c2
-rw-r--r--drivers/usb/host/xhci-mtk.c1
-rw-r--r--drivers/usb/host/xhci-mvebu.c1
-rw-r--r--drivers/usb/host/xhci-omap.c1
-rw-r--r--drivers/usb/host/xhci-pci.c1
-rw-r--r--drivers/usb/host/xhci-rcar.c1
-rw-r--r--drivers/usb/host/xhci-ring.c19
-rw-r--r--drivers/usb/host/xhci.c1
-rw-r--r--drivers/usb/isp1760/isp1760-hcd.c1
-rw-r--r--drivers/usb/isp1760/isp1760-if.c1
-rw-r--r--drivers/usb/isp1760/isp1760-uboot.c1
-rw-r--r--drivers/usb/mtu3/mtu3_plat.c24
-rw-r--r--drivers/usb/musb-new/am35x.c1
-rw-r--r--drivers/usb/musb-new/da8xx.c1
-rw-r--r--drivers/usb/musb-new/linux-compat.h4
-rw-r--r--drivers/usb/musb-new/mt85xx.c1
-rw-r--r--drivers/usb/musb-new/musb_core.c9
-rw-r--r--drivers/usb/musb-new/musb_core.h3
-rw-r--r--drivers/usb/musb-new/musb_dma.h1
-rw-r--r--drivers/usb/musb-new/musb_dsps.c1
-rw-r--r--drivers/usb/musb-new/musb_gadget.c5
-rw-r--r--drivers/usb/musb-new/musb_gadget.h1
-rw-r--r--drivers/usb/musb-new/musb_gadget_ep0.c3
-rw-r--r--drivers/usb/musb-new/musb_host.c7
-rw-r--r--drivers/usb/musb-new/musb_host.h1
-rw-r--r--drivers/usb/musb-new/musb_io.h2
-rw-r--r--drivers/usb/musb-new/musb_regs.h1
-rw-r--r--drivers/usb/musb-new/musb_uboot.c1
-rw-r--r--drivers/usb/musb-new/omap2430.c39
-rw-r--r--drivers/usb/musb-new/pic32.c1
-rw-r--r--drivers/usb/musb-new/sunxi.c1
-rw-r--r--drivers/usb/musb-new/ti-musb.c24
-rw-r--r--drivers/usb/musb-new/ux500.c23
-rw-r--r--drivers/usb/musb/am35x.c1
-rw-r--r--drivers/usb/musb/musb_core.c1
-rw-r--r--drivers/usb/musb/musb_hcd.c1
-rw-r--r--drivers/usb/musb/musb_udc.c1
-rw-r--r--drivers/usb/musb/omap3.c16
-rw-r--r--drivers/usb/phy/rockchip_usb2_phy.c2
-rw-r--r--drivers/usb/ulpi/omap-ulpi-viewport.c1
-rw-r--r--drivers/usb/ulpi/ulpi-viewport.c1
-rw-r--r--drivers/usb/ulpi/ulpi.c1
139 files changed, 413 insertions, 674 deletions
diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 2e44aadea47..ac072260c30 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -5,7 +5,6 @@
* Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index 12a741c6ea7..cbe06a9e7b6 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -11,7 +11,6 @@
* Roger Quadros <rogerq@ti.com>
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <dm/device-internal.h>
@@ -21,6 +20,7 @@
#include <linux/bug.h>
#include <linux/kernel.h>
#include <linux/io.h>
+#include <linux/usb/gadget.h>
#include <usb.h>
#include <usb/xhci.h>
@@ -463,15 +463,38 @@ static int cdns3_gadget_remove(struct udevice *dev)
return cdns3_remove(cdns);
}
+static int cdns3_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct cdns3 *cdns = dev_get_priv(dev);
+
+ cdns3_gadget_uboot_handle_interrupt(cdns);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops cdns3_gadget_ops = {
+ .handle_interrupts = cdns3_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(cdns_usb3_peripheral) = {
.name = "cdns-usb3-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
.of_match = cdns3_ids,
+ .ops = &cdns3_gadget_ops,
.probe = cdns3_gadget_probe,
.remove = cdns3_gadget_remove,
.priv_auto = sizeof(struct cdns3_gadget_priv),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
+#else
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct cdns3 *cdns = dev_get_priv(dev);
+
+ cdns3_gadget_uboot_handle_interrupt(cdns);
+
+ return 0;
+}
#endif
#if defined(CONFIG_SPL_USB_HOST) || \
diff --git a/drivers/usb/cdns3/gadget-export.h b/drivers/usb/cdns3/gadget-export.h
index 577469eee96..b3fd7c53039 100644
--- a/drivers/usb/cdns3/gadget-export.h
+++ b/drivers/usb/cdns3/gadget-export.h
@@ -25,4 +25,6 @@ static inline void cdns3_gadget_exit(struct cdns3 *cdns) { }
#endif
+void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns);
+
#endif /* __LINUX_CDNS3_GADGET_EXPORT */
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index d11175dc5b6..32b2c412068 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -2755,19 +2755,10 @@ int cdns3_gadget_init(struct cdns3 *cdns)
*
* Handles ep0 and gadget interrupt
*/
-static void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns)
+void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns)
{
int ret = cdns3_device_irq_handler(0, cdns);
if (ret == IRQ_WAKE_THREAD)
cdns3_device_thread_irq_handler(0, cdns);
}
-
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct cdns3 *cdns = dev_get_priv(dev);
-
- cdns3_gadget_uboot_handle_interrupt(cdns);
-
- return 0;
-}
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 7137a569d97..13e9a61072a 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -6,7 +6,6 @@
* Texas Instruments Incorporated, <www.ti.com>
*/
-#include <common.h>
#include <dm.h>
#include <asm/global_data.h>
#include <linux/printk.h>
diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
index 00b8cd368b1..6a68bd76c27 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -7,7 +7,6 @@
* Author: Tor Krill tor@excito.com
*/
-#include <common.h>
#include <log.h>
#include <usb.h>
#include <asm/io.h>
diff --git a/drivers/usb/common/fsl-errata.c b/drivers/usb/common/fsl-errata.c
index 9eb1d230672..89ae73f2ba4 100644
--- a/drivers/usb/common/fsl-errata.c
+++ b/drivers/usb/common/fsl-errata.c
@@ -5,7 +5,6 @@
* Copyright 2013 Freescale Semiconductor, Inc.
*/
-#include <common.h>
#include <hwconfig.h>
#include <fsl_errata.h>
#include<fsl_usb.h>
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index c0c8c16fd9c..0100723a68b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -37,6 +37,20 @@ config SPL_USB_DWC3_GENERIC
Select this for Xilinx ZynqMP and similar Platforms.
This wrapper supports Host and Peripheral operation modes.
+config SPL_USB_DWC3_AM62
+ bool "TI AM62 USB wrapper"
+ depends on SPL_DM_USB && SPL_USB_DWC3_GENERIC && SPL_SYSCON
+ help
+ Select this for TI AM62 Platforms.
+ This wrapper supports Host and Peripheral operation modes.
+
+config USB_DWC3_AM62
+ bool "TI AM62 USB wrapper"
+ depends on DM_USB && USB_DWC3_GENERIC && SYSCON
+ help
+ Select this for TI AM62 Platforms.
+ This wrapper supports Host and Peripheral operation modes.
+
config USB_DWC3_MESON_G12A
bool "Amlogic Meson G12A USB wrapper"
depends on DM_USB && USB_DWC3 && ARCH_MESON
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 97b4f7191ca..a46b6824ab7 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -6,6 +6,7 @@ dwc3-y := core.o
obj-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o
+obj-$(CONFIG_$(SPL_)USB_DWC3_AM62) += dwc3-am62.o
obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o
obj-$(CONFIG_USB_DWC3_MESON_G12A) += dwc3-meson-g12a.o
obj-$(CONFIG_USB_DWC3_MESON_GXL) += dwc3-meson-gxl.o
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 96e850b7170..c443d56746d 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -13,7 +13,6 @@
* commit cd72f890d2 : usb: dwc3: core: enable phy suspend quirk on non-FPGA
*/
-#include <common.h>
#include <clk.h>
#include <cpu_func.h>
#include <malloc.h>
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
new file mode 100644
index 00000000000..99519602eb2
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI AM62 specific glue layer for DWC3
+ */
+
+#include <dm.h>
+#include <dm/device_compat.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+
+#include "dwc3-generic.h"
+
+#define USBSS_MODE_CONTROL 0x1c
+#define USBSS_PHY_CONFIG 0x8
+#define USBSS_PHY_VBUS_SEL_MASK GENMASK(2, 1)
+#define USBSS_PHY_VBUS_SEL_SHIFT 1
+#define USBSS_MODE_VALID BIT(0)
+#define PHY_PLL_REFCLK_MASK GENMASK(3, 0)
+static const int dwc3_ti_am62_rate_table[] = { /* in KHZ */
+ 9600,
+ 10000,
+ 12000,
+ 19200,
+ 20000,
+ 24000,
+ 25000,
+ 26000,
+ 38400,
+ 40000,
+ 58000,
+ 50000,
+ 52000,
+};
+
+static void dwc3_ti_am62_glue_configure(struct udevice *dev, int index,
+ enum usb_dr_mode mode)
+{
+ struct clk usb2_refclk;
+ int rate_code, i, ret;
+ unsigned long rate;
+ u32 reg;
+ void *usbss;
+ bool vbus_divider;
+ struct regmap *syscon;
+ struct ofnode_phandle_args args;
+
+ usbss = dev_remap_addr_index(dev, 0);
+ if (IS_ERR(usbss)) {
+ dev_err(dev, "can't map IOMEM resource\n");
+ return;
+ }
+
+ ret = clk_get_by_name(dev, "ref", &usb2_refclk);
+ if (ret) {
+ dev_err(dev, "can't get usb2_refclk\n");
+ return;
+ }
+
+ /* Calculate the rate code */
+ rate = clk_get_rate(&usb2_refclk);
+ rate /= 1000; /* To KHz */
+ for (i = 0; i < ARRAY_SIZE(dwc3_ti_am62_rate_table); i++) {
+ if (dwc3_ti_am62_rate_table[i] == rate)
+ break;
+ }
+
+ if (i == ARRAY_SIZE(dwc3_ti_am62_rate_table)) {
+ dev_err(dev, "unsupported usb2_refclk rate: %lu KHz\n", rate);
+ return;
+ }
+
+ rate_code = i;
+
+ /* Read the syscon property */
+ syscon = syscon_regmap_lookup_by_phandle(dev, "ti,syscon-phy-pll-refclk");
+ if (IS_ERR(syscon)) {
+ dev_err(dev, "unable to get ti,syscon-phy-pll-refclk regmap\n");
+ return;
+ }
+
+ ret = ofnode_parse_phandle_with_args(dev_ofnode(dev), "ti,syscon-phy-pll-refclk", NULL, 1,
+ 0, &args);
+ if (ret)
+ return;
+
+ /* Program PHY PLL refclk by reading syscon property */
+ ret = regmap_update_bits(syscon, args.args[0], PHY_PLL_REFCLK_MASK, rate_code);
+ if (ret) {
+ dev_err(dev, "failed to set phy pll reference clock rate\n");
+ return;
+ }
+
+ /* VBUS divider select */
+ reg = readl(usbss + USBSS_PHY_CONFIG);
+ vbus_divider = dev_read_bool(dev, "ti,vbus-divider");
+ if (vbus_divider)
+ reg |= 1 << USBSS_PHY_VBUS_SEL_SHIFT;
+
+ writel(reg, usbss + USBSS_PHY_CONFIG);
+
+ /* Set mode valid */
+ reg = readl(usbss + USBSS_MODE_CONTROL);
+ reg |= USBSS_MODE_VALID;
+ writel(reg, usbss + USBSS_MODE_CONTROL);
+}
+
+struct dwc3_glue_ops ti_am62_ops = {
+ .glue_configure = dwc3_ti_am62_glue_configure,
+};
+
+static const struct udevice_id dwc3_am62_match[] = {
+ { .compatible = "ti,am62-usb", .data = (ulong)&ti_am62_ops },
+ { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(dwc3_am62_wrapper) = {
+ .name = "dwc3-am62",
+ .id = UCLASS_SIMPLE_BUS,
+ .of_match = dwc3_am62_match,
+ .bind = dwc3_glue_bind,
+ .probe = dwc3_glue_probe,
+ .remove = dwc3_glue_remove,
+ .plat_auto = sizeof(struct dwc3_glue_data),
+};
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 7a00529a2a8..a9ba315463c 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -7,7 +7,6 @@
* Based on dwc3-omap.c.
*/
-#include <common.h>
#include <cpu_func.h>
#include <log.h>
#include <dm.h>
@@ -132,7 +131,6 @@ static int dwc3_generic_probe(struct udevice *dev,
priv->base = map_physmem(plat->base, DWC3_OTG_REGS_END, MAP_NOCACHE);
dwc3->regs = priv->base + DWC3_GLOBALS_REGS_START;
-
rc = dwc3_init(dwc3);
if (rc) {
unmap_physmem(priv->base, MAP_NOCACHE);
@@ -195,34 +193,39 @@ static int dwc3_generic_of_to_plat(struct udevice *dev)
}
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+static int dwc3_generic_peripheral_probe(struct udevice *dev)
{
struct dwc3_generic_priv *priv = dev_get_priv(dev);
- struct dwc3 *dwc3 = &priv->dwc3;
-
- dwc3_gadget_uboot_handle_interrupt(dwc3);
- return 0;
+ return dwc3_generic_probe(dev, priv);
}
-static int dwc3_generic_peripheral_probe(struct udevice *dev)
+static int dwc3_generic_peripheral_remove(struct udevice *dev)
{
struct dwc3_generic_priv *priv = dev_get_priv(dev);
- return dwc3_generic_probe(dev, priv);
+ return dwc3_generic_remove(dev, priv);
}
-static int dwc3_generic_peripheral_remove(struct udevice *dev)
+static int dwc3_gadget_handle_interrupts(struct udevice *dev)
{
struct dwc3_generic_priv *priv = dev_get_priv(dev);
+ struct dwc3 *dwc3 = &priv->dwc3;
- return dwc3_generic_remove(dev, priv);
+ dwc3_gadget_uboot_handle_interrupt(dwc3);
+
+ return 0;
}
+static const struct usb_gadget_generic_ops dwc3_gadget_ops = {
+ .handle_interrupts = dwc3_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(dwc3_generic_peripheral) = {
.name = "dwc3-generic-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
.of_to_plat = dwc3_generic_of_to_plat,
+ .ops = &dwc3_gadget_ops,
.probe = dwc3_generic_peripheral_probe,
.remove = dwc3_generic_peripheral_remove,
.priv_auto = sizeof(struct dwc3_generic_priv),
diff --git a/drivers/usb/dwc3/dwc3-layerscape.c b/drivers/usb/dwc3/dwc3-layerscape.c
index c32df2396d7..108b44c67eb 100644
--- a/drivers/usb/dwc3/dwc3-layerscape.c
+++ b/drivers/usb/dwc3/dwc3-layerscape.c
@@ -7,7 +7,6 @@
* Based on dwc3-generic.c.
*/
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <dm/device-internal.h>
@@ -100,33 +99,38 @@ static int dwc3_layerscape_of_to_plat(struct udevice *dev)
}
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+static int dwc3_layerscape_peripheral_probe(struct udevice *dev)
{
struct dwc3_layerscape_priv *priv = dev_get_priv(dev);
- dwc3_gadget_uboot_handle_interrupt(&priv->dwc3);
-
- return 0;
+ return dwc3_layerscape_probe(dev, priv);
}
-static int dwc3_layerscape_peripheral_probe(struct udevice *dev)
+static int dwc3_layerscape_peripheral_remove(struct udevice *dev)
{
struct dwc3_layerscape_priv *priv = dev_get_priv(dev);
- return dwc3_layerscape_probe(dev, priv);
+ return dwc3_layerscape_remove(dev, priv);
}
-static int dwc3_layerscape_peripheral_remove(struct udevice *dev)
+static int dwc3_layerscape_gadget_handle_interrupts(struct udevice *dev)
{
struct dwc3_layerscape_priv *priv = dev_get_priv(dev);
- return dwc3_layerscape_remove(dev, priv);
+ dwc3_gadget_uboot_handle_interrupt(&priv->dwc3);
+
+ return 0;
}
+static const struct usb_gadget_generic_ops dwc3_layerscape_gadget_ops = {
+ .handle_interrupts = dwc3_layerscape_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(dwc3_layerscape_peripheral) = {
.name = "dwc3-layerscape-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
.of_to_plat = dwc3_layerscape_of_to_plat,
+ .ops = &dwc3_layerscape_gadget_ops,
.probe = dwc3_layerscape_peripheral_probe,
.remove = dwc3_layerscape_peripheral_remove,
.priv_auto = sizeof(struct dwc3_layerscape_priv),
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 1a3e9350c46..41d15996e5b 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -6,7 +6,6 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
-#include <common.h>
#include <log.h>
#include <dm.h>
#include <dm/device-internal.h>
@@ -271,7 +270,7 @@ static int dwc3_meson_g12a_usb_init(struct dwc3_meson_g12a *priv)
return 0;
}
-int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
+static int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
{
struct dwc3_meson_g12a *priv = dev_get_plat(dev);
diff --git a/drivers/usb/dwc3/dwc3-meson-gxl.c b/drivers/usb/dwc3/dwc3-meson-gxl.c
index 2ce915701a8..5fb9b477ada 100644
--- a/drivers/usb/dwc3/dwc3-meson-gxl.c
+++ b/drivers/usb/dwc3/dwc3-meson-gxl.c
@@ -7,7 +7,6 @@
*/
#define DEBUG
-#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
@@ -27,7 +26,6 @@
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/compat.h>
-#include <asm/arch/usb-gx.h>
/* USB Glue Control Registers */
@@ -159,9 +157,9 @@ static int dwc3_meson_gxl_usb2_init(struct dwc3_meson_gxl *priv)
if (!priv->phys[i].dev)
continue;
- phy_meson_gxl_usb2_set_mode(&priv->phys[i],
- (i == USB2_OTG_PHY) ? USB_DR_MODE_PERIPHERAL
- : USB_DR_MODE_HOST);
+ generic_phy_set_mode(&priv->phys[i],
+ (i == USB2_OTG_PHY) ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);
}
return 0;
@@ -194,7 +192,7 @@ static int dwc3_meson_gxl_usb_init(struct dwc3_meson_gxl *priv)
return 0;
}
-int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
+static int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
{
struct dwc3_meson_gxl *priv = dev_get_plat(dev);
@@ -225,7 +223,9 @@ int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
#endif
priv->otg_phy_mode = mode;
- phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY], mode);
+ generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
+ mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);
dwc3_meson_gxl_usb2_set_mode(priv, mode);
@@ -362,8 +362,9 @@ static int dwc3_meson_gxl_probe(struct udevice *dev)
}
if (priv->phys[USB2_OTG_PHY].dev)
- phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY],
- priv->otg_phy_mode);
+ generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
+ priv->otg_phy_mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);
dwc3_meson_gxl_usb2_set_mode(priv, priv->otg_phy_mode);
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 53c4d4826b4..4b219c35eb3 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -13,7 +13,6 @@
* commit 7ee2566ff5 : usb: dwc3: dwc3-omap: get rid of ->prepare()/->complete()
*/
-#include <common.h>
#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 16b11ce3d9f..24f516a131b 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -12,7 +12,6 @@
*
* commit c00552ebaf : Merge 3.18-rc7 into usb-next
*/
-#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 7d6bcc2627f..fe33e307d3e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -13,7 +13,6 @@
* commit 8e74475b0e : usb: dwc3: gadget: use udc-core's reset notifier
*/
-#include <common.h>
#include <cpu_func.h>
#include <log.h>
#include <malloc.h>
@@ -755,7 +754,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
dep->name, req, (unsigned long long)dma,
length, last ? " last" : "", chain ? " chain" : "");
-
trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK];
if (!req->trb) {
@@ -1607,6 +1605,38 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
return 0;
}
+static struct usb_ep *dwc3_find_ep(struct usb_gadget *gadget, const char *name)
+{
+ struct usb_ep *ep;
+
+ list_for_each_entry(ep, &gadget->ep_list, ep_list)
+ if (!strcmp(ep->name, name))
+ return ep;
+
+ return NULL;
+}
+
+static struct
+usb_ep *dwc3_gadget_match_ep(struct usb_gadget *gadget,
+ struct usb_endpoint_descriptor *desc,
+ struct usb_ss_ep_comp_descriptor *comp_desc)
+{
+ /*
+ * First try standard, common configuration: ep1in-bulk,
+ * ep2out-bulk, ep3in-int to match other udc drivers to avoid
+ * confusion in already deployed software (endpoint numbers
+ * hardcoded in userspace software/drivers)
+ */
+ if (usb_endpoint_is_bulk_in(desc))
+ return dwc3_find_ep(gadget, "ep1in");
+ if (usb_endpoint_is_bulk_out(desc))
+ return dwc3_find_ep(gadget, "ep2out");
+ if (usb_endpoint_is_int_in(desc))
+ return dwc3_find_ep(gadget, "ep3in");
+
+ return NULL;
+}
+
static const struct usb_gadget_ops dwc3_gadget_ops = {
.get_frame = dwc3_gadget_get_frame,
.wakeup = dwc3_gadget_wakeup,
@@ -1614,6 +1644,7 @@ static const struct usb_gadget_ops dwc3_gadget_ops = {
.pullup = dwc3_gadget_pullup,
.udc_start = dwc3_gadget_start,
.udc_stop = dwc3_gadget_stop,
+ .match_ep = dwc3_gadget_match_ep,
};
/* -------------------------------------------------------------------------- */
diff --git a/drivers/usb/dwc3/samsung_usb_phy.c b/drivers/usb/dwc3/samsung_usb_phy.c
index abbd4136890..3563070cb85 100644
--- a/drivers/usb/dwc3/samsung_usb_phy.c
+++ b/drivers/usb/dwc3/samsung_usb_phy.c
@@ -7,7 +7,7 @@
* Author: Joonyoung Shim <jy0922.shim@samsung.com>
*/
-#include <common.h>
+#include <asm/io.h>
#include <asm/arch/power.h>
#include <asm/arch/xhci-exynos.h>
#include <linux/delay.h>
@@ -26,7 +26,6 @@ void exynos5_usb3_phy_init(struct exynos_usb3_phy *phy)
PHYPARAM0_REF_LOSLEVEL_MASK);
setbits_le32(&phy->phy_param0, PHYPARAM0_REF_LOSLEVEL);
-
writel(0x0, &phy->phy_resume);
/*
diff --git a/drivers/usb/dwc3/ti_usb_phy.c b/drivers/usb/dwc3/ti_usb_phy.c
index 8ae130860f7..f0ecdea958a 100644
--- a/drivers/usb/dwc3/ti_usb_phy.c
+++ b/drivers/usb/dwc3/ti_usb_phy.c
@@ -16,7 +16,6 @@
* and remove" for phy-omap-usb2.c
*/
-#include <common.h>
#include <malloc.h>
#include <ti-usb-phy-uboot.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c
index 7c5c1ab3de7..24420e3d51e 100644
--- a/drivers/usb/emul/sandbox_flash.c
+++ b/drivers/usb/emul/sandbox_flash.c
@@ -6,7 +6,6 @@
#define LOG_CATEGORY UCLASS_USB
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <malloc.h>
diff --git a/drivers/usb/emul/sandbox_hub.c b/drivers/usb/emul/sandbox_hub.c
index 084cc16cc68..3b3e59f978f 100644
--- a/drivers/usb/emul/sandbox_hub.c
+++ b/drivers/usb/emul/sandbox_hub.c
@@ -4,7 +4,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <usb.h>
diff --git a/drivers/usb/emul/sandbox_keyb.c b/drivers/usb/emul/sandbox_keyb.c
index 5ec1e98e4ed..db769883ba3 100644
--- a/drivers/usb/emul/sandbox_keyb.c
+++ b/drivers/usb/emul/sandbox_keyb.c
@@ -4,7 +4,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <os.h>
diff --git a/drivers/usb/emul/usb-emul-uclass.c b/drivers/usb/emul/usb-emul-uclass.c
index b31dc950e3a..cdc18d6cbb9 100644
--- a/drivers/usb/emul/usb-emul-uclass.c
+++ b/drivers/usb/emul/usb-emul-uclass.c
@@ -6,7 +6,6 @@
#define LOG_CATEGORY UCLASS_USB_EMUL
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <usb.h>
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index 26dd312b7d0..40a6e9291de 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -5,7 +5,6 @@
* Patched for AX88772B by Antmicro Ltd <www.antmicro.com>
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <net.h>
@@ -97,7 +96,6 @@
#define FLAG_TYPE_AX88772B (1U << 2)
#define FLAG_EEPROM_MAC (1U << 3) /* initial mac address in eeprom */
-
/* driver private */
struct asix_private {
int flags;
diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index 2e737e60668..4bd3b9d10dc 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -5,7 +5,6 @@
* from the Linux AX88179_178a driver
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <usb.h>
@@ -393,7 +392,6 @@ static int asix_init_common(struct ueth_data *dev,
u8 buf[2], tmp[5], link_sts;
u16 *tmp16, mode;
-
tmp16 = (u16 *)buf;
debug("** %s()\n", __func__);
@@ -630,6 +628,12 @@ static int ax88179_eth_probe(struct udevice *dev)
usb_dev = priv->ueth.pusb_dev;
priv->maxpacketsize = usb_dev->epmaxpacketout[AX_ENDPOINT_OUT];
+ ret = asix_basic_reset(&priv->ueth, priv);
+ if (ret) {
+ printf("Failed to reset ethernet device\n");
+ return ret;
+ }
+
/* Get the MAC address */
ret = asix_read_mac(&priv->ueth, pdata->enetaddr);
if (ret)
diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index d94204f22d5..199fb7a5d08 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -9,7 +9,6 @@
* MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c
index 3c866f4f1e2..e3f20e08c33 100644
--- a/drivers/usb/eth/r8152.c
+++ b/drivers/usb/eth/r8152.c
@@ -4,7 +4,6 @@
*
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
diff --git a/drivers/usb/eth/r8152_fw.c b/drivers/usb/eth/r8152_fw.c
index a41abed3069..3159f301060 100644
--- a/drivers/usb/eth/r8152_fw.c
+++ b/drivers/usb/eth/r8152_fw.c
@@ -3,7 +3,6 @@
* Copyright (c) 2015 Realtek Semiconductor Corp. All rights reserved.
*
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <linux/bitops.h>
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index de6586e6263..b4fcb2c2bb0 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -6,7 +6,6 @@
* Copyright (C) 2007-2008 SMSC (Steve Glendinning)
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
index 2e9af54fd63..8bba3e0974e 100644
--- a/drivers/usb/eth/usb_ether.c
+++ b/drivers/usb/eth/usb_ether.c
@@ -3,7 +3,6 @@
* Copyright (c) 2011 The Chromium OS Authors.
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index e573a03477b..86b2cbf3f6a 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -13,7 +13,6 @@
#undef VERBOSE_DEBUG
#undef PACKET_TRACE
-#include <common.h>
#include <dm/devres.h>
#include <linux/bug.h>
#include <linux/err.h>
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 4c420747b0b..f99553df8d4 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -7,7 +7,6 @@
* Bo Shen <voice.shen@atmel.com>
*/
-#include <common.h>
#include <linux/bitops.h>
#include <linux/errno.h>
#include <asm/gpio.h>
diff --git a/drivers/usb/gadget/bcm_udc_otg_phy.c b/drivers/usb/gadget/bcm_udc_otg_phy.c
index c89cd57c253..9875191091c 100644
--- a/drivers/usb/gadget/bcm_udc_otg_phy.c
+++ b/drivers/usb/gadget/bcm_udc_otg_phy.c
@@ -4,7 +4,6 @@
*/
#include <config.h>
-#include <common.h>
#include <asm/io.h>
#include <asm/arch/sysmap.h>
#include <asm/kona-common/clk.h>
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 750d4714879..bbe03cfff1f 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -7,7 +7,6 @@
* Murray.Jensen@cmst.csiro.au, 27-Jan-01.
*/
-#include <common.h>
#include <command.h>
#include <config.h>
#include <cpu_func.h>
diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c
index e96782644f3..e41b1d964ea 100644
--- a/drivers/usb/gadget/config.c
+++ b/drivers/usb/gadget/config.c
@@ -8,7 +8,6 @@
* Remy Bohmer <linux@bohmer.net>
*/
-#include <common.h>
#include <asm/unaligned.h>
#include <linux/errno.h>
#include <linux/list.h>
@@ -17,7 +16,6 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
-
/**
* usb_descriptor_fillbuf - fill buffer with descriptors
* @buf: Buffer to be filled
@@ -52,7 +50,6 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
return dest - (u8 *)buf;
}
-
/**
* usb_gadget_config_buf - builts a complete configuration descriptor
* @config: Header for the descriptor, including characteristics such
diff --git a/drivers/usb/gadget/core.c b/drivers/usb/gadget/core.c
index 888f0cfea66..bcb1ad3082c 100644
--- a/drivers/usb/gadget/core.c
+++ b/drivers/usb/gadget/core.c
@@ -22,7 +22,6 @@
#define MAX_INTERFACES 2
-
int maxstrings = 20;
/* Global variables ************************************************************************** */
@@ -65,10 +64,8 @@ __maybe_unused static char *usbd_device_status[] = {
#define USBD_DEVICE_STATUS(x) (((unsigned int)x <= USBD_CLOSING) ? usbd_device_status[x] : "UNKNOWN")
-
/* Descriptor support functions ************************************************************** */
-
/**
* usbd_get_string - find and return a string descriptor
* @index: string index to return
@@ -83,10 +80,8 @@ struct usb_string_descriptor *usbd_get_string (__u8 index)
return usb_strings[index];
}
-
/* Access to device descriptor functions ***************************************************** */
-
/* *
* usbd_device_configuration_instance - find a configuration instance for this device
* @device:
@@ -103,7 +98,6 @@ static struct usb_configuration_instance *usbd_device_configuration_instance (st
return device->configuration_instance_array + configuration;
}
-
/* *
* usbd_device_interface_instance
* @device:
@@ -149,7 +143,6 @@ struct usb_alternate_instance *usbd_device_alternate_instance (struct usb_device
return interface_instance->alternates_instance_array + alternate;
}
-
/* *
* usbd_device_device_descriptor
* @device: which device
@@ -182,7 +175,6 @@ struct usb_configuration_descriptor *usbd_device_configuration_descriptor (struc
return (configuration_instance->configuration_descriptor);
}
-
/**
* usbd_device_interface_descriptor
* @device: which device
@@ -231,7 +223,6 @@ struct usb_endpoint_descriptor *usbd_device_endpoint_descriptor_index (struct us
return *(alternate_instance->endpoints_descriptor_array + index);
}
-
/**
* usbd_device_endpoint_transfersize
* @device: which device
@@ -255,7 +246,6 @@ int usbd_device_endpoint_transfersize (struct usb_device_instance *device, int p
return *(alternate_instance->endpoint_transfersize_array + index);
}
-
/**
* usbd_device_endpoint_descriptor
* @device: which device
@@ -292,7 +282,6 @@ int usbd_endpoint_halted (struct usb_device_instance *device, int endpoint)
return (device->status == USB_STATUS_HALT);
}
-
/**
* usbd_rcv_complete - complete a receive
* @endpoint:
@@ -460,7 +449,6 @@ struct urb *first_urb_detached (urb_link * hd)
return urb;
}
-
/*
* Append an urb_link (or a whole list of
* urb_links) to the tail of another list
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 27082f5152c..7e9dd6f4268 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -17,7 +17,6 @@
* Lukasz Majewski <l.majewski@samsumg.com>
*/
#undef DEBUG
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
@@ -942,11 +941,6 @@ int dwc2_udc_handle_interrupt(void)
return 0;
}
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- return dwc2_udc_handle_interrupt();
-}
-
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
struct dwc2_priv_data {
struct clk_bulk clks;
@@ -1174,6 +1168,15 @@ static int dwc2_udc_otg_remove(struct udevice *dev)
return dm_scan_fdt_dev(dev);
}
+static int dwc2_gadget_handle_interrupts(struct udevice *dev)
+{
+ return dwc2_udc_handle_interrupt();
+}
+
+static const struct usb_gadget_generic_ops dwc2_gadget_ops = {
+ .handle_interrupts = dwc2_gadget_handle_interrupts,
+};
+
static const struct udevice_id dwc2_udc_otg_ids[] = {
{ .compatible = "snps,dwc2" },
{ .compatible = "brcm,bcm2835-usb" },
@@ -1186,6 +1189,7 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
.name = "dwc2-udc-otg",
.id = UCLASS_USB_GADGET_GENERIC,
.of_match = dwc2_udc_otg_ids,
+ .ops = &dwc2_gadget_ops,
.of_to_plat = dwc2_udc_otg_of_to_plat,
.probe = dwc2_udc_otg_probe,
.remove = dwc2_udc_otg_remove,
@@ -1201,4 +1205,9 @@ int dwc2_udc_B_session_valid(struct udevice *dev)
return readl(&usbotg_reg->gotgctl) & B_SESSION_VALID;
}
+#else
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ return dwc2_udc_handle_interrupt();
+}
#endif /* CONFIG_IS_ENABLED(DM_USB_GADGET) */
diff --git a/drivers/usb/gadget/dwc2_udc_otg_phy.c b/drivers/usb/gadget/dwc2_udc_otg_phy.c
index 7f8e9564b9e..c7eea7b3442 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_phy.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_phy.c
@@ -17,7 +17,6 @@
* Lukasz Majewski <l.majewski@samsumg.com>
*/
-#include <common.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/list.h>
diff --git a/drivers/usb/gadget/dwc2_udc_otg_regs.h b/drivers/usb/gadget/dwc2_udc_otg_regs.h
index 9ca6f423757..01056fab1c2 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_regs.h
+++ b/drivers/usb/gadget/dwc2_udc_otg_regs.h
@@ -204,7 +204,6 @@ struct dwc2_usbotg_reg {
#define DIEPCTL0_NEXT_EP_BIT (11)
-
/* DWC2_UDC_OTG_DIEPMSK/DOEPMSK device IN/OUT endpoint
common interrupt mask register */
/* DWC2_UDC_OTG_DIEPINTn/DOEPINTn device IN/OUT endpoint interrupt register */
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
index 1c34b753511..c0408bae076 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
@@ -17,7 +17,6 @@
* Lukasz Majewski <l.majewski@samsumg.com>
*/
-#include <common.h>
#include <cpu_func.h>
#include <log.h>
#include <linux/bug.h>
@@ -93,7 +92,6 @@ static inline void dwc2_ep0_complete_out(void)
}
-
static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req)
{
u32 *buf, ctrl;
@@ -973,7 +971,6 @@ static void dwc2_udc_set_nak(struct dwc2_ep *ep)
return;
}
-
static void dwc2_udc_ep_set_stall(struct dwc2_ep *ep)
{
u8 ep_num;
@@ -1441,7 +1438,6 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
}
}
-
if (likely(dev->driver)) {
/* device-2-host (IN) or no data setup command,
* process immediately */
@@ -1463,7 +1459,6 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
" bRequest = %d\n",
i, usb_ctrl->bRequest);
-
} else if (dev->req_pending) {
dev->req_pending = 0;
debug_cond(DEBUG_SETUP != 0,
diff --git a/drivers/usb/gadget/ep0.c b/drivers/usb/gadget/ep0.c
index c256cc31fbd..8c7fc17c2ea 100644
--- a/drivers/usb/gadget/ep0.c
+++ b/drivers/usb/gadget/ep0.c
@@ -36,7 +36,6 @@
* XXX
*/
-#include <common.h>
#include <serial.h>
#include <usbdevice.h>
@@ -94,7 +93,6 @@ __maybe_unused static char *usbd_device_requests[] = {
/* EP0 Configuration Set ********************************************************************* */
-
/**
* ep0_get_status - fill in URB data with appropriate status
* @device:
@@ -377,7 +375,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
return -1;
}
-
dbg_ep0 (1, "urb: buffer: %p buffer_length: %2d actual_length: %2d tx_packetSize: %2d",
urb->buffer, urb->buffer_length, urb->actual_length,
device->bus->endpoint_array[0].tx_packetSize);
@@ -422,7 +419,6 @@ int ep0_recv_setup (struct urb *urb)
dbg_ep0 (3, "urb: %p device: %p", urb, urb->device);
-
/*dbg_ep0(2, "- - - - - - - - - -"); */
dbg_ep0 (2,
@@ -534,7 +530,6 @@ int ep0_recv_setup (struct urb *urb)
/* handle the requests that do not return data */
else {
-
/*dbg_ep0(3, "Host-to-Device"); */
switch (request->bRequest) {
diff --git a/drivers/usb/gadget/ep0.h b/drivers/usb/gadget/ep0.h
index 976825ab93e..a16d36be938 100644
--- a/drivers/usb/gadget/ep0.h
+++ b/drivers/usb/gadget/ep0.h
@@ -18,8 +18,6 @@
#ifndef __USBDCORE_EP0_H__
#define __USBDCORE_EP0_H__
-
int ep0_recv_setup (struct urb *urb);
-
#endif
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index bb0d2971d06..495460473e9 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -8,12 +8,10 @@
* Remy Bohmer <linux@bohmer.net>
*/
-#include <common.h>
#include <linux/usb/ch9.h>
#include <linux/errno.h>
#include <linux/usb/gadget.h>
#include <asm/unaligned.h>
-#include "gadget_chips.h"
#define isdigit(c) ('0' <= (c) && (c) <= '9')
@@ -26,7 +24,6 @@ static unsigned epnum;
static unsigned in_epnum;
#endif
-
/*
* This should work with endpoints from controller drivers sharing the
* same endpoint naming convention. By example:
@@ -168,18 +165,6 @@ static int ep_matches(
return 1;
}
-static struct usb_ep *
-find_ep(struct usb_gadget *gadget, const char *name)
-{
- struct usb_ep *ep;
-
- list_for_each_entry(ep, &gadget->ep_list, ep_list) {
- if (0 == strcmp(ep->name, name))
- return ep;
- }
- return NULL;
-}
-
/**
* usb_ep_autoconfig - choose an endpoint matching the descriptor
* @gadget: The device to which the endpoint must belong.
@@ -215,76 +200,14 @@ struct usb_ep *usb_ep_autoconfig(
struct usb_endpoint_descriptor *desc
)
{
- struct usb_ep *ep = NULL;
- u8 type;
-
- type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+ struct usb_ep *ep;
- /* 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)) {
- const char *name = NULL;
- /*
- * First try standard, common configuration: ep1in-bulk,
- * ep2out-bulk, ep3in-int to match other udc drivers to avoid
- * confusion in already deployed software (endpoint numbers
- * hardcoded in userspace software/drivers)
- */
- if ((desc->bEndpointAddress & USB_DIR_IN) &&
- type == USB_ENDPOINT_XFER_BULK)
- name = "ep1in";
- else if ((desc->bEndpointAddress & USB_DIR_IN) == 0 &&
- type == USB_ENDPOINT_XFER_BULK)
- name = "ep2out";
- else if ((desc->bEndpointAddress & USB_DIR_IN) &&
- type == USB_ENDPOINT_XFER_INT)
- name = "ep3in";
-
- if (name)
- ep = find_ep(gadget, name);
+ if (gadget->ops->match_ep) {
+ ep = gadget->ops->match_ep(gadget, desc, NULL);
if (ep && ep_matches(gadget, ep, desc))
return ep;
-#endif
}
- if (gadget->ops->match_ep)
- ep = gadget->ops->match_ep(gadget, desc, NULL);
-
/* Second, look at endpoints until an unclaimed one looks usable */
list_for_each_entry(ep, &gadget->ep_list, ep_list) {
if (ep_matches(gadget, ep, desc))
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 36618f0bdf3..7973927e8a7 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -7,7 +7,6 @@
* Copyright (C) 2008 Nokia Corporation
*/
-#include <common.h>
#include <console.h>
#include <env.h>
#include <log.h>
@@ -23,8 +22,8 @@
#include <malloc.h>
#include <memalign.h>
#include <linux/ctype.h>
+#include <version.h>
-#include "gadget_chips.h"
#include "rndis.h"
#include <dm.h>
@@ -36,7 +35,6 @@
extern struct platform_data brd;
-
unsigned packet_received, packet_sent;
/*
@@ -274,7 +272,6 @@ static char dev_addr[18];
static char host_addr[18];
-
/*-------------------------------------------------------------------------*/
/*
@@ -807,7 +804,6 @@ static const struct usb_descriptor_header *hs_rndis_function[] = {
};
#endif
-
/* maxpacket and other transfer characteristics vary by speed. */
static inline struct usb_endpoint_descriptor *
ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
@@ -1990,28 +1986,15 @@ static int eth_bind(struct usb_gadget *gadget)
* standard protocol is _strongly_ preferred for interop purposes.
* (By everyone except Microsoft.)
*/
- if (gadget_is_musbhdrc(gadget)) {
+
+ if (IS_ENABLED(CONFIG_USB_MUSB_GADGET) &&
+ !strcmp("musb-hdrc", gadget->name)) {
/* reduce tx dma overhead by avoiding special cases */
zlp = 0;
- } else if (gadget_is_sh(gadget)) {
- /* sh doesn't support multiple interfaces or configs */
- cdc = 0;
- rndis = 0;
}
- gcnum = usb_gadget_controller_number(gadget);
- if (gcnum >= 0)
- device_desc.bcdDevice = cpu_to_le16(0x0300 + gcnum);
- else {
- /*
- * can't assume CDC works. don't want to default to
- * anything less functional on CDC-capable hardware,
- * so we fail in this case.
- */
- pr_err("controller '%s' not recognized",
- gadget->name);
- return -ENODEV;
- }
+ gcnum = (U_BOOT_VERSION_NUM << 4) | U_BOOT_VERSION_NUM_PATCH;
+ device_desc.bcdDevice = cpu_to_le16(gcnum);
/*
* If there's an RNDIS configuration, that's what Windows wants to
@@ -2151,7 +2134,6 @@ autoconf_fail:
#endif
}
-
/* network device setup */
dev->net = l_priv->netdev;
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index ba216128ab2..f18c6a0a761 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -10,7 +10,6 @@
*/
#include <circbuf.h>
-#include <common.h>
#include <console.h>
#include <errno.h>
#include <g_dnl.h>
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 44877df4ec6..ca8b36e077b 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -16,7 +16,6 @@
#include <env.h>
#include <errno.h>
-#include <common.h>
#include <log.h>
#include <malloc.h>
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 09e740cc962..8df0e3f331d 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -11,7 +11,6 @@
*/
#include <command.h>
#include <config.h>
-#include <common.h>
#include <env.h>
#include <errno.h>
#include <fastboot.h>
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index ef90c7ec7fb..ffe1ae6eb73 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -244,7 +244,6 @@
#include <hexdump.h>
#include <log.h>
#include <malloc.h>
-#include <common.h>
#include <console.h>
#include <g_dnl.h>
#include <dm/devres.h>
@@ -388,7 +387,6 @@ struct fsg_dev {
struct usb_ep *bulk_out;
};
-
static inline int __fsg_is_set(struct fsg_common *common,
const char *func, unsigned line)
{
@@ -405,13 +403,11 @@ static inline int __fsg_is_set(struct fsg_common *common,
#define fsg_is_set(common) likely(__fsg_is_set(common, __func__, __LINE__))
-
static inline struct fsg_dev *fsg_from_func(struct usb_function *f)
{
return container_of(f, struct fsg_dev, function);
}
-
typedef void (*fsg_routine_t)(struct fsg_dev *);
static int exception_in_progress(struct fsg_common *common)
@@ -1119,7 +1115,6 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh)
return 36;
}
-
static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh)
{
struct fsg_lun *curlun = &common->luns[common->lun];
@@ -1211,7 +1206,6 @@ static int do_read_header(struct fsg_common *common, struct fsg_buffhd *bh)
return 8;
}
-
static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh)
{
struct fsg_lun *curlun = &common->luns[common->lun];
@@ -1320,7 +1314,6 @@ static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh)
return len;
}
-
static int do_start_stop(struct fsg_common *common)
{
struct fsg_lun *curlun = &common->luns[common->lun];
@@ -1359,7 +1352,6 @@ static int do_prevent_allow(struct fsg_common *common)
return 0;
}
-
static int do_read_format_capacities(struct fsg_common *common,
struct fsg_buffhd *bh)
{
@@ -1377,7 +1369,6 @@ static int do_read_format_capacities(struct fsg_common *common,
return 12;
}
-
static int do_mode_select(struct fsg_common *common, struct fsg_buffhd *bh)
{
struct fsg_lun *curlun = &common->luns[common->lun];
@@ -1388,7 +1379,6 @@ static int do_mode_select(struct fsg_common *common, struct fsg_buffhd *bh)
return -EINVAL;
}
-
/*-------------------------------------------------------------------------*/
static int halt_bulk_in_endpoint(struct fsg_dev *fsg)
@@ -1513,7 +1503,6 @@ static int throw_away_data(struct fsg_common *common)
return 0;
}
-
static int finish_reply(struct fsg_common *common)
{
struct fsg_buffhd *bh = common->next_buffhd_to_fill;
@@ -1609,7 +1598,6 @@ static int finish_reply(struct fsg_common *common)
return rc;
}
-
static int send_status(struct fsg_common *common)
{
struct fsg_lun *curlun = &common->luns[common->lun];
@@ -1665,7 +1653,6 @@ static int send_status(struct fsg_common *common)
return 0;
}
-
/*-------------------------------------------------------------------------*/
/* Check whether the command is properly formed and whether its data size
@@ -1793,7 +1780,6 @@ static int check_command_size_in_blocks(struct fsg_common *common,
mask, needs_medium, name);
}
-
static int do_scsi_command(struct fsg_common *common)
{
struct fsg_buffhd *bh;
@@ -2128,7 +2114,6 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
return 0;
}
-
static int get_next_command(struct fsg_common *common)
{
struct fsg_buffhd *bh;
@@ -2167,7 +2152,6 @@ static int get_next_command(struct fsg_common *common)
return rc;
}
-
/*-------------------------------------------------------------------------*/
static int enable_endpoint(struct fsg_common *common, struct usb_ep *ep,
@@ -2280,10 +2264,8 @@ reset:
return rc;
}
-
/****************************** ALT CONFIGS ******************************/
-
static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{
struct fsg_dev *fsg = fsg_from_func(f);
@@ -2604,7 +2586,6 @@ static void fsg_common_release(struct kref *ref)
kfree(common);
}
-
/*-------------------------------------------------------------------------*/
/**
@@ -2723,7 +2704,6 @@ autoconf_fail:
return -ENOTSUPP;
}
-
/****************************** ADD FUNCTION ******************************/
static struct usb_gadget_strings *fsg_strings_array[] = {
diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c
index 98a7ffa2a75..d679cdae97c 100644
--- a/drivers/usb/gadget/f_rockusb.c
+++ b/drivers/usb/gadget/f_rockusb.c
@@ -6,7 +6,6 @@
*/
#include <command.h>
#include <config.h>
-#include <common.h>
#include <env.h>
#include <errno.h>
#include <log.h>
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index ca2760c00d0..514c097591b 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -17,7 +17,6 @@
*/
#include <errno.h>
-#include <common.h>
#include <console.h>
#include <env.h>
#include <log.h>
@@ -589,7 +588,6 @@ static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length)
return req;
}
-
static struct usb_request *sdp_start_ep(struct usb_ep *ep, bool in)
{
struct usb_request *req;
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index 0e7529dcdbb..54372118348 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -15,7 +15,6 @@
*/
#include <command.h>
-#include <common.h>
#include <console.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index afb7b74f305..631969b3405 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -6,7 +6,6 @@
* Lukasz Majewski <l.majewski@samsung.com>
*/
-#include <common.h>
#include <log.h>
#include <malloc.h>
@@ -18,10 +17,10 @@
#include <usb_mass_storage.h>
#include <dfu.h>
#include <thor.h>
+#include <version.h>
#include <env_callback.h>
-#include "gadget_chips.h"
#include "composite.c"
/*
@@ -200,18 +199,6 @@ void g_dnl_clear_detach(void)
g_dnl_detach_request = false;
}
-static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev)
-{
- struct usb_gadget *gadget = cdev->gadget;
- int gcnum;
-
- gcnum = usb_gadget_controller_number(gadget);
- if (gcnum > 0)
- gcnum += 0x200;
-
- return g_dnl_get_board_bcd_device_number(gcnum);
-}
-
/**
* Update internal serial number variable when the "serial#" env var changes.
*
@@ -262,7 +249,8 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
if (ret)
goto error;
- gcnum = g_dnl_get_bcd_device_number(cdev);
+ gcnum = g_dnl_get_board_bcd_device_number((U_BOOT_VERSION_NUM << 4) |
+ U_BOOT_VERSION_NUM_PATCH);
if (gcnum >= 0)
device_desc.bcdDevice = cpu_to_le16(gcnum);
else {
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
deleted file mode 100644
index 98156c312d2..00000000000
--- a/drivers/usb/gadget/gadget_chips.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * USB device controllers have lots of quirks. Use these macros in
- * gadget drivers or other code that needs to deal with them, and which
- * autoconfigures instead of using early binding to the hardware.
- *
- * This SHOULD eventually work like the ARM mach_is_*() stuff, driven by
- * some config file that gets updated as new hardware is supported.
- * (And avoiding all runtime comparisons in typical one-choice configs!)
- *
- * NOTE: some of these controller drivers may not be available yet.
- * Some are available on 2.4 kernels; several are available, but not
- * yet pushed in the 2.6 mainline tree.
- *
- * Ported to U-Boot by: Thomas Smits <ts.smits@gmail.com> and
- * Remy Bohmer <linux@bohmer.net>
- */
-#ifdef CONFIG_USB_GADGET_NET2280
-#define gadget_is_net2280(g) (!strcmp("net2280", (g)->name))
-#else
-#define gadget_is_net2280(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_AMD5536UDC
-#define gadget_is_amd5536udc(g) (!strcmp("amd5536udc", (g)->name))
-#else
-#define gadget_is_amd5536udc(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_DUMMY_HCD
-#define gadget_is_dummy(g) (!strcmp("dummy_udc", (g)->name))
-#else
-#define gadget_is_dummy(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_GOKU
-#define gadget_is_goku(g) (!strcmp("goku_udc", (g)->name))
-#else
-#define gadget_is_goku(g) 0
-#endif
-
-/* SH3 UDC -- not yet ported 2.4 --> 2.6 */
-#ifdef CONFIG_USB_GADGET_SUPERH
-#define gadget_is_sh(g) (!strcmp("sh_udc", (g)->name))
-#else
-#define gadget_is_sh(g) 0
-#endif
-
-/* handhelds.org tree (?) */
-#ifdef CONFIG_USB_GADGET_MQ11XX
-#define gadget_is_mq11xx(g) (!strcmp("mq11xx_udc", (g)->name))
-#else
-#define gadget_is_mq11xx(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_OMAP
-#define gadget_is_omap(g) (!strcmp("omap_udc", (g)->name))
-#else
-#define gadget_is_omap(g) 0
-#endif
-
-/* not yet ported 2.4 --> 2.6 */
-#ifdef CONFIG_USB_GADGET_N9604
-#define gadget_is_n9604(g) (!strcmp("n9604_udc", (g)->name))
-#else
-#define gadget_is_n9604(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_ATMEL_USBA
-#define gadget_is_atmel_usba(g) (!strcmp("atmel_usba_udc", (g)->name))
-#else
-#define gadget_is_atmel_usba(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_AT91
-#define gadget_is_at91(g) (!strcmp("at91_udc", (g)->name))
-#else
-#define gadget_is_at91(g) 0
-#endif
-
-/* status unclear */
-#ifdef CONFIG_USB_GADGET_IMX
-#define gadget_is_imx(g) (!strcmp("imx_udc", (g)->name))
-#else
-#define gadget_is_imx(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_FSL_USB2
-#define gadget_is_fsl_usb2(g) (!strcmp("fsl-usb2-udc", (g)->name))
-#else
-#define gadget_is_fsl_usb2(g) 0
-#endif
-
-/* Mentor high speed function controller */
-/* from Montavista kernel (?) */
-#ifdef CONFIG_USB_GADGET_MUSBHSFC
-#define gadget_is_musbhsfc(g) (!strcmp("musbhsfc_udc", (g)->name))
-#else
-#define gadget_is_musbhsfc(g) 0
-#endif
-
-/* Mentor high speed "dual role" controller, in peripheral role */
-#ifdef CONFIG_USB_MUSB_GADGET
-#define gadget_is_musbhdrc(g) (!strcmp("musb-hdrc", (g)->name))
-#else
-#define gadget_is_musbhdrc(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_M66592
-#define gadget_is_m66592(g) (!strcmp("m66592_udc", (g)->name))
-#else
-#define gadget_is_m66592(g) 0
-#endif
-
-#ifdef CONFIG_CI_UDC
-#define gadget_is_ci(g) (!strcmp("ci_udc", (g)->name))
-#else
-#define gadget_is_ci(g) 0
-#endif
-
-#ifdef CONFIG_USB_DWC3_GADGET
-#define gadget_is_dwc3(g) (!strcmp("dwc3-gadget", (g)->name))
-#else
-#define gadget_is_dwc3(g) 0
-#endif
-
-#ifdef CONFIG_USB_CDNS3_GADGET
-#define gadget_is_cdns3(g) (!strcmp("cdns3-gadget", (g)->name))
-#else
-#define gadget_is_cdns3(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_MAX3420
-#define gadget_is_max3420(g) (!strcmp("max3420-udc", (g)->name))
-#else
-#define gadget_is_max3420(g) 0
-#endif
-
-#ifdef CONFIG_USB_MTU3_GADGET
-#define gadget_is_mtu3(g) (!strcmp("mtu3-gadget", (g)->name))
-#else
-#define gadget_is_mtu3(g) 0
-#endif
-
-#ifdef CONFIG_USB_GADGET_DWC2_OTG
-#define gadget_is_dwc2(g) (!strcmp("dwc2-udc", (g)->name))
-#else
-#define gadget_is_dwc2(g) 0
-#endif
-
-/**
- * usb_gadget_controller_number - support bcdDevice id convention
- * @gadget: the controller being driven
- *
- * Return a 2-digit BCD value associated with the peripheral controller,
- * suitable for use as part of a bcdDevice value, or a negative error code.
- *
- * NOTE: this convention is purely optional, and has no meaning in terms of
- * any USB specification. If you want to use a different convention in your
- * gadget driver firmware -- maybe a more formal revision ID -- feel free.
- *
- * Hosts see these bcdDevice numbers, and are allowed (but not encouraged!)
- * to change their behavior accordingly. For example it might help avoiding
- * some chip bug.
- */
-static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
-{
- if (gadget_is_net2280(gadget))
- return 0x01;
- else if (gadget_is_dummy(gadget))
- return 0x02;
- else if (gadget_is_sh(gadget))
- return 0x04;
- else if (gadget_is_goku(gadget))
- return 0x06;
- else if (gadget_is_mq11xx(gadget))
- return 0x07;
- else if (gadget_is_omap(gadget))
- return 0x08;
- else if (gadget_is_n9604(gadget))
- return 0x09;
- else if (gadget_is_at91(gadget))
- return 0x12;
- else if (gadget_is_imx(gadget))
- return 0x13;
- else if (gadget_is_musbhsfc(gadget))
- return 0x14;
- else if (gadget_is_musbhdrc(gadget))
- return 0x15;
- else if (gadget_is_atmel_usba(gadget))
- return 0x17;
- else if (gadget_is_fsl_usb2(gadget))
- return 0x18;
- else if (gadget_is_amd5536udc(gadget))
- return 0x19;
- else if (gadget_is_m66592(gadget))
- return 0x20;
- else if (gadget_is_ci(gadget))
- return 0x21;
- else if (gadget_is_dwc3(gadget))
- return 0x23;
- else if (gadget_is_cdns3(gadget))
- return 0x24;
- else if (gadget_is_max3420(gadget))
- return 0x25;
- else if (gadget_is_mtu3(gadget))
- return 0x26;
- else if (gadget_is_dwc2(gadget))
- return 0x27;
- return -ENOENT;
-}
diff --git a/drivers/usb/gadget/max3420_udc.c b/drivers/usb/gadget/max3420_udc.c
index fa655c98dcc..557a1f0644e 100644
--- a/drivers/usb/gadget/max3420_udc.c
+++ b/drivers/usb/gadget/max3420_udc.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0+
-#include <common.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <asm/gpio.h>
@@ -809,13 +808,6 @@ static void max3420_setup_spi(struct max3420_udc *udc)
spi_wr8(udc, MAX3420_REG_PINCTL, bFDUPSPI);
}
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct max3420_udc *udc = dev_get_priv(dev);
-
- return max3420_irq(udc);
-}
-
static int max3420_udc_probe(struct udevice *dev)
{
struct max3420_udc *udc = dev_get_priv(dev);
@@ -860,6 +852,17 @@ static int max3420_udc_remove(struct udevice *dev)
return 0;
}
+static int max3420_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct max3420_udc *udc = dev_get_priv(dev);
+
+ return max3420_irq(udc);
+}
+
+static const struct usb_gadget_generic_ops max3420_gadget_ops = {
+ .handle_interrupts = max3420_gadget_handle_interrupts,
+};
+
static const struct udevice_id max3420_ids[] = {
{ .compatible = "maxim,max3421-udc" },
{ }
@@ -869,6 +872,7 @@ U_BOOT_DRIVER(max3420_generic_udc) = {
.name = "max3420-udc",
.id = UCLASS_USB_GADGET_GENERIC,
.of_match = max3420_ids,
+ .ops = &max3420_gadget_ops,
.probe = max3420_udc_probe,
.remove = max3420_udc_remove,
.priv_auto = sizeof(struct max3420_udc),
diff --git a/drivers/usb/gadget/ndis.h b/drivers/usb/gadget/ndis.h
index 753838f7941..371d37ff05a 100644
--- a/drivers/usb/gadget/ndis.h
+++ b/drivers/usb/gadget/ndis.h
@@ -21,7 +21,6 @@
#ifndef _USBGADGET_NDIS_H
#define _USBGADGET_NDIS_H
-
#define NDIS_STATUS_MULTICAST_FULL 0xC0010009
#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A
#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
@@ -60,7 +59,6 @@ struct NDIS_PM_PACKET_PATTERN {
__le32 PatternFlags;
};
-
/* Required Object IDs (OIDs) */
#define OID_GEN_SUPPORTED_LIST 0x00010101
#define OID_GEN_HARDWARE_STATUS 0x00010102
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index e7276ccd37a..76801bff9a3 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -18,7 +18,6 @@
* updates to merge with Linux 2.6, better match RNDIS spec
*/
-#include <common.h>
#include <log.h>
#include <net.h>
#include <malloc.h>
@@ -54,7 +53,6 @@ static const __le32 rndis_driver_version = __constant_cpu_to_le32(1);
/* Function Prototypes */
static rndis_resp_t *rndis_add_response(int configNr, u32 length);
-
/* supported OIDs */
static const u32 oid_supported_list[] = {
/* the general stuff */
@@ -139,7 +137,6 @@ static const u32 oid_supported_list[] = {
#endif /* RNDIS_PM */
};
-
/* NDIS Functions */
static int gen_ndis_query_resp(int configNr, u32 OID, u8 *buf,
unsigned buf_len, rndis_resp_t *r)
@@ -943,7 +940,6 @@ static int rndis_keepalive_response(int configNr,
return 0;
}
-
/*
* Device to Host Comunication
*/
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h
index 77db55a563f..84b6aeffb08 100644
--- a/drivers/usb/gadget/rndis.h
+++ b/drivers/usb/gadget/rndis.h
@@ -72,7 +72,6 @@
#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
#define OID_PNP_ENABLE_WAKE_UP 0xFD010106
-
typedef struct rndis_init_msg_type {
__le32 MessageType;
__le32 MessageLength;
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 97dc6b6f729..7e4b542f7ce 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -13,7 +13,6 @@
* Łukasz Majewski <l.majewski@samsung.com>
*/
-
/*
* This file requires the following identifiers used in USB strings to
* be defined (each of type pointer to char):
@@ -46,10 +45,8 @@
* characters rather then a pointer to void.
*/
-
/* #include <asm/unaligned.h> */
-
/*
* Thanks to NetChip Technologies for donating this product ID.
*
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index ba658d92296..6bb419ae2ab 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -19,7 +19,6 @@
#include <malloc.h>
#include <asm/cache.h>
#include <linux/dma-mapping.h>
-#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c
index 30ee1cab066..fbe62bbce47 100644
--- a/drivers/usb/gadget/udc/udc-uclass.c
+++ b/drivers/usb/gadget/udc/udc-uclass.c
@@ -6,13 +6,31 @@
#define LOG_CATEGORY UCLASS_USB_GADGET_GENERIC
-#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <linux/printk.h>
#include <linux/usb/gadget.h>
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
+static inline const struct usb_gadget_generic_ops *
+usb_gadget_generic_dev_ops(struct udevice *dev)
+{
+ return (const struct usb_gadget_generic_ops *)dev->driver->ops;
+}
+
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ const struct usb_gadget_generic_ops *ops;
+
+ ops = usb_gadget_generic_dev_ops(dev);
+ if (!ops)
+ return -EFAULT;
+ if (!ops->handle_interrupts)
+ return -ENOSYS;
+
+ return ops->handle_interrupts(dev);
+}
+
int udc_device_get_by_index(int index, struct udevice **udev)
{
struct udevice *dev = NULL;
@@ -55,6 +73,11 @@ int udc_device_put(struct udevice *udev)
{
return board_usb_cleanup(legacy_index, USB_INIT_DEVICE);
}
+
+__weak int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ return 0;
+}
#endif
#if CONFIG_IS_ENABLED(DM)
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
index e2464ad923f..4617a95bd0a 100644
--- a/drivers/usb/gadget/usbstring.c
+++ b/drivers/usb/gadget/usbstring.c
@@ -6,7 +6,6 @@
* Remy Bohmer <linux@bohmer.net>
*/
-#include <common.h>
#include <linux/errno.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 637eb2dd06f..a9dbb85f4e6 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -4,7 +4,6 @@
* Copyright (C) 2014 Marek Vasut <marex@denx.de>
*/
-#include <common.h>
#include <clk.h>
#include <cpu_func.h>
#include <dm.h>
diff --git a/drivers/usb/host/dwc3-of-simple.c b/drivers/usb/host/dwc3-of-simple.c
index f9df59d2e5d..d52e7d22d1a 100644
--- a/drivers/usb/host/dwc3-of-simple.c
+++ b/drivers/usb/host/dwc3-of-simple.c
@@ -10,7 +10,6 @@
* Author: Neil Armstrong <narmstron@baylibre.com>
*/
-#include <common.h>
#include <dm.h>
#include <reset.h>
#include <clk.h>
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
index 4a3ab611127..3e6834e38e3 100644
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ b/drivers/usb/host/dwc3-sti-glue.c
@@ -6,7 +6,6 @@
* Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
*/
-#include <common.h>
#include <log.h>
#include <asm/global_data.h>
#include <asm/io.h>
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index c6d50fd4551..ee751224463 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -5,7 +5,6 @@
* Written-by: Bo Shen <voice.shen@atmel.com>
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <log.h>
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index c1cdd4b0889..1e4a5a0b6f6 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -6,7 +6,6 @@
* Vivek Gautam <gautam.vivek@samsung.com>
*/
-#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <log.h>
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 0569dd54fff..ee3eb065b14 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -7,7 +7,6 @@
* Author: Tor Krill tor@excito.com
*/
-#include <common.h>
#include <env.h>
#include <log.h>
#include <pci.h>
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 936e30438d9..23c3ed25554 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -3,7 +3,6 @@
* Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
*/
-#include <common.h>
#include <clk.h>
#include <log.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 9839aa17492..7d5519c65a9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -6,7 +6,6 @@
*
* All rights reserved.
*/
-#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c
index 6093c8fb0b6..ca0ab57d49c 100644
--- a/drivers/usb/host/ehci-marvell.c
+++ b/drivers/usb/host/ehci-marvell.c
@@ -5,7 +5,6 @@
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
*/
-#include <common.h>
#include <log.h>
#include <asm/global_data.h>
#include <asm/io.h>
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 98fe7bc3bcb..ff336082e3a 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -7,8 +7,9 @@
* Based on Linux driver
*/
-#include <common.h>
+#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <errno.h>
#include <usb.h>
@@ -25,6 +26,8 @@ struct msm_ehci_priv {
struct usb_ehci *ehci; /* Start of IP core*/
struct ulpi_viewport ulpi_vp; /* ULPI Viewport */
struct phy phy;
+ struct clk iface_clk;
+ struct clk core_clk;
};
static int msm_init_after_reset(struct ehci_ctrl *dev)
@@ -53,20 +56,46 @@ static int ehci_usb_probe(struct udevice *dev)
struct ehci_hcor *hcor;
int ret;
+ ret = clk_get_by_name(dev, "core", &p->core_clk);
+ if (ret) {
+ dev_err(dev, "Failed to get core clock: %d\n", ret);
+ return ret;
+ }
+
+ ret = clk_get_by_name(dev, "iface", &p->iface_clk);
+ if (ret) {
+ dev_err(dev, "Failed to get iface clock: %d\n", ret);
+ return ret;
+ }
+
+ ret = clk_prepare_enable(&p->core_clk);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(&p->iface_clk);
+ if (ret)
+ goto cleanup_core;
+
hccr = (struct ehci_hccr *)((phys_addr_t)&ehci->caplength);
hcor = (struct ehci_hcor *)((phys_addr_t)hccr +
HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));
ret = generic_setup_phy(dev, &p->phy, 0);
if (ret)
- return ret;
+ goto cleanup_iface;
ret = board_usb_init(0, plat->init_type);
if (ret < 0)
- return ret;
+ goto cleanup_iface;
return ehci_register(dev, hccr, hcor, &msm_ehci_ops, 0,
plat->init_type);
+
+cleanup_iface:
+ clk_disable_unprepare(&p->iface_clk);
+cleanup_core:
+ clk_disable_unprepare(&p->core_clk);
+ return ret;
}
static int ehci_usb_remove(struct udevice *dev)
@@ -82,6 +111,9 @@ static int ehci_usb_remove(struct udevice *dev)
/* Stop controller. */
clrbits_le32(&ehci->usbcmd, CMD_RUN);
+ clk_disable_unprepare(&p->iface_clk);
+ clk_disable_unprepare(&p->core_clk);
+
ret = generic_shutdown_phy(&p->phy);
if (ret)
return ret;
diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
index c11279867c7..44912de7787 100644
--- a/drivers/usb/host/ehci-mx5.c
+++ b/drivers/usb/host/ehci-mx5.c
@@ -4,7 +4,6 @@
* Copyright (C) 2010 Freescale Semiconductor, Inc.
*/
-#include <common.h>
#include <log.h>
#include <usb.h>
#include <errno.h>
@@ -22,7 +21,6 @@
#define MX5_USBOTHER_REGS_OFFSET 0x800
-
#define MXC_OTG_OFFSET 0
#define MXC_H1_OFFSET 0x200
#define MXC_H2_OFFSET 0x400
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index a35fcca43a2..31cd8a50f4a 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -4,7 +4,6 @@
* Copyright (C) 2010 Freescale Semiconductor, Inc.
*/
-#include <common.h>
#include <clk.h>
#include <log.h>
#include <usb.h>
diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c
index ddf7cc2d00a..95af5c9254c 100644
--- a/drivers/usb/host/ehci-mxs.c
+++ b/drivers/usb/host/ehci-mxs.c
@@ -6,7 +6,6 @@
* on behalf of DENX Software Engineering GmbH
*/
-#include <common.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <errno.h>
diff --git a/drivers/usb/host/ehci-npcm.c b/drivers/usb/host/ehci-npcm.c
index 357a5614edb..d2a9965b4b4 100644
--- a/drivers/usb/host/ehci-npcm.c
+++ b/drivers/usb/host/ehci-npcm.c
@@ -3,7 +3,6 @@
* Copyright (c) 2021 Nuvoton Technology Corp.
*/
-#include <common.h>
#include <dm.h>
#include <generic-phy.h>
#include <reset.h>
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 765336a3c42..a95fcad0213 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -10,8 +10,8 @@
*
*/
-#include <common.h>
#include <log.h>
+#include <time.h>
#include <usb.h>
#include <linux/delay.h>
#include <usb/ulpi.h>
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index e98ab312618..572686580cd 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -4,7 +4,6 @@
* All rights reserved.
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <init.h>
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 2cf16256703..343893b9f19 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -5,7 +5,6 @@
* Copyright (c) 2013 Lucas Stach
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <linux/delay.h>
diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 648e136447d..5afe28ea303 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -6,7 +6,6 @@
* Based on ehci-mx6 driver
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <usb.h>
diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c
index f7e458cb15a..dfaff5c60f4 100644
--- a/drivers/usb/host/ehci-zynq.c
+++ b/drivers/usb/host/ehci-zynq.c
@@ -5,7 +5,6 @@
* USB Low level initialization(Specific to zynq)
*/
-#include <common.h>
#include <dm.h>
#include <usb.h>
#include <asm/arch/hardware.h>
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 9b955c1bd67..b170f26e6c6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -4,7 +4,6 @@
* DENX Software Engineering <mk@denx.de>
*/
-#include <common.h>
#include <asm/arch/clk.h>
int usb_cpu_init(void)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index d3d73d23844..d321d147c2f 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -3,7 +3,6 @@
* Copyright (C) 2012 Sughosh Ganu <urwithsughosh@gmail.com>
*/
-#include <common.h>
#include <malloc.h>
#include <asm/io.h>
#include <clk.h>
diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index ceed1911a95..f1325cd4953 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -3,7 +3,6 @@
* Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <log.h>
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 3f4418198cc..c020d13c43d 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -27,7 +27,7 @@
* to activate workaround for bug #41 or this driver will NOT work!
*/
-#include <common.h>
+#include <config.h>
#include <cpu_func.h>
#include <asm/byteorder.h>
#include <dm.h>
diff --git a/drivers/usb/host/ohci-lpc32xx.c b/drivers/usb/host/ohci-lpc32xx.c
index a04b2961b96..ed04cae7afe 100644
--- a/drivers/usb/host/ohci-lpc32xx.c
+++ b/drivers/usb/host/ohci-lpc32xx.c
@@ -7,7 +7,6 @@
* Copyright (c) 2015 Tyco Fire Protection Products.
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <init.h>
diff --git a/drivers/usb/host/ohci-npcm.c b/drivers/usb/host/ohci-npcm.c
index 9e1d5298809..ffeb6bc206a 100644
--- a/drivers/usb/host/ohci-npcm.c
+++ b/drivers/usb/host/ohci-npcm.c
@@ -3,7 +3,6 @@
* Copyright (c) 2021 Nuvoton Technology Corp.
*/
-#include <common.h>
#include <dm.h>
#include <generic-phy.h>
#include <reset.h>
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index f061aec2896..f10f1092420 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -5,7 +5,6 @@
*
*/
-#include <common.h>
#include <dm.h>
#include <errno.h>
#include <pci.h>
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 87ef19074b0..c21deb53ce2 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -71,7 +71,6 @@ struct ed {
} __attribute__((aligned(ED_ALIGNMENT)));
typedef struct ed ed_t;
-
/* TD info field */
#define TD_CC 0xf0000000
#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
@@ -107,7 +106,6 @@ typedef struct ed ed_t;
#define TD_BUFFERUNDERRUN 0x0D
#define TD_NOTACCESSED 0x0F
-
#define MAXPSW 1
struct td {
@@ -232,7 +230,6 @@ struct ohci_regs {
#define OHCI_INTR_OC (1 << 30) /* ownership change */
#define OHCI_INTR_MIE (1 << 31) /* master interrupt enable */
-
/* Virtual Root HUB */
struct virt_root_hub {
int devnum; /* Address of Root Hub endpoint */
@@ -268,7 +265,6 @@ struct virt_root_hub {
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
-
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
@@ -295,7 +291,6 @@ struct virt_root_hub {
#define RH_REQ_ERR -1
#define RH_NACK 0x00
-
/* OHCI ROOT HUB REGISTER MASKS */
/* roothub.portstatus [i] bits */
@@ -372,7 +367,6 @@ typedef struct ohci_device {
* a subset of what the full implementation needs. (Linus)
*/
-
typedef struct ohci {
/* this allocates EDs for all possible endpoints */
struct ohci_device ohci_dev __aligned(TD_ALIGNMENT);
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 3ccbc16da37..f0b18bffba4 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -5,7 +5,6 @@
* Copyright (C) 2008 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
*/
-#include <common.h>
#include <console.h>
#include <dm.h>
#include <log.h>
diff --git a/drivers/usb/host/usb-sandbox.c b/drivers/usb/host/usb-sandbox.c
index 3d4f8d653b5..f687fe2c430 100644
--- a/drivers/usb/host/usb-sandbox.c
+++ b/drivers/usb/host/usb-sandbox.c
@@ -4,7 +4,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <usb.h>
@@ -124,12 +123,7 @@ static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
return ret;
}
-#if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- return 0;
-}
-#else
+#if !CONFIG_IS_ENABLED(DM_USB_GADGET)
int usb_gadget_register_driver(struct usb_gadget_driver *driver)
{
struct sandbox_udc *dev = this_controller;
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index a5288ebca8f..bfec303e7af 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_USB
-#include <common.h>
#include <bootdev.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/usb/host/usb_bootdev.c b/drivers/usb/host/usb_bootdev.c
index 7fa1c601dff..362b46dc466 100644
--- a/drivers/usb/host/usb_bootdev.c
+++ b/drivers/usb/host/usb_bootdev.c
@@ -6,7 +6,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <bootdev.h>
#include <dm.h>
#include <usb.h>
diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c
index fe17924028c..2ffad148dea 100644
--- a/drivers/usb/host/xhci-brcm.c
+++ b/drivers/usb/host/xhci-brcm.c
@@ -3,7 +3,6 @@
* Copyright (C) 2019 Broadcom.
*/
-#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <usb.h>
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index 6cebe1cc30c..e3e0ceff43e 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -8,7 +8,6 @@
*/
#include <clk.h>
-#include <common.h>
#include <dm.h>
#include <generic-phy.h>
#include <log.h>
diff --git a/drivers/usb/host/xhci-exynos5.c b/drivers/usb/host/xhci-exynos5.c
index 270be934e7f..6a2d422c4b8 100644
--- a/drivers/usb/host/xhci-exynos5.c
+++ b/drivers/usb/host/xhci-exynos5.c
@@ -12,7 +12,6 @@
* exynos5 specific PHY-init sequence.
*/
-#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <log.h>
diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c
index e67e09e31e4..3484ae1d21e 100644
--- a/drivers/usb/host/xhci-fsl.c
+++ b/drivers/usb/host/xhci-fsl.c
@@ -7,7 +7,6 @@
* Author: Ramneek Mehresh<ramneek.mehresh@freescale.com>
*/
-#include <common.h>
#include <log.h>
#include <usb.h>
#include <linux/errno.h>
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 72b75306265..df94a66aa0a 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -13,7 +13,6 @@
* Vikas Sajjan <vikas.sajjan@samsung.com>
*/
-#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <log.h>
@@ -57,7 +56,6 @@ void xhci_inval_cache(uintptr_t addr, u32 len)
ALIGN(addr + len, CACHELINE_SIZE));
}
-
/**
* frees the "segment" pointer passed
*
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 63dfb793c6b..7e288f0575b 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -5,7 +5,6 @@
*/
#include <clk.h>
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <dm/devres.h>
diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 46b89de85d1..1338b1021c6 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -5,7 +5,6 @@
* MVEBU USB HOST xHCI Controller
*/
-#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <log.h>
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index 501129d769a..66da94c0709 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -8,7 +8,6 @@
* Author: Dan Murphy <dmurphy@ti.com>
*/
-#include <common.h>
#include <log.h>
#include <usb.h>
#include <linux/errno.h>
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 11f1c02000a..f6972af7963 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -5,7 +5,6 @@
* All rights reserved.
*/
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <init.h>
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index fedcf786929..38c5928faed 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -5,7 +5,6 @@
* Renesas RCar USB HOST xHCI Controller
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <fdtdec.h>
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 910c5f3352b..68cf08e0b6b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -13,7 +13,6 @@
* Vikas Sajjan <vikas.sajjan@samsung.com>
*/
-#include <common.h>
#include <cpu_func.h>
#include <log.h>
#include <asm/byteorder.h>
@@ -531,9 +530,8 @@ static void reset_ep(struct usb_device *udev, int ep_index)
if (!event)
return;
- BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
- != udev->slot_id || GET_COMP_CODE(le32_to_cpu(
- event->event_cmd.status)) != COMP_SUCCESS);
+ BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id ||
+ GET_COMP_CODE(le32_to_cpu(event->event_cmd.status)) != COMP_SUCCESS);
xhci_acknowledge_event(ctrl);
}
@@ -566,8 +564,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
field = le32_to_cpu(event->trans_event.flags);
BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
- BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len
- != COMP_STOP)));
+ BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len != COMP_STOP)));
xhci_acknowledge_event(ctrl);
event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
@@ -581,9 +578,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
comp = GET_COMP_CODE(le32_to_cpu(event->event_cmd.status));
BUG_ON(type != TRB_COMPLETION ||
- TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
- != udev->slot_id || (comp != COMP_SUCCESS && comp
- != COMP_CTX_STATE));
+ TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id ||
+ (comp != COMP_SUCCESS && comp != COMP_CTX_STATE));
xhci_acknowledge_event(ctrl);
addr = xhci_trb_virt_to_dma(ring->enq_seg,
@@ -593,9 +589,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
if (!event)
return;
- BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
- != udev->slot_id || GET_COMP_CODE(le32_to_cpu(
- event->event_cmd.status)) != COMP_SUCCESS);
+ BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id ||
+ GET_COMP_CODE(le32_to_cpu(event->event_cmd.status)) != COMP_SUCCESS);
xhci_acknowledge_event(ctrl);
}
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 741e186ee05..d30725d3fca 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -19,7 +19,6 @@
* The quirk devices support hasn't been given yet.
*/
-#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
index a6c4d97aee3..96c483fb9af 100644
--- a/drivers/usb/isp1760/isp1760-hcd.c
+++ b/drivers/usb/isp1760/isp1760-hcd.c
@@ -7,7 +7,6 @@
*/
#include <hexdump.h>
-#include <common.h>
#include <asm/cache.h>
#include <cpu_func.h>
#include <dm.h>
diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
index c96ab459f93..54246b49d5f 100644
--- a/drivers/usb/isp1760/isp1760-if.c
+++ b/drivers/usb/isp1760/isp1760-if.c
@@ -6,7 +6,6 @@
* (c) 2007 Sebastian Siewior <bigeasy@linutronix.de>
*/
-#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/isp1760/isp1760-uboot.c b/drivers/usb/isp1760/isp1760-uboot.c
index 203500a4cb7..8dcb7768a2c 100644
--- a/drivers/usb/isp1760/isp1760-uboot.c
+++ b/drivers/usb/isp1760/isp1760-uboot.c
@@ -6,7 +6,6 @@
*
*/
-#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index b1b22b9357c..f8e14eabfb2 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -5,7 +5,6 @@
* Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
*/
-#include <common.h>
#include <dm/lists.h>
#include <linux/iopoll.h>
@@ -224,15 +223,6 @@ static const struct udevice_id ssusb_of_match[] = {
};
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct mtu3 *mtu = dev_get_priv(dev);
-
- mtu3_irq(0, mtu);
-
- return 0;
-}
-
static int mtu3_gadget_probe(struct udevice *dev)
{
struct ssusb_mtk *ssusb = dev_to_ssusb(dev->parent);
@@ -251,10 +241,24 @@ static int mtu3_gadget_remove(struct udevice *dev)
return 0;
}
+static int mtu3_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct mtu3 *mtu = dev_get_priv(dev);
+
+ mtu3_irq(0, mtu);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops mtu3_gadget_ops = {
+ .handle_interrupts = mtu3_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(mtu3_peripheral) = {
.name = "mtu3-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
.of_match = ssusb_of_match,
+ .ops = &mtu3_gadget_ops,
.probe = mtu3_gadget_probe,
.remove = mtu3_gadget_remove,
.priv_auto = sizeof(struct mtu3),
diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
index 0a52e09e19f..42bc816e4f1 100644
--- a/drivers/usb/musb-new/am35x.c
+++ b/drivers/usb/musb-new/am35x.c
@@ -24,7 +24,6 @@
#include <plat/usb.h>
#else
-#include <common.h>
#include <asm/omap_musb.h>
#include <linux/bug.h>
#include <linux/delay.h>
diff --git a/drivers/usb/musb-new/da8xx.c b/drivers/usb/musb-new/da8xx.c
index 68fc0c36146..7caf03cc2e1 100644
--- a/drivers/usb/musb-new/da8xx.c
+++ b/drivers/usb/musb-new/da8xx.c
@@ -13,7 +13,6 @@
*
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <dm/device-internal.h>
diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h
index 8829567bfb6..40e238f86a8 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -19,8 +19,4 @@
#define CFG_SOC_OMAP3430
#endif
-#ifdef CONFIG_OMAP44XX
-#define CFG_ARCH_OMAP4
-#endif
-
#endif /* __LINUX_COMPAT_H__ */
diff --git a/drivers/usb/musb-new/mt85xx.c b/drivers/usb/musb-new/mt85xx.c
index 1e632dca046..14b28bbae6b 100644
--- a/drivers/usb/musb-new/mt85xx.c
+++ b/drivers/usb/musb-new/mt85xx.c
@@ -9,7 +9,6 @@
*
* This file is part of the Inventra Controller Driver for Linux.
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 00da554982f..6375be741ae 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -79,7 +79,6 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#else
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <usb.h>
@@ -99,7 +98,6 @@
#define TA_WAIT_BCON(m) max_t(int, (m)->a_wait_bcon, OTG_TIME_A_WAIT_BCON)
-
#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia"
#define DRIVER_DESC "Inventra Dual-Role USB Controller Driver"
@@ -115,7 +113,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" MUSB_DRIVER_NAME);
-
#ifndef __UBOOT__
/*-------------------------------------------------------------------------*/
@@ -302,7 +299,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
#endif /* normal PIO */
-
/*-------------------------------------------------------------------------*/
/* for high speed test mode; see USB 2.0 spec 7.1.20 */
@@ -972,7 +968,6 @@ int musb_start(struct musb *musb)
#endif
}
-
static void musb_generic_disable(struct musb *musb)
{
void __iomem *mbase = musb->mregs;
@@ -1043,7 +1038,6 @@ static void musb_shutdown(struct platform_device *pdev)
}
#endif
-
/*-------------------------------------------------------------------------*/
/*
@@ -1345,7 +1339,6 @@ done:
return 0;
}
-
/*
* ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false
* @param musb the controller
@@ -1527,7 +1520,7 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb)
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_SOC_OMAP2430) || defined(CFG_SOC_OMAP3430) || \
- defined(CFG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500)
+ defined(CONFIG_ARCH_U8500)
static irqreturn_t generic_interrupt(int irq, void *__hci)
{
diff --git a/drivers/usb/musb-new/musb_core.h b/drivers/usb/musb-new/musb_core.h
index adfd81b8544..00e9181556d 100644
--- a/drivers/usb/musb-new/musb_core.h
+++ b/drivers/usb/musb-new/musb_core.h
@@ -143,7 +143,6 @@ enum musb_g_ep0_state {
#define OTG_TIME_A_AIDL_BDIS 200 /* min 200 msec */
#define OTG_TIME_B_ASE0_BRST 100 /* min 3.125 ms */
-
/*************************** REGISTER ACCESS ********************************/
/* Endpoint registers (other than dynfifo setup) can be accessed either
@@ -151,7 +150,7 @@ enum musb_g_ep0_state {
*/
#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_SOC_OMAP2430) \
- || defined(CFG_SOC_OMAP3430) || defined(CFG_ARCH_OMAP4)
+ || defined(CFG_SOC_OMAP3430)
/* REVISIT indexed access seemed to
* misbehave (on DaVinci) for at least peripheral IN ...
*/
diff --git a/drivers/usb/musb-new/musb_dma.h b/drivers/usb/musb-new/musb_dma.h
index 5f99356ca79..9cafcf4432d 100644
--- a/drivers/usb/musb-new/musb_dma.h
+++ b/drivers/usb/musb-new/musb_dma.h
@@ -141,7 +141,6 @@ struct dma_controller {
/* called after channel_program(), may indicate a fault */
extern void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit);
-
extern struct dma_controller *__init
dma_controller_create(struct musb *, void __iomem *);
diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c
index a8ff7434c9f..b73f3531ce2 100644
--- a/drivers/usb/musb-new/musb_dsps.c
+++ b/drivers/usb/musb-new/musb_dsps.c
@@ -31,7 +31,6 @@
#include <plat/usb.h>
#else
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <asm/omap_musb.h>
diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c
index c6083963ede..08fac829ce7 100644
--- a/drivers/usb/musb-new/musb_gadget.c
+++ b/drivers/usb/musb-new/musb_gadget.c
@@ -22,7 +22,6 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#else
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <linux/bug.h>
@@ -33,7 +32,6 @@
#include "musb_core.h"
-
/* MUSB PERIPHERAL status 3-mar-2006:
*
* - EP0 seems solid. It passes both USBCV and usbtest control cases.
@@ -275,7 +273,6 @@ static inline int max_ep_writesize(struct musb *musb, struct musb_ep *ep)
return ep->packet_sz;
}
-
#ifdef CONFIG_USB_INVENTRA_DMA
/* Peripheral tx (IN) using Mentor DMA works as follows:
@@ -1824,7 +1821,6 @@ static void musb_gadget_release(struct device *dev)
}
#endif
-
static void __devinit
init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
{
@@ -2286,7 +2282,6 @@ __acquires(musb->lock)
else if (devctl & MUSB_DEVCTL_HR)
musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
-
/* what speed did we negotiate? */
power = musb_readb(mbase, MUSB_POWER);
musb->g.speed = (power & MUSB_POWER_HSMODE)
diff --git a/drivers/usb/musb-new/musb_gadget.h b/drivers/usb/musb-new/musb_gadget.h
index 7cb7a5cd6dc..b11e7205299 100644
--- a/drivers/usb/musb-new/musb_gadget.h
+++ b/drivers/usb/musb-new/musb_gadget.h
@@ -43,7 +43,6 @@ extern struct usb_request *
musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags);
extern void musb_free_request(struct usb_ep *ep, struct usb_request *req);
-
/*
* struct musb_ep - peripheral side view of endpoint rx or tx side
*/
diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c
index 55ce8de99bb..ea65326ab62 100644
--- a/drivers/usb/musb-new/musb_gadget_ep0.c
+++ b/drivers/usb/musb-new/musb_gadget_ep0.c
@@ -18,7 +18,6 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#else
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <linux/printk.h>
@@ -502,7 +501,6 @@ static void ep0_rxstate(struct musb *musb)
} else
csr = MUSB_CSR0_P_SVDRXPKTRDY | MUSB_CSR0_P_SENDSTALL;
-
/* Completion handler may choose to stall, e.g. because the
* message just received holds invalid data.
*/
@@ -896,7 +894,6 @@ finish:
return retval;
}
-
static int
musb_g_ep0_enable(struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
{
diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c
index e5905d90d66..7528a53d73e 100644
--- a/drivers/usb/musb-new/musb_host.c
+++ b/drivers/usb/musb-new/musb_host.c
@@ -21,7 +21,6 @@
#include <linux/list.h>
#include <linux/dma-mapping.h>
#else
-#include <common.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <usb.h>
@@ -33,7 +32,6 @@
#include "musb_core.h"
#include "musb_host.h"
-
/* MUSB HOST status 22-mar-2006
*
* - There's still lots of partial code duplication for fault paths, so
@@ -68,7 +66,6 @@
* although ARP RX wins. (That test was done with a full speed link.)
*/
-
/*
* NOTE on endpoint usage:
*
@@ -83,7 +80,6 @@
* of transfers between endpoints, or anything clever.
*/
-
static void musb_ep_program(struct musb *musb, u8 epnum,
struct urb *urb, int is_out,
u8 *buf, u32 offset, u32 len);
@@ -885,7 +881,6 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
}
}
-
/*
* Service the default endpoint (ep0) as host.
* Return true until it's time to start the status stage.
@@ -1086,7 +1081,6 @@ done:
return retval;
}
-
#ifdef CONFIG_USB_INVENTRA_DMA
/* Host side TX (OUT) using Mentor DMA works as follows:
@@ -1345,7 +1339,6 @@ void musb_host_tx(struct musb *musb, u8 epnum)
MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
}
-
#ifdef CONFIG_USB_INVENTRA_DMA
/* Host side RX (IN) using Mentor DMA works as follows:
diff --git a/drivers/usb/musb-new/musb_host.h b/drivers/usb/musb-new/musb_host.h
index 5a604bdb0cf..823e327ef0e 100644
--- a/drivers/usb/musb-new/musb_host.h
+++ b/drivers/usb/musb-new/musb_host.h
@@ -59,7 +59,6 @@ static inline struct musb_qh *first_qh(struct list_head *q)
return list_entry(q->next, struct musb_qh, ring);
}
-
extern void musb_root_disconnect(struct musb *musb);
struct usb_hcd;
diff --git a/drivers/usb/musb-new/musb_io.h b/drivers/usb/musb-new/musb_io.h
index 19b12f36a5c..0ced19919ef 100644
--- a/drivers/usb/musb-new/musb_io.h
+++ b/drivers/usb/musb-new/musb_io.h
@@ -24,14 +24,12 @@ static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
{ return __raw_readl(addr + offset); }
-
static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
{ __raw_writew(data, addr + offset); }
static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
{ __raw_writel(data, addr + offset); }
-
#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
/*
diff --git a/drivers/usb/musb-new/musb_regs.h b/drivers/usb/musb-new/musb_regs.h
index 9fd01fafdf7..a54da45d490 100644
--- a/drivers/usb/musb-new/musb_regs.h
+++ b/drivers/usb/musb-new/musb_regs.h
@@ -188,7 +188,6 @@
/* HUBADDR */
#define MUSB_HUBADDR_MULTI_TT 0x80
-
/* SUNXI has different reg addresses, but identical r/w functions */
#ifndef CONFIG_ARCH_SUNXI
diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
index 7cea9a2ed65..43ab3245e5c 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -1,4 +1,3 @@
-#include <common.h>
#include <console.h>
#include <dm.h>
#include <malloc.h>
diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index 308eff832c9..ba600d01102 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -8,7 +8,6 @@
*
* This file is part of the Inventra Controller Driver for Linux.
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <serial.h>
@@ -22,7 +21,6 @@
#include <asm/omap_common.h>
#include <asm/omap_musb.h>
#include <twl4030.h>
-#include <twl6030.h>
#include "linux-compat.h"
#include "musb_core.h"
#include "omap2430.h"
@@ -47,16 +45,6 @@ static inline void omap2430_low_level_init(struct musb *musb)
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
-#ifdef CONFIG_DM_USB_GADGET
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct musb_host_data *host = dev_get_priv(dev);
-
- host->host->isr(0, host->host);
- return 0;
-}
-#endif
-
static int omap2430_musb_init(struct musb *musb)
{
u32 l;
@@ -115,17 +103,6 @@ static int omap2430_musb_enable(struct musb *musb)
__PRETTY_FUNCTION__);
}
#endif
-
-#ifdef CONFIG_TWL6030_POWER
- twl6030_usb_device_settings();
-#endif
-
-#ifdef CONFIG_OMAP44XX
- u32 *usbotghs_control = (u32 *)((*ctrl)->control_usbotghs_ctrl);
- *usbotghs_control = USBOTGHS_CONTROL_AVALID |
- USBOTGHS_CONTROL_VBUSVALID | USBOTGHS_CONTROL_IDDIG;
-#endif
-
return 0;
}
@@ -274,6 +251,21 @@ static int omap2430_musb_remove(struct udevice *dev)
return 0;
}
+#ifndef CONFIG_USB_MUSB_HOST
+static int omap2340_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct musb_host_data *host = dev_get_priv(dev);
+
+ host->host->isr(0, host->host);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops omap2340_gadget_ops = {
+ .handle_interrupts = omap2340_gadget_handle_interrupts,
+};
+#endif
+
static const struct udevice_id omap2430_musb_ids[] = {
{ .compatible = "ti,omap3-musb" },
{ .compatible = "ti,omap4-musb" },
@@ -286,6 +278,7 @@ U_BOOT_DRIVER(omap2430_musb) = {
.id = UCLASS_USB,
#else
.id = UCLASS_USB_GADGET_GENERIC,
+ .ops = &omap2340_gadget_ops,
#endif
.of_match = omap2430_musb_ids,
.of_to_plat = omap2430_musb_of_to_plat,
diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c
index 4ed5e6e90c6..0b25e5893b3 100644
--- a/drivers/usb/musb-new/pic32.c
+++ b/drivers/usb/musb-new/pic32.c
@@ -9,7 +9,6 @@
* Based on the dsps "glue layer" code.
*/
-#include <common.h>
#include <dm.h>
#include <asm/global_data.h>
#include <dm/device_compat.h>
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 778b01b22ea..b577ba41878 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -15,7 +15,6 @@
*
* This file is part of the Inventra Controller Driver for Linux.
*/
-#include <common.h>
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index ed5e5194d8c..ec1baa9337d 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -5,7 +5,6 @@
* (C) Copyright 2016
* Texas Instruments Incorporated, <www.ti.com>
*/
-#include <common.h>
#include <command.h>
#include <console.h>
#include <dm.h>
@@ -234,15 +233,6 @@ static int ti_musb_peripheral_of_to_plat(struct udevice *dev)
}
#endif
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct ti_musb_peripheral *priv = dev_get_priv(dev);
-
- priv->periph->isr(0, priv->periph);
-
- return 0;
-}
-
static int ti_musb_peripheral_probe(struct udevice *dev)
{
struct ti_musb_peripheral *priv = dev_get_priv(dev);
@@ -270,12 +260,26 @@ static int ti_musb_peripheral_remove(struct udevice *dev)
return 0;
}
+static int ti_musb_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct ti_musb_peripheral *priv = dev_get_priv(dev);
+
+ priv->periph->isr(0, priv->periph);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops ti_musb_gadget_ops = {
+ .handle_interrupts = ti_musb_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(ti_musb_peripheral) = {
.name = "ti-musb-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
#if CONFIG_IS_ENABLED(OF_CONTROL)
.of_to_plat = ti_musb_peripheral_of_to_plat,
#endif
+ .ops = &ti_musb_gadget_ops,
.probe = ti_musb_peripheral_probe,
.remove = ti_musb_peripheral_remove,
.ops = &musb_usb_ops,
diff --git a/drivers/usb/musb-new/ux500.c b/drivers/usb/musb-new/ux500.c
index 57c7d5630d3..89dd75b7d05 100644
--- a/drivers/usb/musb-new/ux500.c
+++ b/drivers/usb/musb-new/ux500.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+
/* Copyright (C) 2019 Stephan Gerhold */
-#include <common.h>
#include <dm.h>
#include <generic-phy.h>
#include <dm/device_compat.h>
@@ -92,14 +91,6 @@ static const struct musb_platform_ops ux500_musb_ops = {
.disable = ux500_musb_disable,
};
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct ux500_glue *glue = dev_get_priv(dev);
-
- glue->mdata.host->isr(0, glue->mdata.host);
- return 0;
-}
-
static int ux500_musb_probe(struct udevice *dev)
{
#ifdef CONFIG_USB_MUSB_HOST
@@ -156,6 +147,19 @@ static int ux500_musb_remove(struct udevice *dev)
return 0;
}
+static int ux500_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct ux500_glue *glue = dev_get_priv(dev);
+
+ glue->mdata.host->isr(0, glue->mdata.host);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops ux500_gadget_ops = {
+ .handle_interrupts = ux500_gadget_handle_interrupts,
+};
+
static const struct udevice_id ux500_musb_ids[] = {
{ .compatible = "stericsson,db8500-musb" },
{ }
@@ -169,6 +173,7 @@ U_BOOT_DRIVER(ux500_musb) = {
.id = UCLASS_USB_GADGET_GENERIC,
#endif
.of_match = ux500_musb_ids,
+ .ops = &ux500_gadget_ops,
.probe = ux500_musb_probe,
.remove = ux500_musb_remove,
#ifdef CONFIG_USB_MUSB_HOST
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index f945f1f5e2c..2c23043d40e 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -9,7 +9,6 @@
* Copyright (c) 2010 Texas Instruments Incorporated
*/
-#include <common.h>
#include <linux/delay.h>
#include "am35x.h"
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 9651f074a49..260552e4dbd 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -8,7 +8,6 @@
* Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
*/
-#include <common.h>
#include <linux/bitops.h>
#include "musb_core.h"
diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 4676cabae0a..c95c6a48281 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -7,7 +7,6 @@
* Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
*/
-#include <common.h>
#include <log.h>
#include <usb.h>
#include <linux/delay.h>
diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c
index 2ffcb7caaad..696855ee3a6 100644
--- a/drivers/usb/musb/musb_udc.c
+++ b/drivers/usb/musb/musb_udc.c
@@ -37,7 +37,6 @@
* -------------------------------------------------------------------------
*/
-#include <common.h>
#include <hang.h>
#include <serial.h>
#include <usbdevice.h>
diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c
index 080bd78523c..e5238bc02f8 100644
--- a/drivers/usb/musb/omap3.c
+++ b/drivers/usb/musb/omap3.c
@@ -19,7 +19,6 @@
#include <serial.h>
#include <asm/omap_common.h>
#include <twl4030.h>
-#include <twl6030.h>
#include "omap3.h"
static int platform_needs_initialization = 1;
@@ -54,16 +53,10 @@ static struct omap3_otg_regs *otg;
#define OMAP3_OTG_SYSSTATUS_RESETDONE 0x0001
-/* OMAP4430 has an internal PHY, use it */
-#ifdef CONFIG_OMAP44XX
-#define OMAP3_OTG_INTERFSEL_OMAP 0x0000
-#else
#define OMAP3_OTG_INTERFSEL_OMAP 0x0001
-#endif
#define OMAP3_OTG_FORCESTDBY_STANDBY 0x0001
-
#ifdef DEBUG_MUSB_OMAP3
static void musb_db_otg_regs(void)
{
@@ -100,10 +93,6 @@ int musb_platform_init(void)
}
#endif
-#ifdef CONFIG_TWL6030_POWER
- twl6030_usb_device_settings();
-#endif
-
otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE;
/* Set OTG to always be on */
@@ -122,11 +111,6 @@ int musb_platform_init(void)
musb_cfg.extvbus = omap3_evm_need_extvbus();
#endif
-#ifdef CONFIG_OMAP44XX
- u32 *usbotghs_control =
- (u32 *)((*ctrl)->control_usbotghs_ctrl);
- *usbotghs_control = 0x15;
-#endif
platform_needs_initialization = 0;
}
diff --git a/drivers/usb/phy/rockchip_usb2_phy.c b/drivers/usb/phy/rockchip_usb2_phy.c
index c46ad86d3d6..ce9a7b5b819 100644
--- a/drivers/usb/phy/rockchip_usb2_phy.c
+++ b/drivers/usb/phy/rockchip_usb2_phy.c
@@ -3,7 +3,6 @@
* Copyright 2016 Rockchip Electronics Co., Ltd
*/
-#include <common.h>
#include <hang.h>
#include <log.h>
#include <asm/global_data.h>
@@ -73,7 +72,6 @@ static void property_enable(struct dwc2_plat_otg_data *pdata,
writel(val, pdata->regs_phy + reg->offset);
}
-
void otg_phy_init(struct dwc2_udc *dev)
{
struct dwc2_plat_otg_data *pdata = dev->pdata;
diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
index 1b01cd4c559..6f0c3eb154e 100644
--- a/drivers/usb/ulpi/omap-ulpi-viewport.c
+++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
@@ -7,7 +7,6 @@
* Author: Govindraj R <govindraj.raja@ti.com>
*/
-#include <common.h>
#include <log.h>
#include <asm/io.h>
#include <linux/delay.h>
diff --git a/drivers/usb/ulpi/ulpi-viewport.c b/drivers/usb/ulpi/ulpi-viewport.c
index 55a62808384..bac20a02f01 100644
--- a/drivers/usb/ulpi/ulpi-viewport.c
+++ b/drivers/usb/ulpi/ulpi-viewport.c
@@ -13,7 +13,6 @@
* Copyright (C) 2011 Google, Inc.
*/
-#include <common.h>
#include <asm/io.h>
#include <linux/delay.h>
#include <usb/ulpi.h>
diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c
index b5d2c2c2d1c..128adcbde13 100644
--- a/drivers/usb/ulpi/ulpi.c
+++ b/drivers/usb/ulpi/ulpi.c
@@ -19,7 +19,6 @@
* Freescale Semiconductors
*/
-#include <common.h>
#include <exports.h>
#include <log.h>
#include <linux/delay.h>