Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/dwc3.c
Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | snps_dwc3_attach_xhci(device_t dev) | ||||
if (err != 0) { | if (err != 0) { | ||||
device_printf(dev, "Failed to initialize USB, with error %d\n", err); | device_printf(dev, "Failed to initialize USB, with error %d\n", err); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
#if 0 | #ifdef DWC3_DEBUG | ||||
static void | static void | ||||
snsp_dwc3_dump_regs(struct snps_dwc3_softc *sc) | snsp_dwc3_dump_regs(struct snps_dwc3_softc *sc, const char *msg) | ||||
{ | { | ||||
struct xhci_softc *xsc; | |||||
uint32_t reg; | uint32_t reg; | ||||
if (!bootverbose) | |||||
return; | |||||
device_printf(sc->dev, "%s: %s:\n", __func__, msg ? msg : ""); | |||||
reg = DWC3_READ(sc, DWC3_GCTL); | reg = DWC3_READ(sc, DWC3_GCTL); | ||||
device_printf(sc->dev, "GCTL: %x\n", reg); | device_printf(sc->dev, "GCTL: %#012x\n", reg); | ||||
reg = DWC3_READ(sc, DWC3_GUCTL); | |||||
device_printf(sc->dev, "GUCTL: %#012x\n", reg); | |||||
reg = DWC3_READ(sc, DWC3_GUCTL1); | reg = DWC3_READ(sc, DWC3_GUCTL1); | ||||
device_printf(sc->dev, "GUCTL1: %x\n", reg); | device_printf(sc->dev, "GUCTL1: %#012x\n", reg); | ||||
reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); | reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); | ||||
device_printf(sc->dev, "GUSB2PHYCFG0: %x\n", reg); | device_printf(sc->dev, "GUSB2PHYCFG0: %#012x\n", reg); | ||||
reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); | reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); | ||||
device_printf(sc->dev, "GUSB3PIPECTL0: %x\n", reg); | device_printf(sc->dev, "GUSB3PIPECTL0: %#012x\n", reg); | ||||
reg = DWC3_READ(sc, DWC3_DCFG); | reg = DWC3_READ(sc, DWC3_DCFG); | ||||
device_printf(sc->dev, "DCFG: %x\n", reg); | device_printf(sc->dev, "DCFG: %#012x\n", reg); | ||||
xsc = &sc->sc; | |||||
device_printf(sc->dev, "xhci quirks: %#012x\n", xsc->sc_quirks); | |||||
} | } | ||||
#endif | #endif | ||||
#ifdef DWC3_DEBUG | #ifdef DWC3_DEBUG | ||||
static void | static void | ||||
snps_dwc3_dump_ctrlparams(struct snps_dwc3_softc *sc) | snps_dwc3_dump_ctrlparams(struct snps_dwc3_softc *sc) | ||||
{ | { | ||||
const bus_size_t offs[] = { | const bus_size_t offs[] = { | ||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | #endif | ||||
sc->node = ofw_bus_get_node(dev); | sc->node = ofw_bus_get_node(dev); | ||||
phy_get_by_ofw_name(dev, sc->node, "usb2-phy", &sc->usb2_phy); | phy_get_by_ofw_name(dev, sc->node, "usb2-phy", &sc->usb2_phy); | ||||
phy_get_by_ofw_name(dev, sc->node, "usb3-phy", &sc->usb3_phy); | phy_get_by_ofw_name(dev, sc->node, "usb3-phy", &sc->usb3_phy); | ||||
snps_dwc3_reset(sc); | snps_dwc3_reset(sc); | ||||
snps_dwc3_configure_host(sc); | snps_dwc3_configure_host(sc); | ||||
snps_dwc3_configure_phy(sc); | snps_dwc3_configure_phy(sc); | ||||
snps_dwc3_do_quirks(sc); | snps_dwc3_do_quirks(sc); | ||||
#if 0 | |||||
snsp_dwc3_dump_regs(sc); | #ifdef DWC3_DEBUG | ||||
snsp_dwc3_dump_regs(sc, "Pre XHCI init"); | |||||
#endif | #endif | ||||
snps_dwc3_attach_xhci(dev); | snps_dwc3_attach_xhci(dev); | ||||
#ifdef DWC3_DEBUG | |||||
snsp_dwc3_dump_regs(sc, "Post XHCI init"); | |||||
#endif | |||||
return (0); | return (0); | ||||
} | } | ||||
static device_method_t snps_dwc3_methods[] = { | static device_method_t snps_dwc3_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, snps_dwc3_probe), | DEVMETHOD(device_probe, snps_dwc3_probe), | ||||
DEVMETHOD(device_attach, snps_dwc3_attach), | DEVMETHOD(device_attach, snps_dwc3_attach), | ||||
Show All 12 Lines |