mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Felipe Balbi <balbi@ti.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@gmail.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Peter Griffin <peter.griffin@linaro.org>
Subject: [PATCH 2/5] usb: dwc3: st: prepare the driver for generic usb_get_dr_mode function
Date: Tue, 25 Aug 2015 14:04:32 +0300	[thread overview]
Message-ID: <1440500675-55872-3-git-send-email-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <1440500675-55872-1-git-send-email-heikki.krogerus@linux.intel.com>

of_usb_get_dr_mode will be converted into more generic
usb_get_dr_mode function that will take struct device
instead of struct device_node as it's parameter.

To make the conversion possible later, waiting for the
platform device for dwc3 to be populated before calling
of_usb_get_dr_mode.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
CC: Peter Griffin <peter.griffin@linaro.org>
---
 drivers/usb/dwc3/dwc3-st.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
index de4d52f..02d47d5 100644
--- a/drivers/usb/dwc3/dwc3-st.c
+++ b/drivers/usb/dwc3/dwc3-st.c
@@ -195,6 +195,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev = &pdev->dev;
 	struct device_node *node = dev->of_node, *child;
+	struct platform_device *child_pdev;
 	struct regmap *regmap;
 	int ret;
 
@@ -253,8 +254,6 @@ static int st_dwc3_probe(struct platform_device *pdev)
 		goto undo_softreset;
 	}
 
-	dwc3_data->dr_mode = of_usb_get_dr_mode(child);
-
 	/* Allocate and initialize the core */
 	ret = of_platform_populate(node, NULL, NULL, dev);
 	if (ret) {
@@ -262,6 +261,15 @@ static int st_dwc3_probe(struct platform_device *pdev)
 		goto undo_softreset;
 	}
 
+	child_pdev = of_find_device_by_node(child);
+	if (!child_pdev) {
+		dev_err(dev, "failed to find dwc3 core device\n");
+		ret = -ENODEV;
+		goto undo_softreset;
+	}
+
+	dwc3_data->dr_mode = of_usb_get_dr_mode(child_pdev->dev.of_node);
+
 	/*
 	 * Configure the USB port as device or host according to the static
 	 * configuration passed from DT.
-- 
2.5.0


  parent reply	other threads:[~2015-08-25 11:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 11:04 [PATCH 0/5] usb: common and dwc3: converting to unified device property Heikki Krogerus
2015-08-25 11:04 ` [PATCH 1/5] usb: common: of_usb_get_maximum_speed to usb_get_maximum_speed Heikki Krogerus
2015-09-18 19:42   ` Felipe Balbi
2015-09-21  7:06     ` Heikki Krogerus
2015-08-25 11:04 ` Heikki Krogerus [this message]
2015-08-25 11:04 ` [PATCH 3/5] usb: common: of_usb_get_dr_mode to usb_get_dr_mode Heikki Krogerus
2015-08-25 11:04 ` [PATCH 4/5] usb: dwc3: core: convert to unified device property interface Heikki Krogerus
2015-08-25 11:04 ` [PATCH 5/5] usb: dwc3: pci: passing forward the ACPI companion Heikki Krogerus
2015-08-26  4:53 ` [PATCH 0/5] usb: common and dwc3: converting to unified device property Peter Chen
2015-08-26 10:13   ` Heikki Krogerus
2015-08-27  1:37     ` 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=1440500675-55872-3-git-send-email-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=balbi@ti.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=peter.griffin@linaro.org \
    --cc=srinivas.kandagatla@gmail.com \
    /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

all inboxes | Powered by JetHome®