Modified: trunk/drivers/usb/musb/Kconfig (3981 => 3982)
--- trunk/drivers/usb/musb/Kconfig 2007-12-05 00:52:08 UTC (rev 3981)
+++ trunk/drivers/usb/musb/Kconfig 2007-12-05 06:52:12 UTC (rev 3982)
@@ -20,7 +20,8 @@
Texas Instruments parts using this IP include DaVinci 644x,
OMAP 243x, OMAP 343x, and TUSB 6010.
- Analog Devices parts using this IP include Blackfin BF54x.
+ Analog Devices parts using this IP include Blackfin BF54x,
+ BF525 and BF527.
If you do not know what this is, please say N.
@@ -32,7 +33,7 @@
depends on USB_MUSB_HDRC
default y if ARCH_DAVINCI
default y if ARCH_OMAP2430
- default y if ARCH_OMAP343X
+ default y if ARCH_OMAP34XX
default y if BF54x
default y if BF52x
help
@@ -47,9 +48,9 @@
depends on USB_MUSB_HDRC && ARCH_OMAP2430
comment "OMAP 343x high speed USB support"
- depends on USB_MUSB_HDRC && ARCH_OMAP343X
+ depends on USB_MUSB_HDRC && ARCH_OMAP34XX
-comment "Blackfin BF54x high speed USB support"
+comment "Blackfin BF54x, BF525 and BF527 high speed USB support"
depends on USB_MUSB_HDRC && (BF54x || BF525 || BF527)
config USB_TUSB6010
@@ -153,7 +154,7 @@
config USB_INVENTRA_DMA
bool
depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
- default ARCH_OMAP2430 || ARCH_OMAP343X
+ default ARCH_OMAP2430 || ARCH_OMAP34XX
help
Enable DMA transfers using Mentor's engine.
Modified: trunk/drivers/usb/musb/blackfin.c (3981 => 3982)
--- trunk/drivers/usb/musb/blackfin.c 2007-12-05 00:52:08 UTC (rev 3981)
+++ trunk/drivers/usb/musb/blackfin.c 2007-12-05 06:52:12 UTC (rev 3982)
@@ -307,8 +307,64 @@
return IRQ_HANDLED;
}
+/* Almost 1 second */
+#define TIMER_DELAY (1 * HZ)
+
+static struct timer_list conn_timer;
+
+static void conn_timer_handler(unsigned long _musb)
+{
+ struct musb *musb = (void *)_musb;
+ unsigned long flags;
+ u16 val;
+
+ spin_lock_irqsave(&musb->lock, flags);
+ switch (musb->xceiv.state) {
+ case OTG_STATE_A_IDLE:
+ 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_readw(musb->mregs, MUSB_DEVCTL);
+ if (!(val & MUSB_DEVCTL_BDEVICE)) {
+ gpio_set_value(GPIO_USB_VRSEL, 1);
+ musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+ } else {
+ gpio_set_value(GPIO_USB_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);
+
+ val = MUSB_POWER_HSENAB;
+ musb_writeb(musb->mregs, MUSB_POWER, val);
+ }
+ mod_timer(&conn_timer, jiffies + TIMER_DELAY);
+ break;
+
+ default:
+ DBG(1, "%s state not handled\n", otg_state_string(musb));
+ break;
+ }
+ spin_unlock_irqrestore(&musb->lock, flags);
+
+ DBG(4, "state is %s\n", otg_state_string(musb));
+
+ return;
+}
+
void musb_platform_enable(struct musb *musb)
{
+ if (is_host_enabled(musb)) {
+ mod_timer(&conn_timer, jiffies + TIMER_DELAY);
+ musb->a_wait_bcon = TIMER_DELAY;
+ }
}
void musb_platform_disable(struct musb *musb)
@@ -321,36 +377,11 @@
static void bfin_set_vbus(struct musb *musb, int is_on)
{
- u8 devctl;
- /* HDRC controls CPEN, but beware current surges during device
- * connect. They can trigger transient overcurrent conditions
- * that must be ignored.
- */
+ if (is_on)
+ gpio_set_value(GPIO_USB_VRSEL, 1);
+ else
+ gpio_set_value(GPIO_USB_VRSEL, 0);
- devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-
- if (is_on) {
- musb->is_active = 1;
- musb->xceiv.default_a = 1;
- musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
- devctl |= MUSB_DEVCTL_SESSION;
-
- MUSB_HST_MODE(musb);
- } else {
- musb->is_active = 0;
-
- /* NOTE: we're skipping A_WAIT_VFALL -> A_IDLE and
- * jumping right to B_IDLE...
- */
-
- musb->xceiv.default_a = 0;
- musb->xceiv.state = OTG_STATE_B_IDLE;
- devctl &= ~MUSB_DEVCTL_SESSION;
-
- MUSB_DEV_MODE(musb);
- }
- musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
-
DBG(1, "VBUS %s, devctl %02x "
/* otg %3x conf %08x prcm %08x */ "\n",
otg_state_string(musb),
@@ -362,6 +393,21 @@
return 0;
}
+void musb_platform_try_idle(struct musb *musb, unsigned long timeout)
+{
+ if (is_host_enabled(musb))
+ mod_timer(&conn_timer, jiffies + TIMER_DELAY);
+}
+
+int musb_platform_get_vbus_status(struct musb *musb)
+{
+ return 0;
+}
+
+void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
+{
+}
+
int musb_platform_resume(struct musb *musb);
int __init musb_platform_init(struct musb *musb)
@@ -376,18 +422,11 @@
if (gpio_request(GPIO_USB_VRSEL, "USB_VRSEL")) {
printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n",
- GPIO_USB_VRSEL);
- return;
+ GPIO_USB_VRSEL);
+ return -ENODEV;
}
gpio_direction_output(GPIO_USB_VRSEL);
-
-#ifdef CONFIG_USB_MUSB_PERIPHERAL
- gpio_set_value(GPIO_USB_VRSEL, 0);
-#else
- gpio_set_value(GPIO_USB_VRSEL, 1);
-#endif
-
/* Anomaly #05000346 */
bfin_write_USB_APHY_CALIB(0x5411);
SSYNC();
@@ -424,8 +463,11 @@
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
- if (is_host_enabled(musb))
+ if (is_host_enabled(musb)) {
musb->board_set_vbus = bfin_set_vbus;
+ setup_timer(&conn_timer,
+ conn_timer_handler, (unsigned long) musb);
+ }
if (is_peripheral_enabled(musb))
musb->xceiv.set_power = bfin_set_power;
Modified: trunk/drivers/usb/musb/musb_core.h (3981 => 3982)
--- trunk/drivers/usb/musb/musb_core.h 2007-12-05 00:52:08 UTC (rev 3981)
+++ trunk/drivers/usb/musb/musb_core.h 2007-12-05 06:52:12 UTC (rev 3982)
@@ -481,7 +481,7 @@
extern void musb_hnp_stop(struct musb *musb);
-#ifdef CONFIG_USB_TUSB6010
+#if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN)
extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout);
extern int musb_platform_get_vbus_status(struct musb *musb);
extern void musb_platform_set_mode(struct musb *musb, u8 musb_mode);
Modified: trunk/include/asm-blackfin/mach-bf527/hdrc_cnf.h (3981 => 3982)
--- trunk/include/asm-blackfin/mach-bf527/hdrc_cnf.h 2007-12-05 00:52:08 UTC (rev 3981)
+++ trunk/include/asm-blackfin/mach-bf527/hdrc_cnf.h 2007-12-05 06:52:12 UTC (rev 3982)
@@ -174,11 +174,12 @@
*/
#define MUSB_C_RAM_BITS 13
-#define clk_get(dev, id) NULL
-#define clk_put(clock)
-#define clk_disable(clock)
+#define clk_get(dev, id) NULL
+#define clk_put(clock) do {} while (0)
+#define clk_enable(clock) do {} while (0)
+#define clk_disable(clock) do {} while (0)
-#define dma_controller_create(musb, regs) NULL
-#define dma_controller_destroy(c)
+#define dma_controller_create(musb, regs) NULL
+#define dma_controller_destroy(c) do {} while (0)
#endif /* __ARCH_MUSB_HDRC_CNF */
Modified: trunk/include/asm-blackfin/mach-bf548/hdrc_cnf.h (3981 => 3982)
--- trunk/include/asm-blackfin/mach-bf548/hdrc_cnf.h 2007-12-05 00:52:08 UTC (rev 3981)
+++ trunk/include/asm-blackfin/mach-bf548/hdrc_cnf.h 2007-12-05 06:52:12 UTC (rev 3982)
@@ -174,11 +174,12 @@
*/
#define MUSB_C_RAM_BITS 13
-#define clk_get(dev, id) NULL
-#define clk_put(clock)
-#define clk_disable(clock)
+#define clk_get(dev, id) NULL
+#define clk_put(clock) do {} while (0)
+#define clk_enable(clock) do {} while (0)
+#define clk_disable(clock) do {} while (0)
-#define dma_controller_create(musb, regs) NULL
-#define dma_controller_destroy(c)
+#define dma_controller_create(musb, regs) NULL
+#define dma_controller_destroy(c) do {} while (0)
#endif /* __ARCH_MUSB_HDRC_CNF */