[Letux-kernel] [PATCH] musb: omap2430: make b_host.sh script work again

Andreas Kemnade andreas at kemnade.info
Fri Jul 29 22:15:31 CEST 2016


In 1ace8fcf607f87b48477ffbaee1d64a8b902282d some parts which are vital
for the b_host.sh script were removed, re-add them together with an entry in
the platform ops table

Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
---
 drivers/usb/musb/omap2430.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index c7ae117..44b2b3f 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -122,6 +122,29 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 		musb_readb(musb->mregs, MUSB_DEVCTL));
 }
 
+static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode)
+{
+	u8	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+
+	devctl |= MUSB_DEVCTL_SESSION;
+
+	/* this bit only works in the b_peripheral state
+	 * to start the transition to b_wait_aconn
+	 * and would normally be set through as a response
+	 * to a b_hnp_enable
+	 */
+
+	if (musb_mode == MUSB_HOST) {
+		devctl |= MUSB_DEVCTL_HR;
+		if (musb->g.is_otg)
+			musb->g.b_hnp_enable = 1;
+	} else if (musb_mode == MUSB_PERIPHERAL) {
+		devctl &= (~MUSB_DEVCTL_HR);
+	}
+	musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+	return 0;
+}
+
 static inline void omap2430_low_level_exit(struct musb *musb)
 {
 	u32 l;
@@ -449,7 +472,7 @@ static const struct musb_platform_ops omap2430_ops = {
 	.exit		= omap2430_musb_exit,
 
 	.set_vbus	= omap2430_musb_set_vbus,
-
+	.set_mode	= omap2430_musb_set_mode,
 	.enable		= omap2430_musb_enable,
 	.disable	= omap2430_musb_disable,
 
-- 
2.1.4



More information about the Letux-kernel mailing list