lkml.org 
[lkml]   [2013]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 1/3] usb: musb: core: added musb_restart() API to handle babble condition
Date
Added musb_restart() API, used for restart of the musb controller by
the glue layer, when there is babble condition occured on the bus.

During babble condition, the musb controller will remove the session
and no longer in host-mode. As part of recovery this API can be used
to restart the musb controller.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
drivers/usb/musb/musb_core.c | 24 ++++++++++++++++++++++++
drivers/usb/musb/musb_core.h | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 37a261a..ab6fa39 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1373,6 +1373,30 @@ static int ep_config_from_hw(struct musb *musb)
return 0;
}

+/*
+ * musb_restart - restarts musb controller
+ * @param musb the controller
+ */
+int musb_restart(struct musb *musb)
+{
+ int status = 0;
+
+ /* during babble condition the musb controller removes the
+ * session bit and the fifo table initialized value get changed
+ */
+ if (musb->dyn_fifo)
+ status = ep_config_from_table(musb);
+ else
+ status = ep_config_from_hw(musb);
+
+ /* starts session */
+ if (!status)
+ musb_start(musb);
+
+ return status;
+}
+EXPORT_SYMBOL_GPL(musb_restart);
+
enum { MUSB_CONTROLLER_MHDRC, MUSB_CONTROLLER_HDRC, };

/* Initialize MUSB (M)HDRC part of the USB hardware subsystem;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 7fb4819..f96e899 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -522,6 +522,7 @@ extern const char musb_driver_name[];

extern void musb_start(struct musb *musb);
extern void musb_stop(struct musb *musb);
+extern int musb_restart(struct musb *musb);

extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src);
extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst);
--
1.7.0.4


\
 
 \ /
  Last update: 2013-05-29 15:41    [W:0.062 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site