[ELDK] [PATCH 1/2] META-ELDK: linux-eldk: Add USB support for M53EVK

Marek Vasut marex at denx.de
Tue Apr 1 22:42:18 CEST 2014


Backport Linux patches necessary to get USB operational on i.MX5x
and backport a patch which enables USB support on M53. Moreover,
enable NOP PHY in the M53EVK defconfig, as that is the PHY type
used on i.MX5x .

The diffstat for the kernel part looks like below, so the changes
for the kernel part are contained:
 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt |  6 +++
 arch/arm/boot/dts/imx51.dtsi                          | 23 ++++++++++
 arch/arm/boot/dts/imx53-m53evk.dts                    | 22 +++++++++
 arch/arm/boot/dts/imx53.dtsi                          | 31 +++++++++++++
 drivers/usb/chipidea/bits.h                           | 16 ++++++-
 drivers/usb/chipidea/ci13xxx_imx.c                    | 98 ++++++++++++----------------------------
 drivers/usb/chipidea/core.c                           | 97 +++++++++++++++++++++++++++++++++++----
 drivers/usb/chipidea/host.c                           | 23 +++++++++-
 drivers/usb/chipidea/udc.c                            | 20 +++++++-
 drivers/usb/chipidea/udc.h                            |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                    |  4 +-
 drivers/usb/phy/Makefile                              |  1 +
 drivers/usb/phy/of.c                                  | 47 +++++++++++++++++++
 drivers/usb/usb-common.c                              | 35 ++++++++++++++
 include/linux/usb/chipidea.h                          |  4 +-
 include/linux/usb/of.h                                | 28 ++++++++++++
 include/linux/usb/otg.h                               |  7 +++
 include/linux/usb/phy.h                               |  9 ++++
 18 files changed, 388 insertions(+), 84 deletions(-)

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
---
 ...a-ci13xxx_imx-let-device-core-handle-pinc.patch |  55 ++++++
 ...a-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch |  41 ++++
 ...-usb-chipidea-udc-configure-iso-endpoints.patch | 100 ++++++++++
 ...9-usb-chipidea-ci13xxx_imx-fix-error-path.patch |  71 +++++++
 ...-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch |  72 +++++++
 ...a-ci13xxx_imx-check-if-data-phy_np-is-not.patch |  33 ++++
 ...32-usb-chipidea-ci13xxx_imx-remove-phy_np.patch |  55 ++++++
 ...usb-chipidea-add-PTW-PTS-and-STS-handling.patch | 170 ++++++++++++++++
 ...icetree-helpers-for-determining-dr_mode-a.patch | 217 +++++++++++++++++++++
 ...idea-introduce-dual-role-mode-pdata-flags.patch |  90 +++++++++
 ...a-ci13xxx-imx-move-static-pdata-into-prob.patch |  69 +++++++
 ...a-i.MX-use-devm_usb_get_phy_by_phandle-to.patch | 100 ++++++++++
 ...idea-move-hw_phymode_configure-into-probe.patch |  47 +++++
 ...a-ci_hdrc_imx-remove-an-unsolicited-modul.patch |  39 ++++
 ...a-prevent-endless-loop-registering-platfo.patch |  71 +++++++
 ...dea-move-vbus-regulator-operation-to-core.patch | 161 +++++++++++++++
 ...-chipidea-host-add-vbus-regulator-control.patch |  85 ++++++++
 ...043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch | 105 ++++++++++
 ...RM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch | 103 ++++++++++
 ...-use-usb-nop-xceiv-usbphy-entries-for-imx.patch |  81 ++++++++
 ...-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch |  62 ++++++
 .../linux/linux-eldk/m53evk/defconfig              |   1 +
 meta-eldk/recipes-kernel/linux/linux-eldk_3.10.bb  |  21 ++
 23 files changed, 1849 insertions(+)
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0026-usb-chipidea-ci13xxx_imx-let-device-core-handle-pinc.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0027-usb-chipidea-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0028-usb-chipidea-udc-configure-iso-endpoints.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0029-usb-chipidea-ci13xxx_imx-fix-error-path.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0030-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0031-usb-chipidea-ci13xxx_imx-check-if-data-phy_np-is-not.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0032-usb-chipidea-ci13xxx_imx-remove-phy_np.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0033-usb-chipidea-add-PTW-PTS-and-STS-handling.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0034-usb-add-devicetree-helpers-for-determining-dr_mode-a.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0035-usb-chipidea-introduce-dual-role-mode-pdata-flags.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0036-usb-chipidea-ci13xxx-imx-move-static-pdata-into-prob.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0037-usb-chipidea-i.MX-use-devm_usb_get_phy_by_phandle-to.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0038-usb-chipidea-move-hw_phymode_configure-into-probe.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0039-usb-chipidea-ci_hdrc_imx-remove-an-unsolicited-modul.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0040-usb-chipidea-prevent-endless-loop-registering-platfo.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0041-usb-chipidea-move-vbus-regulator-operation-to-core.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0042-usb-chipidea-host-add-vbus-regulator-control.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0044-ARM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0045-ARM-dts-imx-use-usb-nop-xceiv-usbphy-entries-for-imx.patch
 create mode 100644 meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0046-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch

diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0026-usb-chipidea-ci13xxx_imx-let-device-core-handle-pinc.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0026-usb-chipidea-ci13xxx_imx-let-device-core-handle-pinc.patch
new file mode 100644
index 0000000..6d4ff48
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0026-usb-chipidea-ci13xxx_imx-let-device-core-handle-pinc.patch
@@ -0,0 +1,55 @@
+From bc59b35f2f63d2466831821a647b679c2974bf0e Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:45 +0300
+Subject: [PATCH 01/21] usb: chipidea: ci13xxx_imx: let device core handle
+ pinctrl
+
+Since commit ab78029 (drivers/pinctrl: grab default handles from device core),
+we can rely on device core for handling pinctrl.
+
+So remove devm_pinctrl_get_select_default() from the driver.
+
+Cc: <linux-usb at vger.kernel.org>
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Tested-by: Shawn Guo <shawn.guo at linaro.org>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 73f9d5f..2e45ac8 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -20,7 +20,6 @@
+ #include <linux/usb/chipidea.h>
+ #include <linux/clk.h>
+ #include <linux/regulator/consumer.h>
+-#include <linux/pinctrl/consumer.h>
+ 
+ #include "ci.h"
+ #include "ci13xxx_imx.h"
+@@ -103,7 +102,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 	struct device_node *phy_np;
+ 	struct resource *res;
+ 	struct regulator *reg_vbus;
+-	struct pinctrl *pinctrl;
+ 	int ret;
+ 
+ 	if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
+@@ -122,11 +120,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		return -ENOENT;
+ 	}
+ 
+-	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+-	if (IS_ERR(pinctrl))
+-		dev_warn(&pdev->dev, "pinctrl get/select failed, err=%ld\n",
+-			PTR_ERR(pinctrl));
+-
+ 	data->clk = devm_clk_get(&pdev->dev, NULL);
+ 	if (IS_ERR(data->clk)) {
+ 		dev_err(&pdev->dev,
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0027-usb-chipidea-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0027-usb-chipidea-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch
new file mode 100644
index 0000000..8da280b
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0027-usb-chipidea-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch
@@ -0,0 +1,41 @@
+From 91b03f59c8f63996d9620bd5391314fb9ac80ddf Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:46 +0300
+Subject: [PATCH 02/21] usb: chipidea: usbmisc_imx: Staticize
+ usbmisc_imx_drv_init/exit
+
+Fix the following sparse warnings:
+
+drivers/usb/chipidea/usbmisc_imx.c:246:5: warning: symbol 'usbmisc_imx_drv_init' was not declared. Should it be static?
+drivers/usb/chipidea/usbmisc_imx.c:252:6: warning: symbol 'usbmisc_imx_drv_exit' was not declared. Should it be static?
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/usbmisc_imx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
+index 714a6bd..1c6610a 100644
+--- a/drivers/usb/chipidea/usbmisc_imx.c
++++ b/drivers/usb/chipidea/usbmisc_imx.c
+@@ -243,13 +243,13 @@ static struct platform_driver usbmisc_imx_driver = {
+ 	 },
+ };
+ 
+-int usbmisc_imx_drv_init(void)
++static int usbmisc_imx_drv_init(void)
+ {
+ 	return platform_driver_register(&usbmisc_imx_driver);
+ }
+ subsys_initcall(usbmisc_imx_drv_init);
+ 
+-void usbmisc_imx_drv_exit(void)
++static void usbmisc_imx_drv_exit(void)
+ {
+ 	platform_driver_unregister(&usbmisc_imx_driver);
+ }
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0028-usb-chipidea-udc-configure-iso-endpoints.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0028-usb-chipidea-udc-configure-iso-endpoints.patch
new file mode 100644
index 0000000..26d5cfe
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0028-usb-chipidea-udc-configure-iso-endpoints.patch
@@ -0,0 +1,100 @@
+From ae67a94cc318e786e4726def27103e6d6a9b4444 Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <mgr at pengutronix.de>
+Date: Thu, 13 Jun 2013 17:59:47 +0300
+Subject: [PATCH 03/21] usb: chipidea: udc: configure iso endpoints
+
+This patch adds iso endpoint support to the device controller.
+It makes use of the multiplication bits in the maxpacket field
+of the endpoint and calculates the multiplier bits for each
+transfer description on every request.
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Reviewed-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/core.c |  2 +-
+ drivers/usb/chipidea/udc.c  | 20 +++++++++++++++++++-
+ drivers/usb/chipidea/udc.h  |  1 +
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index 475c9c1..ade1b91 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -43,7 +43,7 @@
+  *
+  * TODO List
+  * - OTG
+- * - Isochronous & Interrupt Traffic
++ * - Interrupt Traffic
+  * - Handle requests which spawns into several TDs
+  * - GET_STATUS(device) - always reports 0
+  * - Gadget API (majority of optional features)
+diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
+index b501346..8aed288 100644
+--- a/drivers/usb/chipidea/udc.c
++++ b/drivers/usb/chipidea/udc.c
+@@ -466,6 +466,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
+ 	mEp->qh.ptr->td.token &=
+ 		cpu_to_le32(~(TD_STATUS_HALTED|TD_STATUS_ACTIVE));
+ 
++	if (mEp->type == USB_ENDPOINT_XFER_ISOC) {
++		u32 mul = mReq->req.length / mEp->ep.maxpacket;
++
++		if (mReq->req.length % mEp->ep.maxpacket)
++			mul++;
++		mEp->qh.ptr->cap |= mul << __ffs(QH_MULT);
++	}
++
+ 	wmb();   /* synchronize before ep prime */
+ 
+ 	ret = hw_ep_prime(ci, mEp->num, mEp->dir,
+@@ -678,6 +686,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
+ 		}
+ 	}
+ 
++	if (usb_endpoint_xfer_isoc(mEp->ep.desc) &&
++	    mReq->req.length > (1 + mEp->ep.mult) * mEp->ep.maxpacket) {
++		dev_err(mEp->ci->dev, "request length too big for isochronous\n");
++		return -EMSGSIZE;
++	}
++
+ 	/* first nuke then test link, e.g. previous status has not sent */
+ 	if (!list_empty(&mReq->queue)) {
+ 		dev_err(mEp->ci->dev, "request already in queue\n");
+@@ -1060,7 +1074,8 @@ static int ep_enable(struct usb_ep *ep,
+ 	mEp->num  = usb_endpoint_num(desc);
+ 	mEp->type = usb_endpoint_type(desc);
+ 
+-	mEp->ep.maxpacket = usb_endpoint_maxp(desc);
++	mEp->ep.maxpacket = usb_endpoint_maxp(desc) & 0x07ff;
++	mEp->ep.mult = QH_ISO_MULT(usb_endpoint_maxp(desc));
+ 
+ 	if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
+ 		cap |= QH_IOS;
+@@ -1246,6 +1261,9 @@ static int ep_set_halt(struct usb_ep *ep, int value)
+ 	if (ep == NULL || mEp->ep.desc == NULL)
+ 		return -EINVAL;
+ 
++	if (usb_endpoint_xfer_isoc(mEp->ep.desc))
++		return -EOPNOTSUPP;
++
+ 	spin_lock_irqsave(mEp->lock, flags);
+ 
+ #ifndef STALL_IN
+diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h
+index d12e8b5..a75724a 100644
+--- a/drivers/usb/chipidea/udc.h
++++ b/drivers/usb/chipidea/udc.h
+@@ -50,6 +50,7 @@ struct ci13xxx_qh {
+ #define QH_MAX_PKT            (0x07FFUL << 16)
+ #define QH_ZLT                BIT(29)
+ #define QH_MULT               (0x0003UL << 30)
++#define QH_ISO_MULT(x)		((x >> 11) & 0x03)
+ 	/* 1 */
+ 	u32 curr;
+ 	/* 2 - 8 */
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0029-usb-chipidea-ci13xxx_imx-fix-error-path.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0029-usb-chipidea-ci13xxx_imx-fix-error-path.patch
new file mode 100644
index 0000000..f222833
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0029-usb-chipidea-ci13xxx_imx-fix-error-path.patch
@@ -0,0 +1,71 @@
+From 0fc4145ec13f24e9e5d241991aeaaeac84c1cedc Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:48 +0300
+Subject: [PATCH 04/21] usb: chipidea: ci13xxx_imx: fix error path
+
+If usbmisc_ops->post() fails it should point the error path to release all
+previously acquired resources, so adjust it to call ci13xxx_remove_device().
+
+While at it, remove the unnecessary 'plat_ci' indirection, as we can directly
+use the private structure.
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 2e45ac8..d0f505a 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -98,7 +98,7 @@ static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
+ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ {
+ 	struct ci13xxx_imx_data *data;
+-	struct platform_device *plat_ci, *phy_pdev;
++	struct platform_device *phy_pdev;
+ 	struct device_node *phy_np;
+ 	struct resource *res;
+ 	struct regulator *reg_vbus;
+@@ -180,11 +180,11 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		}
+ 	}
+ 
+-	plat_ci = ci13xxx_add_device(&pdev->dev,
++	data->ci_pdev = ci13xxx_add_device(&pdev->dev,
+ 				pdev->resource, pdev->num_resources,
+ 				&ci13xxx_imx_platdata);
+-	if (IS_ERR(plat_ci)) {
+-		ret = PTR_ERR(plat_ci);
++	if (IS_ERR(data->ci_pdev)) {
++		ret = PTR_ERR(data->ci_pdev);
+ 		dev_err(&pdev->dev,
+ 			"Can't register ci_hdrc platform device, err=%d\n",
+ 			ret);
+@@ -196,11 +196,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		if (ret) {
+ 			dev_err(&pdev->dev,
+ 				"usbmisc post failed, ret=%d\n", ret);
+-			goto put_np;
++			goto disable_device;
+ 		}
+ 	}
+ 
+-	data->ci_pdev = plat_ci;
+ 	platform_set_drvdata(pdev, data);
+ 
+ 	pm_runtime_no_callbacks(&pdev->dev);
+@@ -208,6 +207,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 
+ 	return 0;
+ 
++disable_device:
++	ci13xxx_remove_device(data->ci_pdev);
+ err:
+ 	if (reg_vbus)
+ 		regulator_disable(reg_vbus);
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0030-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0030-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch
new file mode 100644
index 0000000..981cb33
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0030-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch
@@ -0,0 +1,72 @@
+From 83128d822daf6c5ec9abfc5e070be56fb2a9c98e Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:49 +0300
+Subject: [PATCH 05/21] usb: chipidea: ci13xxx_imx: remove reg_vbus
+
+There is no need to keep a 'reg_vbus' indirection, so get rid of it.
+
+The motivation for doing this change is that in the case of error, the current
+code only sets the local reg_vbus to NULL instead of updating the private
+structure 'data->reg_vbus'.
+
+Updating only the local reg_vbus is wrong, since we currently check for
+data->reg_vbus in the ci13xxx_imx_remove() function.
+
+In order to avoid such issue, just use 'data->reg_vbus' directly.
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index d0f505a..1d2897d 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -101,7 +101,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 	struct platform_device *phy_pdev;
+ 	struct device_node *phy_np;
+ 	struct resource *res;
+-	struct regulator *reg_vbus;
+ 	int ret;
+ 
+ 	if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
+@@ -150,18 +149,17 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 	}
+ 
+ 	/* we only support host now, so enable vbus here */
+-	reg_vbus = devm_regulator_get(&pdev->dev, "vbus");
+-	if (!IS_ERR(reg_vbus)) {
+-		ret = regulator_enable(reg_vbus);
++	data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus");
++	if (!IS_ERR(data->reg_vbus)) {
++		ret = regulator_enable(data->reg_vbus);
+ 		if (ret) {
+ 			dev_err(&pdev->dev,
+ 				"Failed to enable vbus regulator, err=%d\n",
+ 				ret);
+ 			goto put_np;
+ 		}
+-		data->reg_vbus = reg_vbus;
+ 	} else {
+-		reg_vbus = NULL;
++		data->reg_vbus = NULL;
+ 	}
+ 
+ 	ci13xxx_imx_platdata.phy = data->phy;
+@@ -210,8 +208,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ disable_device:
+ 	ci13xxx_remove_device(data->ci_pdev);
+ err:
+-	if (reg_vbus)
+-		regulator_disable(reg_vbus);
++	if (data->reg_vbus)
++		regulator_disable(data->reg_vbus);
+ put_np:
+ 	if (phy_np)
+ 		of_node_put(phy_np);
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0031-usb-chipidea-ci13xxx_imx-check-if-data-phy_np-is-not.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0031-usb-chipidea-ci13xxx_imx-check-if-data-phy_np-is-not.patch
new file mode 100644
index 0000000..c0f34cc
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0031-usb-chipidea-ci13xxx_imx-check-if-data-phy_np-is-not.patch
@@ -0,0 +1,33 @@
+From 619ff9b7baf407257b4a377444b6587ba3daccce Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:50 +0300
+Subject: [PATCH 06/21] usb: chipidea: ci13xxx_imx: check if 'data->phy_np' is
+ not NULL
+
+Similarly as it is done in ci13xxx_imx_remove(), only calls of_node_put if
+data->phy_np is not NULL.
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 1d2897d..75f553b 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -232,7 +232,8 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
+ 		module_put(data->phy->dev->driver->owner);
+ 	}
+ 
+-	of_node_put(data->phy_np);
++	if (data->phy_np)
++		of_node_put(data->phy_np);
+ 
+ 	clk_disable_unprepare(data->clk);
+ 
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0032-usb-chipidea-ci13xxx_imx-remove-phy_np.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0032-usb-chipidea-ci13xxx_imx-remove-phy_np.patch
new file mode 100644
index 0000000..9bb741d
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0032-usb-chipidea-ci13xxx_imx-remove-phy_np.patch
@@ -0,0 +1,55 @@
+From c2053667582c9a504f6363e12616c1e15b9f8427 Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Thu, 13 Jun 2013 17:59:51 +0300
+Subject: [PATCH 07/21] usb: chipidea: ci13xxx_imx: remove 'phy_np'
+
+There is no need to keep a local 'phy_np' as we can directly use the private
+structure in data->phy_np.
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 75f553b..aef5b5b 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -99,7 +99,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ {
+ 	struct ci13xxx_imx_data *data;
+ 	struct platform_device *phy_pdev;
+-	struct device_node *phy_np;
+ 	struct resource *res;
+ 	int ret;
+ 
+@@ -133,10 +132,9 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		return ret;
+ 	}
+ 
+-	phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
+-	if (phy_np) {
+-		data->phy_np = phy_np;
+-		phy_pdev = of_find_device_by_node(phy_np);
++	data->phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
++	if (data->phy_np) {
++		phy_pdev = of_find_device_by_node(data->phy_np);
+ 		if (phy_pdev) {
+ 			struct usb_phy *phy;
+ 			phy = pdev_to_phy(phy_pdev);
+@@ -211,8 +209,8 @@ err:
+ 	if (data->reg_vbus)
+ 		regulator_disable(data->reg_vbus);
+ put_np:
+-	if (phy_np)
+-		of_node_put(phy_np);
++	if (data->phy_np)
++		of_node_put(data->phy_np);
+ 	clk_disable_unprepare(data->clk);
+ 	return ret;
+ }
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0033-usb-chipidea-add-PTW-PTS-and-STS-handling.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0033-usb-chipidea-add-PTW-PTS-and-STS-handling.patch
new file mode 100644
index 0000000..62a7ec2
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0033-usb-chipidea-add-PTW-PTS-and-STS-handling.patch
@@ -0,0 +1,170 @@
+From 6b4995bec8ee213f178755161a77f8a15d3c2ba0 Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 13 Jun 2013 17:59:56 +0300
+Subject: [PATCH 08/21] usb: chipidea: add PTW, PTS and STS handling
+
+This patch makes it possible to configure the PTW, PTS and STS bits
+inside the portsc register for host and device mode before the driver
+starts and the phy can be addressed as hardware implementation is
+designed.
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
+Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ .../devicetree/bindings/usb/ci13xxx-imx.txt        |  5 +++
+ drivers/usb/chipidea/bits.h                        | 16 +++++++-
+ drivers/usb/chipidea/core.c                        | 48 ++++++++++++++++++++++
+ include/linux/usb/chipidea.h                       |  1 +
+ 4 files changed, 69 insertions(+), 1 deletion(-)
+
+diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+index 1c04a4c..184a8e0 100644
+--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
++++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+@@ -5,6 +5,11 @@ Required properties:
+ - reg: Should contain registers location and length
+ - interrupts: Should contain controller interrupt
+ 
++Recommended properies:
++- phy_type: the type of the phy connected to the core. Should be one
++  of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
++  property the PORTSC register won't be touched
++
+ Optional properties:
+ - fsl,usbphy: phandler of usb phy that connects to the only one port
+ - fsl,usbmisc: phandler of non-core register device, with one argument
+diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
+index 050de85..aefa026 100644
+--- a/drivers/usb/chipidea/bits.h
++++ b/drivers/usb/chipidea/bits.h
+@@ -48,10 +48,24 @@
+ #define PORTSC_SUSP           BIT(7)
+ #define PORTSC_HSP            BIT(9)
+ #define PORTSC_PTC            (0x0FUL << 16)
++/* PTS and PTW for non lpm version only */
++#define PORTSC_PTS(d)						\
++	((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0))
++#define PORTSC_PTW            BIT(28)
++#define PORTSC_STS            BIT(29)
+ 
+ /* DEVLC */
+ #define DEVLC_PSPD            (0x03UL << 25)
+-#define    DEVLC_PSPD_HS      (0x02UL << 25)
++#define DEVLC_PSPD_HS         (0x02UL << 25)
++#define DEVLC_PTW             BIT(27)
++#define DEVLC_STS             BIT(28)
++#define DEVLC_PTS(d)          (((d) & 0x7) << 29)
++
++/* Encoding for DEVLC_PTS and PORTSC_PTS */
++#define PTS_UTMI              0
++#define PTS_ULPI              2
++#define PTS_SERIAL            3
++#define PTS_HSIC              4
+ 
+ /* OTGSC */
+ #define OTGSC_IDPU	      BIT(5)
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index ade1b91..5740ac2 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -64,6 +64,8 @@
+ #include <linux/usb/gadget.h>
+ #include <linux/usb/otg.h>
+ #include <linux/usb/chipidea.h>
++#include <linux/usb/of.h>
++#include <linux/phy.h>
+ 
+ #include "ci.h"
+ #include "udc.h"
+@@ -208,6 +210,45 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
+ 	return 0;
+ }
+ 
++static void hw_phymode_configure(struct ci13xxx *ci)
++{
++	u32 portsc, lpm, sts;
++
++	switch (ci->platdata->phy_mode) {
++	case USBPHY_INTERFACE_MODE_UTMI:
++		portsc = PORTSC_PTS(PTS_UTMI);
++		lpm = DEVLC_PTS(PTS_UTMI);
++		break;
++	case USBPHY_INTERFACE_MODE_UTMIW:
++		portsc = PORTSC_PTS(PTS_UTMI) | PORTSC_PTW;
++		lpm = DEVLC_PTS(PTS_UTMI) | DEVLC_PTW;
++		break;
++	case USBPHY_INTERFACE_MODE_ULPI:
++		portsc = PORTSC_PTS(PTS_ULPI);
++		lpm = DEVLC_PTS(PTS_ULPI);
++		break;
++	case USBPHY_INTERFACE_MODE_SERIAL:
++		portsc = PORTSC_PTS(PTS_SERIAL);
++		lpm = DEVLC_PTS(PTS_SERIAL);
++		sts = 1;
++		break;
++	case USBPHY_INTERFACE_MODE_HSIC:
++		portsc = PORTSC_PTS(PTS_HSIC);
++		lpm = DEVLC_PTS(PTS_HSIC);
++		break;
++	default:
++		return;
++	}
++
++	if (ci->hw_bank.lpm) {
++		hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm);
++		hw_write(ci, OP_DEVLC, DEVLC_STS, sts);
++	} else {
++		hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc);
++		hw_write(ci, OP_PORTSC, PORTSC_STS, sts);
++	}
++}
++
+ /**
+  * hw_device_reset: resets chip (execute without interruption)
+  * @ci: the controller
+@@ -224,6 +265,7 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
+ 	while (hw_read(ci, OP_USBCMD, USBCMD_RST))
+ 		udelay(10);		/* not RTOS friendly */
+ 
++	hw_phymode_configure(ci);
+ 
+ 	if (ci->platdata->notify_event)
+ 		ci->platdata->notify_event(ci,
+@@ -370,6 +412,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 		return -ENODEV;
+ 	}
+ 
++	if (!dev->of_node && dev->parent)
++		dev->of_node = dev->parent->of_node;
++
+ 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ 	base = devm_ioremap_resource(dev, res);
+ 	if (IS_ERR(base))
+@@ -409,6 +454,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 		return -ENODEV;
+ 	}
+ 
++	if (!ci->platdata->phy_mode)
++		ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
++
+ 	/* initialize role(s) before the interrupt is requested */
+ 	ret = ci_hdrc_host_init(ci);
+ 	if (ret)
+diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
+index 544825d..1a2aa18 100644
+--- a/include/linux/usb/chipidea.h
++++ b/include/linux/usb/chipidea.h
+@@ -14,6 +14,7 @@ struct ci13xxx_platform_data {
+ 	uintptr_t	 capoffset;
+ 	unsigned	 power_budget;
+ 	struct usb_phy	*phy;
++	enum usb_phy_interface phy_mode;
+ 	unsigned long	 flags;
+ #define CI13XXX_REGS_SHARED		BIT(0)
+ #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0034-usb-add-devicetree-helpers-for-determining-dr_mode-a.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0034-usb-add-devicetree-helpers-for-determining-dr_mode-a.patch
new file mode 100644
index 0000000..0670036
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0034-usb-add-devicetree-helpers-for-determining-dr_mode-a.patch
@@ -0,0 +1,217 @@
+From 9b61fe6abb94890ec47e567e2897f60e7239ed6f Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 13 Jun 2013 17:59:55 +0300
+Subject: [PATCH 09/21] usb: add devicetree helpers for determining dr_mode and
+ phy_type
+
+This adds two little devicetree helper functions for determining the
+dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
+the devicetree.
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
+Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
+Acked-by: Felipe Balbi <balbi at ti.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/phy/Makefile |  1 +
+ drivers/usb/phy/of.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/usb/usb-common.c | 35 +++++++++++++++++++++++++++++++++++
+ include/linux/usb/of.h   | 28 ++++++++++++++++++++++++++++
+ include/linux/usb/otg.h  |  7 +++++++
+ include/linux/usb/phy.h  |  9 +++++++++
+ 6 files changed, 127 insertions(+)
+ create mode 100644 drivers/usb/phy/of.c
+ create mode 100644 include/linux/usb/of.h
+
+diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
+index a9169cb..070eca3 100644
+--- a/drivers/usb/phy/Makefile
++++ b/drivers/usb/phy/Makefile
+@@ -5,6 +5,7 @@
+ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
+ 
+ obj-$(CONFIG_USB_PHY)			+= phy.o
++obj-$(CONFIG_OF)			+= of.o
+ 
+ # transceiver drivers, keep the list sorted
+ 
+diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
+new file mode 100644
+index 0000000..7ea0154
+--- /dev/null
++++ b/drivers/usb/phy/of.c
+@@ -0,0 +1,47 @@
++/*
++ * USB of helper code
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/usb/of.h>
++#include <linux/usb/otg.h>
++
++static const char *const usbphy_modes[] = {
++	[USBPHY_INTERFACE_MODE_UNKNOWN]	= "",
++	[USBPHY_INTERFACE_MODE_UTMI]	= "utmi",
++	[USBPHY_INTERFACE_MODE_UTMIW]	= "utmi_wide",
++	[USBPHY_INTERFACE_MODE_ULPI]	= "ulpi",
++	[USBPHY_INTERFACE_MODE_SERIAL]	= "serial",
++	[USBPHY_INTERFACE_MODE_HSIC]	= "hsic",
++};
++
++/**
++ * of_usb_get_phy_mode - Get phy mode for given device_node
++ * @np:	Pointer to the given device_node
++ *
++ * The function gets phy interface string from property 'phy_type',
++ * and returns the correspondig enum usb_phy_interface
++ */
++enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
++{
++	const char *phy_type;
++	int err, i;
++
++	err = of_property_read_string(np, "phy_type", &phy_type);
++	if (err < 0)
++		return USBPHY_INTERFACE_MODE_UNKNOWN;
++
++	for (i = 0; i < ARRAY_SIZE(usbphy_modes); i++)
++		if (!strcmp(phy_type, usbphy_modes[i]))
++			return i;
++
++	return USBPHY_INTERFACE_MODE_UNKNOWN;
++}
++EXPORT_SYMBOL_GPL(of_usb_get_phy_mode);
+diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
+index 0db0a91..675384d 100644
+--- a/drivers/usb/usb-common.c
++++ b/drivers/usb/usb-common.c
+@@ -13,7 +13,9 @@
+ 
+ #include <linux/kernel.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ #include <linux/usb/ch9.h>
++#include <linux/usb/of.h>
+ #include <linux/usb/otg.h>
+ 
+ const char *usb_otg_state_string(enum usb_otg_state state)
+@@ -79,4 +81,37 @@ const char *usb_state_string(enum usb_device_state state)
+ }
+ EXPORT_SYMBOL_GPL(usb_state_string);
+ 
++#ifdef CONFIG_OF
++static const char *const usb_dr_modes[] = {
++	[USB_DR_MODE_UNKNOWN]		= "",
++	[USB_DR_MODE_HOST]		= "host",
++	[USB_DR_MODE_PERIPHERAL]	= "peripheral",
++	[USB_DR_MODE_OTG]		= "otg",
++};
++
++/**
++ * of_usb_get_dr_mode - Get dual role mode for given device_node
++ * @np:	Pointer to the given device_node
++ *
++ * The function gets phy interface string from property 'dr_mode',
++ * and returns the correspondig enum usb_dr_mode
++ */
++enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
++{
++	const char *dr_mode;
++	int err, i;
++
++	err = of_property_read_string(np, "dr_mode", &dr_mode);
++	if (err < 0)
++		return USB_DR_MODE_UNKNOWN;
++
++	for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++)
++		if (!strcmp(dr_mode, usb_dr_modes[i]))
++			return i;
++
++	return USB_DR_MODE_UNKNOWN;
++}
++EXPORT_SYMBOL_GPL(of_usb_get_dr_mode);
++#endif
++
+ MODULE_LICENSE("GPL");
+diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
+new file mode 100644
+index 0000000..e460a24
+--- /dev/null
++++ b/include/linux/usb/of.h
+@@ -0,0 +1,28 @@
++/*
++ * OF helpers for usb devices.
++ *
++ * This file is released under the GPLv2
++ */
++
++#ifndef __LINUX_USB_OF_H
++#define __LINUX_USB_OF_H
++
++#include <linux/usb/otg.h>
++#include <linux/usb/phy.h>
++
++#ifdef CONFIG_OF
++enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
++enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
++#else
++static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
++{
++	return USBPHY_INTERFACE_MODE_UNKNOWN;
++}
++
++static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
++{
++	return USB_DR_MODE_UNKNOWN;
++}
++#endif
++
++#endif /* __LINUX_USB_OF_H */
+diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
+index 291e01b..154332b 100644
+--- a/include/linux/usb/otg.h
++++ b/include/linux/usb/otg.h
+@@ -92,4 +92,11 @@ otg_start_srp(struct usb_otg *otg)
+ /* for OTG controller drivers (and maybe other stuff) */
+ extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
+ 
++enum usb_dr_mode {
++	USB_DR_MODE_UNKNOWN,
++	USB_DR_MODE_HOST,
++	USB_DR_MODE_PERIPHERAL,
++	USB_DR_MODE_OTG,
++};
++
+ #endif /* __LINUX_USB_OTG_H */
+diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
+index 6b5978f..4403680 100644
+--- a/include/linux/usb/phy.h
++++ b/include/linux/usb/phy.h
+@@ -12,6 +12,15 @@
+ #include <linux/notifier.h>
+ #include <linux/usb.h>
+ 
++enum usb_phy_interface {
++	USBPHY_INTERFACE_MODE_UNKNOWN,
++	USBPHY_INTERFACE_MODE_UTMI,
++	USBPHY_INTERFACE_MODE_UTMIW,
++	USBPHY_INTERFACE_MODE_ULPI,
++	USBPHY_INTERFACE_MODE_SERIAL,
++	USBPHY_INTERFACE_MODE_HSIC,
++};
++
+ enum usb_phy_events {
+ 	USB_EVENT_NONE,         /* no events or cable disconnected */
+ 	USB_EVENT_VBUS,         /* vbus valid event */
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0035-usb-chipidea-introduce-dual-role-mode-pdata-flags.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0035-usb-chipidea-introduce-dual-role-mode-pdata-flags.patch
new file mode 100644
index 0000000..064f8fb
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0035-usb-chipidea-introduce-dual-role-mode-pdata-flags.patch
@@ -0,0 +1,90 @@
+From def830ffbd488f87816f58fc09dae857c98ad354 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer at pengutronix.de>
+Date: Thu, 13 Jun 2013 17:59:57 +0300
+Subject: [PATCH 10/21] usb: chipidea: introduce dual role mode pdata flags
+
+Even if a chipidea core is otg capable the board may not be. This allows
+to explicitly set the core to host/peripheral mode. Without these flags
+the driver falls back to the old behaviour.
+
+Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ .../devicetree/bindings/usb/ci13xxx-imx.txt        |  1 +
+ drivers/usb/chipidea/core.c                        | 24 ++++++++++++++++------
+ include/linux/usb/chipidea.h                       |  2 +-
+ 3 files changed, 20 insertions(+), 7 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+index 184a8e0..b4b5b79 100644
+--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
++++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+@@ -9,6 +9,7 @@ Recommended properies:
+ - phy_type: the type of the phy connected to the core. Should be one
+   of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
+   property the PORTSC register won't be touched
++- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
+ 
+ Optional properties:
+ - fsl,usbphy: phandler of usb phy that connects to the only one port
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index 5740ac2..8ade814 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -406,6 +406,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 	struct resource	*res;
+ 	void __iomem	*base;
+ 	int		ret;
++	enum usb_dr_mode dr_mode;
+ 
+ 	if (!dev->platform_data) {
+ 		dev_err(dev, "platform data missing\n");
+@@ -457,14 +458,25 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 	if (!ci->platdata->phy_mode)
+ 		ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
+ 
++	if (!ci->platdata->dr_mode)
++		ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
++
++	if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
++		ci->platdata->dr_mode = USB_DR_MODE_OTG;
++
++	dr_mode = ci->platdata->dr_mode;
+ 	/* initialize role(s) before the interrupt is requested */
+-	ret = ci_hdrc_host_init(ci);
+-	if (ret)
+-		dev_info(dev, "doesn't support host\n");
++	if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
++		ret = ci_hdrc_host_init(ci);
++		if (ret)
++			dev_info(dev, "doesn't support host\n");
++	}
+ 
+-	ret = ci_hdrc_gadget_init(ci);
+-	if (ret)
+-		dev_info(dev, "doesn't support gadget\n");
++	if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) {
++		ret = ci_hdrc_gadget_init(ci);
++		if (ret)
++			dev_info(dev, "doesn't support gadget\n");
++	}
+ 
+ 	if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) {
+ 		dev_err(dev, "no supported roles\n");
+diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
+index 1a2aa18..b314647 100644
+--- a/include/linux/usb/chipidea.h
++++ b/include/linux/usb/chipidea.h
+@@ -20,7 +20,7 @@ struct ci13xxx_platform_data {
+ #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
+ #define CI13XXX_PULLUP_ON_VBUS		BIT(2)
+ #define CI13XXX_DISABLE_STREAMING	BIT(3)
+-
++	enum usb_dr_mode	dr_mode;
+ #define CI13XXX_CONTROLLER_RESET_EVENT		0
+ #define CI13XXX_CONTROLLER_STOPPED_EVENT	1
+ 	void	(*notify_event) (struct ci13xxx *ci, unsigned event);
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0036-usb-chipidea-ci13xxx-imx-move-static-pdata-into-prob.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0036-usb-chipidea-ci13xxx-imx-move-static-pdata-into-prob.patch
new file mode 100644
index 0000000..069594a
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0036-usb-chipidea-ci13xxx-imx-move-static-pdata-into-prob.patch
@@ -0,0 +1,69 @@
+From e3af21cb67aefd98a5292f58bcc80eaabad55707 Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 13 Jun 2013 17:59:58 +0300
+Subject: [PATCH 11/21] usb: chipidea: ci13xxx-imx: move static pdata into
+ probe function
+
+The pdata structure gets copied anyway inside ci13xxx_add_device
+by platform_device_add. We don't need to have it static.
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
+Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
+Reviewed-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 19 +++++++++----------
+ 1 file changed, 9 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index aef5b5b..43fa40a 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -87,17 +87,16 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
+ 
+ /* End of common functions shared by usbmisc drivers*/
+ 
+-static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
+-	.name			= "ci13xxx_imx",
+-	.flags			= CI13XXX_REQUIRE_TRANSCEIVER |
+-				  CI13XXX_PULLUP_ON_VBUS |
+-				  CI13XXX_DISABLE_STREAMING,
+-	.capoffset		= DEF_CAPOFFSET,
+-};
+-
+ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ {
+ 	struct ci13xxx_imx_data *data;
++	struct ci13xxx_platform_data pdata = {
++		.name		= "ci13xxx_imx",
++		.capoffset	= DEF_CAPOFFSET,
++		.flags		= CI13XXX_REQUIRE_TRANSCEIVER |
++				  CI13XXX_PULLUP_ON_VBUS |
++				  CI13XXX_DISABLE_STREAMING,
++	};
+ 	struct platform_device *phy_pdev;
+ 	struct resource *res;
+ 	int ret;
+@@ -160,7 +159,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		data->reg_vbus = NULL;
+ 	}
+ 
+-	ci13xxx_imx_platdata.phy = data->phy;
++	pdata.phy = data->phy;
+ 
+ 	if (!pdev->dev.dma_mask)
+ 		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+@@ -178,7 +177,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 
+ 	data->ci_pdev = ci13xxx_add_device(&pdev->dev,
+ 				pdev->resource, pdev->num_resources,
+-				&ci13xxx_imx_platdata);
++				&pdata);
+ 	if (IS_ERR(data->ci_pdev)) {
+ 		ret = PTR_ERR(data->ci_pdev);
+ 		dev_err(&pdev->dev,
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0037-usb-chipidea-i.MX-use-devm_usb_get_phy_by_phandle-to.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0037-usb-chipidea-i.MX-use-devm_usb_get_phy_by_phandle-to.patch
new file mode 100644
index 0000000..8248506
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0037-usb-chipidea-i.MX-use-devm_usb_get_phy_by_phandle-to.patch
@@ -0,0 +1,100 @@
+From 0585a578c9ec53ea1d2f5f0370a1e4e97f0ea7c0 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer at pengutronix.de>
+Date: Thu, 13 Jun 2013 18:00:00 +0300
+Subject: [PATCH 12/21] usb: chipidea: i.MX: use devm_usb_get_phy_by_phandle to
+ get phy
+
+This patch converts the driver to use devm_usb_get_phy_by_phandle
+which makes the code smaller and a bit simpler.
+
+Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 32 ++++++++++++--------------------
+ 1 file changed, 12 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 43fa40a..2ec9052 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -28,7 +28,6 @@
+ 	((struct usb_phy *)platform_get_drvdata(pdev))
+ 
+ struct ci13xxx_imx_data {
+-	struct device_node *phy_np;
+ 	struct usb_phy *phy;
+ 	struct platform_device *ci_pdev;
+ 	struct clk *clk;
+@@ -97,9 +96,9 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 				  CI13XXX_PULLUP_ON_VBUS |
+ 				  CI13XXX_DISABLE_STREAMING,
+ 	};
+-	struct platform_device *phy_pdev;
+ 	struct resource *res;
+ 	int ret;
++	struct usb_phy *phy;
+ 
+ 	if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
+ 		&& !usbmisc_ops)
+@@ -131,18 +130,16 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		return ret;
+ 	}
+ 
+-	data->phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
+-	if (data->phy_np) {
+-		phy_pdev = of_find_device_by_node(data->phy_np);
+-		if (phy_pdev) {
+-			struct usb_phy *phy;
+-			phy = pdev_to_phy(phy_pdev);
+-			if (phy &&
+-			    try_module_get(phy_pdev->dev.driver->owner)) {
+-				usb_phy_init(phy);
+-				data->phy = phy;
+-			}
++	phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
++	if (!IS_ERR(phy)) {
++		ret = usb_phy_init(phy);
++		if (ret) {
++			dev_err(&pdev->dev, "unable to init phy: %d\n", ret);
++			goto err_clk;
+ 		}
++	} else if (PTR_ERR(phy) == -EPROBE_DEFER) {
++		ret = -EPROBE_DEFER;
++		goto err_clk;
+ 	}
+ 
+ 	/* we only support host now, so enable vbus here */
+@@ -153,7 +150,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 			dev_err(&pdev->dev,
+ 				"Failed to enable vbus regulator, err=%d\n",
+ 				ret);
+-			goto put_np;
++			goto err_clk;
+ 		}
+ 	} else {
+ 		data->reg_vbus = NULL;
+@@ -207,9 +204,7 @@ disable_device:
+ err:
+ 	if (data->reg_vbus)
+ 		regulator_disable(data->reg_vbus);
+-put_np:
+-	if (data->phy_np)
+-		of_node_put(data->phy_np);
++err_clk:
+ 	clk_disable_unprepare(data->clk);
+ 	return ret;
+ }
+@@ -229,9 +224,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
+ 		module_put(data->phy->dev->driver->owner);
+ 	}
+ 
+-	if (data->phy_np)
+-		of_node_put(data->phy_np);
+-
+ 	clk_disable_unprepare(data->clk);
+ 
+ 	platform_set_drvdata(pdev, NULL);
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0038-usb-chipidea-move-hw_phymode_configure-into-probe.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0038-usb-chipidea-move-hw_phymode_configure-into-probe.patch
new file mode 100644
index 0000000..3f61700
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0038-usb-chipidea-move-hw_phymode_configure-into-probe.patch
@@ -0,0 +1,47 @@
+From 072376645f89dc99c42603c7f269a2a6be1cc489 Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam at freescale.com>
+Date: Wed, 14 Aug 2013 12:43:56 +0300
+Subject: [PATCH 13/21] usb: chipidea: move hw_phymode_configure() into probe
+
+Currently hw_phymode_configure() is located inside hw_device_reset(), which is
+only called by chipidea udc driver.
+
+When operating in host mode, we also need to call hw_phymode_configure() in
+order to properly configure the PHY mode, so move this function into probe.
+
+After this change, USB Host1 port on mx53qsb board is functional.
+
+Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
+Tested-by: Arnaud Patard <arnaud.patard at rtp-net.org>
+Reviewed-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index 8ade814..4fdb4e2 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -265,8 +265,6 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
+ 	while (hw_read(ci, OP_USBCMD, USBCMD_RST))
+ 		udelay(10);		/* not RTOS friendly */
+ 
+-	hw_phymode_configure(ci);
+-
+ 	if (ci->platdata->notify_event)
+ 		ci->platdata->notify_event(ci,
+ 			CI13XXX_CONTROLLER_RESET_EVENT);
+@@ -458,6 +456,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 	if (!ci->platdata->phy_mode)
+ 		ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
+ 
++	hw_phymode_configure(ci);
++
+ 	if (!ci->platdata->dr_mode)
+ 		ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
+ 
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0039-usb-chipidea-ci_hdrc_imx-remove-an-unsolicited-modul.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0039-usb-chipidea-ci_hdrc_imx-remove-an-unsolicited-modul.patch
new file mode 100644
index 0000000..c8b4d3b
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0039-usb-chipidea-ci_hdrc_imx-remove-an-unsolicited-modul.patch
@@ -0,0 +1,39 @@
+From 3ac1bf8ae9b41f47f5989f0a80b02a206efd19c6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= <LW at KARO-electronics.de>
+Date: Wed, 14 Aug 2013 12:43:59 +0300
+Subject: [PATCH 14/21] usb: chipidea: ci_hdrc_imx: remove an unsolicited
+ module_put() call from ci_hdrc_imx_remove()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This prevents the USB PHY refcount to be decremented below zero upon
+unloading the ci-hdrc-imx module.
+
+Signed-off-by: Lothar Waßmann <LW at KARO-electronics.de>
+Acked-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index 2ec9052..d81c6a8 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -219,10 +219,8 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
+ 	if (data->reg_vbus)
+ 		regulator_disable(data->reg_vbus);
+ 
+-	if (data->phy) {
++	if (data->phy)
+ 		usb_phy_shutdown(data->phy);
+-		module_put(data->phy->dev->driver->owner);
+-	}
+ 
+ 	clk_disable_unprepare(data->clk);
+ 
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0040-usb-chipidea-prevent-endless-loop-registering-platfo.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0040-usb-chipidea-prevent-endless-loop-registering-platfo.patch
new file mode 100644
index 0000000..05ff167
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0040-usb-chipidea-prevent-endless-loop-registering-platfo.patch
@@ -0,0 +1,71 @@
+From cd839fc541d83398f2aeaabc343229ff306df16e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= <LW at KARO-electronics.de>
+Date: Wed, 14 Aug 2013 12:44:01 +0300
+Subject: [PATCH 15/21] usb: chipidea: prevent endless loop registering
+ platform_devices when probe fails
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Commit 40dcd0e ("usb: chipidea: add PTW, PTS and STS handling") introduced
+the following code to the ci_hdrc_probe() function:
+
++       if (!dev->of_node && dev->parent)
++               dev->of_node = dev->parent->of_node;
+
+This inadvertently associates the ci_hdrc device with the ci_hdrc_imx
+driver (which created the ci_hdrc device in the first place).
+
+This results in ci_hdrc_imx_probe() being run for the ci_hdrc device
+if ci_hdrc_probe() fails for some reason.
+ci_hdrc_imx_probe() will happily create a new ci_hdrc platform_device
+whose probing will likewise fail and trigger a new invocation of
+ci_hdrc_imx_probe() ... ad nauseam.
+
+Signed-off-by: Lothar Waßmann <LW at KARO-electronics.de>
+Reviewed-and-tested-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/core.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index 4fdb4e2..d0e0e2f 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -405,15 +405,13 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 	void __iomem	*base;
+ 	int		ret;
+ 	enum usb_dr_mode dr_mode;
++	struct device_node *of_node = dev->of_node ?: dev->parent->of_node;
+ 
+ 	if (!dev->platform_data) {
+ 		dev_err(dev, "platform data missing\n");
+ 		return -ENODEV;
+ 	}
+ 
+-	if (!dev->of_node && dev->parent)
+-		dev->of_node = dev->parent->of_node;
+-
+ 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ 	base = devm_ioremap_resource(dev, res);
+ 	if (IS_ERR(base))
+@@ -454,12 +452,12 @@ static int ci_hdrc_probe(struct platform_device *pdev)
+ 	}
+ 
+ 	if (!ci->platdata->phy_mode)
+-		ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
++		ci->platdata->phy_mode = of_usb_get_phy_mode(of_node);
+ 
+ 	hw_phymode_configure(ci);
+ 
+ 	if (!ci->platdata->dr_mode)
+-		ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
++		ci->platdata->dr_mode = of_usb_get_dr_mode(of_node);
+ 
+ 	if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
+ 		ci->platdata->dr_mode = USB_DR_MODE_OTG;
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0041-usb-chipidea-move-vbus-regulator-operation-to-core.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0041-usb-chipidea-move-vbus-regulator-operation-to-core.patch
new file mode 100644
index 0000000..654a8d7
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0041-usb-chipidea-move-vbus-regulator-operation-to-core.patch
@@ -0,0 +1,161 @@
+From c6f0b1db75ab03cd9113ed8a61049d6188737ebd Mon Sep 17 00:00:00 2001
+From: Peter Chen <peter.chen at freescale.com>
+Date: Wed, 14 Aug 2013 12:44:03 +0300
+Subject: [PATCH 16/21] usb: chipidea: move vbus regulator operation to core
+
+The vbus regulator is a common element for USB vbus operation,
+So, move it from glue layer to core.
+
+Tested-by: Marek Vasut <marex at denx.de>
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/ci13xxx_imx.c | 26 ++------------------------
+ drivers/usb/chipidea/core.c        | 23 +++++++++++++++++++++++
+ include/linux/usb/chipidea.h       |  1 +
+ 3 files changed, 26 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
+index d81c6a8..557659c 100644
+--- a/drivers/usb/chipidea/ci13xxx_imx.c
++++ b/drivers/usb/chipidea/ci13xxx_imx.c
+@@ -19,7 +19,6 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/usb/chipidea.h>
+ #include <linux/clk.h>
+-#include <linux/regulator/consumer.h>
+ 
+ #include "ci.h"
+ #include "ci13xxx_imx.h"
+@@ -31,7 +30,6 @@ struct ci13xxx_imx_data {
+ 	struct usb_phy *phy;
+ 	struct platform_device *ci_pdev;
+ 	struct clk *clk;
+-	struct regulator *reg_vbus;
+ };
+ 
+ static const struct usbmisc_ops *usbmisc_ops;
+@@ -142,20 +140,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		goto err_clk;
+ 	}
+ 
+-	/* we only support host now, so enable vbus here */
+-	data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus");
+-	if (!IS_ERR(data->reg_vbus)) {
+-		ret = regulator_enable(data->reg_vbus);
+-		if (ret) {
+-			dev_err(&pdev->dev,
+-				"Failed to enable vbus regulator, err=%d\n",
+-				ret);
+-			goto err_clk;
+-		}
+-	} else {
+-		data->reg_vbus = NULL;
+-	}
+-
+ 	pdata.phy = data->phy;
+ 
+ 	if (!pdev->dev.dma_mask)
+@@ -168,7 +152,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		if (ret) {
+ 			dev_err(&pdev->dev,
+ 				"usbmisc init failed, ret=%d\n", ret);
+-			goto err;
++			goto err_clk;
+ 		}
+ 	}
+ 
+@@ -180,7 +164,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 		dev_err(&pdev->dev,
+ 			"Can't register ci_hdrc platform device, err=%d\n",
+ 			ret);
+-		goto err;
++		goto err_clk;
+ 	}
+ 
+ 	if (usbmisc_ops && usbmisc_ops->post) {
+@@ -201,9 +185,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
+ 
+ disable_device:
+ 	ci13xxx_remove_device(data->ci_pdev);
+-err:
+-	if (data->reg_vbus)
+-		regulator_disable(data->reg_vbus);
+ err_clk:
+ 	clk_disable_unprepare(data->clk);
+ 	return ret;
+@@ -216,9 +197,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
+ 	pm_runtime_disable(&pdev->dev);
+ 	ci13xxx_remove_device(data->ci_pdev);
+ 
+-	if (data->reg_vbus)
+-		regulator_disable(data->reg_vbus);
+-
+ 	if (data->phy)
+ 		usb_phy_shutdown(data->phy);
+ 
+diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
+index d0e0e2f..aa7a3d6 100644
+--- a/drivers/usb/chipidea/core.c
++++ b/drivers/usb/chipidea/core.c
+@@ -66,6 +66,7 @@
+ #include <linux/usb/chipidea.h>
+ #include <linux/usb/of.h>
+ #include <linux/phy.h>
++#include <linux/regulator/consumer.h>
+ 
+ #include "ci.h"
+ #include "udc.h"
+@@ -343,6 +344,24 @@ static irqreturn_t ci_irq(int irq, void *data)
+ 	return ret;
+ }
+ 
++static int ci_get_platdata(struct device *dev,
++		struct ci13xxx_platform_data *platdata)
++{
++	/* Get the vbus regulator */
++	platdata->reg_vbus = devm_regulator_get(dev, "vbus");
++	if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) {
++		return -EPROBE_DEFER;
++	} else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) {
++		platdata->reg_vbus = NULL; /* no vbus regualator is needed */
++	} else if (IS_ERR(platdata->reg_vbus)) {
++		dev_err(dev, "Getting regulator error: %ld\n",
++			PTR_ERR(platdata->reg_vbus));
++		return PTR_ERR(platdata->reg_vbus);
++	}
++
++	return 0;
++}
++
+ static DEFINE_IDA(ci_ida);
+ 
+ struct platform_device *ci13xxx_add_device(struct device *dev,
+@@ -352,6 +371,10 @@ struct platform_device *ci13xxx_add_device(struct device *dev,
+ 	struct platform_device *pdev;
+ 	int id, ret;
+ 
++	ret = ci_get_platdata(dev, platdata);
++	if (ret)
++		return ERR_PTR(ret);
++
+ 	id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
+ 	if (id < 0)
+ 		return ERR_PTR(id);
+diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
+index b314647..35901ed 100644
+--- a/include/linux/usb/chipidea.h
++++ b/include/linux/usb/chipidea.h
+@@ -24,6 +24,7 @@ struct ci13xxx_platform_data {
+ #define CI13XXX_CONTROLLER_RESET_EVENT		0
+ #define CI13XXX_CONTROLLER_STOPPED_EVENT	1
+ 	void	(*notify_event) (struct ci13xxx *ci, unsigned event);
++	struct regulator	*reg_vbus;
+ };
+ 
+ /* Default offset of capability registers */
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0042-usb-chipidea-host-add-vbus-regulator-control.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0042-usb-chipidea-host-add-vbus-regulator-control.patch
new file mode 100644
index 0000000..32cb4b9
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0042-usb-chipidea-host-add-vbus-regulator-control.patch
@@ -0,0 +1,85 @@
+From 05f6cd40eeeb7cdba2db48fd094215fdcaf2a712 Mon Sep 17 00:00:00 2001
+From: Peter Chen <peter.chen at freescale.com>
+Date: Wed, 14 Aug 2013 12:44:04 +0300
+Subject: [PATCH 17/21] usb: chipidea: host: add vbus regulator control
+
+For boards which have board level vbus control (eg, through gpio), we
+need to vbus operation according to below rules:
+- For host, we need open vbus before start hcd, and close it
+after remove hcd.
+- For otg, the vbus needs to be on/off when usb role switches.
+When the host roles begins, it opens vbus; when the host role
+finishes, it closes vbus.
+
+We put vbus operation to host as host is the only vbus user,
+When we are at host mode, the vbus is on, when we are not at
+host mode, vbus should be off.
+
+Tested-by: Marek Vasut <marex at denx.de>
+Signed-off-by: Peter Chen <peter.chen at freescale.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/usb/chipidea/host.c | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
+index 8e9d312..6dbbcc5 100644
+--- a/drivers/usb/chipidea/host.c
++++ b/drivers/usb/chipidea/host.c
+@@ -24,6 +24,7 @@
+ #include <linux/usb.h>
+ #include <linux/usb/hcd.h>
+ #include <linux/usb/chipidea.h>
++#include <linux/regulator/consumer.h>
+ 
+ #include "../host/ehci.h"
+ 
+@@ -64,9 +65,19 @@ static int host_start(struct ci13xxx *ci)
+ 	ehci->caps = ci->hw_bank.cap;
+ 	ehci->has_hostpc = ci->hw_bank.lpm;
+ 
++	if (ci->platdata->reg_vbus) {
++		ret = regulator_enable(ci->platdata->reg_vbus);
++		if (ret) {
++			dev_err(ci->dev,
++				"Failed to enable vbus regulator, ret=%d\n",
++				ret);
++			goto put_hcd;
++		}
++	}
++
+ 	ret = usb_add_hcd(hcd, 0, 0);
+ 	if (ret)
+-		usb_put_hcd(hcd);
++		goto disable_reg;
+ 	else
+ 		ci->hcd = hcd;
+ 
+@@ -74,6 +85,14 @@ static int host_start(struct ci13xxx *ci)
+ 		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
+ 
+ 	return ret;
++
++disable_reg:
++	regulator_disable(ci->platdata->reg_vbus);
++
++put_hcd:
++	usb_put_hcd(hcd);
++
++	return ret;
+ }
+ 
+ static void host_stop(struct ci13xxx *ci)
+@@ -82,6 +101,8 @@ static void host_stop(struct ci13xxx *ci)
+ 
+ 	usb_remove_hcd(hcd);
+ 	usb_put_hcd(hcd);
++	if (ci->platdata->reg_vbus)
++		regulator_disable(ci->platdata->reg_vbus);
+ }
+ 
+ int ci_hdrc_host_init(struct ci13xxx *ci)
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch
new file mode 100644
index 0000000..f8be301
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch
@@ -0,0 +1,105 @@
+From 988d6b3e41eabd200cea386299023167b84d66bc Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 11 Apr 2013 12:13:14 +0200
+Subject: [PATCH 18/21] ARM: dts: imx: add imx5x usbmisc entries
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
+---
+ arch/arm/boot/dts/imx51.dtsi | 10 ++++++++++
+ arch/arm/boot/dts/imx53.dtsi | 10 ++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
+index 5ef1b31..1dbf016 100644
+--- a/arch/arm/boot/dts/imx51.dtsi
++++ b/arch/arm/boot/dts/imx51.dtsi
+@@ -180,6 +180,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80000 0x0200>;
+ 				interrupts = <18>;
++				fsl,usbmisc = <&usbmisc 0>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -187,6 +188,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80200 0x0200>;
+ 				interrupts = <14>;
++				fsl,usbmisc = <&usbmisc 1>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -194,6 +196,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80400 0x0200>;
+ 				interrupts = <16>;
++				fsl,usbmisc = <&usbmisc 2>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -201,9 +204,16 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80600 0x0200>;
+ 				interrupts = <17>;
++				fsl,usbmisc = <&usbmisc 3>;
+ 				status = "disabled";
+ 			};
+ 
++			usbmisc: usbmisc at 73f80800 {
++				#index-cells = <1>;
++				compatible = "fsl,imx51-usbmisc";
++				reg = <0x73f80800 0x200>;
++			};
++
+ 			gpio1: gpio at 73f84000 {
+ 				compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
+ 				reg = <0x73f84000 0x4000>;
+diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
+index 682be13..09d7c69 100644
+--- a/arch/arm/boot/dts/imx53.dtsi
++++ b/arch/arm/boot/dts/imx53.dtsi
+@@ -176,6 +176,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80000 0x0200>;
+ 				interrupts = <18>;
++				fsl,usbmisc = <&usbmisc 0>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -183,6 +184,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80200 0x0200>;
+ 				interrupts = <14>;
++				fsl,usbmisc = <&usbmisc 1>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -190,6 +192,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80400 0x0200>;
+ 				interrupts = <16>;
++				fsl,usbmisc = <&usbmisc 2>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -197,9 +200,16 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80600 0x0200>;
+ 				interrupts = <17>;
++				fsl,usbmisc = <&usbmisc 3>;
+ 				status = "disabled";
+ 			};
+ 
++			usbmisc: usbmisc at 53f80800 {
++				#index-cells = <1>;
++				compatible = "fsl,imx53-usbmisc";
++				reg = <0x53f80800 0x200>;
++			};
++
+ 			gpio1: gpio at 53f84000 {
+ 				compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
+ 				reg = <0x53f84000 0x4000>;
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0044-ARM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0044-ARM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch
new file mode 100644
index 0000000..278fdfb
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0044-ARM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch
@@ -0,0 +1,103 @@
+From ce37aa95f40c19a7cac036ef161ac31e0f5002d8 Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 11 Apr 2013 12:13:15 +0200
+Subject: [PATCH 19/21] ARM: dts: imx: add imx5x usb clock DT lookups
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
+---
+ arch/arm/boot/dts/imx51.dtsi | 5 +++++
+ arch/arm/boot/dts/imx53.dtsi | 5 +++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
+index 1dbf016..2f43dda 100644
+--- a/arch/arm/boot/dts/imx51.dtsi
++++ b/arch/arm/boot/dts/imx51.dtsi
+@@ -180,6 +180,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80000 0x0200>;
+ 				interrupts = <18>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 0>;
+ 				status = "disabled";
+ 			};
+@@ -188,6 +189,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80200 0x0200>;
+ 				interrupts = <14>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 1>;
+ 				status = "disabled";
+ 			};
+@@ -196,6 +198,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80400 0x0200>;
+ 				interrupts = <16>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 2>;
+ 				status = "disabled";
+ 			};
+@@ -204,6 +207,7 @@
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80600 0x0200>;
+ 				interrupts = <17>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 3>;
+ 				status = "disabled";
+ 			};
+@@ -212,6 +216,7 @@
+ 				#index-cells = <1>;
+ 				compatible = "fsl,imx51-usbmisc";
+ 				reg = <0x73f80800 0x200>;
++				clocks = <&clks 108>;
+ 			};
+ 
+ 			gpio1: gpio at 73f84000 {
+diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
+index 09d7c69..83fbb2b 100644
+--- a/arch/arm/boot/dts/imx53.dtsi
++++ b/arch/arm/boot/dts/imx53.dtsi
+@@ -176,6 +176,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80000 0x0200>;
+ 				interrupts = <18>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 0>;
+ 				status = "disabled";
+ 			};
+@@ -184,6 +185,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80200 0x0200>;
+ 				interrupts = <14>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 1>;
+ 				status = "disabled";
+ 			};
+@@ -192,6 +194,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80400 0x0200>;
+ 				interrupts = <16>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 2>;
+ 				status = "disabled";
+ 			};
+@@ -200,6 +203,7 @@
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80600 0x0200>;
+ 				interrupts = <17>;
++				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 3>;
+ 				status = "disabled";
+ 			};
+@@ -208,6 +212,7 @@
+ 				#index-cells = <1>;
+ 				compatible = "fsl,imx53-usbmisc";
+ 				reg = <0x53f80800 0x200>;
++				clocks = <&clks 108>;
+ 			};
+ 
+ 			gpio1: gpio at 53f84000 {
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0045-ARM-dts-imx-use-usb-nop-xceiv-usbphy-entries-for-imx.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0045-ARM-dts-imx-use-usb-nop-xceiv-usbphy-entries-for-imx.patch
new file mode 100644
index 0000000..6e3ac5c
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0045-ARM-dts-imx-use-usb-nop-xceiv-usbphy-entries-for-imx.patch
@@ -0,0 +1,81 @@
+From 0861282b1d08164ad1a6477992ff40ba91422e2a Mon Sep 17 00:00:00 2001
+From: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Date: Thu, 11 Apr 2013 12:13:16 +0200
+Subject: [PATCH 20/21] ARM: dts: imx: use usb-nop-xceiv usbphy entries for
+ imx5x
+
+Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
+Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
+---
+ arch/arm/boot/dts/imx51.dtsi |  8 ++++++++
+ arch/arm/boot/dts/imx53.dtsi | 16 ++++++++++++++++
+ 2 files changed, 24 insertions(+)
+
+diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
+index 2f43dda..c396094 100644
+--- a/arch/arm/boot/dts/imx51.dtsi
++++ b/arch/arm/boot/dts/imx51.dtsi
+@@ -176,12 +176,20 @@
+ 				};
+ 			};
+ 
++			usbphy0: usbphy at 0 {
++				compatible = "usb-nop-xceiv";
++				clocks = <&clks 124>;
++				clock-names = "main_clk";
++				status = "okay";
++			};
++
+ 			usbotg: usb at 73f80000 {
+ 				compatible = "fsl,imx51-usb", "fsl,imx27-usb";
+ 				reg = <0x73f80000 0x0200>;
+ 				interrupts = <18>;
+ 				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 0>;
++				fsl,usbphy = <&usbphy0>;
+ 				status = "disabled";
+ 			};
+ 
+diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
+index 83fbb2b..b05aadc 100644
+--- a/arch/arm/boot/dts/imx53.dtsi
++++ b/arch/arm/boot/dts/imx53.dtsi
+@@ -172,12 +172,27 @@
+ 				};
+ 			};
+ 
++			usbphy0: usbphy at 0 {
++				compatible = "usb-nop-xceiv";
++				clocks = <&clks 124>;
++				clock-names = "main_clk";
++				status = "okay";
++			};
++
++			usbphy1: usbphy at 1 {
++				compatible = "usb-nop-xceiv";
++				clocks = <&clks 125>;
++				clock-names = "main_clk";
++				status = "okay";
++			};
++
+ 			usbotg: usb at 53f80000 {
+ 				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+ 				reg = <0x53f80000 0x0200>;
+ 				interrupts = <18>;
+ 				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 0>;
++				fsl,usbphy = <&usbphy0>;
+ 				status = "disabled";
+ 			};
+ 
+@@ -187,6 +202,7 @@
+ 				interrupts = <14>;
+ 				clocks = <&clks 108>;
+ 				fsl,usbmisc = <&usbmisc 1>;
++				fsl,usbphy = <&usbphy1>;
+ 				status = "disabled";
+ 			};
+ 
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0046-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0046-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch
new file mode 100644
index 0000000..6647910
--- /dev/null
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/eldk/0046-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch
@@ -0,0 +1,62 @@
+From 6a887f0bef1b85387f651624e0719ae512db9d0f Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex at denx.de>
+Date: Sun, 17 Nov 2013 04:04:50 +0100
+Subject: [PATCH 21/21] ARM: dts: imx53: Add USB support for M53EVK
+
+Add USB support for M53EVK. The configuration is such that USB Host1
+port is used as Host and the USB OTG port is used as Peripheral thus
+far. Once OTG is properly fixed, the OTG will be further adjusted.
+
+Signed-off-by: Marek Vasut <marex at denx.de>
+Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
+---
+ arch/arm/boot/dts/imx53-m53evk.dts | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts
+index b51bc9d..c16f451 100644
+--- a/arch/arm/boot/dts/imx53-m53evk.dts
++++ b/arch/arm/boot/dts/imx53-m53evk.dts
+@@ -75,6 +75,15 @@
+ 			regulator-max-microvolt = <3200000>;
+ 			regulator-always-on;
+ 		};
++
++		reg_usbh1_vbus: regulator {
++			compatible = "regulator-fixed";
++			regulator-name = "vbus";
++			regulator-min-microvolt = <5000000>;
++			regulator-max-microvolt = <5000000>;
++			gpio = <&gpio1 2 0>;
++			enable-active-low;
++		};
+ 	};
+ 
+ 	sound {
+@@ -149,6 +158,8 @@
+ 				MX53_PAD_EIM_EB3__GPIO2_31		0x80000000
+ 				MX53_PAD_PATA_DA_0__GPIO7_6		0x80000000
+ 				MX53_PAD_DISP0_DAT8__PWM1_PWMO		0x5
++				MX53_PAD_GPIO_2__GPIO1_2		0x84
++				MX53_PAD_GPIO_3__USBOH3_USBH1_OC	0x84
+ 			>;
+ 		};
+ 
+@@ -256,3 +267,14 @@
+ 	phy-mode = "rmii";
+ 	status = "okay";
+ };
++
++&usbh1 {
++	vbus-supply = <&reg_usbh1_vbus>;
++	phy_type = "utmi";
++	status = "okay";
++};
++
++&usbotg {
++	dr_mode = "peripheral";
++	status = "okay";
++};
+-- 
+1.8.5.2
+
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk/m53evk/defconfig b/meta-eldk/recipes-kernel/linux/linux-eldk/m53evk/defconfig
index 5415d0c..b7c2935 100644
--- a/meta-eldk/recipes-kernel/linux/linux-eldk/m53evk/defconfig
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk/m53evk/defconfig
@@ -216,6 +216,7 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_CHIPIDEA=y
 CONFIG_USB_CHIPIDEA_HOST=y
 CONFIG_USB_PHY=y
