* [PATCH] Fix mis-reporting USB Mode on sysfs
@ 2007-05-03 19:44 Felipe Balbi
2007-05-03 20:11 ` Tony Lindgren
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2007-05-03 19:44 UTC (permalink / raw)
To: Linux-OMAP
This small patch fixes the mode reporting on sysfs.
Whithout this, we will always see the device as in
otg mode.
Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
---
drivers/usb/musb/tusb6010.c | 24 ++++++++----------------
1 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index d9113b0..a94555e 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -417,19 +417,14 @@ void musb_platform_set_mode(struct musb *musb,
u8 musb_mode)
u32 otg_stat, phy_otg_ena, phy_otg_ctrl, dev_conf;
int vbus = 0;
- if (musb->board_mode != MUSB_OTG) {
- ERR("Changing mode currently only supported in OTG mode\n");
- return;
- }
-
otg_stat = musb_readl(base, TUSB_DEV_OTG_STAT);
phy_otg_ena = musb_readl(base, TUSB_PHY_OTG_CTRL_ENABLE);
phy_otg_ctrl = musb_readl(base, TUSB_PHY_OTG_CTRL);
dev_conf = musb_readl(base, TUSB_DEV_CONF);
+#ifdef CONFIG_USB_MUSB_OTG
switch (musb_mode) {
-#ifdef CONFIG_USB_MUSB_HDRC_HCD
case MUSB_HOST: /* Disable PHY ID detect, ground ID */
if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
ERR("Already in host mode otg_stat: %08x\n", otg_stat);
@@ -440,10 +435,8 @@ void musb_platform_set_mode(struct musb *musb, u8
musb_mode)
dev_conf |= TUSB_DEV_CONF_ID_SEL;
dev_conf &= ~TUSB_DEV_CONF_SOFT_ID;
vbus = 1;
+ musb->board_mode = MUSB_HOST;
break;
-#endif
-
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */
if (otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS) {
ERR("Already in peripheral mode otg_stat: %08x\n",
@@ -453,16 +446,15 @@ void musb_platform_set_mode(struct musb *musb,
u8 musb_mode)
phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID);
+ musb->board_mode = MUSB_PERIPHERAL;
break;
-#endif
-#ifdef CONFIG_USB_MUSB_OTG
case MUSB_OTG: /* Use PHY ID detection */
phy_otg_ena &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID);
+ musb->board_mode = MUSB_OTG;
break;
-#endif
default:
DBG(2, "Trying to set unknown mode %i\n", musb_mode);
@@ -476,10 +468,10 @@ void musb_platform_set_mode(struct musb *musb,
u8 musb_mode)
msleep(1);
otg_stat = musb_readl(base, TUSB_DEV_OTG_STAT);
- if ((musb_mode == MUSB_PERIPHERAL) &&
- !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS))
- ERR("Cannot be peripheral with mini-A cable "
- "otg_stat: %08x\n", otg_stat);
+#else
+ ERR("Changing mode currently only supported in OTG mode\n");
+ return;
+#endif
}
--
Best Regards,
Felipe Balbi
felipebalbi@users.sourceforge.net
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix mis-reporting USB Mode on sysfs
2007-05-03 19:44 [PATCH] Fix mis-reporting USB Mode on sysfs Felipe Balbi
@ 2007-05-03 20:11 ` Tony Lindgren
2007-05-04 6:02 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2007-05-03 20:11 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Linux-OMAP
* Felipe Balbi <felipebalbi@users.sourceforge.net> [070503 19:45]:
> This small patch fixes the mode reporting on sysfs.
> Whithout this, we will always see the device as in
> otg mode.
Hmmm, it should not be necessary to change the mode here as if the
mode changes, the interrupt should set it correctly.
Maybe should have some additional modes though:
host
peripheral
otg_host
otg_peripheral
I guess host and peripheral should be possible to compile in without
OTG eventually. And if just say otg, we don't know if it's currently
host or peripheral.
Tony
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix mis-reporting USB Mode on sysfs
2007-05-03 20:11 ` Tony Lindgren
@ 2007-05-04 6:02 ` Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2007-05-04 6:02 UTC (permalink / raw)
To: ext Tony Lindgren; +Cc: Linux-OMAP
On Thu, May 03, 2007 at 08:11:59PM +0000, ext Tony Lindgren wrote:
> * Felipe Balbi <felipebalbi@users.sourceforge.net> [070503 19:45]:
> > This small patch fixes the mode reporting on sysfs.
> > Whithout this, we will always see the device as in
> > otg mode.
>
> Hmmm, it should not be necessary to change the mode here as if the
> mode changes, the interrupt should set it correctly.
>
> Maybe should have some additional modes though:
>
> host
> peripheral
> otg_host
> otg_peripheral
yeah, tought about it but didn't wanna change so much the current code.
anyway, i'll check this and provide a better patch then.
>
> I guess host and peripheral should be possible to compile in without
> OTG eventually. And if just say otg, we don't know if it's currently
> host or peripheral.
>
> Tony
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
--
Best Regards,
Felipe Balbi
felipe.lima@indt.org.br
+55 92 2126-1003
Kernel Developers Team
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-04 6:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-03 19:44 [PATCH] Fix mis-reporting USB Mode on sysfs Felipe Balbi
2007-05-03 20:11 ` Tony Lindgren
2007-05-04 6:02 ` Felipe Balbi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.