Dear all,

when configuring our platform (DM8148 based) to work with USB0 as device and USB1 as host I've found some problems. It was fine if I configure both as device or both as host or enable only one port, but configure both in different modes lead to a not working configuration. After a bit of debug I've found that probably the problem is inside ti81xx_musb_set_mode() because this configure the controller but does not set musb->board_mode. IIUC, without setting this structure the whole musb generic state machine does not work correctly.

Attached you can find the patch that fixed the problem on our board. I hope this can help others too and can be integrated inside the main tree.

Feel free to comment and tell me if I've done something wrong.

I hope the the patch format is quite correct for you.

Best Regards,


--

Andrea SCIAN
>From d88b38b52d6561e8cee40cb7726fd4dc099fb07f Mon Sep 17 00:00:00 2001
From: Andrea Scian <[email protected]>
Date: Mon, 18 Jun 2012 16:17:28 +0200
Subject: [PATCH] set board_mode too when forcing musb mode, in this way musb is 
initialized
 properly

---
 drivers/usb/musb/ti81xx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/ti81xx.c b/drivers/usb/musb/ti81xx.c
index 22390e7..3656c74 100644
--- a/drivers/usb/musb/ti81xx.c
+++ b/drivers/usb/musb/ti81xx.c
@@ -1011,6 +1011,7 @@ int ti81xx_musb_set_mode(struct musb *musb, u8 musb_mode)
 
        /* TODO: implement this using CONF0 */
        if (musb_mode == MUSB_HOST) {
+               musb->board_mode = MUSB_HOST;
                regval = musb_readl(reg_base, USB_MODE_REG);
 
                regval &= ~USBMODE_USBID_HIGH;
@@ -1023,6 +1024,7 @@ int ti81xx_musb_set_mode(struct musb *musb, u8 musb_mode)
                        musb_readl(reg_base, USB_MODE_REG), regval);
        } else
        if (musb_mode == MUSB_PERIPHERAL) {
+               musb->board_mode = MUSB_PERIPHERAL;
                /* TODO commmented writing 8 to USB_MODE_REG device
                        mode is not working */
                regval = musb_readl(reg_base, USB_MODE_REG);
-- 
1.6.5.GIT

Reply via email to