xhci_mv: Move the driver to generic_xhci

Marvell XHCI is in fact generic-xhci, so move the driver and
add the compatible string.
While here, get and enable the phy if the dtb provide one.
The xhci bindings state that phys should be in a 'phys' property but
Marvell DTS uses 'usb-phy', only add support for 'usb-phy' for now.

Sponsored-by:      Rubicon Communications, LCC ("Netgate")
This commit is contained in:
manu 2019-02-27 21:04:40 +00:00
parent 069c1a1c45
commit ab251adb8b
3 changed files with 17 additions and 2 deletions

View File

@ -196,7 +196,6 @@ device ohci # OHCI USB interface
device ehci # EHCI USB interface (USB 2.0)
device ehci_mv # Marvell EHCI USB interface
device xhci # XHCI PCI->USB interface (USB 3.0)
device xhci_mv # Marvell XHCI USB interface
device usb # USB Bus (required)
device ukbd # Keyboard
device umass # Disks/Mass storage - Requires scbus and da

View File

@ -233,8 +233,8 @@ dev/usb/controller/ehci_mv.c optional ehci_mv fdt
dev/usb/controller/generic_ehci.c optional ehci acpi
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
dev/usb/controller/usb_nop_xceiv.c optional fdt ext_resources
dev/usb/controller/generic_xhci.c optional xhci fdt
dev/vnic/mrml_bridge.c optional vnic fdt
dev/vnic/nic_main.c optional vnic pci
dev/vnic/nicvf_main.c optional vnic pci pci_iov

View File

@ -64,6 +64,10 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/xhci.h>
#include <dev/usb/controller/xhcireg.h>
#ifdef EXT_RESOURCES
#include <dev/extres/phy/phy.h>
#endif
#define XHCI_HC_DEVSTR "Marvell Integrated USB 3.0 controller"
#define XHCI_HC_VENDOR "Marvell"
@ -76,6 +80,7 @@ static struct ofw_compat_data compat_data[] = {
{"marvell,armada-380-xhci", true},
{"marvell,armada3700-xhci", true},
{"marvell,armada-8k-xhci", true},
{"generic-xhci", true},
{NULL, false}
};
@ -99,6 +104,10 @@ xhci_attach(device_t dev)
{
struct xhci_softc *sc = device_get_softc(dev);
int err = 0, rid = 0;
#ifdef EXT_RESOURCES
phandle_t node;
phy_t phy;
#endif
sc->sc_bus.parent = dev;
sc->sc_bus.devices = sc->sc_devices;
@ -124,6 +133,13 @@ xhci_attach(device_t dev)
return (ENXIO);
}
#ifdef EXT_RESOURCES
node = ofw_bus_get_node(dev);
if (phy_get_by_ofw_property(dev, node, "usb-phy", &phy) == 0)
if (phy_enable(phy) != 0)
device_printf(dev, "Cannot enable phy\n");
#endif
sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (sc->sc_bus.bdev == NULL) {
device_printf(dev, "Failed to add USB device\n");