/*
* Turn off legacy mode. Some controllers won't
* interrupt us as expected otherwise.
*/
ehcirun(ctlr, 0);
/* clear high 32 bits of address signals if it's 64 bits capable.
* This is probably not needed but it does not hurt and others do it.
*/
if((ctlr->capio->capparms & C64) != 0){
dprint("ehci: 64 bits\n");
opio->seg = 0;
}
static void
wrulpi(Eopio *opio, int port, int reg, uchar data)
{
opio->insn[5] = Control | port << Portsh | Write | reg << Regaddrsh |
data;
coherence();
/*
* this seems contrary to the skimpy documentation in the manual
* but inverting the test hangs forever.
*/
while (!(opio->insn[5] & Control))
;
}
static int
reset(Hci *hp)
{
Ctlr *ctlr;
Ecapio *capio;
Eopio *opio;
Uhh *uhh;
static int beenhere;
ctlr = smalloc(sizeof(Ctlr));
/*
* don't bother with vmap; i/o space is all mapped anyway,
* and a size less than 1MB will blow an assertion in mmukmap.
*/
ctlr->capio = capio = (Ecapio *)PHYSEHCI;
ctlr->opio = opio = (Eopio*)((uintptr)capio + (capio->cap & 0xff));
/* omap35-specific set up */
/* bit 5 `must be set to 1 for proper behavior', spruf98d §23.2.6.7.17 */
opio->insn[4] |= 1<<5;
coherence();
/* insn[5] is for both utmi and ulpi, depending on hostconfig mode */
uhh = (Uhh *)PHYSUHH;
if (uhh->hostconfig & P1ulpi_bypass) { /* utmi port 1 active */
/* not doing this */
iprint("usbehci: bypassing ulpi on port 1!\n");
opio->insn[5] &= ~(MASK(4) << 13);
opio->insn[5] |= 1 << 13; /* select port 1 */
coherence();
} else { /* ulpi port 1 active */
/* TODO may need to reset gpio port2 here */