mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 01:10:28 +00:00
usb: phy: Check initial state for twl6030
We need to check the state for the PHY with delayed_work as otherwise MUSB will get confused and idles immediately. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
aec373c1e5
commit
b6a619a883
@ -97,6 +97,9 @@ struct twl6030_usb {
|
||||
|
||||
struct regulator *usb3v3;
|
||||
|
||||
/* used to check initial cable status after probe */
|
||||
struct delayed_work get_status_work;
|
||||
|
||||
/* used to set vbus, in atomic path */
|
||||
struct work_struct set_vbus_work;
|
||||
|
||||
@ -280,6 +283,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void twl6030_status_work(struct work_struct *work)
|
||||
{
|
||||
struct twl6030_usb *twl = container_of(work, struct twl6030_usb,
|
||||
get_status_work.work);
|
||||
|
||||
twl6030_usb_irq(twl->irq2, twl);
|
||||
twl6030_usbotg_irq(twl->irq1, twl);
|
||||
}
|
||||
|
||||
static int twl6030_enable_irq(struct twl6030_usb *twl)
|
||||
{
|
||||
twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
|
||||
@ -290,8 +302,6 @@ static int twl6030_enable_irq(struct twl6030_usb *twl)
|
||||
REG_INT_MSK_LINE_C);
|
||||
twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK,
|
||||
REG_INT_MSK_STS_C);
|
||||
twl6030_usb_irq(twl->irq2, twl);
|
||||
twl6030_usbotg_irq(twl->irq1, twl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -377,6 +387,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
|
||||
dev_warn(&pdev->dev, "could not create sysfs file\n");
|
||||
|
||||
INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
|
||||
INIT_DELAYED_WORK(&twl->get_status_work, twl6030_status_work);
|
||||
|
||||
status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
|
||||
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
|
||||
@ -401,6 +412,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
|
||||
|
||||
twl->asleep = 0;
|
||||
twl6030_enable_irq(twl);
|
||||
schedule_delayed_work(&twl->get_status_work, HZ);
|
||||
dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
|
||||
|
||||
return 0;
|
||||
@ -410,6 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct twl6030_usb *twl = platform_get_drvdata(pdev);
|
||||
|
||||
cancel_delayed_work(&twl->get_status_work);
|
||||
twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
|
||||
REG_INT_MSK_LINE_C);
|
||||
twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
|
||||
|
Loading…
Reference in New Issue
Block a user