From 96a274d1da950a96cb31ac1bed044e049d770980 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 24 Nov 2008 13:06:47 +0200 Subject: USB: musb: sysfs mode updates Fix three omissions in the "mode" sysfs attribute support: (a) inability to report errors; (b) no DaVinci support ... just report an error; (c) for omap2430, accepting unsupportable values The 2430 stuff is still odd.... Signed-off-by: David Brownell Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/omap2430.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers/usb/musb/omap2430.c') diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index ce6c162920f..52988a403b5 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -196,7 +196,7 @@ static int omap_set_power(struct otg_transceiver *x, unsigned mA) static int musb_platform_resume(struct musb *musb); -void musb_platform_set_mode(struct musb *musb, u8 musb_mode) +int musb_platform_set_mode(struct musb *musb, u8 musb_mode) { u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); @@ -204,15 +204,24 @@ void musb_platform_set_mode(struct musb *musb, u8 musb_mode) musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); switch (musb_mode) { +#ifdef CONFIG_USB_MUSB_HDRC_HCD case MUSB_HOST: otg_set_host(&musb->xceiv, musb->xceiv.host); break; +#endif +#ifdef CONFIG_USB_GADGET_MUSB_HDRC case MUSB_PERIPHERAL: otg_set_peripheral(&musb->xceiv, musb->xceiv.gadget); break; +#endif +#ifdef CONFIG_USB_MUSB_OTG case MUSB_OTG: break; +#endif + default: + return -EINVAL; } + return 0; } int __init musb_platform_init(struct musb *musb) -- cgit v1.2.3 From 71783e0defa16ca5abca7750df98ff8e7767bd2e Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 24 Nov 2008 13:06:49 +0200 Subject: USB: musb: minor locking fix Minor locking fix for musb_hdrc on OMAP3 and OMAP2430: don't read DEVCTL without holding the spinlock, since an IRQ could come in and corrupt things. Signed-off-by: David Brownell Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/omap2430.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb/musb/omap2430.c') diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 52988a403b5..901dffdf23b 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -58,10 +58,10 @@ static void musb_do_idle(unsigned long _musb) #endif u8 devctl; - devctl = musb_readb(musb->mregs, MUSB_DEVCTL); - spin_lock_irqsave(&musb->lock, flags); + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + switch (musb->xceiv.state) { case OTG_STATE_A_WAIT_BCON: devctl &= ~MUSB_DEVCTL_SESSION; -- cgit v1.2.3