Commit 0855214a authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

musb_hdrc: Minor root hub cleanups

Minor root hub cleanups:

 - Use unaligned accessors to return status, in case usbcore passes
   a buffer that's not aligned.

 - Fix some glitching on restart (e.g. when switching gadget drivers
   while leaving the OTG-mode musb_hdrc driver loaded).
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent ea4c46f2
...@@ -2121,10 +2121,13 @@ static int musb_h_get_frame_number(struct usb_hcd *hcd) ...@@ -2121,10 +2121,13 @@ static int musb_h_get_frame_number(struct usb_hcd *hcd)
static int musb_h_start(struct usb_hcd *hcd) static int musb_h_start(struct usb_hcd *hcd)
{ {
struct musb *musb = hcd_to_musb(hcd);
/* NOTE: musb_start() is called when the hub driver turns /* NOTE: musb_start() is called when the hub driver turns
* on port power, or when (OTG) peripheral starts. * on port power, or when (OTG) peripheral starts.
*/ */
hcd->state = HC_STATE_RUNNING; hcd->state = HC_STATE_RUNNING;
musb->port1_status = 0;
return 0; return 0;
} }
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <asm/unaligned.h>
#include "musbdefs.h" #include "musbdefs.h"
...@@ -300,11 +302,11 @@ int musb_hub_control( ...@@ -300,11 +302,11 @@ int musb_hub_control(
musb->xceiv.state = OTG_STATE_A_HOST; musb->xceiv.state = OTG_STATE_A_HOST;
} }
*(__le32 *) buf = cpu_to_le32(musb->port1_status put_unaligned(cpu_to_le32(musb->port1_status & ~MUSB_PORT_STAT_RESUME),
& ~MUSB_PORT_STAT_RESUME); (__le32 *) buf);
/* port change status is more interesting */ /* port change status is more interesting */
DBG((*(u16*)(buf+2)) ? 2 : 5, "port status %08x\n", DBG(get_unaligned((u16*)(buf+2)) ? 2 : 5, "port status %08x\n",
musb->port1_status); musb->port1_status);
break; break;
case SetPortFeature: case SetPortFeature:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment