Re: [PATCH]: USB: EHCI: Do not rely on PORT_SUSPEND to stop USB resuming in ehci_bus_resume().

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

 



On Fri, 5 Aug 2011, River Wang wrote:

> Sorry for missing diffstat line.
> ---------------------------------------------------------------
> From: Wang Zhi <zhi.wang@xxxxxxxxxxxxx>
> Date: Thu, 04 Aug 2011 21:51:57 -0700
> Subject: [PATCH]: USB: EHCI: Do not rely on PORT_SUSPEND to stop USB
> resuming in ehci_bus_resume().
> 
> From EHCI Spec p.28 HC should clear PORT_SUSPEND when SW clears
> PORT_RESUME. In Intel Oaktrail platform, MPH (Multi-Port Host
> Controller) core clears PORT_SUSPEND directly when SW sets PORT_RESUME
> bit. If we rely on PORT_SUSPEND bit to stop USB resume, we will miss
> the action of clearing PORT_RESUME. This will cause unexpected long
> resume signal on USB bus.
> 
> Signed-off-by: Wang Zhi <zhi.wang@xxxxxxxxxxxxx>

Basically okay, but see below.

> ---
>  ehci-hub.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
> index ea6184b..2f6cf9b 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -343,7 +343,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
>  	u32			temp;
>  	u32			power_okay;
>  	int			i;
> -	u8			resume_needed = 0;
> +	unsigned long		resume_needed = 0;
> 
>  	if (time_before (jiffies, ehci->next_statechange))
>  		msleep(5);
> @@ -416,7 +416,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
>  		if (test_bit(i, &ehci->bus_suspended) &&
>  				(temp & PORT_SUSPEND)) {
>  			temp |= PORT_RESUME;
> -			resume_needed = 1;
> +			set_bit(i, &resume_needed);
>  		}
>  		ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
>  	}
> @@ -432,7 +432,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
>  	while (i--) {
>  		temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
>  		if (test_bit(i, &ehci->bus_suspended) &&
> -				(temp & PORT_SUSPEND)) {
> +				test_bit(i, &resume_needed)) {

You should remove the test_bit(i, &ehci->bus_suspended).  The i bit
won't be set in resume_needed if it isn't also set in bus_suspended.

>  			temp &= ~(PORT_RWC_BITS | PORT_RESUME);
>  			ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
>  			ehci_vdbg (ehci, "resumed port %d\n", i + 1);

Alan Stern

--
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