devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	Lior Amsalem <alior@marvell.com>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 4/5] usb: host: xhci-plat: add optional PHY support
Date: Fri, 23 May 2014 14:58:52 +0530	[thread overview]
Message-ID: <537F14D4.1090705@ti.com> (raw)
In-Reply-To: <1400257376-13251-4-git-send-email-gregory.clement@free-electrons.com>

Hi,

On Friday 16 May 2014 09:52 PM, Gregory CLEMENT wrote:
> This commit extends the xhci-plat so that it can optionally be passed
> a reference to a PHY through the Device Tree. It will be useful for
> the Armada 375 SoCs. If no PHY is provided then the behavior of the
> driver is unchanged.
> 
> As for the clock, to achieve this, it adds a 'struct phy *' member in
> xhci_hcd. While only used for now in xhci-plat, here again, it might
> be used by other drivers in the future.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/usb/host/xhci-plat.c | 29 ++++++++++++++++++++++++++++-
>  drivers/usb/host/xhci.h      |  2 ++
>  2 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 0f5f4c8f5bf6..34239b582621 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -15,6 +15,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> +#include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  
> @@ -94,6 +95,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	struct resource         *res;
>  	struct usb_hcd		*hcd;
>  	struct clk              *clk;
> +	struct phy              *phy;
>  	int			ret;
>  	int			irq;
>  
> @@ -160,9 +162,23 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  			goto unmap_registers;
>  	}
>  
> +	phy = devm_phy_optional_get(&pdev->dev, "usb");
> +	if (IS_ERR(phy)) {
> +		ret = PTR_ERR(phy);
> +		goto disable_clk;
> +	} else {
> +		ret = phy_init(phy);
> +		if (ret)
> +			goto disable_phy;

I think you meant disable_clk here?
> +
> +		ret = phy_power_on(phy);
> +		if (ret)
> +			goto disable_phy;
> +	}
> +
>  	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
>  	if (ret)
> -		goto disable_clk;
> +		goto power_off_phy;
>  
>  	device_wakeup_enable(hcd->self.controller);
>  
> @@ -198,6 +214,12 @@ put_usb3_hcd:
>  dealloc_usb2_hcd:
>  	usb_remove_hcd(hcd);
>  
> +power_off_phy:
> +	if (!IS_ERR(phy))

This check is unnecessary here since you do power_off only if PHY is not error.
> +		phy_power_off(phy);
> +disable_phy:
> +	if (!IS_ERR(phy))

same here..
> +		phy_exit(phy);
>  disable_clk:
>  	if (!IS_ERR(clk))
>  		clk_disable_unprepare(clk);
> @@ -219,6 +241,7 @@ static int xhci_plat_remove(struct platform_device *dev)
>  	struct usb_hcd	*hcd = platform_get_drvdata(dev);
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
>  	struct clk *clk = xhci->clk;
> +	struct phy *phy = xhci->phy;
>  
>  	usb_remove_hcd(xhci->shared_hcd);
>  	usb_put_hcd(xhci->shared_hcd);
> @@ -226,6 +249,10 @@ static int xhci_plat_remove(struct platform_device *dev)
>  	usb_remove_hcd(hcd);
>  	if (!IS_ERR(clk))
>  		clk_disable_unprepare(clk);
> +	if (!IS_ERR(phy)) {

same here..

Thanks
Kishon

  reply	other threads:[~2014-05-23  9:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 16:22 [PATCH 1/5] phy: add support for USB cluster on the Armada 375 SoC Gregory CLEMENT
2014-05-16 16:22 ` [PATCH 3/5] ARM: mvebu: add Device Tree description of USB cluster controller on Armada 375 Gregory CLEMENT
2014-05-16 16:22 ` [PATCH 4/5] usb: host: xhci-plat: add optional PHY support Gregory CLEMENT
2014-05-23  9:28   ` Kishon Vijay Abraham I [this message]
     [not found]     ` <537F14D4.1090705-l0cyMroinI0@public.gmane.org>
2014-05-23 21:39       ` Gregory CLEMENT
2014-05-16 16:22 ` [PATCH 5/5] ARM: mvebu: add PHY support to the dts for the USB controllers on Armada 375 Gregory CLEMENT
     [not found] ` <1400257376-13251-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-05-16 16:22   ` [PATCH 2/5] Documentation: dt-bindings: document the Armada 375 USB cluster binding Gregory CLEMENT
     [not found]     ` <1400257376-13251-2-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-05-23  9:24       ` Kishon Vijay Abraham I
2014-05-23 13:21         ` Andrew Lunn
     [not found]           ` <20140523132145.GA31314-g2DYL2Zd6BY@public.gmane.org>
2014-05-23 13:36             ` Andrew Lunn
     [not found]               ` <20140523133608.GB31314-g2DYL2Zd6BY@public.gmane.org>
2014-05-23 13:52                 ` Kishon Vijay Abraham I
     [not found]                   ` <537F52B0.5030204-l0cyMroinI0@public.gmane.org>
2014-05-23 13:59                     ` Andrew Lunn
     [not found]                       ` <20140523135943.GC31314-g2DYL2Zd6BY@public.gmane.org>
2014-05-23 21:25                         ` Gregory CLEMENT
2014-05-23 13:50             ` Kishon Vijay Abraham I
     [not found]         ` <537F13B2.6070500-l0cyMroinI0@public.gmane.org>
2014-05-23 13:24           ` Gregory CLEMENT
2014-05-23  9:20   ` [PATCH 1/5] phy: add support for USB cluster on the Armada 375 SoC Kishon Vijay Abraham I
     [not found]     ` <537F12F5.2030102-l0cyMroinI0@public.gmane.org>
2014-05-23 21:50       ` Gregory CLEMENT
2014-05-24  6:46         ` Thomas Petazzoni
     [not found]         ` <537FC2BE.1040501-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-05-26  9:42           ` 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=537F14D4.1090705@ti.com \
    --to=kishon@ti.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=nadavh@marvell.com \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.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).