devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu,
	ulf.hansson@linaro.org, broonie@kernel.org, sre@kernel.org,
	robh+dt@kernel.org, shawnguo@kernel.org
Cc: k.kozlowski@samsung.com, linux-arm-kernel@lists.infradead.org,
	p.zabel@pengutronix.de, devicetree@vger.kernel.org,
	pawel.moll@arm.com, mark.rutland@arm.com,
	linux-usb@vger.kernel.org, arnd@arndb.de, s.hauer@pengutronix.de,
	mail@maciej.szmigiero.name, troy.kisky@boundarydevices.com,
	festevam@gmail.com, oscar@naiandei.net, stephen.boyd@linaro.org,
	linux-pm@vger.kernel.org, Peter Chen <peter.chen@freescale.com>
Subject: [PATCH 5/6] usb: chipidea: host: let the hcd know's parent device node
Date: Thu, 7 Jul 2016 17:14:51 +0800	[thread overview]
Message-ID: <1467882892-27589-6-git-send-email-peter.chen@nxp.com> (raw)
In-Reply-To: <1467882892-27589-1-git-send-email-peter.chen@nxp.com>

From: Peter Chen <peter.chen@freescale.com>

Since the hcd (chipidea core device) has no device node, so
if we want to describe the child node under the hcd, we had
to put it under its parent's node (glue layer device), and
in the code, we need to let the hcd knows glue layer's code,
then the USB core can handle this node.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
 drivers/usb/chipidea/host.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 053bac9..55120ef 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -109,15 +109,25 @@ static int host_start(struct ci_hdrc *ci)
 	struct ehci_hcd *ehci;
 	struct ehci_ci_priv *priv;
 	int ret;
+	struct device *dev = ci->dev;
 
-	if (usb_disabled())
+	if (usb_disabled() || !dev)
 		return -ENODEV;
 
-	hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
+	/*
+	 * USB Core will try to get child node under roothub,
+	 * but chipidea core has no of_node, and the child node
+	 * for controller is located at glue layer's node which
+	 * is chipidea core's parent.
+	 */
+	if (dev->parent && dev->parent->of_node)
+		dev->of_node = dev->parent->of_node;
+
+	hcd = usb_create_hcd(&ci_ehci_hc_driver, dev, dev_name(dev));
 	if (!hcd)
 		return -ENOMEM;
 
-	dev_set_drvdata(ci->dev, ci);
+	dev_set_drvdata(dev, ci);
 	hcd->rsrc_start = ci->hw_bank.phys;
 	hcd->rsrc_len = ci->hw_bank.size;
 	hcd->regs = ci->hw_bank.abs;
@@ -143,7 +153,7 @@ static int host_start(struct ci_hdrc *ci)
 		if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) {
 			ret = regulator_enable(ci->platdata->reg_vbus);
 			if (ret) {
-				dev_err(ci->dev,
+				dev_err(dev,
 				"Failed to enable vbus regulator, ret=%d\n",
 									ret);
 				goto put_hcd;
-- 
1.9.1


  parent reply	other threads:[~2016-07-07  9:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07  9:14 [PATCH 0/6] power: add power sequence library Peter Chen
     [not found] ` <1467882892-27589-1-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-07-07  9:14   ` [PATCH 1/6] binding-doc: power: pwrseq-generic: add binding doc for generic " Peter Chen
     [not found]     ` <1467882892-27589-2-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-07-07  9:47       ` Philipp Zabel
     [not found]         ` <1467884834.4236.36.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-07-07 23:53           ` Joshua Clayton
2016-07-08  2:39             ` Peter Chen
2016-07-08  2:37         ` Peter Chen
2016-07-07  9:14 ` [PATCH 2/6] power: add " Peter Chen
2016-07-07  9:14 ` [PATCH 3/6] binding-doc: usb: usb-device: add optional properties for power sequence Peter Chen
2016-07-07  9:14 ` [PATCH 4/6] usb: core: add power sequence handling for USB devices Peter Chen
2016-07-07  9:14 ` Peter Chen [this message]
2016-07-07 22:56   ` [PATCH 5/6] usb: chipidea: host: let the hcd know's parent device node Stephen Boyd
2016-07-08  1:54     ` Peter Chen
2016-07-07  9:14 ` [PATCH 6/6] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467882892-27589-6-git-send-email-peter.chen@nxp.com \
    --to=peter.chen@nxp.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@maciej.szmigiero.name \
    --cc=mark.rutland@arm.com \
    --cc=oscar@naiandei.net \
    --cc=p.zabel@pengutronix.de \
    --cc=pawel.moll@arm.com \
    --cc=peter.chen@freescale.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sre@kernel.org \
    --cc=stephen.boyd@linaro.org \
    --cc=stern@rowland.harvard.edu \
    --cc=troy.kisky@boundarydevices.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).