mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb: ehci-hcd: Correct CLEAR_FEATURE code
@ 2014-10-16 12:52 Dmitry Voytik
  2014-10-21 10:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Voytik @ 2014-10-16 12:52 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Dmitry Voytik, barebox

This commit broke USB on olinuxino board:

  87b9bea USB: host: hub: Use usb_hub_power_on from U-Boot

This patch was ported from U-Boot with small changes. See discussion:
http://lists.denx.de/pipermail/u-boot/2013-May/153920.html

The root cause seems to be a missing mask and missing 'break' in
ehci-hcd.c. Fix both.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
---
 drivers/usb/host/ehci-hcd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 5624552..d2e1296 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -675,21 +675,23 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 		break;
 	case USB_REQ_CLEAR_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
 		reg = ehci_readl(status_reg);
+		reg &= ~EHCI_PS_CLEAR;
 		switch (le16_to_cpu(req->value)) {
 		case USB_PORT_FEAT_ENABLE:
 			reg &= ~EHCI_PS_PE;
 			break;
 		case USB_PORT_FEAT_C_ENABLE:
-			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_PE;
+			reg |= EHCI_PS_PEC;
 			break;
 		case USB_PORT_FEAT_POWER:
 			if (HCS_PPC(ehci_readl(&ehci->hccr->cr_hcsparams)))
-				reg = reg & ~(EHCI_PS_CLEAR | EHCI_PS_PP);
+				reg &= ~ EHCI_PS_PP;
+			break;
 		case USB_PORT_FEAT_C_CONNECTION:
-			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_CSC;
+			reg |= EHCI_PS_CSC;
 			break;
 		case USB_PORT_FEAT_OVER_CURRENT:
-			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_OCC;
+			reg |= EHCI_PS_OCC;
 			break;
 		case USB_PORT_FEAT_C_RESET:
 			ehci->portreset &= ~(1 << le16_to_cpu(req->index));
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: ehci-hcd: Correct CLEAR_FEATURE code
  2014-10-16 12:52 [PATCH] usb: ehci-hcd: Correct CLEAR_FEATURE code Dmitry Voytik
@ 2014-10-21 10:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-10-21 10:59 UTC (permalink / raw)
  To: Dmitry Voytik; +Cc: barebox

On Thu, Oct 16, 2014 at 04:52:20PM +0400, Dmitry Voytik wrote:
> This commit broke USB on olinuxino board:
> 
>   87b9bea USB: host: hub: Use usb_hub_power_on from U-Boot
> 
> This patch was ported from U-Boot with small changes. See discussion:
> http://lists.denx.de/pipermail/u-boot/2013-May/153920.html
> 
> The root cause seems to be a missing mask and missing 'break' in
> ehci-hcd.c. Fix both.
> 
> Signed-off-by: Dmitry Voytik <voytikd@gmail.com>

Applied, thanks

Sascha

> ---
>  drivers/usb/host/ehci-hcd.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 5624552..d2e1296 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -675,21 +675,23 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
>  		break;
>  	case USB_REQ_CLEAR_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
>  		reg = ehci_readl(status_reg);
> +		reg &= ~EHCI_PS_CLEAR;
>  		switch (le16_to_cpu(req->value)) {
>  		case USB_PORT_FEAT_ENABLE:
>  			reg &= ~EHCI_PS_PE;
>  			break;
>  		case USB_PORT_FEAT_C_ENABLE:
> -			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_PE;
> +			reg |= EHCI_PS_PEC;
>  			break;
>  		case USB_PORT_FEAT_POWER:
>  			if (HCS_PPC(ehci_readl(&ehci->hccr->cr_hcsparams)))
> -				reg = reg & ~(EHCI_PS_CLEAR | EHCI_PS_PP);
> +				reg &= ~ EHCI_PS_PP;
> +			break;
>  		case USB_PORT_FEAT_C_CONNECTION:
> -			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_CSC;
> +			reg |= EHCI_PS_CSC;
>  			break;
>  		case USB_PORT_FEAT_OVER_CURRENT:
> -			reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_OCC;
> +			reg |= EHCI_PS_OCC;
>  			break;
>  		case USB_PORT_FEAT_C_RESET:
>  			ehci->portreset &= ~(1 << le16_to_cpu(req->index));
> -- 
> 1.9.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-21 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16 12:52 [PATCH] usb: ehci-hcd: Correct CLEAR_FEATURE code Dmitry Voytik
2014-10-21 10:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox