usb: musb: core: drop recover_work
authorFelipe Balbi <balbi@ti.com>
Thu, 26 Feb 2015 20:27:12 +0000 (14:27 -0600)
committerFelipe Balbi <balbi@ti.com>
Tue, 10 Mar 2015 20:33:29 +0000 (15:33 -0500)
that's not needed anymore. Everything that we
call is irq-safe, so we might as well not
have a delayed work for babble recovery.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h

index bf9746287d7c413f4d3e4198021075e430f11c79..b410af6b051027fb00b5264f18e58389363aafcd 100644 (file)
@@ -509,6 +509,7 @@ void musb_hnp_stop(struct musb *musb)
 
 static void musb_disable_interrupts(struct musb *musb);
 static void musb_generic_disable(struct musb *musb);
+static void musb_recover_from_babble(struct musb *musb);
 
 /*
  * Interrupt Service Routine to record USB "global" interrupts.
@@ -885,8 +886,7 @@ b_host:
 
                                if (is_host_active(musb)) {
                                        musb_disable_interrupts(musb);
-                                       schedule_delayed_work(&musb->recover_work,
-                                                       usecs_to_jiffies(10));
+                                       musb_recover_from_babble(musb);
                                }
                        }
                } else {
@@ -1831,13 +1831,17 @@ static void musb_irq_work(struct work_struct *data)
        }
 }
 
-/* Recover from babble interrupt conditions */
-static void musb_recover_work(struct work_struct *data)
+static void musb_recover_from_babble(struct musb *musb)
 {
-       struct musb *musb = container_of(data, struct musb, recover_work.work);
        int ret;
        u8 devctl;
 
+       /*
+        * wait at least 320 cycles of 60MHz clock. That's 5.3us, we will give
+        * it some slack and wait for 10us.
+        */
+       udelay(10);
+
        ret  = musb_platform_recover(musb);
        if (ret) {
                musb_enable_interrupts(musb);
@@ -2098,7 +2102,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
        /* Init IRQ workqueue before request_irq */
        INIT_WORK(&musb->irq_work, musb_irq_work);
-       INIT_DELAYED_WORK(&musb->recover_work, musb_recover_work);
        INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset);
        INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume);
 
@@ -2194,7 +2197,6 @@ fail4:
 
 fail3:
        cancel_work_sync(&musb->irq_work);
-       cancel_delayed_work_sync(&musb->recover_work);
        cancel_delayed_work_sync(&musb->finish_resume_work);
        cancel_delayed_work_sync(&musb->deassert_reset_work);
        if (musb->dma_controller)
@@ -2260,7 +2262,6 @@ static int musb_remove(struct platform_device *pdev)
                dma_controller_destroy(musb->dma_controller);
 
        cancel_work_sync(&musb->irq_work);
-       cancel_delayed_work_sync(&musb->recover_work);
        cancel_delayed_work_sync(&musb->finish_resume_work);
        cancel_delayed_work_sync(&musb->deassert_reset_work);
        musb_free(musb);
index 1e03c7ec82e41cf68151051979fa1b057fb33caa..3877249a8b2d39c009da0a93874b79c3155a26b4 100644 (file)
@@ -301,7 +301,6 @@ struct musb {
 
        irqreturn_t             (*isr)(int, void *);
        struct work_struct      irq_work;
-       struct delayed_work     recover_work;
        struct delayed_work     deassert_reset_work;
        struct delayed_work     finish_resume_work;
        u16                     hwvers;