diff options
author | Felipe Balbi <balbi@ti.com> | 2013-02-11 04:03:59 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-03-18 05:17:01 -0400 |
commit | 9a4b5dab91a8bfae46bfa572660cf43e9ebdc6c3 (patch) | |
tree | 5c3191a062edf90d8c6dbb9c131f2a7a05428d17 /drivers/usb/dwc3 | |
parent | 7415f17c9560c923ba61cd330c8dfcd5c3630b80 (diff) |
usb: dwc3: omap: introduce enable/disable IRQ methods
they will be re-used on suspend/resume implementation.
Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/dwc3-omap.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 3d343d92548a..43d62053e158 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -250,6 +250,34 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) | |||
250 | return 0; | 250 | return 0; |
251 | } | 251 | } |
252 | 252 | ||
253 | static void dwc3_omap_enable_irqs(struct dwc3_omap *omap) | ||
254 | { | ||
255 | u32 reg; | ||
256 | |||
257 | /* enable all IRQs */ | ||
258 | reg = USBOTGSS_IRQO_COREIRQ_ST; | ||
259 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, reg); | ||
260 | |||
261 | reg = (USBOTGSS_IRQ1_OEVT | | ||
262 | USBOTGSS_IRQ1_DRVVBUS_RISE | | ||
263 | USBOTGSS_IRQ1_CHRGVBUS_RISE | | ||
264 | USBOTGSS_IRQ1_DISCHRGVBUS_RISE | | ||
265 | USBOTGSS_IRQ1_IDPULLUP_RISE | | ||
266 | USBOTGSS_IRQ1_DRVVBUS_FALL | | ||
267 | USBOTGSS_IRQ1_CHRGVBUS_FALL | | ||
268 | USBOTGSS_IRQ1_DISCHRGVBUS_FALL | | ||
269 | USBOTGSS_IRQ1_IDPULLUP_FALL); | ||
270 | |||
271 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_1, reg); | ||
272 | } | ||
273 | |||
274 | static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) | ||
275 | { | ||
276 | /* disable all IRQs */ | ||
277 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_1, 0x00); | ||
278 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, 0x00); | ||
279 | } | ||
280 | |||
253 | static int dwc3_omap_probe(struct platform_device *pdev) | 281 | static int dwc3_omap_probe(struct platform_device *pdev) |
254 | { | 282 | { |
255 | struct device_node *node = pdev->dev.of_node; | 283 | struct device_node *node = pdev->dev.of_node; |
@@ -355,21 +383,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
355 | return ret; | 383 | return ret; |
356 | } | 384 | } |
357 | 385 | ||
358 | /* enable all IRQs */ | 386 | dwc3_omap_enable_irqs(omap); |
359 | reg = USBOTGSS_IRQO_COREIRQ_ST; | ||
360 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, reg); | ||
361 | |||
362 | reg = (USBOTGSS_IRQ1_OEVT | | ||
363 | USBOTGSS_IRQ1_DRVVBUS_RISE | | ||
364 | USBOTGSS_IRQ1_CHRGVBUS_RISE | | ||
365 | USBOTGSS_IRQ1_DISCHRGVBUS_RISE | | ||
366 | USBOTGSS_IRQ1_IDPULLUP_RISE | | ||
367 | USBOTGSS_IRQ1_DRVVBUS_FALL | | ||
368 | USBOTGSS_IRQ1_CHRGVBUS_FALL | | ||
369 | USBOTGSS_IRQ1_DISCHRGVBUS_FALL | | ||
370 | USBOTGSS_IRQ1_IDPULLUP_FALL); | ||
371 | |||
372 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_1, reg); | ||
373 | 387 | ||
374 | ret = of_platform_populate(node, NULL, NULL, dev); | 388 | ret = of_platform_populate(node, NULL, NULL, dev); |
375 | if (ret) { | 389 | if (ret) { |
@@ -382,6 +396,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
382 | 396 | ||
383 | static int dwc3_omap_remove(struct platform_device *pdev) | 397 | static int dwc3_omap_remove(struct platform_device *pdev) |
384 | { | 398 | { |
399 | struct dwc3_omap *omap = platform_get_drvdata(pdev); | ||
400 | |||
401 | dwc3_omap_disable_irqs(omap); | ||
385 | pm_runtime_put_sync(&pdev->dev); | 402 | pm_runtime_put_sync(&pdev->dev); |
386 | pm_runtime_disable(&pdev->dev); | 403 | pm_runtime_disable(&pdev->dev); |
387 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | 404 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); |