Re: [PATCH] EHCI: only power off port if over-current is active

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

 



On Tue, 5 Jul 2011, Sergei Shtylyov wrote:

> MAX4967 USB power supply chip we use on our boards signals over-current when
> power is not enabled; once it's enabled, over-current signal returns to normal.
> That unfortunately causes the endless stream of "over-current change on port"
> messages. The EHCI root hub code reacts on every over-current signal change
> with powering off the port -- such change event is generated the moment the
> port power is enabled, so once enabled the power is immediately cut off.
> I think we should only cut off power only when we're seeing the active over-
> current signal, so I'm adding such check to that code. I also think that the
> fact that we shut off the port power should be reflected in the result of
> GetPortStatus() immediately, hence I'm also changing the place where the
> PORT_POWER bit is cleared...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxx
> 
> ---
> The patch is against the 'usb-linus' branch of Greg KH's usb-2.6.git...
> 
>  drivers/usb/host/ehci-hub.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Index: usb-2.6/drivers/usb/host/ehci-hub.c
> ===================================================================
> --- usb-2.6.orig/drivers/usb/host/ehci-hub.c
> +++ usb-2.6/drivers/usb/host/ehci-hub.c
> @@ -891,10 +891,10 @@ static int ehci_hub_control (
>  			 * power switching; they're allowed to just limit the
>  			 * current.  khubd will turn the power back on.
>  			 */
> -			if (HCS_PPC (ehci->hcs_params)){
> -				ehci_writel(ehci,
> -					temp & ~(PORT_RWC_BITS | PORT_POWER),
> -					status_reg);
> +			if ((temp & PORT_OC) && HCS_PPC(ehci->hcs_params)) {
> +				temp &= ~PORT_POWER;
> +				ehci_writel(ehci, temp & ~PORT_RWC_BITS,
> +					    status_reg);
>  			}
>  		}

Instead of removing the PORT_POWER bit from temp, how about re-reading 
temp from the register after turning off the power?  That way the final 
port status value will be consistent.

Otherwise this seems okay.

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