Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/usb/controller/musb_otg.c
Show First 20 Lines • Show All 3,162 Lines • ▼ Show 20 Lines | musbotg_init(struct musbotg_softc *sc) | ||||
/* set default value */ | /* set default value */ | ||||
MUSB2_WRITE_1(sc, MUSB2_REG_MISC, 0); | MUSB2_WRITE_1(sc, MUSB2_REG_MISC, 0); | ||||
/* select endpoint index 0 */ | /* select endpoint index 0 */ | ||||
MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); | MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); | ||||
if (sc->sc_ep_max == 0) { | |||||
/* read out number of endpoints */ | /* read out number of endpoints */ | ||||
nrx = | nrx = | ||||
(MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); | (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); | ||||
ntx = | ntx = | ||||
(MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); | (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); | ||||
sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; | |||||
} else { | |||||
nrx = ntx = sc->sc_ep_max; | |||||
} | |||||
/* these numbers exclude the control endpoint */ | /* these numbers exclude the control endpoint */ | ||||
DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); | DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); | ||||
sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; | |||||
if (sc->sc_ep_max == 0) { | if (sc->sc_ep_max == 0) { | ||||
DPRINTFN(2, "ERROR: Looks like the clocks are off!\n"); | DPRINTFN(2, "ERROR: Looks like the clocks are off!\n"); | ||||
} | } | ||||
/* read out configuration data */ | /* read out configuration data */ | ||||
sc->sc_conf_data = MUSB2_READ_1(sc, MUSB2_REG_CONFDATA); | sc->sc_conf_data = MUSB2_READ_1(sc, MUSB2_REG_CONFDATA); | ||||
DPRINTFN(2, "Config Data: 0x%02x\n", | DPRINTFN(2, "Config Data: 0x%02x\n", | ||||
▲ Show 20 Lines • Show All 1,083 Lines • Show Last 20 Lines |