Re: [PATCH] usb: ehci: fix port power enable when override present

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

 



On Mon, 5 Jan 2015, Lucas Stach wrote:

> Some controllers need to have external power supplied before toggling
> the internal PORT_POWER bit.
> 
> Fixes: 11a7e5940514 (usb: ehci: add ehci_port_power interface) on i.MX51
> where the controller would hang the machine when trying to enable PORT_POWER.
> 
> Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx [3.18+]
> ---
>  drivers/usb/host/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 118edb7bdca2..aad5b3b32d0e 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -1306,13 +1306,13 @@ static int ehci_port_power(struct ehci_hcd *ehci, int portnum, bool enable)
>  	u32 __iomem *status_reg = &ehci->regs->port_status[portnum];
>  	u32 temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS;
>  
> +	if (hcd->driver->port_power)
> +			hcd->driver->port_power(hcd, portnum, enable);
> +
>  	if (enable)
>  		ehci_writel(ehci, temp | PORT_POWER, status_reg);
>  	else
>  		ehci_writel(ehci, temp & ~PORT_POWER, status_reg);
>  
> -	if (hcd->driver->port_power)
> -		hcd->driver->port_power(hcd, portnum, enable);
> -
>  	return 0;
>  }

This comment may not be relevant any more, but...

It seems to me that what you really want to do is call the driver's 
override routine _before_ turning _on_ the PORT_POWER bit and _after_ 
turning that bit _off_.

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