* [patch-2.6.35 01/11] usb: musb: debugfs: musb_exit_debugfs() can be called on probe
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
` (5 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi
when we fail to probe(), we can call musb_exit_debugfs().
Allow that by removing section annotations.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 7 +++++--
drivers/usb/musb/musb_debugfs.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 13f36bf..9b88727 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2056,12 +2056,12 @@ bad_config:
status = musb_init_debugfs(musb);
if (status < 0)
- goto fail2;
+ goto fail4;
#ifdef CONFIG_SYSFS
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
if (status)
- goto fail4;
+ goto fail5;
#endif
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
@@ -2078,6 +2078,9 @@ bad_config:
return 0;
+fail5:
+ musb_exit_debugfs(musb);
+
fail4:
if (!is_otg_enabled(musb) && is_host_enabled(musb))
usb_remove_hcd(musb_to_hcd(musb));
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index b6a27ba..7768634 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -289,7 +289,7 @@ err0:
return ret;
}
-void __exit musb_exit_debugfs(struct musb *musb)
+void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
{
debugfs_remove_recursive(musb_debugfs_root);
}
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread[parent not found: <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>]
* [patch-2.6.35 02/11] USB: musb: support host/gadget role switching on Blackfin parts
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 05/11] MUSB: OMAP: make musb_platform_suspend() 'static' Felipe Balbi
` (3 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Cliff Cai,
Mike Frysinger, Felipe Balbi
From: Cliff Cai <cliff.cai-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Cliff Cai <cliff.cai-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/blackfin.c | 69 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 3774815..78f33b9 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -171,6 +171,13 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
retval = musb_interrupt(musb);
}
+ /* Start sampling ID pin, when plug is removed from MUSB */
+ if (is_otg_enabled(musb) && (musb->xceiv->state == OTG_STATE_B_IDLE
+ || musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
+ mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
+ musb->a_wait_bcon = TIMER_DELAY;
+ }
+
spin_unlock_irqrestore(&musb->lock, flags);
return retval;
@@ -181,6 +188,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
struct musb *musb = (void *)_musb;
unsigned long flags;
u16 val;
+ static u8 toggle;
spin_lock_irqsave(&musb->lock, flags);
switch (musb->xceiv->state) {
@@ -188,10 +196,44 @@ static void musb_conn_timer_handler(unsigned long _musb)
case OTG_STATE_A_WAIT_BCON:
/* Start a new session */
val = musb_readw(musb->mregs, MUSB_DEVCTL);
+ val &= ~MUSB_DEVCTL_SESSION;
+ musb_writew(musb->mregs, MUSB_DEVCTL, val);
val |= MUSB_DEVCTL_SESSION;
musb_writew(musb->mregs, MUSB_DEVCTL, val);
+ /* Check if musb is host or peripheral. */
+ val = musb_readw(musb->mregs, MUSB_DEVCTL);
+
+ if (!(val & MUSB_DEVCTL_BDEVICE)) {
+ gpio_set_value(musb->config->gpio_vrsel, 1);
+ musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+ } else {
+ gpio_set_value(musb->config->gpio_vrsel, 0);
+ /* Ignore VBUSERROR and SUSPEND IRQ */
+ val = musb_readb(musb->mregs, MUSB_INTRUSBE);
+ val &= ~MUSB_INTR_VBUSERROR;
+ musb_writeb(musb->mregs, MUSB_INTRUSBE, val);
+ val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
+ musb_writeb(musb->mregs, MUSB_INTRUSB, val);
+ if (is_otg_enabled(musb))
+ musb->xceiv->state = OTG_STATE_B_IDLE;
+ else
+ musb_writeb(musb->mregs, MUSB_POWER, MUSB_POWER_HSENAB);
+ }
+ mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
+ break;
+ case OTG_STATE_B_IDLE:
+
+ if (!is_peripheral_enabled(musb))
+ break;
+ /* Start a new session. It seems that MUSB needs taking
+ * some time to recognize the type of the plug inserted?
+ */
val = musb_readw(musb->mregs, MUSB_DEVCTL);
+ val |= MUSB_DEVCTL_SESSION;
+ musb_writew(musb->mregs, MUSB_DEVCTL, val);
+ val = musb_readw(musb->mregs, MUSB_DEVCTL);
+
if (!(val & MUSB_DEVCTL_BDEVICE)) {
gpio_set_value(musb->config->gpio_vrsel, 1);
musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
@@ -206,12 +248,27 @@ static void musb_conn_timer_handler(unsigned long _musb)
val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSB, val);
- val = MUSB_POWER_HSENAB;
- musb_writeb(musb->mregs, MUSB_POWER, val);
+ /* Toggle the Soft Conn bit, so that we can response to
+ * the inserting of either A-plug or B-plug.
+ */
+ if (toggle) {
+ val = musb_readb(musb->mregs, MUSB_POWER);
+ val &= ~MUSB_POWER_SOFTCONN;
+ musb_writeb(musb->mregs, MUSB_POWER, val);
+ toggle = 0;
+ } else {
+ val = musb_readb(musb->mregs, MUSB_POWER);
+ val |= MUSB_POWER_SOFTCONN;
+ musb_writeb(musb->mregs, MUSB_POWER, val);
+ toggle = 1;
+ }
+ /* The delay time is set to 1/4 second by default,
+ * shortening it, if accelerating A-plug detection
+ * is needed in OTG mode.
+ */
+ mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY / 4);
}
- mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
break;
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 05/11] MUSB: OMAP: make musb_platform_suspend() 'static'
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 12:55 ` [patch-2.6.35 02/11] USB: musb: support host/gadget role switching on Blackfin parts Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 06/11] MUSB: Blackfin: remove musb_platform_{suspend|resume}() Felipe Balbi
` (2 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
This function is only called inside omap2430.c...
Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/omap2430.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 218df2c..2633049 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -276,7 +276,7 @@ void musb_platform_restore_context(struct musb *musb,
}
#endif
-int musb_platform_suspend(struct musb *musb)
+static int musb_platform_suspend(struct musb *musb)
{
u32 l;
--
1.7.0.rc0.33.g7c3932
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 06/11] MUSB: Blackfin: remove musb_platform_{suspend|resume}()
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 12:55 ` [patch-2.6.35 02/11] USB: musb: support host/gadget role switching on Blackfin parts Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 05/11] MUSB: OMAP: make musb_platform_suspend() 'static' Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 07/11] usb: musb: omap2430: remove unused define Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 09/11] usb: musb: Makefile: remove unexistent config option Felipe Balbi
4 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
These functions do nothing and also are both unnecessarily 'extern'; actually,
musb_platform_resume() in not even called...
Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/blackfin.c | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 7372ef9..95db366 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -393,22 +393,10 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
return 0;
}
-int musb_platform_suspend(struct musb *musb)
-{
- return 0;
-}
-
-int musb_platform_resume(struct musb *musb)
-{
- return 0;
-}
-
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 07/11] usb: musb: omap2430: remove unused define
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 06/11] MUSB: Blackfin: remove musb_platform_{suspend|resume}() Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 09/11] usb: musb: Makefile: remove unexistent config option Felipe Balbi
4 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Anand Gadiyar,
Felipe Balbi
From: Anand Gadiyar <gadiyar-l0cyMroinI0@public.gmane.org>
get_cpu_rev() is unused in this driver. It is probably legacy
code. So remove it.
Signed-off-by: Anand Gadiyar <gadiyar-l0cyMroinI0@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/omap2430.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2633049..202cafa 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -40,10 +40,6 @@
#include "musb_core.h"
#include "omap2430.h"
-#ifdef CONFIG_ARCH_OMAP3430
-#define get_cpu_rev() 2
-#endif
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 09/11] usb: musb: Makefile: remove unexistent config option
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 07/11] usb: musb: omap2430: remove unused define Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
[not found] ` <1269435318-29153-10-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
4 siblings, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi
Remove the unexistent CONFIG_USB_INVENTRA_MUSB_HAS_AHB_ID
option from our Makefile.
Problem reported by Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/Makefile | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index a1677f9..4266d79 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -74,10 +74,6 @@ endif
# FIXME remove all these extra "-DMUSB_* things, stick to CONFIG_*
-ifeq ($(CONFIG_USB_INVENTRA_MUSB_HAS_AHB_ID),y)
- EXTRA_CFLAGS += -DMUSB_AHB_ID
-endif
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [patch-2.6.35 03/11] MUSB: OMAP: remove omap_vbus_power()
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 01/11] usb: musb: debugfs: musb_exit_debugfs() can be called on probe Felipe Balbi
[not found] ` <1269435318-29153-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 04/11] MUSB: Blackfin: remove bfin_vbus_power() Felipe Balbi
` (3 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
This function does nothing...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/omap2430.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f8cc636..218df2c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -146,10 +146,6 @@ void musb_platform_enable(struct musb *musb)
void musb_platform_disable(struct musb *musb)
{
}
-static void omap_vbus_power(struct musb *musb, int is_on, int sleeping)
-{
-}
-
static void omap_set_vbus(struct musb *musb, int is_on)
{
u8 devctl;
@@ -256,8 +252,6 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
- omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
-
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
@@ -337,8 +331,6 @@ static int musb_platform_resume(struct musb *musb)
int musb_platform_exit(struct musb *musb)
{
- omap_vbus_power(musb, 0 /*off*/, 1);
-
musb_platform_suspend(musb);
return 0;
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 04/11] MUSB: Blackfin: remove bfin_vbus_power()
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
` (2 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 03/11] MUSB: OMAP: remove omap_vbus_power() Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
[not found] ` <1269435318-29153-5-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 12:55 ` [patch-2.6.35 08/11] usb: musb: omap2430.c: remove unnecessary includes Felipe Balbi
` (2 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
This function does nothing...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
--
The patch is against the recent Linus' tree plus the series of 6 fixes posted
yesterday...
drivers/usb/musb/blackfin.c | 7 -------
1 file changed, 7 deletions(-)
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/blackfin.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 78f33b9..7372ef9 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -290,10 +290,6 @@ void musb_platform_disable(struct musb *musb)
{
}
-static void bfin_vbus_power(struct musb *musb, int is_on, int sleeping)
-{
-}
-
static void bfin_set_vbus(struct musb *musb, int is_on)
{
int value = musb->config->gpio_vrsel_active;
@@ -411,7 +407,6 @@ int musb_platform_resume(struct musb *musb)
int musb_platform_exit(struct musb *musb)
{
- bfin_vbus_power(musb, 0 /*off*/, 1);
gpio_free(musb->config->gpio_vrsel);
musb_platform_suspend(musb);
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 08/11] usb: musb: omap2430.c: remove unnecessary includes
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
` (3 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 04/11] MUSB: Blackfin: remove bfin_vbus_power() Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 10/11] musb: Add extvbus in musb_board_data Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 11/11] usb: musb: add ulpi access operations Felipe Balbi
6 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Anand Gadiyar,
Felipe Balbi
From: Anand Gadiyar <gadiyar@ti.com>
We don't need mach-types and hardware.h
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/omap2430.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 202cafa..c5cc473 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -33,8 +33,6 @@
#include <linux/clk.h>
#include <linux/io.h>
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
#include <plat/mux.h>
#include "musb_core.h"
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 10/11] musb: Add extvbus in musb_board_data
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
` (4 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 08/11] usb: musb: omap2430.c: remove unnecessary includes Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
2010-03-24 12:55 ` [patch-2.6.35 11/11] usb: musb: add ulpi access operations Felipe Balbi
6 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Ajay Kumar Gupta,
Felipe Balbi
From: Ajay Kumar Gupta <ajay.gupta@ti.com>
EXTVBUS programming is required by OMAP3EVM REV >=E to supply 500mA
power so adding a flag which can be used by musb driver to program
EXTVBUS.
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
arch/arm/mach-omap2/board-omap3evm.c | 3 +++
arch/arm/mach-omap2/usb-musb.c | 1 +
arch/arm/plat-omap/include/plat/usb.h | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 017bb2f..7d7b5bc 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -702,6 +702,9 @@ static void __init omap3_evm_init(void)
omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
ehci_pdata.reset_gpio_port[1] = 21;
+ /* EVM REV >= E can supply 500mA with EXTVBUS programming */
+ musb_board_data.power = 500;
+ musb_board_data.extvbus = 1;
} else {
/* setup EHCI phy reset on MDC */
omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 6d41fa7..96f6787 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -107,6 +107,7 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
musb_plat.board_data = board_data;
musb_plat.power = board_data->power >> 1;
musb_plat.mode = board_data->mode;
+ musb_plat.extvbus = board_data->extvbus;
if (platform_device_register(&musb_device) < 0)
printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 876ca8d..60c734f 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -47,6 +47,7 @@ struct omap_musb_board_data {
u8 interface_type;
u8 mode;
u16 power;
+ unsigned extvbus:1;
};
enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread* [patch-2.6.35 11/11] usb: musb: add ulpi access operations
2010-03-24 12:55 [patch-2.6.35 00/11] musb patches Felipe Balbi
` (5 preceding siblings ...)
2010-03-24 12:55 ` [patch-2.6.35 10/11] musb: Add extvbus in musb_board_data Felipe Balbi
@ 2010-03-24 12:55 ` Felipe Balbi
6 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2010-03-24 12:55 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Heikki Krogerus,
Felipe Balbi
From: Heikki Krogerus <ext-heikki.krogerus@nokia.com>
This adds helper functions for ULPI access, and implements
otg_io_access_ops for musb.
Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@nokia.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 86 ++++++++++++++++++++++++++++++++++++++++++
drivers/usb/musb/musb_regs.h | 10 +++++
2 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 9b88727..ae7728c 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -149,6 +149,87 @@ static inline struct musb *dev_to_musb(struct device *dev)
/*-------------------------------------------------------------------------*/
+#ifndef CONFIG_BLACKFIN
+static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset)
+{
+ void __iomem *addr = otg->io_priv;
+ int i = 0;
+ u8 r;
+ u8 power;
+
+ /* Make sure the transceiver is not in low power mode */
+ power = musb_readb(addr, MUSB_POWER);
+ power &= ~MUSB_POWER_SUSPENDM;
+ musb_writeb(addr, MUSB_POWER, power);
+
+ /* REVISIT: musbhdrc_ulpi_an.pdf recommends setting the
+ * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM.
+ */
+
+ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset);
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL,
+ MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR);
+
+ while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
+ & MUSB_ULPI_REG_CMPLT)) {
+ i++;
+ if (i == 10000) {
+ DBG(3, "ULPI read timed out\n");
+ return -ETIMEDOUT;
+ }
+
+ }
+ r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
+ r &= ~MUSB_ULPI_REG_CMPLT;
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
+
+ return musb_readb(addr, MUSB_ULPI_REG_DATA);
+}
+
+static int musb_ulpi_write(struct otg_transceiver *otg,
+ u32 offset, u32 data)
+{
+ void __iomem *addr = otg->io_priv;
+ int i = 0;
+ u8 r = 0;
+ u8 power;
+
+ /* Make sure the transceiver is not in low power mode */
+ power = musb_readb(addr, MUSB_POWER);
+ power &= ~MUSB_POWER_SUSPENDM;
+ musb_writeb(addr, MUSB_POWER, power);
+
+ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset);
+ musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data);
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ);
+
+ while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
+ & MUSB_ULPI_REG_CMPLT)) {
+ i++;
+ if (i == 10000) {
+ DBG(3, "ULPI write timed out\n");
+ return -ETIMEDOUT;
+ }
+ }
+
+ r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
+ r &= ~MUSB_ULPI_REG_CMPLT;
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
+
+ return 0;
+}
+#else
+#define musb_ulpi_read(a, b) NULL
+#define musb_ulpi_write(a, b, c) NULL
+#endif
+
+static struct otg_io_access_ops musb_ulpi_access = {
+ .read = musb_ulpi_read,
+ .write = musb_ulpi_write,
+};
+
+/*-------------------------------------------------------------------------*/
+
#if !defined(CONFIG_USB_TUSB6010) && !defined(CONFIG_BLACKFIN)
/*
@@ -1954,6 +2035,11 @@ bad_config:
goto fail3;
}
+ if (!musb->xceiv->io_ops) {
+ musb->xceiv->io_priv = musb->mregs;
+ musb->xceiv->io_ops = &musb_ulpi_access;
+ }
+
#ifndef CONFIG_MUSB_PIO_ONLY
if (use_dma && dev->dma_mask) {
struct dma_controller *c;
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index fa55aac..2442675 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -75,6 +75,10 @@
/* MUSB ULPI VBUSCONTROL */
#define MUSB_ULPI_USE_EXTVBUS 0x01
#define MUSB_ULPI_USE_EXTVBUSIND 0x02
+/* ULPI_REG_CONTROL */
+#define MUSB_ULPI_REG_REQ (1 << 0)
+#define MUSB_ULPI_REG_CMPLT (1 << 1)
+#define MUSB_ULPI_RDN_WR (1 << 2)
/* TESTMODE */
#define MUSB_TEST_FORCE_HOST 0x80
@@ -251,6 +255,12 @@
/* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */
#define MUSB_HWVERS 0x6C /* 8 bit */
#define MUSB_ULPI_BUSCONTROL 0x70 /* 8 bit */
+#define MUSB_ULPI_INT_MASK 0x72 /* 8 bit */
+#define MUSB_ULPI_INT_SRC 0x73 /* 8 bit */
+#define MUSB_ULPI_REG_DATA 0x74 /* 8 bit */
+#define MUSB_ULPI_REG_ADDR 0x75 /* 8 bit */
+#define MUSB_ULPI_REG_CONTROL 0x76 /* 8 bit */
+#define MUSB_ULPI_RAW_DATA 0x77 /* 8 bit */
#define MUSB_EPINFO 0x78 /* 8 bit */
#define MUSB_RAMINFO 0x79 /* 8 bit */
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 17+ messages in thread