From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] usb: chipidea: move platform related things to ci_get_platdata
Date: Fri, 2 Aug 2013 16:37:41 +0800 [thread overview]
Message-ID: <1375432662-32018-3-git-send-email-peter.chen@freescale.com> (raw)
In-Reply-To: <1375432662-32018-1-git-send-email-peter.chen@freescale.com>
It will make probe cleaner, meanwhile, it fixes the problem
http://marc.info/?l=linux-usb&m=137528143523296&w=2
described indirectly.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
drivers/usb/chipidea/core.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index f09b4db..61c928c 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -381,6 +381,15 @@ static int ci_get_platdata(struct device *dev,
return PTR_ERR(platdata->reg_vbus);
}
+ if (!platdata->phy_mode)
+ platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
+
+ if (!platdata->dr_mode)
+ platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
+
+ if (platdata->dr_mode == USB_DR_MODE_UNKNOWN)
+ platdata->dr_mode = USB_DR_MODE_OTG;
+
return 0;
}
@@ -479,9 +488,6 @@ 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))
@@ -517,17 +523,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
/* To know if controller is OTG capable or not */
ci_get_otg_capable(ci);
- 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);
-
- 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 */
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
--
1.7.0.4
next prev parent reply other threads:[~2013-08-02 8:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 8:37 [PATCH 0/3] Misc Chipidea Patch Peter Chen
2013-08-02 8:37 ` [PATCH 1/3] usb: chipidea: udc: fix the oops when plugs in usb cable after rmmod gadget Peter Chen
2013-08-02 8:37 ` Peter Chen [this message]
2013-08-02 8:37 ` [PATCH 3/3] usb: host: delete chipidea dependency Peter Chen
2013-08-09 10:51 ` Alexander Shishkin
2013-08-09 14:34 ` Alan Stern
2013-08-09 14:42 ` Alexander Shishkin
2013-08-09 14:52 ` Alan Stern
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=1375432662-32018-3-git-send-email-peter.chen@freescale.com \
--to=peter.chen@freescale.com \
--cc=linux-arm-kernel@lists.infradead.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).