提交 675ae763 编写于 作者: G George Cherian 提交者: Felipe Balbi

usb: musb: core: Convert babble recover work to delayed work

During babble condition both first disconnect of devices are
initiated. Make sure MUSB controller is reset and re-initialized
after all disconnects.

To acheive this schedule a delayed work for babble recovery.

While at that convert udelay to usleep_range.
Refer Documentation/timers/timers-howto.txt
Signed-off-by: NGeorge Cherian <george.cherian@ti.com>
Tested-by: NBin Liu <b-liu@ti.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 97b4129e
...@@ -850,7 +850,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -850,7 +850,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
/* handle babble condition */ /* handle babble condition */
if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb)) if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb))
schedule_work(&musb->recover_work); schedule_delayed_work(&musb->recover_work,
msecs_to_jiffies(100));
#if 0 #if 0
/* REVISIT ... this would be for multiplexing periodic endpoints, or /* REVISIT ... this would be for multiplexing periodic endpoints, or
...@@ -1751,16 +1752,16 @@ static void musb_irq_work(struct work_struct *data) ...@@ -1751,16 +1752,16 @@ static void musb_irq_work(struct work_struct *data)
/* Recover from babble interrupt conditions */ /* Recover from babble interrupt conditions */
static void musb_recover_work(struct work_struct *data) static void musb_recover_work(struct work_struct *data)
{ {
struct musb *musb = container_of(data, struct musb, recover_work); struct musb *musb = container_of(data, struct musb, recover_work.work);
int status; int status;
musb_platform_reset(musb); musb_platform_reset(musb);
usb_phy_vbus_off(musb->xceiv); usb_phy_vbus_off(musb->xceiv);
udelay(100); usleep_range(100, 200);
usb_phy_vbus_on(musb->xceiv); usb_phy_vbus_on(musb->xceiv);
udelay(100); usleep_range(100, 200);
/* /*
* When a babble condition occurs, the musb controller removes the * When a babble condition occurs, the musb controller removes the
...@@ -1943,7 +1944,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -1943,7 +1944,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
/* Init IRQ workqueue before request_irq */ /* Init IRQ workqueue before request_irq */
INIT_WORK(&musb->irq_work, musb_irq_work); INIT_WORK(&musb->irq_work, musb_irq_work);
INIT_WORK(&musb->recover_work, musb_recover_work); INIT_DELAYED_WORK(&musb->recover_work, musb_recover_work);
INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset);
INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume); INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume);
...@@ -2039,7 +2040,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -2039,7 +2040,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
fail3: fail3:
cancel_work_sync(&musb->irq_work); cancel_work_sync(&musb->irq_work);
cancel_work_sync(&musb->recover_work); cancel_delayed_work_sync(&musb->recover_work);
cancel_delayed_work_sync(&musb->finish_resume_work); cancel_delayed_work_sync(&musb->finish_resume_work);
cancel_delayed_work_sync(&musb->deassert_reset_work); cancel_delayed_work_sync(&musb->deassert_reset_work);
if (musb->dma_controller) if (musb->dma_controller)
...@@ -2105,7 +2106,7 @@ static int musb_remove(struct platform_device *pdev) ...@@ -2105,7 +2106,7 @@ static int musb_remove(struct platform_device *pdev)
dma_controller_destroy(musb->dma_controller); dma_controller_destroy(musb->dma_controller);
cancel_work_sync(&musb->irq_work); cancel_work_sync(&musb->irq_work);
cancel_work_sync(&musb->recover_work); cancel_delayed_work_sync(&musb->recover_work);
cancel_delayed_work_sync(&musb->finish_resume_work); cancel_delayed_work_sync(&musb->finish_resume_work);
cancel_delayed_work_sync(&musb->deassert_reset_work); cancel_delayed_work_sync(&musb->deassert_reset_work);
musb_free(musb); musb_free(musb);
......
...@@ -297,7 +297,7 @@ struct musb { ...@@ -297,7 +297,7 @@ struct musb {
irqreturn_t (*isr)(int, void *); irqreturn_t (*isr)(int, void *);
struct work_struct irq_work; struct work_struct irq_work;
struct work_struct recover_work; struct delayed_work recover_work;
struct delayed_work deassert_reset_work; struct delayed_work deassert_reset_work;
struct delayed_work finish_resume_work; struct delayed_work finish_resume_work;
u16 hwvers; u16 hwvers;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册