/*
  * Renesas R-Car Gen3 for USB2.0 PHY driver
  *
- * Copyright (C) 2015 Renesas Electronics Corporation
+ * Copyright (C) 2015-2017 Renesas Electronics Corporation
  *
  * This is based on the phy-rcar-gen2 driver:
  * Copyright (C) 2014 Renesas Solutions Corp.
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
+#include <linux/usb/of.h>
 #include <linux/workqueue.h>
 
 /******* USB2.0 Host registers (original offset is +0x200) *******/
        /* call request_irq for OTG */
        irq = platform_get_irq(pdev, 0);
        if (irq >= 0) {
-               int ret;
-
                INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work);
                irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq,
                                       IRQF_SHARED, dev_name(dev), channel);
                if (irq < 0)
                        dev_err(dev, "No irq handler (%d)\n", irq);
+       }
+
+       if (of_usb_get_dr_mode_by_phy(dev->of_node, 0) == USB_DR_MODE_OTG) {
+               int ret;
+
                channel->has_otg = true;
                channel->extcon = devm_extcon_dev_allocate(dev,
                                                        rcar_gen3_phy_cable);