Index: sys/conf/files.arm64 =================================================================== --- sys/conf/files.arm64 +++ sys/conf/files.arm64 @@ -230,7 +230,9 @@ dev/uart/uart_dev_pl011.c optional uart pl011 dev/usb/controller/dwc_otg_hisi.c optional dwcotg fdt soc_hisi_hi6220 dev/usb/controller/ehci_mv.c optional ehci_mv fdt -dev/usb/controller/generic_ehci.c optional ehci acpi +dev/usb/controller/generic_ehci.c optional ehci +dev/usb/controller/generic_ehci_acpi.c optional ehci acpi +dev/usb/controller/generic_ehci_fdt.c optional ehci fdt dev/usb/controller/generic_ohci.c optional ohci fdt dev/usb/controller/generic_usb_if.m optional ohci fdt dev/usb/controller/xhci_mv.c optional xhci_mv fdt Index: sys/dev/usb/controller/generic_ehci.c =================================================================== --- sys/dev/usb/controller/generic_ehci.c +++ sys/dev/usb/controller/generic_ehci.c @@ -60,26 +60,9 @@ #include #include -#include -#include -#include - static device_attach_t generic_ehci_attach; static device_detach_t generic_ehci_detach; -static int -generic_ehci_probe(device_t self) -{ - ACPI_HANDLE h; - - if ((h = acpi_get_handle(self)) == NULL || - !acpi_MatchHid(h, "PNP0D20")) - return (ENXIO); - - device_set_desc(self, "Generic EHCI Controller"); - return (BUS_PROBE_DEFAULT); -} - static int generic_ehci_attach(device_t self) { @@ -192,7 +175,6 @@ static device_method_t ehci_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, generic_ehci_probe), DEVMETHOD(device_attach, generic_ehci_attach), DEVMETHOD(device_detach, generic_ehci_detach), DEVMETHOD(device_suspend, bus_generic_suspend), @@ -202,13 +184,8 @@ DEVMETHOD_END }; -static driver_t ehci_driver = { +driver_t ehci_driver = { .name = "ehci", .methods = ehci_methods, .size = sizeof(ehci_softc_t), }; - -static devclass_t ehci_devclass; - -DRIVER_MODULE(ehci, acpi, ehci_driver, ehci_devclass, 0, 0); -MODULE_DEPEND(ehci, usb, 1, 1, 1); Index: sys/dev/usb/controller/generic_ehci_acpi.c =================================================================== --- /dev/null +++ sys/dev/usb/controller/generic_ehci_acpi.c @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +static int +generic_ehci_acpi_probe(device_t self) +{ + ACPI_HANDLE h; + + if ((h = acpi_get_handle(self)) == NULL || + !acpi_MatchHid(h, "PNP0D20")) + return (ENXIO); + + device_set_desc(self, "Generic EHCI Controller"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t ehci_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, generic_ehci_acpi_probe), + + DEVMETHOD_END +}; + +extern driver_t ehci_driver; +DEFINE_CLASS_1(ehci, ehci_acpi_driver, ehci_acpi_methods, + sizeof(ehci_softc_t), ehci_driver); + +static devclass_t ehci_acpi_devclass; + +DRIVER_MODULE(ehci, acpi, ehci_acpi_driver, ehci_acpi_devclass, 0, 0); +MODULE_DEPEND(ehci, usb, 1, 1, 1); Index: sys/dev/usb/controller/generic_ehci_fdt.c =================================================================== --- /dev/null +++ sys/dev/usb/controller/generic_ehci_fdt.c @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +static int +generic_ehci_fdt_probe(device_t self) +{ + + if (!ofw_bus_status_okay(self)) + return (ENXIO); + + if (!ofw_bus_is_compatible(self, "generic-ehci")) + return (ENXIO); + + device_set_desc(self, "Generic EHCI Controller"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t ehci_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, generic_ehci_fdt_probe), + + DEVMETHOD_END +}; + +extern driver_t ehci_driver; +DEFINE_CLASS_1(ehci, ehci_fdt_driver, ehci_fdt_methods, + sizeof(ehci_softc_t), ehci_driver); + +static devclass_t ehci_fdt_devclass; + +DRIVER_MODULE(ehci, simplebus, ehci_fdt_driver, ehci_fdt_devclass, 0, 0); +MODULE_DEPEND(ehci, usb, 1, 1, 1);