struct dwc3_rockchip {
int num_clocks;
+ bool connected;
struct device *dev;
struct clk **clks;
struct dwc3 *dwc;
return;
if (extcon_get_cable_state_(edev, EXTCON_USB) > 0) {
- if (dwc->connected)
+ if (rockchip->connected)
return;
/*
pm_runtime_get_sync(dwc->dev);
spin_lock_irqsave(&dwc->lock, flags);
- dwc->connected = true;
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
spin_unlock_irqrestore(&dwc->lock, flags);
+ rockchip->connected = true;
dev_info(rockchip->dev, "USB peripheral connected\n");
} else if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) > 0) {
- if (dwc->connected)
+ if (rockchip->connected)
return;
/*
spin_lock_irqsave(&dwc->lock, flags);
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
- dwc->connected = true;
spin_unlock_irqrestore(&dwc->lock, flags);
if (hcd->state == HC_STATE_HALT) {
usb_add_hcd(hcd->shared_hcd, hcd->irq, IRQF_SHARED);
}
+ rockchip->connected = true;
dev_info(rockchip->dev, "USB HOST connected\n");
} else {
- if (!dwc->connected)
+ if (!rockchip->connected)
return;
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
}
- spin_lock_irqsave(&dwc->lock, flags);
- dwc->connected = false;
- spin_unlock_irqrestore(&dwc->lock, flags);
-
pm_runtime_put_sync(dwc->dev);
+ rockchip->connected = false;
dev_info(rockchip->dev, "USB unconnected\n");
}
}