Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Nov 2011 12:54:28 -0800
From:      mdf@FreeBSD.org
To:        Hans Petter Selasky <hselasky@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r227541 - head/sys/dev/usb/controller
Message-ID:  <CAMBSHm_Hs1rhNTb2Fp_MU0Wzkrom721oJjzDaqe8sArp6FFivg@mail.gmail.com>
In-Reply-To: <201111152048.pAFKmvNC016452@svn.freebsd.org>
References:  <201111152048.pAFKmvNC016452@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, Nov 15, 2011 at 12:48 PM, Hans Petter Selasky
<hselasky@freebsd.org> wrote:
> Author: hselasky
> Date: Tue Nov 15 20:48:57 2011
> New Revision: 227541
> URL: http://svn.freebsd.org/changeset/base/227541
>
> Log:
>  Some brands of XHCI controllers needs more time to reset.

... and since there's no guarantee that hz is 1000 or has any
particular value, most of these seem a bit spurious.

Is there some reason these functions aren't asking for a delay in
terms of milli- or microseconds, and converting to hz internally?  I
would expect a delay while waiting for hardware to have a wall-clock
time, not a time relative to hz, which has no predefined range.

Thanks,
matthew

>  Reported by:  Jan Henrik Sylvester
>  MFC after:    1 week
>
> Modified:
>  head/sys/dev/usb/controller/xhci.c
>
> Modified: head/sys/dev/usb/controller/xhci.c
> ==============================================================================
> --- head/sys/dev/usb/controller/xhci.c  Tue Nov 15 20:41:50 2011        (r227540)
> +++ head/sys/dev/usb/controller/xhci.c  Tue Nov 15 20:48:57 2011        (r227541)
> @@ -292,7 +292,7 @@ xhci_start_controller(struct xhci_softc
>        XWRITE4(sc, oper, XHCI_USBCMD, XHCI_CMD_HCRST);
>
>        for (i = 0; i != 100; i++) {
> -               usb_pause_mtx(NULL, hz / 1000);
> +               usb_pause_mtx(NULL, hz / 100);
>                temp = XREAD4(sc, oper, XHCI_USBCMD) &
>                    (XHCI_CMD_HCRST | XHCI_STS_CNR);
>                if (!temp)
> @@ -453,7 +453,7 @@ xhci_start_controller(struct xhci_softc
>            XHCI_CMD_INTE | XHCI_CMD_HSEE);
>
>        for (i = 0; i != 100; i++) {
> -               usb_pause_mtx(NULL, hz / 1000);
> +               usb_pause_mtx(NULL, hz / 100);
>                temp = XREAD4(sc, oper, XHCI_USBSTS) & XHCI_STS_HCH;
>                if (!temp)
>                        break;
> @@ -487,7 +487,7 @@ xhci_halt_controller(struct xhci_softc *
>        XWRITE4(sc, oper, XHCI_USBCMD, 0);
>
>        for (i = 0; i != 100; i++) {
> -               usb_pause_mtx(NULL, hz / 1000);
> +               usb_pause_mtx(NULL, hz / 100);
>                temp = XREAD4(sc, oper, XHCI_USBSTS) & XHCI_STS_HCH;
>                if (temp)
>                        break;
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm_Hs1rhNTb2Fp_MU0Wzkrom721oJjzDaqe8sArp6FFivg>