Date: Tue, 14 Oct 2008 22:22:41 +0200 From: "Attilio Rao" <attilio@freebsd.org> To: "Rafal Jaworowski" <raj@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r183866 - head/sys/dev/usb Message-ID: <3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97@mail.gmail.com> In-Reply-To: <200810140705.m9E75K3x098307@svn.freebsd.org> References: <200810140705.m9E75K3x098307@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
2008/10/14, Rafal Jaworowski <raj@freebsd.org>: > Author: raj > Date: Tue Oct 14 07:05:20 2008 > New Revision: 183866 > URL: http://svn.freebsd.org/changeset/base/183866 > > Log: > Mbus attachment for USB EHCI integrated controller on Marvell chips. > > This includes workarounds required for the ehci(4) to handle some non-standard > behaviour of these devices. > > Obtained from: Marvell, Semihalf > > Added: > head/sys/dev/usb/ehci_mbus.c (contents, props changed) > Modified: > head/sys/dev/usb/ehci.c > head/sys/dev/usb/ehcivar.h > > Modified: head/sys/dev/usb/ehci.c > ============================================================================== > --- head/sys/dev/usb/ehci.c Tue Oct 14 04:09:33 2008 (r183865) > +++ head/sys/dev/usb/ehci.c Tue Oct 14 07:05:20 2008 (r183866) > @@ -351,8 +351,12 @@ ehci_hcreset(ehci_softc_t *sc) > for (i = 0; i < 100; i++) { > usb_delay_ms(&sc->sc_bus, 1); > hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET; > - if (!hcr) > + if (!hcr) { > + if (sc->sc_flags & EHCI_SCFLG_SETMODE) > + EOWRITE4(sc, 0x68, 0x3); > + > return (USBD_NORMAL_COMPLETION); > + } > } > printf("%s: reset timeout\n", device_get_nameunit(sc->sc_bus.bdev)); > return (USBD_IOERROR); > @@ -2194,7 +2198,18 @@ ehci_root_ctrl_start(usbd_xfer_handle xf > v = EOREAD4(sc, EHCI_PORTSC(index)); > DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n", > v)); > + > i = UPS_HIGH_SPEED; > + > + if (sc->sc_flags & EHCI_SCFLG_FORCESPEED) { > + if ((v & 0xc000000) == 0x8000000) > + i = UPS_HIGH_SPEED; > + else if ((v & 0xc000000) == 0x4000000) > + i = UPS_LOW_SPEED; > + else > + i = 0; > + } > + > if (v & EHCI_PS_CS) i |= UPS_CURRENT_CONNECT_STATUS; > if (v & EHCI_PS_PE) i |= UPS_PORT_ENABLED; > if (v & EHCI_PS_SUSP) i |= UPS_SUSPEND; > @@ -2249,7 +2264,11 @@ ehci_root_ctrl_start(usbd_xfer_handle xf > goto ret; > } > /* Terminate reset sequence. */ > - EOWRITE4(sc, port, v); > + if (sc->sc_flags & EHCI_SCFLG_NORESTERM) > + ; > + else > + EOWRITE4(sc, port, v); > + > /* Wait for HC to complete reset. */ > usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE); > if (sc->sc_dying) { > > Added: head/sys/dev/usb/ehci_mbus.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/usb/ehci_mbus.c Tue Oct 14 07:05:20 2008 (r183866) > @@ -0,0 +1,318 @@ > +/*- > + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. > + * All rights reserved. > + * > + * Developed by Semihalf. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. Neither the name of MARVELL nor the names of contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +/* > + * MBus attachment driver for the USB Enhanced Host Controller. > + */ > + > +#include <sys/cdefs.h> > +__FBSDID("$FreeBSD$"); > + > +#include "opt_bus.h" > + > +#include <sys/param.h> > +#include <sys/systm.h> > +#include <sys/kernel.h> > +#include <sys/module.h> > +#include <sys/lock.h> > +#include <sys/mutex.h> > +#include <sys/bus.h> > +#include <sys/queue.h> > +#include <sys/lockmgr.h> Why this includes lockmgr? I don't think it needs. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97>