init_mutex is a leftover from the time, when s3c-hsotg driver did not
implement proper pull up/down control and emulated it by enabling
enabling/disabling usb phy. Proper pull up/down control has been added
by commit
5b9451f8c4fbaf0549139755fb45ff2b57975b7f ("usb: dwc2: gadget:
use soft-disconnect udc feature in pullup() method"), so init_muxtex can
be removed now to avoid potential deadlocks with other locks.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Tested-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)];
spinlock_t lock;
struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)];
spinlock_t lock;
- struct mutex init_mutex;
void *priv;
int irq;
struct clk *clk;
void *priv;
int irq;
struct clk *clk;
- mutex_lock(&hsotg->init_mutex);
WARN_ON(hsotg->driver);
driver->driver.bus = NULL;
WARN_ON(hsotg->driver);
driver->driver.bus = NULL;
dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
- mutex_unlock(&hsotg->init_mutex);
-
- mutex_unlock(&hsotg->init_mutex);
hsotg->driver = NULL;
return ret;
}
hsotg->driver = NULL;
return ret;
}
if (!hsotg)
return -ENODEV;
if (!hsotg)
return -ENODEV;
- mutex_lock(&hsotg->init_mutex);
-
/* all endpoints should be shutdown */
for (ep = 1; ep < hsotg->num_of_eps; ep++) {
if (hsotg->eps_in[ep])
/* all endpoints should be shutdown */
for (ep = 1; ep < hsotg->num_of_eps; ep++) {
if (hsotg->eps_in[ep])
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
- mutex_unlock(&hsotg->init_mutex);
-
- mutex_lock(&hsotg->init_mutex);
spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) {
hsotg->enabled = 1;
spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) {
hsotg->enabled = 1;
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
spin_unlock_irqrestore(&hsotg->lock, flags);
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
spin_unlock_irqrestore(&hsotg->lock, flags);
- mutex_unlock(&hsotg->init_mutex);
if (hsotg->lx_state != DWC2_L0)
return ret;
if (hsotg->lx_state != DWC2_L0)
return ret;
- mutex_lock(&hsotg->init_mutex);
-
if (hsotg->driver) {
int ep;
if (hsotg->driver) {
int ep;
clk_disable(hsotg->clk);
}
clk_disable(hsotg->clk);
}
- mutex_unlock(&hsotg->init_mutex);
-
if (hsotg->lx_state == DWC2_L2)
return ret;
if (hsotg->lx_state == DWC2_L2)
return ret;
- mutex_lock(&hsotg->init_mutex);
-
if (hsotg->driver) {
dev_info(hsotg->dev, "resuming usb gadget %s\n",
hsotg->driver->driver.name);
if (hsotg->driver) {
dev_info(hsotg->dev, "resuming usb gadget %s\n",
hsotg->driver->driver.name);
dwc2_hsotg_core_connect(hsotg);
spin_unlock_irqrestore(&hsotg->lock, flags);
}
dwc2_hsotg_core_connect(hsotg);
spin_unlock_irqrestore(&hsotg->lock, flags);
}
- mutex_unlock(&hsotg->init_mutex);
}
spin_lock_init(&hsotg->lock);
}
spin_lock_init(&hsotg->lock);
- mutex_init(&hsotg->init_mutex);
/* Detect config values from hardware */
retval = dwc2_get_hwparams(hsotg);
/* Detect config values from hardware */
retval = dwc2_get_hwparams(hsotg);