Merge tag 'dt-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[linux-3.10.git] / arch / arm / mach-omap2 / usb-host.c
index 45f9b80..aa27d7f 100644 (file)
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita <vikram.pandita@ti.com>
+ * Author: Keshava Munegowda <keshava_mgowda@ti.com>
  *
  * Generalization by:
  * Felipe Balbi <balbi@ti.com>
 #include <linux/errno.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
-#include <linux/clk.h>
+#include <linux/slab.h>
 #include <linux/dma-mapping.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/string.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/usb/phy.h>
 
-#include <asm/io.h>
-
-#include <mach/hardware.h>
-#include <mach/irqs.h>
-#include <plat/usb.h>
-
+#include "soc.h"
+#include "omap_device.h"
 #include "mux.h"
+#include "usb.h"
 
-#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
-
-static struct resource ehci_resources[] = {
-       {
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .flags  = IORESOURCE_MEM,
-       },
-       {         /* general IRQ */
-               .flags   = IORESOURCE_IRQ,
-       }
-};
+#ifdef CONFIG_MFD_OMAP_USB_HOST
 
-static u64 ehci_dmamask = ~(u32)0;
-static struct platform_device ehci_device = {
-       .name           = "ehci-omap",
-       .id             = 0,
-       .dev = {
-               .dma_mask               = &ehci_dmamask,
-               .coherent_dma_mask      = 0xffffffff,
-               .platform_data          = NULL,
-       },
-       .num_resources  = ARRAY_SIZE(ehci_resources),
-       .resource       = ehci_resources,
-};
+#define OMAP_USBHS_DEVICE      "usbhs_omap"
+#define OMAP_USBTLL_DEVICE     "usbhs_tll"
+#define        USBHS_UHH_HWMODNAME     "usb_host_hs"
+#define USBHS_TLL_HWMODNAME    "usb_tll_hs"
 
 /* MUX settings for EHCI pins */
 /*
  * setup_ehci_io_mux - initialize IO pad mux for USBHOST
  */
-static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
+static void __init setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
 {
        switch (port_mode[0]) {
-       case EHCI_HCD_OMAP_MODE_PHY:
+       case OMAP_EHCI_PORT_MODE_PHY:
                omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT);
                omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT);
                omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN);
@@ -81,7 +62,7 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN);
                omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case EHCI_HCD_OMAP_MODE_TLL:
+       case OMAP_EHCI_PORT_MODE_TLL:
                omap_mux_init_signal("hsusb1_tll_stp",
                        OMAP_PIN_INPUT_PULLUP);
                omap_mux_init_signal("hsusb1_tll_clk",
@@ -107,14 +88,14 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("hsusb1_tll_data7",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case EHCI_HCD_OMAP_MODE_UNKNOWN:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
        }
 
        switch (port_mode[1]) {
-       case EHCI_HCD_OMAP_MODE_PHY:
+       case OMAP_EHCI_PORT_MODE_PHY:
                omap_mux_init_signal("hsusb2_stp", OMAP_PIN_OUTPUT);
                omap_mux_init_signal("hsusb2_clk", OMAP_PIN_OUTPUT);
                omap_mux_init_signal("hsusb2_dir", OMAP_PIN_INPUT_PULLDOWN);
@@ -136,7 +117,7 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("hsusb2_data7",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case EHCI_HCD_OMAP_MODE_TLL:
+       case OMAP_EHCI_PORT_MODE_TLL:
                omap_mux_init_signal("hsusb2_tll_stp",
                        OMAP_PIN_INPUT_PULLUP);
                omap_mux_init_signal("hsusb2_tll_clk",
@@ -162,17 +143,17 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("hsusb2_tll_data7",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case EHCI_HCD_OMAP_MODE_UNKNOWN:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
        }
 
        switch (port_mode[2]) {
-       case EHCI_HCD_OMAP_MODE_PHY:
+       case OMAP_EHCI_PORT_MODE_PHY:
                printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
                break;
-       case EHCI_HCD_OMAP_MODE_TLL:
+       case OMAP_EHCI_PORT_MODE_TLL:
                omap_mux_init_signal("hsusb3_tll_stp",
                        OMAP_PIN_INPUT_PULLUP);
                omap_mux_init_signal("hsusb3_tll_clk",
@@ -198,7 +179,7 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("hsusb3_tll_data7",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case EHCI_HCD_OMAP_MODE_UNKNOWN:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
@@ -207,10 +188,11 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
        return;
 }
 
-static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
+static
+void __init setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
 {
        switch (port_mode[0]) {
-       case EHCI_HCD_OMAP_MODE_PHY:
+       case OMAP_EHCI_PORT_MODE_PHY:
                omap_mux_init_signal("usbb1_ulpiphy_stp",
                        OMAP_PIN_OUTPUT);
                omap_mux_init_signal("usbb1_ulpiphy_clk",
@@ -236,7 +218,7 @@ static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("usbb1_ulpiphy_dat7",
                        OMAP_PIN_INPUT_PULLDOWN);
                        break;
-       case EHCI_HCD_OMAP_MODE_TLL:
+       case OMAP_EHCI_PORT_MODE_TLL:
                omap_mux_init_signal("usbb1_ulpitll_stp",
                        OMAP_PIN_INPUT_PULLUP);
                omap_mux_init_signal("usbb1_ulpitll_clk",
@@ -262,12 +244,12 @@ static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("usbb1_ulpitll_dat7",
                        OMAP_PIN_INPUT_PULLDOWN);
                        break;
-       case EHCI_HCD_OMAP_MODE_UNKNOWN:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
        default:
                        break;
        }
        switch (port_mode[1]) {
-       case EHCI_HCD_OMAP_MODE_PHY:
+       case OMAP_EHCI_PORT_MODE_PHY:
                omap_mux_init_signal("usbb2_ulpiphy_stp",
                        OMAP_PIN_OUTPUT);
                omap_mux_init_signal("usbb2_ulpiphy_clk",
@@ -293,7 +275,7 @@ static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("usbb2_ulpiphy_dat7",
                        OMAP_PIN_INPUT_PULLDOWN);
                        break;
-       case EHCI_HCD_OMAP_MODE_TLL:
+       case OMAP_EHCI_PORT_MODE_TLL:
                omap_mux_init_signal("usbb2_ulpitll_stp",
                        OMAP_PIN_INPUT_PULLUP);
                omap_mux_init_signal("usbb2_ulpitll_clk",
@@ -319,99 +301,13 @@ static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
                omap_mux_init_signal("usbb2_ulpitll_dat7",
                        OMAP_PIN_INPUT_PULLDOWN);
                        break;
-       case EHCI_HCD_OMAP_MODE_UNKNOWN:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
        default:
                        break;
        }
 }
 
-void __init usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata)
-{
-       platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
-
-       /* Setup Pin IO MUX for EHCI */
-       if (cpu_is_omap34xx()) {
-               ehci_resources[0].start = OMAP34XX_EHCI_BASE;
-               ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-               ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
-               ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-               ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
-               ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-               ehci_resources[3].start = INT_34XX_EHCI_IRQ;
-               setup_ehci_io_mux(pdata->port_mode);
-       } else if (cpu_is_omap44xx()) {
-               ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
-               ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-               ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
-               ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
-               ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
-               ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-               ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
-               setup_4430ehci_io_mux(pdata->port_mode);
-       }
-
-       ehci_resources[0].name  = "ehci";
-       ehci_resources[1].name  = "uhh";
-       ehci_resources[2].name  = "tll";
-       ehci_resources[3].name  = "irq";
-
-       if (platform_device_register(&ehci_device) < 0) {
-               printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
-               return;
-       }
-}
-
-#else
-
-void __init usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata)
-
-{
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
-static struct resource ohci_resources[] = {
-       {
-               .name   = "ohci",
-               .start  = OMAP34XX_OHCI_BASE,
-               .end    = OMAP34XX_OHCI_BASE + SZ_1K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "uhh",
-               .start  = OMAP34XX_UHH_CONFIG_BASE,
-               .end    = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "tll",
-               .start  = OMAP34XX_USBTLL_BASE,
-               .end    = OMAP34XX_USBTLL_BASE + SZ_4K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       {       /* general IRQ */
-               .name   = "irq",
-               .start  = INT_34XX_OHCI_IRQ,
-               .flags  = IORESOURCE_IRQ,
-       }
-};
-
-static u64 ohci_dmamask = DMA_BIT_MASK(32);
-
-static struct platform_device ohci_device = {
-       .name           = "ohci-omap3",
-       .id             = 0,
-       .dev = {
-               .dma_mask               = &ohci_dmamask,
-               .coherent_dma_mask      = 0xffffffff,
-       },
-       .num_resources  = ARRAY_SIZE(ohci_resources),
-       .resource       = ohci_resources,
-};
-
-static void setup_ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
+static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
 {
        switch (port_mode[0]) {
        case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
@@ -439,7 +335,7 @@ static void setup_ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
                omap_mux_init_signal("mm1_txdat",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case OMAP_OHCI_PORT_MODE_UNUSED:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
@@ -470,7 +366,7 @@ static void setup_ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
                omap_mux_init_signal("mm2_txdat",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case OMAP_OHCI_PORT_MODE_UNUSED:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
@@ -501,31 +397,288 @@ static void setup_ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
                omap_mux_init_signal("mm3_txdat",
                        OMAP_PIN_INPUT_PULLDOWN);
                break;
-       case OMAP_OHCI_PORT_MODE_UNUSED:
+       case OMAP_USBHS_PORT_MODE_UNUSED:
                /* FALLTHROUGH */
        default:
                break;
        }
 }
 
-void __init usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata)
+static
+void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
+{
+       switch (port_mode[0]) {
+       case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+       case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+               omap_mux_init_signal("usbb1_mm_rxdp",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               omap_mux_init_signal("usbb1_mm_rxdm",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+       case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+       case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+               omap_mux_init_signal("usbb1_mm_rxrcv",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+       case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+               omap_mux_init_signal("usbb1_mm_txen",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+
+       case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+               omap_mux_init_signal("usbb1_mm_txdat",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               omap_mux_init_signal("usbb1_mm_txse0",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               break;
+
+       case OMAP_USBHS_PORT_MODE_UNUSED:
+       default:
+               break;
+       }
+
+       switch (port_mode[1]) {
+       case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+       case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+               omap_mux_init_signal("usbb2_mm_rxdp",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               omap_mux_init_signal("usbb2_mm_rxdm",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+       case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+       case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+               omap_mux_init_signal("usbb2_mm_rxrcv",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+       case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+               omap_mux_init_signal("usbb2_mm_txen",
+                       OMAP_PIN_INPUT_PULLDOWN);
+
+
+       case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+       case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+               omap_mux_init_signal("usbb2_mm_txdat",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               omap_mux_init_signal("usbb2_mm_txse0",
+                       OMAP_PIN_INPUT_PULLDOWN);
+               break;
+
+       case OMAP_USBHS_PORT_MODE_UNUSED:
+       default:
+               break;
+       }
+}
+
+void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
 {
-       platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
+       struct omap_hwmod       *uhh_hwm, *tll_hwm;
+       struct platform_device  *pdev;
+       int                     bus_id = -1;
 
-       /* Setup Pin IO MUX for OHCI */
-       if (cpu_is_omap34xx())
+       if (cpu_is_omap34xx()) {
+               setup_ehci_io_mux(pdata->port_mode);
                setup_ohci_io_mux(pdata->port_mode);
 
-       if (platform_device_register(&ohci_device) < 0) {
-               pr_err("Unable to register FS-USB (OHCI) device\n");
+               if (omap_rev() <= OMAP3430_REV_ES2_1)
+                       pdata->single_ulpi_bypass = true;
+
+       } else if (cpu_is_omap44xx()) {
+               setup_4430ehci_io_mux(pdata->port_mode);
+               setup_4430ohci_io_mux(pdata->port_mode);
+       }
+
+       uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+       if (!uhh_hwm) {
+               pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
+               return;
+       }
+
+       tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+       if (!tll_hwm) {
+               pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
+               return;
+       }
+
+       pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+                               pdata, sizeof(*pdata));
+       if (IS_ERR(pdev)) {
+               pr_err("Could not build hwmod device %s\n",
+                      USBHS_TLL_HWMODNAME);
+               return;
+       }
+
+       pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+                               pdata, sizeof(*pdata));
+       if (IS_ERR(pdev)) {
+               pr_err("Could not build hwmod devices %s\n",
+                      USBHS_UHH_HWMODNAME);
                return;
        }
 }
 
 #else
 
-void __init usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata)
+void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
 {
 }
 
-#endif /* CONFIG_USB_OHCI_HCD */
+#endif
+
+/* Template for PHY regulators */
+static struct fixed_voltage_config hsusb_reg_config = {
+       /* .supply_name filled later */
+       .microvolts = 3300000,
+       .gpio = -1,             /* updated later */
+       .startup_delay = 70000, /* 70msec */
+       .enable_high = 1,       /* updated later */
+       .enabled_at_boot = 0,   /* keep in RESET */
+       /* .init_data filled later */
+};
+
+static const char *nop_name = "nop_usb_xceiv"; /* NOP PHY driver */
+static const char *reg_name = "reg-fixed-voltage"; /* Regulator driver */
+
+/**
+ * usbhs_add_regulator - Add a gpio based fixed voltage regulator device
+ * @name: name for the regulator
+ * @dev_id: device id of the device this regulator supplies power to
+ * @dev_supply: supply name that the device expects
+ * @gpio: GPIO number
+ * @polarity: 1 - Active high, 0 - Active low
+ */
+static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply,
+                                               int gpio, int polarity)
+{
+       struct regulator_consumer_supply *supplies;
+       struct regulator_init_data *reg_data;
+       struct fixed_voltage_config *config;
+       struct platform_device *pdev;
+       int ret;
+
+       supplies = kzalloc(sizeof(*supplies), GFP_KERNEL);
+       if (!supplies)
+               return -ENOMEM;
+
+       supplies->supply = dev_supply;
+       supplies->dev_name = dev_id;
+
+       reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL);
+       if (!reg_data)
+               return -ENOMEM;
+
+       reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
+       reg_data->consumer_supplies = supplies;
+       reg_data->num_consumer_supplies = 1;
+
+       config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
+                       GFP_KERNEL);
+       if (!config)
+               return -ENOMEM;
+
+       config->supply_name = name;
+       config->gpio = gpio;
+       config->enable_high = polarity;
+       config->init_data = reg_data;
+
+       /* create a regulator device */
+       pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
+       if (!pdev)
+               return -ENOMEM;
+
+       pdev->id = PLATFORM_DEVID_AUTO;
+       pdev->name = reg_name;
+       pdev->dev.platform_data = config;
+
+       ret = platform_device_register(pdev);
+       if (ret)
+               pr_err("%s: Failed registering regulator %s for %s\n",
+                               __func__, name, dev_id);
+
+       return ret;
+}
+
+int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
+{
+       char *rail_name;
+       int i, len;
+       struct platform_device *pdev;
+       char *phy_id;
+
+       /* the phy_id will be something like "nop_usb_xceiv.1" */
+       len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */
+
+       for (i = 0; i < num_phys; i++) {
+
+               if (!phy->port) {
+                       pr_err("%s: Invalid port 0. Must start from 1\n",
+                                               __func__);
+                       continue;
+               }
+
+               /* do we need a NOP PHY device ? */
+               if (!gpio_is_valid(phy->reset_gpio) &&
+                       !gpio_is_valid(phy->vcc_gpio))
+                       continue;
+
+               /* create a NOP PHY device */
+               pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
+               if (!pdev)
+                       return -ENOMEM;
+
+               pdev->id = phy->port;
+               pdev->name = nop_name;
+               pdev->dev.platform_data = phy->platform_data;
+
+               phy_id = kmalloc(len, GFP_KERNEL);
+               if (!phy_id)
+                       return -ENOMEM;
+
+               scnprintf(phy_id, len, "nop_usb_xceiv.%d\n",
+                                       pdev->id);
+
+               if (platform_device_register(pdev)) {
+                       pr_err("%s: Failed to register device %s\n",
+                               __func__,  phy_id);
+                       continue;
+               }
+
+               usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id);
+
+               /* Do we need RESET regulator ? */
+               if (gpio_is_valid(phy->reset_gpio)) {
+
+                       rail_name = kmalloc(13, GFP_KERNEL);
+                       if (!rail_name)
+                               return -ENOMEM;
+
+                       scnprintf(rail_name, 13, "hsusb%d_reset", phy->port);
+
+                       usbhs_add_regulator(rail_name, phy_id, "reset",
+                                               phy->reset_gpio, 1);
+               }
+
+               /* Do we need VCC regulator ? */
+               if (gpio_is_valid(phy->vcc_gpio)) {
+
+                       rail_name = kmalloc(13, GFP_KERNEL);
+                       if (!rail_name)
+                               return -ENOMEM;
+
+                       scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port);
+
+                       usbhs_add_regulator(rail_name, phy_id, "vcc",
+                                       phy->vcc_gpio, phy->vcc_polarity);
+               }
+
+               phy++;
+       }
+
+       return 0;
+}