Date: Mon, 25 Aug 2008 20:51:37 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 148445 for review Message-ID: <200808252051.m7PKpboZ003303@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148445 Change 148445 by hselasky@hselasky_laptop001 on 2008/08/25 20:51:01 Various bugfixes and improvements. 1) xfer->udev is not initialised during transfer setup. 2) Improvements to musbotg driver. It is almost working. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#9 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#6 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.h#2 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg_atmelarm.c#2 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#8 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#9 (text+ko) ==== @@ -2405,7 +2405,7 @@ if (ntd) { ep_no = xfer->endpoint & UE_ADDR; - at91dci_get_hw_ep_profile(xfer->udev, &pf, ep_no); + at91dci_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { /* should not happen */ ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#6 (text+ko) ==== @@ -99,7 +99,7 @@ /* * Here is a configuration that the chip supports. */ -static const struct usb2_hw_ep_profile musbotg_ep_profile[2] = { +static const struct usb2_hw_ep_profile musbotg_ep_profile[4] = { [0] = { .max_frame_size = 64, /* fixed */ @@ -117,6 +117,27 @@ .support_in = 1, .support_out = 1, }, + + + [2] = { + .max_frame_size = (3 * 1024), + .is_simplex = 1, /* simplex */ + .support_multi_buffer = 1, + .support_bulk = 1, + .support_interrupt = 1, + .support_isochronous = 1, + .support_in = 1, + }, + + [3] = { + .max_frame_size = (3 * 1024), + .is_simplex = 1, /* simplex */ + .support_multi_buffer = 1, + .support_bulk = 1, + .support_interrupt = 1, + .support_isochronous = 1, + .support_out = 1, + }, }; static void @@ -127,14 +148,18 @@ sc = MUSBOTG_BUS2SC(udev->bus); - if (ep_addr <= sc->sc_ep_max) { - if (ep_addr == 0) { - /* control endpoint */ - *ppf = musbotg_ep_profile; - } else { - /* non-control endpoints */ - *ppf = musbotg_ep_profile + 1; - } + if (ep_addr == 0) { + /* control endpoint */ + *ppf = musbotg_ep_profile; + } else if (ep_addr <= sc->sc_ep_max) { + /* non-control duplex endpoints */ + *ppf = musbotg_ep_profile + 1; + } else if (ep_addr <= sc->sc_ep_tx_max) { + /* non-control simplex TX endpoints */ + *ppf = musbotg_ep_profile + 2; + } else if (ep_addr <= sc->sc_ep_rx_max) { + /* non-control simplex RX endpoints */ + *ppf = musbotg_ep_profile + 3; } else { *ppf = NULL; } @@ -497,7 +522,7 @@ td->error = 1; return (0); /* complete */ } - if (!(csr & MUSB2_MASK_CSR0L_TXPKTRDY)) { + if (csr & MUSB2_MASK_CSR0L_TXPKTRDY) { return (1); /* not complete */ } count = td->max_frame_size; @@ -874,12 +899,19 @@ else sc->sc_flags.status_high_speed = 0; - temp = MUSB2_READ_1(sc, MUSB2_REG_INTUSBE); + /* + * After reset all interrupts are on and we need to + * turn them off! + */ + temp = MUSB2_MASK_IRESET; /* disable resume interrupt */ temp &= ~MUSB2_MASK_IRESUME; /* enable suspend interrupt */ temp |= MUSB2_MASK_ISUSP; MUSB2_WRITE_1(sc, MUSB2_REG_INTUSBE, temp); + /* disable TX and RX interrupts */ + MUSB2_WRITE_2(sc, MUSB2_REG_INTTXE, 0); + MUSB2_WRITE_2(sc, MUSB2_REG_INTRXE, 0); } /* * If RXRSM and RXSUSP is set at the same time we interpret @@ -1564,9 +1596,13 @@ ntx = (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + /* these numbers exclude the control endpoint */ + DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); sc->sc_ep_max = (nrx < ntx) ? nrx : ntx; + sc->sc_ep_rx_max = nrx; + sc->sc_ep_tx_max = ntx; /* read out configuration data */ @@ -2541,7 +2577,7 @@ if (ntd) { ep_no = xfer->endpoint & UE_ADDR; - musbotg_get_hw_ep_profile(xfer->udev, &pf, ep_no); + musbotg_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { /* should not happen */ @@ -2566,8 +2602,7 @@ /* init TD */ td->max_frame_size = xfer->max_frame_size; - td->ep_no = - (xfer->pipe->edesc->bEndpointAddress & UE_ADDR); + td->ep_no = ep_no; td->obj_next = last_obj; last_obj = td; ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.h#2 (text+ko) ==== @@ -365,7 +365,11 @@ void (*sc_clocks_off) (void *arg); void *sc_clocks_arg; - uint8_t sc_ep_max; /* maximum number of endpoints */ + uint8_t sc_ep_max; /* maximum number of duplex endpoints */ + uint8_t sc_ep_rx_max; /* maximum number of simplex RX + * endpoints */ + uint8_t sc_ep_tx_max; /* maximum number of simplex TX + * endpoints */ uint8_t sc_rt_addr; /* root HUB address */ uint8_t sc_dv_addr; /* device address */ uint8_t sc_conf; /* root HUB config */ ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg_atmelarm.c#2 (text+ko) ==== @@ -52,7 +52,7 @@ static void musbotg_vbus_interrupt(struct musbotg_super_softc *sc) { - uint8_t vbus_val = 0; + uint8_t vbus_val = 1; /* fake VBUS on - TODO */ /* just forward it */ ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#8 (text+ko) ==== @@ -2427,7 +2427,7 @@ if (ntd) { ep_no = xfer->endpoint & UE_ADDR; - uss820dci_get_hw_ep_profile(xfer->udev, &pf, ep_no); + uss820dci_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { /* should not happen */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808252051.m7PKpboZ003303>