Re: [PATCH 6/8] xHCI: calculate HIRD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 26, 2011 at 08:37:36AM +0800, Andiry Xu wrote:
> Calculate HIRD(Host Initiated Resume Duration) in USB2 PORTPMSC based on
> the host's U2 Device Exit Latency field.
> 
> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
> ---
>  drivers/usb/host/xhci-mem.c |   17 +++++++++++++++++
>  drivers/usb/host/xhci.h     |    2 ++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 2b4cff9..83ba59b 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1927,6 +1927,21 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
>  	return 0;
>  }
>  
> +/* Calculate HIRD for USB2 PORTPMSC*/
> +static void xhci_calculate_hird(struct xhci_hcd *xhci)
> +{
> +	int u2del;
> +
> +	u2del = HCS_U2_LATENCY(xhci->hcs_params3);
> +	if (u2del <= 50)
> +		xhci->hird = 0;
> +	else
> +		xhci->hird = (u2del - 51) / 75 + 1;
> +
> +	if (xhci->hird > 15)
> +		xhci->hird = 15;
> +}
> +

Can you store the hird in microseconds instead of converting it for the
USB 2.0 port PM register format?  The USB 3.0 exit latency in the port
PM status register is going to want to use the unconverted value, so it
makes sense to move the conversion into (or into a new function above)
the hub code that turns on USB 2.0 LPM.

Also, the latest version of the 1.0 spec that I have seems to be a bit
different from what you're using to code this.  It renames the port PM
status register HIRD field to BESL, and adds some fields in a new
register, Port Hardware LPM Control Register.  It also adds some text to
section 4.23.5.1.1.1 about how to handle these fields.  I think you'll
need to revise your patchset to handle that change.  Writing to the
fourth port status register should have no effect for xHCI 1.0 hosts
that don't support it, since they should ignore those writes.

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux