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
Cc: k.kozlowski@samsung.com, linux-arm-kernel@lists.infradead.org,
p.zabel@pengutronix.de, devicetree@vger.kernel.org,
javier@osg.samsung.com, 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, linux-mmc@vger.kernel.org,
Peter Chen <peter.chen@freescale.com>
Subject: [PATCH 11/12] usb: chipidea: host: let the hcd know's parent device node
Date: Fri, 17 Jun 2016 18:09:24 +0800 [thread overview]
Message-ID: <1466158165-9380-12-git-send-email-peter.chen@nxp.com> (raw)
In-Reply-To: <1466158165-9380-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
next prev parent reply other threads:[~2016-06-17 10:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 10:09 [PATCH 00/12] power: add generic power sequence framework Peter Chen
2016-06-17 10:09 ` [PATCH 01/12] power/mmc: Move pwrseq drivers to power/pwrseq Peter Chen
2016-06-17 10:09 ` [PATCH 02/12] MAINTAINERS: Retain Ulf Hansson as the same maintainer of pwrseq Peter Chen
2016-06-17 10:09 ` [PATCH 03/12] power: pwrseq: Enable COMPILE_TEST for drivers Peter Chen
2016-06-17 10:09 ` [PATCH 05/12] power: pwrseq: Generalize mmc_pwrseq operations by removing mmc prefix Peter Chen
2016-06-17 10:09 ` [PATCH 06/12] power: pwrseq: change common helpers as generic Peter Chen
2016-06-17 10:09 ` [PATCH 07/12] power: pwrseq: rename file name for generic driver Peter Chen
2016-06-20 12:48 ` Krzysztof Kozlowski
2016-06-21 2:19 ` Peter Chen
2016-06-17 10:09 ` [PATCH 09/12] power: pwrseq: pwrseq_usb_generic: add generic power sequence support for USB deivces Peter Chen
2016-06-17 10:09 ` Peter Chen [this message]
[not found] ` <1466158165-9380-1-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-06-17 10:09 ` [PATCH 04/12] power: pwrseq: Remove mmc prefix from mmc_pwrseq Peter Chen
2016-06-17 10:09 ` [PATCH 08/12] doc: binding: pwrseq-usb-generic: add binding doc for generic usb power sequence driver Peter Chen
2016-06-17 17:16 ` Rob Herring
2016-06-20 11:26 ` Peter Chen
2016-06-20 12:29 ` Chen-Yu Tsai
2016-06-21 2:14 ` Peter Chen
2016-06-20 16:16 ` Rob Herring
2016-06-20 17:06 ` Mark Brown
2016-06-21 2:11 ` Peter Chen
2016-06-21 21:26 ` Rob Herring
2016-06-22 1:14 ` Peter Chen
2016-06-22 9:09 ` Ulf Hansson
2016-06-24 15:25 ` Rob Herring
2016-06-17 10:09 ` [PATCH 10/12] usb: core: add power sequence handling for USB devices Peter Chen
[not found] ` <1466158165-9380-11-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-06-17 16:12 ` Alan Stern
2016-06-17 10:09 ` [PATCH 12/12] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property Peter Chen
2016-06-17 23:29 ` [PATCH 00/12] power: add generic power sequence framework Maciej S. Szmigiero
2016-06-20 11:27 ` 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=1466158165-9380-12-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=javier@osg.samsung.com \
--cc=k.kozlowski@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.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=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).