* [PATCH] Fix bootup crash for LDP platform
[not found] <1224284642-13863-1-git-send-email-vikram.pandita@ti.com>
@ 2008-10-17 23:08 ` Pandita, Vikram
2008-10-17 23:50 ` Felipe Balbi
0 siblings, 1 reply; 9+ messages in thread
From: Pandita, Vikram @ 2008-10-17 23:08 UTC (permalink / raw)
To: linux-omap@vger.kernel.org
From: Vikram Pandita <vikram.pandita@ti.com>
Fix following bootup crash on LDP platform by enabling T2 USB driver for MUSB
Backtrace:
[<c001b9ac>] (musb_platform_init+0x0/0x120) from [<c001b0a8>] (musb_probe+0x208/0xb0c)
r5:00000000 r4:c0222ad4
[<c001aea0>] (musb_probe+0x0/0xb0c) from [<c0142e80>] (platform_drv_probe+0x20/0x24)
[<c0142e60>] (platform_drv_probe+0x0/0x24) from [<c0142118>] (driver_probe_device+0xd0/0x17c)
[<c0142048>] (driver_probe_device+0x0/0x17c) from [<c0142210>] (__driver_attach+ 0x4c/0x70)
r7:c0233214 r6:c0233214 r5:c02229ec r4:c0222940
[<c01421c4>] (__driver_attach+0x0/0x70) from [<c0141790>] (bus_for_each_dev+0x4c/0x84)
r7:c0233214 r6:c01421c4 r5:c781de94 r4:00000000
[<c0141744>] (bus_for_each_dev+0x0/0x84) from [<c0141f60>] (driver_attach+0x20/0x28)
r7:c78999c0 r6:c0234c60 r5:c0233214 r4:00000000
[<c0141f40>] (driver_attach+0x0/0x28) from [<c0141c1c>] (bus_add_driver+0xa8/0x214)
[<c0141b74>] (bus_add_driver+0x0/0x214) from [<c0142404>] (driver_register+0x98/0x120)
r8:00000000 r7:00000000 r6:c0234c60 r5:c0233214 r4:c001e5c4
[<c014236c>] (driver_register+0x0/0x120) from [<c014303c>] (platform_driver_register+0x78/0x94)
[<c0142fc4>] (platform_driver_register+0x0/0x94) from [<c0143070>] (platform_driver_probe+0x18/0x68)
[<c0143058>] (platform_driver_probe+0x0/0x68) from [<c001ad38>] (musb_init+0x3c/0x54)
r5:c001e510 r4:c001e5c4
[<c001acfc>] (musb_init+0x0/0x54) from [<c0022298>] (__exception_text_end+0x50/0x168)
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
---
arch/arm/configs/omap_ldp_defconfig | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index da9146e..0acaee5 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.27-omap1
-# Fri Oct 17 14:00:54 2008
+# Fri Oct 17 17:56:45 2008
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -534,7 +534,7 @@ CONFIG_I2C_OMAP=y
# CONFIG_TPS65010 is not set
# CONFIG_SENSORS_TLV320AIC23 is not set
CONFIG_TWL4030_MADC=y
-# CONFIG_TWL4030_USB is not set
+CONFIG_TWL4030_USB=y
# CONFIG_TWL4030_PWRBUTTON is not set
# CONFIG_TWL4030_POWEROFF is not set
# CONFIG_SENSORS_MAX6875 is not set
--
1.6.0.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-17 23:08 ` [PATCH] Fix bootup crash for LDP platform Pandita, Vikram
@ 2008-10-17 23:50 ` Felipe Balbi
2008-10-18 13:56 ` Tony Lindgren
0 siblings, 1 reply; 9+ messages in thread
From: Felipe Balbi @ 2008-10-17 23:50 UTC (permalink / raw)
To: Pandita, Vikram; +Cc: linux-omap@vger.kernel.org
On Sat, Oct 18, 2008 at 04:38:04AM +0530, Pandita, Vikram wrote:
>
> From: Vikram Pandita <vikram.pandita@ti.com>
>
> Fix following bootup crash on LDP platform by enabling T2 USB driver for MUSB
>
> Backtrace:
> [<c001b9ac>] (musb_platform_init+0x0/0x120) from [<c001b0a8>] (musb_probe+0x208/0xb0c)
> r5:00000000 r4:c0222ad4
> [<c001aea0>] (musb_probe+0x0/0xb0c) from [<c0142e80>] (platform_drv_probe+0x20/0x24)
> [<c0142e60>] (platform_drv_probe+0x0/0x24) from [<c0142118>] (driver_probe_device+0xd0/0x17c)
> [<c0142048>] (driver_probe_device+0x0/0x17c) from [<c0142210>] (__driver_attach+ 0x4c/0x70)
> r7:c0233214 r6:c0233214 r5:c02229ec r4:c0222940
> [<c01421c4>] (__driver_attach+0x0/0x70) from [<c0141790>] (bus_for_each_dev+0x4c/0x84)
> r7:c0233214 r6:c01421c4 r5:c781de94 r4:00000000
> [<c0141744>] (bus_for_each_dev+0x0/0x84) from [<c0141f60>] (driver_attach+0x20/0x28)
> r7:c78999c0 r6:c0234c60 r5:c0233214 r4:00000000
> [<c0141f40>] (driver_attach+0x0/0x28) from [<c0141c1c>] (bus_add_driver+0xa8/0x214)
> [<c0141b74>] (bus_add_driver+0x0/0x214) from [<c0142404>] (driver_register+0x98/0x120)
> r8:00000000 r7:00000000 r6:c0234c60 r5:c0233214 r4:c001e5c4
> [<c014236c>] (driver_register+0x0/0x120) from [<c014303c>] (platform_driver_register+0x78/0x94)
> [<c0142fc4>] (platform_driver_register+0x0/0x94) from [<c0143070>] (platform_driver_probe+0x18/0x68)
> [<c0143058>] (platform_driver_probe+0x0/0x68) from [<c001ad38>] (musb_init+0x3c/0x54)
> r5:c001e510 r4:c001e5c4
> [<c001acfc>] (musb_init+0x0/0x54) from [<c0022298>] (__exception_text_end+0x50/0x168)
>
>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
> ---
> arch/arm/configs/omap_ldp_defconfig | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
> index da9146e..0acaee5 100644
> --- a/arch/arm/configs/omap_ldp_defconfig
> +++ b/arch/arm/configs/omap_ldp_defconfig
> @@ -1,7 +1,7 @@
> #
> # Automatically generated make config: don't edit
> # Linux kernel version: 2.6.27-omap1
> -# Fri Oct 17 14:00:54 2008
> +# Fri Oct 17 17:56:45 2008
> #
> CONFIG_ARM=y
> CONFIG_SYS_SUPPORTS_APM_EMULATION=y
> @@ -534,7 +534,7 @@ CONFIG_I2C_OMAP=y
> # CONFIG_TPS65010 is not set
> # CONFIG_SENSORS_TLV320AIC23 is not set
> CONFIG_TWL4030_MADC=y
> -# CONFIG_TWL4030_USB is not set
> +CONFIG_TWL4030_USB=y
> # CONFIG_TWL4030_PWRBUTTON is not set
> # CONFIG_TWL4030_POWEROFF is not set
> # CONFIG_SENSORS_MAX6875 is not set
> --
> 1.6.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
balbi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-17 23:50 ` Felipe Balbi
@ 2008-10-18 13:56 ` Tony Lindgren
2008-10-18 19:28 ` David Brownell
0 siblings, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2008-10-18 13:56 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Pandita, Vikram, linux-omap@vger.kernel.org
* Felipe Balbi <me@felipebalbi.com> [081017 16:50]:
> On Sat, Oct 18, 2008 at 04:38:04AM +0530, Pandita, Vikram wrote:
> >
> > From: Vikram Pandita <vikram.pandita@ti.com>
> >
> > Fix following bootup crash on LDP platform by enabling T2 USB driver for MUSB
> >
> > Backtrace:
> > [<c001b9ac>] (musb_platform_init+0x0/0x120) from [<c001b0a8>] (musb_probe+0x208/0xb0c)
> > r5:00000000 r4:c0222ad4
> > [<c001aea0>] (musb_probe+0x0/0xb0c) from [<c0142e80>] (platform_drv_probe+0x20/0x24)
> > [<c0142e60>] (platform_drv_probe+0x0/0x24) from [<c0142118>] (driver_probe_device+0xd0/0x17c)
> > [<c0142048>] (driver_probe_device+0x0/0x17c) from [<c0142210>] (__driver_attach+ 0x4c/0x70)
> > r7:c0233214 r6:c0233214 r5:c02229ec r4:c0222940
> > [<c01421c4>] (__driver_attach+0x0/0x70) from [<c0141790>] (bus_for_each_dev+0x4c/0x84)
> > r7:c0233214 r6:c01421c4 r5:c781de94 r4:00000000
> > [<c0141744>] (bus_for_each_dev+0x0/0x84) from [<c0141f60>] (driver_attach+0x20/0x28)
> > r7:c78999c0 r6:c0234c60 r5:c0233214 r4:00000000
> > [<c0141f40>] (driver_attach+0x0/0x28) from [<c0141c1c>] (bus_add_driver+0xa8/0x214)
> > [<c0141b74>] (bus_add_driver+0x0/0x214) from [<c0142404>] (driver_register+0x98/0x120)
> > r8:00000000 r7:00000000 r6:c0234c60 r5:c0233214 r4:c001e5c4
> > [<c014236c>] (driver_register+0x0/0x120) from [<c014303c>] (platform_driver_register+0x78/0x94)
> > [<c0142fc4>] (platform_driver_register+0x0/0x94) from [<c0143070>] (platform_driver_probe+0x18/0x68)
> > [<c0143058>] (platform_driver_probe+0x0/0x68) from [<c001ad38>] (musb_init+0x3c/0x54)
> > r5:c001e510 r4:c001e5c4
> > [<c001acfc>] (musb_init+0x0/0x54) from [<c0022298>] (__exception_text_end+0x50/0x168)
> >
> >
>
> Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Pushed. I hope you have a real fix for this coming from mainline soon :)
Tony
>
> > Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
> > ---
> > arch/arm/configs/omap_ldp_defconfig | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
> > index da9146e..0acaee5 100644
> > --- a/arch/arm/configs/omap_ldp_defconfig
> > +++ b/arch/arm/configs/omap_ldp_defconfig
> > @@ -1,7 +1,7 @@
> > #
> > # Automatically generated make config: don't edit
> > # Linux kernel version: 2.6.27-omap1
> > -# Fri Oct 17 14:00:54 2008
> > +# Fri Oct 17 17:56:45 2008
> > #
> > CONFIG_ARM=y
> > CONFIG_SYS_SUPPORTS_APM_EMULATION=y
> > @@ -534,7 +534,7 @@ CONFIG_I2C_OMAP=y
> > # CONFIG_TPS65010 is not set
> > # CONFIG_SENSORS_TLV320AIC23 is not set
> > CONFIG_TWL4030_MADC=y
> > -# CONFIG_TWL4030_USB is not set
> > +CONFIG_TWL4030_USB=y
> > # CONFIG_TWL4030_PWRBUTTON is not set
> > # CONFIG_TWL4030_POWEROFF is not set
> > # CONFIG_SENSORS_MAX6875 is not set
> > --
> > 1.6.0.2
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> balbi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-18 13:56 ` Tony Lindgren
@ 2008-10-18 19:28 ` David Brownell
2008-10-18 19:43 ` Felipe Balbi
0 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2008-10-18 19:28 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Felipe Balbi, Pandita, Vikram, linux-omap@vger.kernel.org
On Saturday 18 October 2008, Tony Lindgren wrote:
> Pushed. I hope you have a real fix for this coming from mainline soon :)
There's a general issue to sort out here too.
The early development of the MUSB code was on DaVinci, and
then TUSB6010, which integrate (a) an OTG transceiver, plus
(b) the OTG hardware. So musb_hdrc currently presumes it
always works that way.
However, OMAP3 (and 2430) split out (a) into the TWL4030
or TWL5030 chip, leaving (b) integral to the MUSB silicon.
But the MUSB code only accomodates that through a hack ...
in musb/omap2430.c is the line which I suspect oopsed:
musb->xceiv = *x;
So when the twl4030 transceiver support does its thing,
it does it to the original otg_transceiver struct instead
of the copy being used by the MUSB core. Wrong!!!
Partial fixup patch appended; doesn't resolve $SUBJECT
issue, I think, but it's in the right direction.
- Dave
===================
Let the otg_transceiver in MUSB be external; don't force it to be internal
any more. Newer OMAPs need it to be external.
PARTIAL AND INCOMPLETE FIX ... not build-tested except for OMAP3 boards.
Davinci and TUSB6010 should provide their own otg_transceiver struct,
and not as part of the overall "struct musb".
The transceiver is responsible for a handful of things, but in this
case most of the OTG state machine is part of the MUSB silicon not
the transceiver.
---
drivers/i2c/chips/twl4030-usb.c | 12 +++++-
drivers/usb/musb/davinci.c | 20 +++++-----
drivers/usb/musb/musb_core.c | 70 +++++++++++++++++++-------------------
drivers/usb/musb/musb_core.h | 3 +
drivers/usb/musb/musb_gadget.c | 36 ++++++++-----------
drivers/usb/musb/musb_host.c | 2 -
drivers/usb/musb/musb_virthub.c | 20 +++++-----
drivers/usb/musb/omap2430.c | 40 ++++++++-------------
drivers/usb/musb/tusb6010.c | 42 +++++++++++-----------
9 files changed, 122 insertions(+), 123 deletions(-)
--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -586,13 +586,14 @@ static int twl4030_set_peripheral(struct
struct usb_gadget *gadget)
{
struct twl4030_usb *twl;
- u32 l;
+// u32 l;
if (!x)
return -ENODEV;
twl = xceiv_to_twl(x);
+/*
if (!gadget) {
omap_writew(0, OTG_IRQ_EN);
twl4030_phy_suspend(twl, 1);
@@ -600,16 +601,19 @@ static int twl4030_set_peripheral(struct
return -ENODEV;
}
+*/
twl->otg.gadget = gadget;
+/*
twl4030_phy_resume(twl);
l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
l &= ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS);
l |= OTG_ID;
omap_writel(l, OTG_CTRL);
+*/
- twl->otg.state = OTG_STATE_B_IDLE;
+ twl->otg.state = gadget ? OTG_STATE_B_IDLE : OTG_STATE_UNDEFINED;
return 0;
}
@@ -623,6 +627,7 @@ static int twl4030_set_host(struct otg_t
twl = xceiv_to_twl(x);
+/*
if (!host) {
omap_writew(0, OTG_IRQ_EN);
twl4030_phy_suspend(twl, 1);
@@ -630,8 +635,10 @@ static int twl4030_set_host(struct otg_t
return -ENODEV;
}
+*/
twl->otg.host = host;
+/*
twl4030_phy_resume(twl);
twl4030_usb_set_bits(twl, TWL4030_OTG_CTRL,
@@ -640,6 +647,7 @@ static int twl4030_set_host(struct otg_t
twl4030_usb_set_bits(twl, FUNC_CTRL, FUNC_CTRL_SUSPENDM);
twl4030_usb_set_bits(twl, TWL4030_OTG_CTRL, TWL4030_OTG_CTRL_DRVVBUS);
+*/
return 0;
}
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -211,7 +211,7 @@ static void otg_timer(unsigned long _mus
DBG(7, "poll devctl %02x (%s)\n", devctl, otg_state_string(musb));
spin_lock_irqsave(&musb->lock, flags);
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_WAIT_VFALL:
/* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL
* seems to mis-handle session "start" otherwise (or in our
@@ -222,7 +222,7 @@ static void otg_timer(unsigned long _mus
mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
break;
}
- musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
+ musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG,
MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT);
break;
@@ -247,7 +247,7 @@ static void otg_timer(unsigned long _mus
if (devctl & MUSB_DEVCTL_BDEVICE)
mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
else
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
break;
default:
break;
@@ -327,21 +327,21 @@ static irqreturn_t davinci_interrupt(int
* to stop registering in devctl.
*/
musb->int_usb &= ~MUSB_INTR_VBUSERROR;
- musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
+ musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
WARNING("VBUS error workaround (delay coming)\n");
} else if (is_host_enabled(musb) && drvvbus) {
musb->is_active = 1;
MUSB_HST_MODE(musb);
- musb->xceiv.default_a = 1;
- musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
+ musb->xceiv->default_a = 1;
+ musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
portstate(musb->port1_status |= USB_PORT_STAT_POWER);
del_timer(&otg_workaround);
} else {
musb->is_active = 0;
MUSB_DEV_MODE(musb);
- musb->xceiv.default_a = 0;
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->default_a = 0;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
}
@@ -363,7 +363,7 @@ static irqreturn_t davinci_interrupt(int
/* poll for ID change */
if (is_otg_enabled(musb)
- && musb->xceiv.state == OTG_STATE_B_IDLE)
+ && musb->xceiv->state == OTG_STATE_B_IDLE)
mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
spin_unlock_irqrestore(&musb->lock, flags);
@@ -432,7 +432,7 @@ int musb_platform_exit(struct musb *musb
davinci_source_power(musb, 0 /*off*/, 1);
/* delay, to avoid problems with module reload */
- if (is_host_enabled(musb) && musb->xceiv.default_a) {
+ if (is_host_enabled(musb) && musb->xceiv->default_a) {
int maxdelay = 30;
u8 devctl, warn = 0;
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -266,7 +266,7 @@ void musb_load_testpacket(struct musb *m
const char *otg_state_string(struct musb *musb)
{
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_IDLE: return "a_idle";
case OTG_STATE_A_WAIT_VRISE: return "a_wait_vrise";
case OTG_STATE_A_WAIT_BCON: return "a_wait_bcon";
@@ -301,11 +301,11 @@ void musb_otg_timer_func(unsigned long d
unsigned long flags;
spin_lock_irqsave(&musb->lock, flags);
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_B_WAIT_ACON:
DBG(1, "HNP: b_wait_acon timeout; back to b_peripheral\n");
musb_g_disconnect(musb);
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
musb->is_active = 0;
break;
case OTG_STATE_A_WAIT_BCON:
@@ -330,20 +330,20 @@ void musb_hnp_stop(struct musb *musb)
void __iomem *mbase = musb->mregs;
u8 reg;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_PERIPHERAL:
case OTG_STATE_A_WAIT_VFALL:
case OTG_STATE_A_WAIT_BCON:
DBG(1, "HNP: Switching back to A-host\n");
musb_g_disconnect(musb);
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
MUSB_HST_MODE(musb);
musb->is_active = 0;
break;
case OTG_STATE_B_HOST:
DBG(1, "HNP: Disabling HR\n");
hcd->self.is_b_host = 0;
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
MUSB_DEV_MODE(musb);
reg = musb_readb(mbase, MUSB_POWER);
reg |= MUSB_POWER_SUSPENDM;
@@ -401,7 +401,7 @@ static irqreturn_t musb_stage0_irq(struc
if (devctl & MUSB_DEVCTL_HM) {
#ifdef CONFIG_USB_MUSB_HDRC_HCD
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_SUSPEND:
/* remote wakeup? later, GetPortStatus
* will stop RESUME signaling
@@ -424,12 +424,12 @@ static irqreturn_t musb_stage0_irq(struc
musb->rh_timer = jiffies
+ msecs_to_jiffies(20);
- musb->xceiv.state = OTG_STATE_A_HOST;
+ musb->xceiv->state = OTG_STATE_A_HOST;
musb->is_active = 1;
usb_hcd_resume_root_hub(musb_to_hcd(musb));
break;
case OTG_STATE_B_WAIT_ACON:
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
musb->is_active = 1;
MUSB_DEV_MODE(musb);
break;
@@ -440,11 +440,11 @@ static irqreturn_t musb_stage0_irq(struc
}
#endif
} else {
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
#ifdef CONFIG_USB_MUSB_HDRC_HCD
case OTG_STATE_A_SUSPEND:
/* possibly DISCONNECT is upcoming */
- musb->xceiv.state = OTG_STATE_A_HOST;
+ musb->xceiv->state = OTG_STATE_A_HOST;
usb_hcd_resume_root_hub(musb_to_hcd(musb));
break;
#endif
@@ -489,7 +489,7 @@ static irqreturn_t musb_stage0_irq(struc
*/
musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
musb->ep0_stage = MUSB_EP0_START;
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
MUSB_HST_MODE(musb);
musb_set_vbus(musb, 1);
@@ -515,7 +515,7 @@ static irqreturn_t musb_stage0_irq(struc
* REVISIT: do delays from lots of DEBUG_KERNEL checks
* make trouble here, keeping VBUS < 4.4V ?
*/
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_HOST:
/* recovery is dicey once we've gotten past the
* initial stages of enumeration, but if VBUS
@@ -601,11 +601,11 @@ static irqreturn_t musb_stage0_irq(struc
MUSB_HST_MODE(musb);
/* indicate new connection to OTG machine */
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_B_PERIPHERAL:
if (int_usb & MUSB_INTR_SUSPEND) {
DBG(1, "HNP: SUSPEND+CONNECT, now b_host\n");
- musb->xceiv.state = OTG_STATE_B_HOST;
+ musb->xceiv->state = OTG_STATE_B_HOST;
hcd->self.is_b_host = 1;
int_usb &= ~MUSB_INTR_SUSPEND;
} else
@@ -613,13 +613,13 @@ static irqreturn_t musb_stage0_irq(struc
break;
case OTG_STATE_B_WAIT_ACON:
DBG(1, "HNP: Waiting to switch to b_host state\n");
- musb->xceiv.state = OTG_STATE_B_HOST;
+ musb->xceiv->state = OTG_STATE_B_HOST;
hcd->self.is_b_host = 1;
break;
default:
if ((devctl & MUSB_DEVCTL_VBUS)
== (3 << MUSB_DEVCTL_VBUS_SHIFT)) {
- musb->xceiv.state = OTG_STATE_A_HOST;
+ musb->xceiv->state = OTG_STATE_A_HOST;
hcd->self.is_b_host = 0;
}
break;
@@ -649,7 +649,7 @@ static irqreturn_t musb_stage0_irq(struc
}
} else if (is_peripheral_capable()) {
DBG(1, "BUS RESET as %s\n", otg_state_string(musb));
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
#ifdef CONFIG_USB_OTG
case OTG_STATE_A_SUSPEND:
/* We need to ignore disconnect on suspend
@@ -672,12 +672,12 @@ static irqreturn_t musb_stage0_irq(struc
case OTG_STATE_B_WAIT_ACON:
DBG(1, "HNP: RESET (%s), to b_peripheral\n",
otg_state_string(musb));
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
musb_g_reset(musb);
break;
#endif
case OTG_STATE_B_IDLE:
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
/* FALLTHROUGH */
case OTG_STATE_B_PERIPHERAL:
musb_g_reset(musb);
@@ -762,7 +762,7 @@ static irqreturn_t musb_stage2_irq(struc
MUSB_MODE(musb), devctl);
handled = IRQ_HANDLED;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
#ifdef CONFIG_USB_MUSB_HDRC_HCD
case OTG_STATE_A_HOST:
case OTG_STATE_A_SUSPEND:
@@ -803,7 +803,7 @@ static irqreturn_t musb_stage2_irq(struc
otg_state_string(musb), devctl, power);
handled = IRQ_HANDLED;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
#ifdef CONFIG_USB_MUSB_OTG
case OTG_STATE_A_PERIPHERAL:
/*
@@ -815,10 +815,10 @@ static irqreturn_t musb_stage2_irq(struc
case OTG_STATE_B_PERIPHERAL:
musb_g_suspend(musb);
musb->is_active = is_otg_enabled(musb)
- && musb->xceiv.gadget->b_hnp_enable;
+ && musb->xceiv->gadget->b_hnp_enable;
if (musb->is_active) {
#ifdef CONFIG_USB_MUSB_OTG
- musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
+ musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
DBG(1, "HNP: Setting timer for b_ase0_brst\n");
musb_otg_timer.data = (unsigned long)musb;
mod_timer(&musb_otg_timer, jiffies
@@ -832,9 +832,9 @@ static irqreturn_t musb_stage2_irq(struc
+ msecs_to_jiffies(musb->a_wait_bcon));
break;
case OTG_STATE_A_HOST:
- musb->xceiv.state = OTG_STATE_A_SUSPEND;
+ musb->xceiv->state = OTG_STATE_A_SUSPEND;
musb->is_active = is_otg_enabled(musb)
- && musb->xceiv.host->b_hnp_enable;
+ && musb->xceiv->host->b_hnp_enable;
break;
case OTG_STATE_B_HOST:
/* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
@@ -1700,7 +1700,7 @@ musb_vbus_store(struct device *dev, stru
spin_lock_irqsave(&musb->lock, flags);
musb->a_wait_bcon = val;
- if (musb->xceiv.state == OTG_STATE_A_WAIT_BCON)
+ if (musb->xceiv->state == OTG_STATE_A_WAIT_BCON)
musb->is_active = 0;
musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val));
spin_unlock_irqrestore(&musb->lock, flags);
@@ -1761,8 +1761,8 @@ static void musb_irq_work(struct work_st
struct musb *musb = container_of(data, struct musb, irq_work);
static int old_state;
- if (musb->xceiv.state != old_state) {
- old_state = musb->xceiv.state;
+ if (musb->xceiv->state != old_state) {
+ old_state = musb->xceiv->state;
sysfs_notify(&musb->controller->kobj, NULL, "mode");
}
}
@@ -1857,7 +1857,7 @@ static void musb_free(struct musb *musb)
}
#ifdef CONFIG_USB_MUSB_OTG
- put_device(musb->xceiv.dev);
+ put_device(musb->xceiv->dev);
#endif
#ifdef CONFIG_USB_MUSB_HDRC_HCD
@@ -2012,7 +2012,7 @@ bad_config:
if (musb->board_mode == MUSB_OTG)
hcd->self.otg_port = 1;
- musb->xceiv.host = &hcd->self;
+ musb->xceiv->host = &hcd->self;
hcd->power_budget = 2 * (plat->power ? : 250);
}
#endif /* CONFIG_USB_MUSB_HDRC_HCD */
@@ -2023,8 +2023,8 @@ bad_config:
*/
if (!is_otg_enabled(musb) && is_host_enabled(musb)) {
MUSB_HST_MODE(musb);
- musb->xceiv.default_a = 1;
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->default_a = 1;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
if (status)
@@ -2039,8 +2039,8 @@ bad_config:
} else /* peripheral is enabled */ {
MUSB_DEV_MODE(musb);
- musb->xceiv.default_a = 0;
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->default_a = 0;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
status = musb_gadget_setup(musb);
if (status)
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -349,6 +349,7 @@ struct musb {
dma_addr_t async;
dma_addr_t sync;
void __iomem *sync_va;
+ struct otg_transceiver otg;
#endif
/* passed down from chip/board specific irq handlers */
@@ -356,7 +357,7 @@ struct musb {
u16 int_rx;
u16 int_tx;
- struct otg_transceiver xceiv;
+ struct otg_transceiver *xceiv;
int nIrq;
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1394,7 +1394,7 @@ static int musb_gadget_wakeup(struct usb
spin_lock_irqsave(&musb->lock, flags);
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_B_PERIPHERAL:
/* NOTE: OTG state machine doesn't include B_SUSPENDED;
* that's part of the standard usb 1.1 state machine, and
@@ -1496,9 +1496,9 @@ static int musb_gadget_vbus_draw(struct
{
struct musb *musb = gadget_to_musb(gadget);
- if (!musb->xceiv.set_power)
+ if (!musb->xceiv->set_power)
return -EOPNOTSUPP;
- return otg_set_power(&musb->xceiv, mA);
+ return otg_set_power(musb->xceiv, mA);
}
static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on)
@@ -1721,11 +1721,7 @@ int usb_gadget_register_driver(struct us
spin_lock_irqsave(&musb->lock, flags);
- /* REVISIT always use otg_set_peripheral(), handling
- * issues including the root hub one below ...
- */
- musb->xceiv.gadget = &musb->g;
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ otg_set_peripheral(musb->xceiv, &musb->g);
musb->is_active = 1;
/* FIXME this ignores the softconnect flag. Drivers are
@@ -1750,8 +1746,7 @@ int usb_gadget_register_driver(struct us
if (retval < 0) {
DBG(1, "add_hcd failed, %d\n", retval);
spin_lock_irqsave(&musb->lock, flags);
- musb->xceiv.gadget = NULL;
- musb->xceiv.state = OTG_STATE_UNDEFINED;
+ otg_set_peripheral(musb->xceiv, NULL);
musb->gadget_driver = NULL;
musb->g.dev.driver = NULL;
spin_unlock_irqrestore(&musb->lock, flags);
@@ -1834,8 +1829,9 @@ int usb_gadget_unregister_driver(struct
(void) musb_gadget_vbus_draw(&musb->g, 0);
- musb->xceiv.state = OTG_STATE_UNDEFINED;
+ musb->xceiv->state = OTG_STATE_UNDEFINED;
stop_activity(musb, driver);
+ otg_set_peripheral(musb->xceiv, NULL);
DBG(3, "unregistering driver %s\n", driver->function);
spin_unlock_irqrestore(&musb->lock, flags);
@@ -1871,7 +1867,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driv
void musb_g_resume(struct musb *musb)
{
musb->is_suspended = 0;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_B_IDLE:
break;
case OTG_STATE_B_WAIT_ACON:
@@ -1897,10 +1893,10 @@ void musb_g_suspend(struct musb *musb)
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
DBG(3, "devctl %02x\n", devctl);
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_B_IDLE:
if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
break;
case OTG_STATE_B_PERIPHERAL:
musb->is_suspended = 1;
@@ -1946,22 +1942,22 @@ void musb_g_disconnect(struct musb *musb
spin_lock(&musb->lock);
}
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
default:
#ifdef CONFIG_USB_MUSB_OTG
DBG(2, "Unhandled disconnect %s, setting a_idle\n",
otg_state_string(musb));
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
break;
case OTG_STATE_A_PERIPHERAL:
- musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
+ musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
break;
case OTG_STATE_B_WAIT_ACON:
case OTG_STATE_B_HOST:
#endif
case OTG_STATE_B_PERIPHERAL:
case OTG_STATE_B_IDLE:
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
break;
case OTG_STATE_B_SRP_INIT:
break;
@@ -2017,10 +2013,10 @@ __acquires(musb->lock)
* or else after HNP, as A-Device
*/
if (devctl & MUSB_DEVCTL_BDEVICE) {
- musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
musb->g.is_a_peripheral = 0;
} else if (is_otg_enabled(musb)) {
- musb->xceiv.state = OTG_STATE_A_PERIPHERAL;
+ musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
musb->g.is_a_peripheral = 1;
} else
WARN_ON(1);
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2130,7 +2130,7 @@ static int musb_bus_suspend(struct usb_h
{
struct musb *musb = hcd_to_musb(hcd);
- if (musb->xceiv.state == OTG_STATE_A_SUSPEND)
+ if (musb->xceiv->state == OTG_STATE_A_SUSPEND)
return 0;
if (is_host_active(musb) && musb->is_active) {
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -78,18 +78,18 @@ static void musb_port_suspend(struct mus
DBG(3, "Root port suspended, power %02x\n", power);
musb->port1_status |= USB_PORT_STAT_SUSPEND;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_HOST:
- musb->xceiv.state = OTG_STATE_A_SUSPEND;
+ musb->xceiv->state = OTG_STATE_A_SUSPEND;
musb->is_active = is_otg_enabled(musb)
- && musb->xceiv.host->b_hnp_enable;
+ && musb->xceiv->host->b_hnp_enable;
musb_platform_try_idle(musb, 0);
break;
#ifdef CONFIG_USB_MUSB_OTG
case OTG_STATE_B_HOST:
- musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
+ musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
musb->is_active = is_otg_enabled(musb)
- && musb->xceiv.host->b_hnp_enable;
+ && musb->xceiv->host->b_hnp_enable;
musb_platform_try_idle(musb, 0);
break;
#endif
@@ -116,7 +116,7 @@ static void musb_port_reset(struct musb
void __iomem *mbase = musb->mregs;
#ifdef CONFIG_USB_MUSB_OTG
- if (musb->xceiv.state == OTG_STATE_B_IDLE) {
+ if (musb->xceiv->state == OTG_STATE_B_IDLE) {
DBG(2, "HNP: Returning from HNP; no hub reset from b_idle\n");
musb->port1_status &= ~USB_PORT_STAT_RESET;
return;
@@ -186,14 +186,14 @@ void musb_root_disconnect(struct musb *m
usb_hcd_poll_rh_status(musb_to_hcd(musb));
musb->is_active = 0;
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_HOST:
case OTG_STATE_A_SUSPEND:
- musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+ musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
musb->is_active = 0;
break;
case OTG_STATE_A_WAIT_VFALL:
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
break;
default:
DBG(1, "host disconnect (%s)\n", otg_state_string(musb));
@@ -332,7 +332,7 @@ int musb_hub_control(
musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
usb_hcd_poll_rh_status(musb_to_hcd(musb));
/* NOTE: it might really be A_WAIT_BCON ... */
- musb->xceiv.state = OTG_STATE_A_HOST;
+ musb->xceiv->state = OTG_STATE_A_HOST;
}
put_unaligned(cpu_to_le32(musb->port1_status
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -60,17 +60,17 @@ static void musb_do_idle(unsigned long _
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
- switch (musb->xceiv.state) {
+ switch (musb->xceiv->state) {
case OTG_STATE_A_WAIT_BCON:
devctl &= ~MUSB_DEVCTL_SESSION;
musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
if (devctl & MUSB_DEVCTL_BDEVICE) {
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
MUSB_DEV_MODE(musb);
} else {
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
MUSB_HST_MODE(musb);
}
break;
@@ -88,7 +88,7 @@ static void musb_do_idle(unsigned long _
musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
usb_hcd_poll_rh_status(musb_to_hcd(musb));
/* NOTE: it might really be A_WAIT_BCON ... */
- musb->xceiv.state = OTG_STATE_A_HOST;
+ musb->xceiv->state = OTG_STATE_A_HOST;
}
break;
#endif
@@ -96,9 +96,9 @@ static void musb_do_idle(unsigned long _
case OTG_STATE_A_HOST:
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
if (devctl & MUSB_DEVCTL_BDEVICE)
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
else
- musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+ musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
#endif
default:
break;
@@ -117,7 +117,7 @@ void musb_platform_try_idle(struct musb
/* Never idle if active, or when VBUS timeout is not set as host */
if (musb->is_active || ((musb->a_wait_bcon == 0)
- && (musb->xceiv.state == OTG_STATE_A_WAIT_BCON))) {
+ && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
del_timer(&musb_idle_timer);
last_timer = jiffies;
@@ -162,8 +162,8 @@ static void omap_set_vbus(struct musb *m
if (is_on) {
musb->is_active = 1;
- musb->xceiv.default_a = 1;
- musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
+ musb->xceiv->default_a = 1;
+ musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
devctl |= MUSB_DEVCTL_SESSION;
MUSB_HST_MODE(musb);
@@ -174,8 +174,8 @@ static void omap_set_vbus(struct musb *m
* jumping right to B_IDLE...
*/
- musb->xceiv.default_a = 0;
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->xceiv->default_a = 0;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
devctl &= ~MUSB_DEVCTL_SESSION;
MUSB_DEV_MODE(musb);
@@ -187,10 +187,6 @@ static void omap_set_vbus(struct musb *m
otg_state_string(musb),
musb_readb(musb->mregs, MUSB_DEVCTL));
}
-static int omap_set_power(struct otg_transceiver *x, unsigned mA)
-{
- return 0;
-}
static int musb_platform_resume(struct musb *musb);
@@ -203,10 +199,10 @@ void musb_platform_set_mode(struct musb
switch (musb_mode) {
case MUSB_HOST:
- otg_set_host(&musb->xceiv, musb->xceiv.host);
+ otg_set_host(musb->xceiv, musb->xceiv->host);
break;
case MUSB_PERIPHERAL:
- otg_set_peripheral(&musb->xceiv, musb->xceiv.gadget);
+ otg_set_peripheral(musb->xceiv, musb->xceiv->gadget);
break;
case MUSB_OTG:
break;
@@ -222,7 +218,7 @@ int __init musb_platform_init(struct mus
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif
- musb->xceiv = *x;
+ musb->xceiv = x;
musb_platform_resume(musb);
l = omap_readl(OTG_SYSCONFIG);
@@ -249,8 +245,6 @@ int __init musb_platform_init(struct mus
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
- if (is_peripheral_enabled(musb))
- musb->xceiv.set_power = omap_set_power;
musb->a_wait_bcon = MUSB_TIMEOUT_A_WAIT_BCON;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
@@ -274,8 +268,7 @@ int musb_platform_suspend(struct musb *m
l |= ENABLEWAKEUP; /* enable wakeup */
omap_writel(l, OTG_SYSCONFIG);
- if (musb->xceiv.set_suspend)
- musb->xceiv.set_suspend(&musb->xceiv, 1);
+ otg_set_suspend(musb->xceiv, 1);
if (musb->set_clock)
musb->set_clock(musb->clock, 0);
@@ -292,8 +285,7 @@ static int musb_platform_resume(struct m
if (!musb->clock)
return 0;
- if (musb->xceiv.set_suspend)
- musb->xceiv.set_suspend(&musb->xceiv, 0);
+ otg_set_suspend(musb->xceiv, 0);
if (musb->set_clock)
musb->set_clock(musb->clock, 1);
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -270,7 +270,7 @@ void musb_read_fifo(struct musb_hw_ep *h
*/
static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
{
- struct musb *musb = container_of(x, struct musb, xceiv);
+ struct musb *musb = container_of(x, struct musb, otg);
void __iomem *tbase = musb->ctrl_base;
u32 reg;
@@ -420,7 +420,7 @@ static void musb_do_idle(unsigned long _
spin_lock_irqsave(&musb->lock, flags);
- switch (musb->xceiv.state) {
+ switch (musb->otg.state) {
case OTG_STATE_A_WAIT_BCON:
if ((musb->a_wait_bcon != 0)
&& (musb->idle_timeout == 0
@@ -484,7 +484,7 @@ void musb_platform_try_idle(struct musb
/* Never idle if active, or when VBUS timeout is not set as host */
if (musb->is_active || ((musb->a_wait_bcon == 0)
- && (musb->xceiv.state == OTG_STATE_A_WAIT_BCON))) {
+ && (musb->otg.state == OTG_STATE_A_WAIT_BCON))) {
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
del_timer(&musb_idle_timer);
last_timer = jiffies;
@@ -533,8 +533,8 @@ static void tusb_source_power(struct mus
if (musb->set_clock)
musb->set_clock(musb->clock, 1);
timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE);
- musb->xceiv.default_a = 1;
- musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
+ musb->otg.default_a = 1;
+ musb->otg.state = OTG_STATE_A_WAIT_VRISE;
devctl |= MUSB_DEVCTL_SESSION;
conf |= TUSB_DEV_CONF_USB_HOST_MODE;
@@ -547,24 +547,24 @@ static void tusb_source_power(struct mus
/* If ID pin is grounded, we want to be a_idle */
otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT);
if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
- switch (musb->xceiv.state) {
+ switch (musb->otg.state) {
case OTG_STATE_A_WAIT_VRISE:
case OTG_STATE_A_WAIT_BCON:
- musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
+ musb->otg.state = OTG_STATE_A_WAIT_VFALL;
break;
case OTG_STATE_A_WAIT_VFALL:
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->otg.state = OTG_STATE_A_IDLE;
break;
default:
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->otg.state = OTG_STATE_A_IDLE;
}
musb->is_active = 0;
- musb->xceiv.default_a = 1;
+ musb->otg.default_a = 1;
MUSB_HST_MODE(musb);
} else {
musb->is_active = 0;
- musb->xceiv.default_a = 0;
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->otg.default_a = 0;
+ musb->otg.state = OTG_STATE_B_IDLE;
MUSB_DEV_MODE(musb);
}
@@ -672,7 +672,7 @@ tusb_otg_ints(struct musb *musb, u32 int
else
default_a = is_host_enabled(musb);
DBG(2, "Default-%c\n", default_a ? 'A' : 'B');
- musb->xceiv.default_a = default_a;
+ musb->otg.default_a = default_a;
tusb_source_power(musb, default_a);
/* Don't allow idling immediately */
@@ -684,7 +684,7 @@ tusb_otg_ints(struct musb *musb, u32 int
if (int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) {
/* B-dev state machine: no vbus ~= disconnect */
- if ((is_otg_enabled(musb) && !musb->xceiv.default_a)
+ if ((is_otg_enabled(musb) && !musb->otg.default_a)
|| !is_host_enabled(musb)) {
#ifdef CONFIG_USB_MUSB_HDRC_HCD
/* ? musb_root_disconnect(musb); */
@@ -699,9 +699,9 @@ tusb_otg_ints(struct musb *musb, u32 int
if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) {
DBG(1, "Forcing disconnect (no interrupt)\n");
- if (musb->xceiv.state != OTG_STATE_B_IDLE) {
+ if (musb->otg.state != OTG_STATE_B_IDLE) {
/* INTR_DISCONNECT can hide... */
- musb->xceiv.state = OTG_STATE_B_IDLE;
+ musb->otg.state = OTG_STATE_B_IDLE;
musb->int_usb |= MUSB_INTR_DISCONNECT;
}
musb->is_active = 0;
@@ -715,7 +715,7 @@ tusb_otg_ints(struct musb *musb, u32 int
DBG(2, "vbus change, %s, otg %03x\n",
otg_state_string(musb), otg_stat);
- switch (musb->xceiv.state) {
+ switch (musb->otg.state) {
case OTG_STATE_A_IDLE:
DBG(2, "Got SRP, turning on VBUS\n");
musb_set_vbus(musb, 1);
@@ -763,7 +763,7 @@ tusb_otg_ints(struct musb *musb, u32 int
DBG(4, "%s timer, %03x\n", otg_state_string(musb), otg_stat);
- switch (musb->xceiv.state) {
+ switch (musb->otg.state) {
case OTG_STATE_A_WAIT_VRISE:
/* VBUS has probably been valid for a while now,
* but may well have bounced out of range a bit
@@ -775,7 +775,7 @@ tusb_otg_ints(struct musb *musb, u32 int
DBG(2, "devctl %02x\n", devctl);
break;
}
- musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+ musb->otg.state = OTG_STATE_A_WAIT_BCON;
musb->is_active = 0;
idle_timeout = jiffies
+ msecs_to_jiffies(musb->a_wait_bcon);
@@ -1128,10 +1128,12 @@ int __init musb_platform_init(struct mus
}
musb->isr = tusb_interrupt;
+ musb->xceiv = &musb->otg;
+
if (is_host_enabled(musb))
musb->board_set_vbus = tusb_source_power;
if (is_peripheral_enabled(musb))
- musb->xceiv.set_power = tusb_draw_power;
+ musb->otg.set_power = tusb_draw_power;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-18 19:28 ` David Brownell
@ 2008-10-18 19:43 ` Felipe Balbi
2008-10-18 20:16 ` David Brownell
0 siblings, 1 reply; 9+ messages in thread
From: Felipe Balbi @ 2008-10-18 19:43 UTC (permalink / raw)
To: David Brownell
Cc: Tony Lindgren, Felipe Balbi, Pandita, Vikram,
linux-omap@vger.kernel.org
On Sat, Oct 18, 2008 at 12:28:08PM -0700, David Brownell wrote:
> On Saturday 18 October 2008, Tony Lindgren wrote:
> > Pushed. I hope you have a real fix for this coming from mainline soon :)
>
> There's a general issue to sort out here too.
>
> The early development of the MUSB code was on DaVinci, and
> then TUSB6010, which integrate (a) an OTG transceiver, plus
> (b) the OTG hardware. So musb_hdrc currently presumes it
> always works that way.
>
> However, OMAP3 (and 2430) split out (a) into the TWL4030
> or TWL5030 chip, leaving (b) integral to the MUSB silicon.
>
> But the MUSB code only accomodates that through a hack ...
> in musb/omap2430.c is the line which I suspect oopsed:
>
> musb->xceiv = *x;
>
> So when the twl4030 transceiver support does its thing,
> it does it to the original otg_transceiver struct instead
> of the copy being used by the MUSB core. Wrong!!!
>
> Partial fixup patch appended; doesn't resolve $SUBJECT
> issue, I think, but it's in the right direction.
Looks fine. I recall talking to you about this some months ago but my
approach was about introducing a drivers/usb/otg layer to which we would
usb_otg_register_driver() or something similar thus allowing musb (or
any other consumer) just use the otg_tranceiver that is registered now.
The good thing about it is that it would allow us to switch otg
transceivers and not have to add aditional conditional code to handle
it.
Your approach looks good but case we have to change the transceiver (not
twl4030-usb, let's say) it's a bit difficult to handle that.
I'd say your fix is good as a short term, right ? We have already
blackfin support for musb and most likely they won't usb twl4030 chips,
I also got a mail from another company asking about adding their musb
glue to our code so this problem with the otg transceiver might soon be
a big pain.
What do you say ??
--
balbi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-18 19:43 ` Felipe Balbi
@ 2008-10-18 20:16 ` David Brownell
2008-10-18 20:36 ` Felipe Balbi
0 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2008-10-18 20:16 UTC (permalink / raw)
To: me; +Cc: Tony Lindgren, Pandita, Vikram, linux-omap@vger.kernel.org
On Saturday 18 October 2008, Felipe Balbi wrote:
> > Partial fixup patch appended; doesn't resolve $SUBJECT
> > issue, I think, but it's in the right direction.
>
> Looks fine. I recall talking to you about this some months ago but my
> approach was about introducing a drivers/usb/otg layer to which we would
> usb_otg_register_driver() or something similar thus allowing musb (or
> any other consumer) just use the otg_tranceiver that is registered now.
Right now all we need is a way to make sure the MUSB code
isn't assuming an integrated transceiver ... the patch I
just sent is *only* to git rid of that "use an out-of-date
copy of the original transceiver" logic.
There are certainly some improvements that can be made in
the area of OTG transceiver handling. There are some PXA
related patches in that area, too. ISTR one of them was
just to provide calls to register and unregister the OTG
transceiver, moving them out of platform code (where they
live today)...
What I recall about your drivers/usb/otg notion (maybe not
entirely correctly) was that it covered a lot of stuff
which, it seemed to me, didn't need abstracting.
Maybe once we get the current MUSB stuff to work within
the current framework -- which splits out otg_transceiver
as an entity that host and peripheral side controller
drivers talk to -- we should revisit such stuff.
> The good thing about it is that it would allow us to switch otg
> transceivers and not have to add aditional conditional code to handle
> it.
>
> Your approach looks good but case we have to change the transceiver (not
> twl4030-usb, let's say) it's a bit difficult to handle that.
I don't follow *that* at all. If some driver other than
twl4030-usb registers as the system's OTG transceiver,
MUSB on OMAP3x should just use that. All musb should do
is ask for the transceiver, and then talk to it ... but
the current code can't do that.
> I'd say your fix is good as a short term, right ?
Let's make sure it doesn't break DaVinci and TUSB first.
It'd be good to remove the musb->xceiv->state doubled
indirections in most places too, just as cleanup.
(Plus cope with the $SUBJECT issue "for real"!)
> We have already
> blackfin support for musb and most likely they won't usb twl4030 chips,
Right. Does Blackfin have an integrated transceiver like
DaVinci and TUSB? Or does it use a discrete one?
> I also got a mail from another company asking about adding their musb
> glue to our code so this problem with the otg transceiver might soon be
> a big pain.
>
> What do you say ??
I'm thinking this issue needs resolving before twl4030-usb can
go upstream. :)
Does mainline work with tusb6010 today? I see lots of USB
patches merged yesterday. And enough ARM/DaVinci patches
merged (a few days back) that its MUSB might work too.
- Dave
>
> --
> balbi
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-18 20:16 ` David Brownell
@ 2008-10-18 20:36 ` Felipe Balbi
2008-10-22 15:35 ` Bryan Wu
0 siblings, 1 reply; 9+ messages in thread
From: Felipe Balbi @ 2008-10-18 20:36 UTC (permalink / raw)
To: David Brownell
Cc: me, Tony Lindgren, Pandita, Vikram, linux-omap@vger.kernel.org
On Sat, Oct 18, 2008 at 01:16:50PM -0700, David Brownell wrote:
> Right now all we need is a way to make sure the MUSB code
> isn't assuming an integrated transceiver ... the patch I
> just sent is *only* to git rid of that "use an out-of-date
> copy of the original transceiver" logic.
right
> There are certainly some improvements that can be made in
> the area of OTG transceiver handling. There are some PXA
> related patches in that area, too. ISTR one of them was
> just to provide calls to register and unregister the OTG
> transceiver, moving them out of platform code (where they
> live today)...
hmm... that (if we're talking about the same patches) was based in
earlier patches from me and Tony when we wrote the whole otg messaging
stuff for n810.
I recall sending them but the community didn't quite like the approach.
I was hoping to get them in better shape and resend but got too busy
with omap3 stuff, so that task got reniced.
I'm just happy someone took over those patches since they are quite
useful.
> What I recall about your drivers/usb/otg notion (maybe not
> entirely correctly) was that it covered a lot of stuff
> which, it seemed to me, didn't need abstracting.
Yeah, from the original idea we were trying to handle some (maybe most)
of the otg timers in sw. Little later I got back to earth and figured
those timers are handled in hw.
> Maybe once we get the current MUSB stuff to work within
> the current framework -- which splits out otg_transceiver
> as an entity that host and peripheral side controller
> drivers talk to -- we should revisit such stuff.
sounds goods to me.
> I don't follow *that* at all. If some driver other than
> twl4030-usb registers as the system's OTG transceiver,
> MUSB on OMAP3x should just use that. All musb should do
> is ask for the transceiver, and then talk to it ... but
> the current code can't do that.
hmm.. true, not that we can have 2 otg transceivers wired at the same
time anyways.
> Let's make sure it doesn't break DaVinci and TUSB first.
> It'd be good to remove the musb->xceiv->state doubled
> indirections in most places too, just as cleanup.
>
> (Plus cope with the $SUBJECT issue "for real"!)
sure.
> Right. Does Blackfin have an integrated transceiver like
> DaVinci and TUSB? Or does it use a discrete one?
I'll revisit the blackfin patches, they're going only for 2.6.29 merge
window.
> I'm thinking this issue needs resolving before twl4030-usb can
> go upstream. :)
hehe, i'll take a closer look at your patch starting on monday and try to
convert tusb6010 asap. Time to get my nice n810 back to life :-)
> Does mainline work with tusb6010 today? I see lots of USB
> patches merged yesterday. And enough ARM/DaVinci patches
> merged (a few days back) that its MUSB might work too.
We don't have any board-support for tusb6010 but all the code is there.
--
balbi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-18 20:36 ` Felipe Balbi
@ 2008-10-22 15:35 ` Bryan Wu
2008-10-22 16:33 ` Felipe Balbi
0 siblings, 1 reply; 9+ messages in thread
From: Bryan Wu @ 2008-10-22 15:35 UTC (permalink / raw)
To: me
Cc: David Brownell, Tony Lindgren, Pandita, Vikram,
linux-omap@vger.kernel.org
>
>> Right. Does Blackfin have an integrated transceiver like
>> DaVinci and TUSB? Or does it use a discrete one?
>
> I'll revisit the blackfin patches, they're going only for 2.6.29 merge
> window.
>
Hi Felipe, is it possible to push blackfin patches in the 2.6.28?
because we are planning to use 2.6.28 stable release as our 2009R1 release.
If the usb part are merged, it is much easier for me to do the release.
Thanks
-Bryan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Fix bootup crash for LDP platform
2008-10-22 15:35 ` Bryan Wu
@ 2008-10-22 16:33 ` Felipe Balbi
0 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2008-10-22 16:33 UTC (permalink / raw)
To: ext Bryan Wu
Cc: me, David Brownell, Tony Lindgren, Pandita, Vikram,
linux-omap@vger.kernel.org
On Wed, Oct 22, 2008 at 11:35:16PM +0800, Bryan Wu wrote:
> >
> >> Right. Does Blackfin have an integrated transceiver like
> >> DaVinci and TUSB? Or does it use a discrete one?
> >
> > I'll revisit the blackfin patches, they're going only for 2.6.29 merge
> > window.
> >
>
> Hi Felipe, is it possible to push blackfin patches in the 2.6.28?
> because we are planning to use 2.6.28 stable release as our 2009R1 release.
>
> If the usb part are merged, it is much easier for me to do the release.
If greg accept the patches in 2.6.28-rc, yes :-)
--
balbi
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-10-22 16:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1224284642-13863-1-git-send-email-vikram.pandita@ti.com>
2008-10-17 23:08 ` [PATCH] Fix bootup crash for LDP platform Pandita, Vikram
2008-10-17 23:50 ` Felipe Balbi
2008-10-18 13:56 ` Tony Lindgren
2008-10-18 19:28 ` David Brownell
2008-10-18 19:43 ` Felipe Balbi
2008-10-18 20:16 ` David Brownell
2008-10-18 20:36 ` Felipe Balbi
2008-10-22 15:35 ` Bryan Wu
2008-10-22 16:33 ` 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.