From owner-p4-projects@FreeBSD.ORG Mon Aug 25 20:51:38 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C62131065682; Mon, 25 Aug 2008 20:51:37 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A27D106567E for ; Mon, 25 Aug 2008 20:51:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6BD118FC32 for ; Mon, 25 Aug 2008 20:51:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7PKpbUh003305 for ; Mon, 25 Aug 2008 20:51:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7PKpboZ003303 for perforce@freebsd.org; Mon, 25 Aug 2008 20:51:37 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 25 Aug 2008 20:51:37 GMT Message-Id: <200808252051.m7PKpboZ003303@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 148445 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Aug 2008 20:51:38 -0000 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 */