From: Felipe Balbi <balbi@ti.com>
To: Roger Quadros <rogerq@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
balbi@ti.com, gregkh@linuxfoundation.org,
rob.herring@calxeda.com, pawel.moll@arm.com,
mark.rutland@arm.com, swarren@wwwdotorg.org,
ijc+devicetree@hellion.org.uk, rob@landley.net,
bcousson@baylibre.com, tony@atomide.com, linux@arm.linux.org.uk,
grant.likely@linaro.org, s.nawrocki@samsung.com,
galak@codeaurora.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 1/7] usb: dwc3: get "usb_phy" only if the platform indicates the presence of PHY's
Date: Thu, 17 Oct 2013 09:54:26 -0500 [thread overview]
Message-ID: <20131017145425.GE11611@gimli> (raw)
In-Reply-To: <525E943E.3080706@ti.com>
[-- Attachment #1: Type: text/plain, Size: 3849 bytes --]
On Wed, Oct 16, 2013 at 04:27:26PM +0300, Roger Quadros wrote:
> On 10/16/2013 04:10 PM, Kishon Vijay Abraham I wrote:
> > Hi roger,
> >
> > On Wednesday 16 October 2013 06:33 PM, Roger Quadros wrote:
> >> Hi Kishon,
> >>
> >> On 10/15/2013 10:54 PM, Kishon Vijay Abraham I wrote:
> >>> There can be systems which does not have a external usb_phy, so get
> >>> usb_phy only if dt data indicates the presence of PHY in the case of dt boot or
> >>> if platform_data indicates the presence of PHY. Also remove checking if
> >>> return value is -ENXIO since it's now changed to always enable usb_phy layer.
> >>>
> >>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >>> ---
> >>> In usb_get_phy_by_phandle, index 0 always refers to usb2 phy and index 1 always
> >>> refers to usb3 phy. Since we've lived so long with this, this patch will make
> >>> an assumption that if only one entry is populated in *usb-phy* property, it will
> >>> be usb2 phy and the next entry will be usb3 phy.
> >>>
> >>> drivers/usb/dwc3/Kconfig | 1 +
> >>> drivers/usb/dwc3/core.c | 72 ++++++++++++++++++++------------------
> >>> drivers/usb/dwc3/platform_data.h | 2 ++
> >>> 3 files changed, 41 insertions(+), 34 deletions(-)
> >>>
> >>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
> >>> index 70fc430..8e385b4 100644
> >>> --- a/drivers/usb/dwc3/Kconfig
> >>> +++ b/drivers/usb/dwc3/Kconfig
> >>> @@ -1,6 +1,7 @@
> >>> config USB_DWC3
> >>> tristate "DesignWare USB3 DRD Core Support"
> >>> depends on (USB || USB_GADGET) && HAS_DMA
> >>> + select USB_PHY
> >>> select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
> >>> help
> >>> Say Y or M here if your system has a Dual Role SuperSpeed
> >>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >>> index 474162e..cb91d70 100644
> >>> --- a/drivers/usb/dwc3/core.c
> >>> +++ b/drivers/usb/dwc3/core.c
> >>> @@ -354,6 +354,7 @@ static int dwc3_probe(struct platform_device *pdev)
> >>> struct device_node *node = dev->of_node;
> >>> struct resource *res;
> >>> struct dwc3 *dwc;
> >>> + int count;
> >>>
> >>> int ret = -ENOMEM;
> >>>
> >>> @@ -387,16 +388,49 @@ static int dwc3_probe(struct platform_device *pdev)
> >>> if (node) {
> >>> dwc->maximum_speed = of_usb_get_maximum_speed(node);
> >>>
> >>> - dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
> >>> - dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
> >>> + count = of_count_phandle_with_args(node, "usb-phy", NULL);
> >>> + switch (count) {
> >>> + case 2:
> >>> + dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev,
> >>> + "usb-phy", 1);
> >>> + if (IS_ERR(dwc->usb3_phy)) {
> >>> + dev_err(dev, "usb3 phy not found\n");
> >>> + return PTR_ERR(dwc->usb3_phy);
> >>> + }
> >>> + case 1:
> >>> + dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev,
> >>> + "usb-phy", 0);
> >>> + if (IS_ERR(dwc->usb2_phy)) {
> >>> + dev_err(dev, "usb2 phy not found\n");
> >>> + return PTR_ERR(dwc->usb2_phy);
> >>> + }
> >>> + break;
> >>
> >> In the Exynos case, there is only 1 phy and it is the USB3 phy. This code
> >> will wrongly treat it as usb2_phy.
> >
> > That was the case even before this patch no? Unfortunately the old USB PHY
> > library doesn't have APIs to get PHYs in a better way. If we try modifying the
> > USB PHY library, it'll be kind of duplicating what is already there in the
> > Generic PHY library. I'd rather prefer Exynos guys to use the new framework.
>
> OK. I agree with you.
> Do you know if there are users of dwc3 other than exynos5250 and omap5?
> If not, we should get rid of the old USB PHY altogether.
Intel's Baytrail, at least. But they don't use DT.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-17 14:54 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-15 19:54 [PATCH v2 0/7] Make dwc3 use Generic PHY Framework Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 1/7] usb: dwc3: get "usb_phy" only if the platform indicates the presence of PHY's Kishon Vijay Abraham I
2013-10-16 13:03 ` Roger Quadros
2013-10-16 13:10 ` Kishon Vijay Abraham I
2013-10-16 13:27 ` Roger Quadros
2013-10-17 14:54 ` Felipe Balbi [this message]
2013-12-03 10:39 ` Heikki Krogerus
2013-12-06 20:15 ` Felipe Balbi
2013-12-09 8:52 ` Heikki Krogerus
2013-12-12 18:27 ` Felipe Balbi
2013-11-05 18:11 ` Vivek Gautam
2013-11-05 18:12 ` Vivek Gautam
2013-10-17 16:38 ` Felipe Balbi
2013-10-21 11:56 ` Kishon Vijay Abraham I
2013-11-11 14:36 ` Kishon Vijay Abraham I
2013-11-25 21:32 ` Felipe Balbi
2013-12-03 9:50 ` Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 2/7] usb: dwc3: adapt dwc3 core to use Generic PHY Framework Kishon Vijay Abraham I
2013-10-16 13:18 ` Roger Quadros
2013-10-16 13:52 ` Kishon Vijay Abraham I
2013-10-16 14:23 ` Roger Quadros
2013-10-21 11:55 ` Kishon Vijay Abraham I
2013-10-21 12:13 ` Roger Quadros
[not found] ` <1381866857-3861-3-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-12-03 11:59 ` Heikki Krogerus
2013-12-03 14:13 ` Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 3/7] Documentation: dt bindings: move ..usb/usb-phy.txt to ..phy/ti-phy.txt Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 4/7] drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework Kishon Vijay Abraham I
2013-10-16 13:40 ` Roger Quadros
2013-10-21 12:53 ` Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 5/7] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2 Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 6/7] phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/ Kishon Vijay Abraham I
2013-10-15 19:54 ` [PATCH v2 7/7] arm/dts: added dt properties to adapt to the new phy framwork Kishon Vijay Abraham I
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=20131017145425.GE11611@gimli \
--to=balbi@ti.com \
--cc=bcousson@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=rogerq@ti.com \
--cc=s.nawrocki@samsung.com \
--cc=swarren@wwwdotorg.org \
--cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).