aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/controller
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller')
-rw-r--r--sys/dev/usb/controller/dwc3/aw_dwc3.c3
-rw-r--r--sys/dev/usb/controller/dwc3/dwc3.c3
-rw-r--r--sys/dev/usb/controller/dwc3/rk_dwc3.c3
-rw-r--r--sys/dev/usb/controller/dwc_otg.c2
-rw-r--r--sys/dev/usb/controller/dwc_otg_acpi.c6
-rw-r--r--sys/dev/usb/controller/dwc_otg_fdt.c9
-rw-r--r--sys/dev/usb/controller/ehci_fsl.c17
-rw-r--r--sys/dev/usb/controller/ehci_imx.c5
-rw-r--r--sys/dev/usb/controller/ehci_msm.c13
-rw-r--r--sys/dev/usb/controller/ehci_mv.c7
-rw-r--r--sys/dev/usb/controller/ehci_pci.c8
-rw-r--r--sys/dev/usb/controller/generic_ehci.c7
-rw-r--r--sys/dev/usb/controller/generic_ehci_acpi.c1
-rw-r--r--sys/dev/usb/controller/generic_ehci_fdt.c1
-rw-r--r--sys/dev/usb/controller/generic_ohci.c6
-rw-r--r--sys/dev/usb/controller/generic_xhci.c7
-rw-r--r--sys/dev/usb/controller/generic_xhci_acpi.c1
-rw-r--r--sys/dev/usb/controller/generic_xhci_fdt.c1
-rw-r--r--sys/dev/usb/controller/musb_otg_allwinner.c20
-rw-r--r--sys/dev/usb/controller/ohci_pci.c8
-rw-r--r--sys/dev/usb/controller/uhci_pci.c8
-rw-r--r--sys/dev/usb/controller/usb_controller.c9
-rw-r--r--sys/dev/usb/controller/xhci_pci.c11
-rw-r--r--sys/dev/usb/controller/xlnx_dwc3.c5
24 files changed, 79 insertions, 82 deletions
diff --git a/sys/dev/usb/controller/dwc3/aw_dwc3.c b/sys/dev/usb/controller/dwc3/aw_dwc3.c
index 802c46bdae28..be941ca2148f 100644
--- a/sys/dev/usb/controller/dwc3/aw_dwc3.c
+++ b/sys/dev/usb/controller/dwc3/aw_dwc3.c
@@ -125,7 +125,8 @@ aw_dwc3_attach(device_t dev)
device_probe_and_attach(cdev);
}
- return (bus_generic_attach(dev));
+ bus_attach_children(dev);
+ return (0);
}
static device_method_t aw_dwc3_methods[] = {
diff --git a/sys/dev/usb/controller/dwc3/dwc3.c b/sys/dev/usb/controller/dwc3/dwc3.c
index a44c2371b891..39b5d3ae4cb1 100644
--- a/sys/dev/usb/controller/dwc3/dwc3.c
+++ b/sys/dev/usb/controller/dwc3/dwc3.c
@@ -26,7 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_platform.h"
#include "opt_acpi.h"
@@ -129,7 +128,7 @@ snps_dwc3_attach_xhci(device_t dev)
return (ENXIO);
}
- sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (sc->sc_bus.bdev == NULL) {
device_printf(dev, "Failed to add USB device\n");
return (ENXIO);
diff --git a/sys/dev/usb/controller/dwc3/rk_dwc3.c b/sys/dev/usb/controller/dwc3/rk_dwc3.c
index f53f446a29f3..16fc5f73f922 100644
--- a/sys/dev/usb/controller/dwc3/rk_dwc3.c
+++ b/sys/dev/usb/controller/dwc3/rk_dwc3.c
@@ -182,7 +182,8 @@ rk_dwc3_attach(device_t dev)
device_probe_and_attach(cdev);
}
- return (bus_generic_attach(dev));
+ bus_attach_children(dev);
+ return (0);
}
static device_method_t rk_dwc3_methods[] = {
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index c888d4c48be5..6c44eebd0616 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -3856,7 +3856,7 @@ dwc_otg_init(struct dwc_otg_softc *sc)
return (ENOMEM);
}
- sc->sc_bus.bdev = device_add_child(sc->sc_bus.parent, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(sc->sc_bus.parent, "usbus", DEVICE_UNIT_ANY);
if (sc->sc_bus.bdev == NULL)
return (ENXIO);
diff --git a/sys/dev/usb/controller/dwc_otg_acpi.c b/sys/dev/usb/controller/dwc_otg_acpi.c
index 9b982dfd6e41..d8deaa80e94e 100644
--- a/sys/dev/usb/controller/dwc_otg_acpi.c
+++ b/sys/dev/usb/controller/dwc_otg_acpi.c
@@ -25,7 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_acpi.h"
#include <sys/param.h>
@@ -127,9 +126,12 @@ static int
dwc_otg_detach(device_t dev)
{
struct dwc_otg_softc *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/dwc_otg_fdt.c b/sys/dev/usb/controller/dwc_otg_fdt.c
index ea46494df8d9..2ed94b23212c 100644
--- a/sys/dev/usb/controller/dwc_otg_fdt.c
+++ b/sys/dev/usb/controller/dwc_otg_fdt.c
@@ -140,10 +140,6 @@ dwc_otg_attach(device_t dev)
if (sc->sc_otg.sc_irq_res == NULL)
goto error;
- sc->sc_otg.sc_bus.bdev = device_add_child(dev, "usbus", -1);
- if (sc->sc_otg.sc_bus.bdev == NULL)
- goto error;
-
err = dwc_otg_init(&sc->sc_otg);
if (err == 0) {
err = device_probe_and_attach(sc->sc_otg.sc_bus.bdev);
@@ -162,9 +158,12 @@ int
dwc_otg_detach(device_t dev)
{
struct dwc_otg_fdt_softc *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/ehci_fsl.c b/sys/dev/usb/controller/ehci_fsl.c
index 668a5b44e4c3..ce1749775ab2 100644
--- a/sys/dev/usb/controller/ehci_fsl.c
+++ b/sys/dev/usb/controller/ehci_fsl.c
@@ -26,7 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
@@ -306,7 +305,7 @@ fsl_ehci_attach(device_t self)
}
/* Add USB device */
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
err = fsl_ehci_detach(self);
@@ -372,10 +371,14 @@ fsl_ehci_attach(device_t self)
static int
fsl_ehci_detach(device_t self)
{
-
int err;
ehci_softc_t *sc;
+ /* During module unload there are lots of children leftover */
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
+
sc = device_get_softc(self);
/*
* only call ehci_detach() after ehci_init()
@@ -399,14 +402,6 @@ fsl_ehci_detach(device_t self)
sc->sc_intr_hdl = NULL;
}
- if (sc->sc_bus.bdev) {
- device_delete_child(self, sc->sc_bus.bdev);
- sc->sc_bus.bdev = NULL;
- }
-
- /* During module unload there are lots of children leftover */
- device_delete_children(self);
-
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
sc->sc_irq_res = NULL;
diff --git a/sys/dev/usb/controller/ehci_imx.c b/sys/dev/usb/controller/ehci_imx.c
index 1fa2d1dab737..149b26f04760 100644
--- a/sys/dev/usb/controller/ehci_imx.c
+++ b/sys/dev/usb/controller/ehci_imx.c
@@ -31,7 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
/*
* EHCI driver for Freescale i.MX SoCs which incorporate the USBOH3 controller.
*/
@@ -314,7 +313,7 @@ imx_ehci_detach(device_t dev)
esc = &sc->ehci_softc;
/* First detach all children; we can't detach if that fails. */
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
@@ -438,7 +437,7 @@ imx_ehci_attach(device_t dev)
imx_ehci_disable_oc(sc);
/* Add USB bus device. */
- esc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ esc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (esc->sc_bus.bdev == NULL) {
device_printf(dev, "Could not add USB device\n");
goto out;
diff --git a/sys/dev/usb/controller/ehci_msm.c b/sys/dev/usb/controller/ehci_msm.c
index 37e330fd6ea7..2586df634b3c 100644
--- a/sys/dev/usb/controller/ehci_msm.c
+++ b/sys/dev/usb/controller/ehci_msm.c
@@ -31,7 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
@@ -125,7 +124,7 @@ ehci_msm_attach(device_t dev)
panic("%s: unable to subregion USB host registers",
device_get_name(dev));
- sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(dev, "Could not add USB device\n");
goto error;
@@ -171,13 +170,9 @@ ehci_msm_detach(device_t dev)
sc = device_get_softc(dev);
- if (sc->sc_bus.bdev) {
- bdev = sc->sc_bus.bdev;
- device_detach(bdev);
- device_delete_child(dev, bdev);
- }
-
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/* only call ehci_detach() after ehci_init() */
diff --git a/sys/dev/usb/controller/ehci_mv.c b/sys/dev/usb/controller/ehci_mv.c
index b5096e5f2fb6..5dc72d4af3d8 100644
--- a/sys/dev/usb/controller/ehci_mv.c
+++ b/sys/dev/usb/controller/ehci_mv.c
@@ -35,7 +35,6 @@
* FDT attachment driver for the USB Enhanced Host Controller.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/stdint.h>
@@ -213,7 +212,7 @@ mv_ehci_attach(device_t self)
goto error;
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -283,7 +282,9 @@ mv_ehci_detach(device_t self)
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
/*
* disable interrupts that might have been switched on in mv_ehci_attach
diff --git a/sys/dev/usb/controller/ehci_pci.c b/sys/dev/usb/controller/ehci_pci.c
index 2aa0cd2fbcd8..d7298ab89df7 100644
--- a/sys/dev/usb/controller/ehci_pci.c
+++ b/sys/dev/usb/controller/ehci_pci.c
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
/*
* USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller.
*
@@ -360,7 +359,7 @@ ehci_pci_attach(device_t self)
device_printf(self, "Could not allocate irq\n");
goto error;
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -505,9 +504,12 @@ static int
ehci_pci_detach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
pci_disable_busmaster(self);
diff --git a/sys/dev/usb/controller/generic_ehci.c b/sys/dev/usb/controller/generic_ehci.c
index 471ce72776d4..bd7dc32b1ea8 100644
--- a/sys/dev/usb/controller/generic_ehci.c
+++ b/sys/dev/usb/controller/generic_ehci.c
@@ -32,7 +32,6 @@
* Generic EHCI driver based on the Allwinner A10 EHCI driver
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
@@ -100,7 +99,7 @@ generic_ehci_attach(device_t self)
device_printf(self, "Could not allocate irq\n");
goto error;
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -139,7 +138,9 @@ generic_ehci_detach(device_t self)
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/generic_ehci_acpi.c b/sys/dev/usb/controller/generic_ehci_acpi.c
index f565590fa09a..d947215ad355 100644
--- a/sys/dev/usb/controller/generic_ehci_acpi.c
+++ b/sys/dev/usb/controller/generic_ehci_acpi.c
@@ -28,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
diff --git a/sys/dev/usb/controller/generic_ehci_fdt.c b/sys/dev/usb/controller/generic_ehci_fdt.c
index af22d0bdef73..df2dc7fba4b9 100644
--- a/sys/dev/usb/controller/generic_ehci_fdt.c
+++ b/sys/dev/usb/controller/generic_ehci_fdt.c
@@ -28,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
diff --git a/sys/dev/usb/controller/generic_ohci.c b/sys/dev/usb/controller/generic_ohci.c
index f3a9e0481bb2..5c0de59074d2 100644
--- a/sys/dev/usb/controller/generic_ohci.c
+++ b/sys/dev/usb/controller/generic_ohci.c
@@ -141,7 +141,7 @@ generic_ohci_attach(device_t dev)
err = ENXIO;
goto error;
}
- sc->ohci_sc.sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ sc->ohci_sc.sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (sc->ohci_sc.sc_bus.bdev == 0) {
err = ENXIO;
goto error;
@@ -231,7 +231,9 @@ generic_ohci_detach(device_t dev)
struct hwrst_list *rst, *rst_tmp;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
/*
* Put the controller into reset, then disable clocks and do
diff --git a/sys/dev/usb/controller/generic_xhci.c b/sys/dev/usb/controller/generic_xhci.c
index e89d1bc84497..16bda77e043d 100644
--- a/sys/dev/usb/controller/generic_xhci.c
+++ b/sys/dev/usb/controller/generic_xhci.c
@@ -27,7 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -99,7 +98,7 @@ generic_xhci_attach(device_t dev)
return (ENXIO);
}
- sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (sc->sc_bus.bdev == NULL) {
device_printf(dev, "Failed to add USB device\n");
generic_xhci_detach(dev);
@@ -152,7 +151,9 @@ generic_xhci_detach(device_t dev)
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res != NULL && sc->sc_intr_hdl != NULL) {
err = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl);
diff --git a/sys/dev/usb/controller/generic_xhci_acpi.c b/sys/dev/usb/controller/generic_xhci_acpi.c
index 2cb5977e0cf1..e24fe1b1bcc3 100644
--- a/sys/dev/usb/controller/generic_xhci_acpi.c
+++ b/sys/dev/usb/controller/generic_xhci_acpi.c
@@ -25,7 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_acpi.h"
#include <sys/param.h>
diff --git a/sys/dev/usb/controller/generic_xhci_fdt.c b/sys/dev/usb/controller/generic_xhci_fdt.c
index 66fc1ab65a23..8aab938cbc77 100644
--- a/sys/dev/usb/controller/generic_xhci_fdt.c
+++ b/sys/dev/usb/controller/generic_xhci_fdt.c
@@ -27,7 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
diff --git a/sys/dev/usb/controller/musb_otg_allwinner.c b/sys/dev/usb/controller/musb_otg_allwinner.c
index 3bfe2b525138..781b4d7e33fa 100644
--- a/sys/dev/usb/controller/musb_otg_allwinner.c
+++ b/sys/dev/usb/controller/musb_otg_allwinner.c
@@ -77,7 +77,7 @@
#if defined(__arm__)
#define bs_parent_space(bs) ((bs)->bs_parent)
typedef bus_space_tag_t awusb_bs_tag;
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__riscv)
#define bs_parent_space(bs) (bs)
typedef void * awusb_bs_tag;
#endif
@@ -89,6 +89,7 @@ static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun6i-a31-musb", AWUSB_OKAY },
{ "allwinner,sun8i-a33-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA },
{ "allwinner,sun8i-h3-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA },
+ { "allwinner,sun20i-d1-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA },
{ NULL, 0 }
};
@@ -474,7 +475,7 @@ awusbdrd_attach(device_t dev)
#if defined(__arm__)
sc->bs.bs_parent = rman_get_bustag(sc->res[0]);
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__riscv)
sc->bs.bs_cookie = rman_get_bustag(sc->res[0]);
#endif
@@ -494,7 +495,7 @@ awusbdrd_attach(device_t dev)
sc->sc.sc_io_hdl = rman_get_bushandle(sc->res[0]);
sc->sc.sc_io_size = rman_get_size(sc->res[0]);
- sc->sc.sc_bus.bdev = device_add_child(dev, "usbus", -1);
+ sc->sc.sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
if (sc->sc.sc_bus.bdev == NULL) {
error = ENXIO;
goto fail;
@@ -561,16 +562,13 @@ static int
awusbdrd_detach(device_t dev)
{
struct awusbdrd_softc *sc;
- device_t bdev;
int error;
- sc = device_get_softc(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
- if (sc->sc.sc_bus.bdev != NULL) {
- bdev = sc->sc.sc_bus.bdev;
- device_detach(bdev);
- device_delete_child(dev, bdev);
- }
+ sc = device_get_softc(dev);
musbotg_uninit(&sc->sc);
error = bus_teardown_intr(dev, sc->res[1], sc->sc.sc_intr_hdl);
@@ -594,8 +592,6 @@ awusbdrd_detach(device_t dev)
bus_release_resources(dev, awusbdrd_spec, sc->res);
- device_delete_children(dev);
-
return (0);
}
diff --git a/sys/dev/usb/controller/ohci_pci.c b/sys/dev/usb/controller/ohci_pci.c
index 12bf55785215..0edcebcb0b38 100644
--- a/sys/dev/usb/controller/ohci_pci.c
+++ b/sys/dev/usb/controller/ohci_pci.c
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
/*
* USB Open Host Controller driver.
*
@@ -240,7 +239,7 @@ ohci_pci_attach(device_t self)
device_printf(self, "Could not allocate irq\n");
goto error;
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -320,9 +319,12 @@ static int
ohci_pci_detach(device_t self)
{
ohci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
pci_disable_busmaster(self);
diff --git a/sys/dev/usb/controller/uhci_pci.c b/sys/dev/usb/controller/uhci_pci.c
index 250e2a7b31c6..97f6d09f9e65 100644
--- a/sys/dev/usb/controller/uhci_pci.c
+++ b/sys/dev/usb/controller/uhci_pci.c
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
/* Universal Host Controller Interface
*
* UHCI spec: http://www.intel.com/
@@ -323,7 +322,7 @@ uhci_pci_attach(device_t self)
device_printf(self, "Could not allocate irq\n");
goto error;
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -414,9 +413,12 @@ int
uhci_pci_detach(device_t self)
{
uhci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
/*
* disable interrupts that might have been switched on in
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index 163ee14bd097..7e89a5ab0155 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -135,7 +135,6 @@ DRIVER_MODULE(usbus, octusb, usb_driver, 0, 0);
/* Dual Mode Drivers */
DRIVER_MODULE(usbus, dwcotg, usb_driver, 0, 0);
-DRIVER_MODULE(usbus, saf1761otg, usb_driver, 0, 0);
/*------------------------------------------------------------------------*
* usb_probe
@@ -439,7 +438,7 @@ usb_bus_detach(struct usb_proc_msg *pm)
/* detach children first */
bus_topo_lock();
- bus_generic_detach(dev);
+ bus_detach_children(dev);
bus_topo_unlock();
/*
@@ -654,8 +653,8 @@ usb_bus_cleanup(struct usb_proc_msg *pm)
bus = ((struct usb_bus_msg *)pm)->bus;
- while ((pd = LIST_FIRST(&bus->pd_cleanup_list)) != NULL) {
- LIST_REMOVE(pd, pd_next);
+ while ((pd = SLIST_FIRST(&bus->pd_cleanup_list)) != NULL) {
+ SLIST_REMOVE(&bus->pd_cleanup_list, pd, usb_fs_privdata, pd_next);
USB_BUS_UNLOCK(bus);
usb_destroy_dev_sync(pd);
@@ -848,7 +847,7 @@ usb_attach_sub(device_t dev, struct usb_bus *bus)
bus->shutdown_msg[1].bus = bus;
#if USB_HAVE_UGEN
- LIST_INIT(&bus->pd_cleanup_list);
+ SLIST_INIT(&bus->pd_cleanup_list);
bus->cleanup_msg[0].hdr.pm_callback = &usb_bus_cleanup;
bus->cleanup_msg[0].bus = bus;
bus->cleanup_msg[1].hdr.pm_callback = &usb_bus_cleanup;
diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c
index 359f14bb1e3c..b50e33ea36ce 100644
--- a/sys/dev/usb/controller/xhci_pci.c
+++ b/sys/dev/usb/controller/xhci_pci.c
@@ -25,7 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -100,6 +99,9 @@ xhci_pci_match(device_t self)
return ("AMD Starship USB 3.0 controller");
case 0x149c1022:
return ("AMD Matisse USB 3.0 controller");
+ case 0x15e01022:
+ case 0x15e11022:
+ return ("AMD Raven USB 3.1 controller");
case 0x43ba1022:
return ("AMD X399 USB 3.0 controller");
case 0x43b91022: /* X370 */
@@ -386,7 +388,7 @@ xhci_pci_attach(device_t self)
device_printf(self, "Could not allocate IRQ\n");
/* goto error; FALLTHROUGH - use polling */
}
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (sc->sc_bus.bdev == NULL) {
device_printf(self, "Could not add USB device\n");
goto error;
@@ -462,9 +464,12 @@ static int
xhci_pci_detach(device_t self)
{
struct xhci_softc *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
usb_callout_drain(&sc->sc_callout);
xhci_halt_controller(sc);
diff --git a/sys/dev/usb/controller/xlnx_dwc3.c b/sys/dev/usb/controller/xlnx_dwc3.c
index b0680db97d22..c450734e4225 100644
--- a/sys/dev/usb/controller/xlnx_dwc3.c
+++ b/sys/dev/usb/controller/xlnx_dwc3.c
@@ -29,8 +29,6 @@
* Xilinx DWC3 glue
*/
-#include <sys/cdefs.h>
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -133,7 +131,8 @@ xlnx_dwc3_attach(device_t dev)
device_probe_and_attach(cdev);
}
- return (bus_generic_attach(dev));
+ bus_attach_children(dev);
+ return (0);
}
static device_method_t xlnx_dwc3_methods[] = {