aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGeorge Cherian <george.cherian@ti.com>2014-07-16 09:07:06 -0400
committerFelipe Balbi <balbi@ti.com>2014-07-16 10:56:49 -0400
commit30fef1a97fb6551abb50b5208993726b878fe40f (patch)
tree3052c12d01f3b33dfd7b8d4b3a510e4492d4a5ba /drivers/usb
parentca632a0d2fec10e62377a78a424d68c90f2e4345 (diff)
usb: dwc3: omap: add dwc3_omap_map_offset() function
Move map offset to its own separate function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 25a6075ef319..22fca6291ff5 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -378,6 +378,27 @@ static int dwc3_omap_vbus_notifier(struct notifier_block *nb,
378 return NOTIFY_DONE; 378 return NOTIFY_DONE;
379} 379}
380 380
381static void dwc3_omap_map_offset(struct dwc3_omap *omap)
382{
383 struct device_node *node = omap->dev->of_node;
384
385 /*
386 * Differentiate between OMAP5 and AM437x.
387 *
388 * For OMAP5(ES2.0) and AM437x wrapper revision is same, even
389 * though there are changes in wrapper register offsets.
390 *
391 * Using dt compatible to differentiate AM437x.
392 */
393 if (of_device_is_compatible(node, "ti,am437x-dwc3")) {
394 omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET;
395 omap->irq0_offset = USBOTGSS_IRQ0_OFFSET;
396 omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET;
397 omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET;
398 omap->debug_offset = USBOTGSS_DEBUG_OFFSET;
399 }
400}
401
381static int dwc3_omap_probe(struct platform_device *pdev) 402static int dwc3_omap_probe(struct platform_device *pdev)
382{ 403{
383 struct device_node *node = pdev->dev.of_node; 404 struct device_node *node = pdev->dev.of_node;
@@ -442,22 +463,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
442 goto err0; 463 goto err0;
443 } 464 }
444 465
445 /* 466 dwc3_omap_map_offset(omap);
446 * Differentiate between OMAP5 and AM437x.
447 *
448 * For OMAP5(ES2.0) and AM437x wrapper revision is same, even
449 * though there are changes in wrapper register offsets.
450 *
451 * Using dt compatible to differentiate AM437x.
452 */
453
454 if (of_device_is_compatible(node, "ti,am437x-dwc3")) {
455 omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET;
456 omap->irq0_offset = USBOTGSS_IRQ0_OFFSET;
457 omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET;
458 omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET;
459 omap->debug_offset = USBOTGSS_DEBUG_OFFSET;
460 }
461 467
462 reg = dwc3_omap_read_utmi_status(omap); 468 reg = dwc3_omap_read_utmi_status(omap);
463 469