+CONFIG_NOP_USB_XCEIV=y
 CONFIG_USB_MXS_PHY=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk_3.10.bb b/meta-eldk/recipes-kernel/linux/linux-eldk_3.10.bb
index b69b025..1b576da 100644
--- a/meta-eldk/recipes-kernel/linux/linux-eldk_3.10.bb
+++ b/meta-eldk/recipes-kernel/linux/linux-eldk_3.10.bb
@@ -45,6 +45,27 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
 	   file://0023-ARM-dts-imx53-Switch-DISP_CLK-polarity-on-M53EVK.patch \
 	   file://0024-ARM-dts-mxs-Fix-the-RTC-compatible-prop-on-M28EVK.patch \
 	   file://0025-ARM-dts-imx-Add-alias-for-ethernet-controller.patch \
+	   file://0026-usb-chipidea-ci13xxx_imx-let-device-core-handle-pinc.patch \
+	   file://0027-usb-chipidea-usbmisc_imx-Staticize-usbmisc_imx_drv_i.patch \
+	   file://0028-usb-chipidea-udc-configure-iso-endpoints.patch \
+	   file://0029-usb-chipidea-ci13xxx_imx-fix-error-path.patch \
+	   file://0030-usb-chipidea-ci13xxx_imx-remove-reg_vbus.patch \
+	   file://0031-usb-chipidea-ci13xxx_imx-check-if-data-phy_np-is-not.patch \
+	   file://0032-usb-chipidea-ci13xxx_imx-remove-phy_np.patch \
+	   file://0033-usb-chipidea-add-PTW-PTS-and-STS-handling.patch \
+	   file://0034-usb-add-devicetree-helpers-for-determining-dr_mode-a.patch \
+	   file://0035-usb-chipidea-introduce-dual-role-mode-pdata-flags.patch \
+	   file://0036-usb-chipidea-ci13xxx-imx-move-static-pdata-into-prob.patch \
+	   file://0037-usb-chipidea-i.MX-use-devm_usb_get_phy_by_phandle-to.patch \
+	   file://0038-usb-chipidea-move-hw_phymode_configure-into-probe.patch \
+	   file://0039-usb-chipidea-ci_hdrc_imx-remove-an-unsolicited-modul.patch \
+	   file://0040-usb-chipidea-prevent-endless-loop-registering-platfo.patch \
+	   file://0041-usb-chipidea-move-vbus-regulator-operation-to-core.patch \
+	   file://0042-usb-chipidea-host-add-vbus-regulator-control.patch \
+	   file://0043-ARM-dts-imx-add-imx5x-usbmisc-entries.patch \
+	   file://0044-ARM-dts-imx-add-imx5x-usb-clock-DT-lookups.patch \
+	   file://0045-ARM-dts-imx-use-usb-nop-xceiv-usbphy-entries-for-imx.patch \
+	   file://0046-ARM-dts-imx53-Add-USB-support-for-M53EVK.patch \
 	   file://defconfig"
 
 LINUX_VERSION ?= "3.10.28"
-- 
1.9.0



More information about the eldk mailing list