linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 1/4 v2] ARM: shmobile: r8a7778: add usb phy power control function
Date: Wed, 10 Jul 2013 11:54:06 +0000	[thread overview]
Message-ID: <51DD4B5E.5030007@cogentembedded.com> (raw)
In-Reply-To: <87vc4jup1i.wl%kuninori.morimoto.gx@renesas.com>

Hello.

On 10-07-2013 6:28, Kuninori Morimoto wrote:

> USB phy initialisation function is needed from not only
> USB Host but also USB Function too.
> This patch adds usb phy common control function.

> Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
[...]

> diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
> index 08e9fb3..99dd715 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7778.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7778.c
> @@ -109,29 +109,46 @@ void __init r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
>   					  pdata, sizeof(*pdata));
>   }
>
> -/* USB */
> -static struct usb_phy *phy;
> +static int r8a7778_usb_phy_power(bool enable)
> +{
> +	static struct usb_phy *phy = NULL;
> +	int ret = 0;
> +
> +	if (!phy)
> +		phy = usb_get_phy(USB_PHY_TYPE_USB2);
> +
> +	if (IS_ERR(phy)) {
> +		pr_err("it doesn't have usb phy driver\n");
> +		return PTR_ERR(phy);
> +	}
> +
> +	if (enable)
> +		ret = usb_phy_init(phy);
> +	else
> +		usb_phy_shutdown(phy);
>
> +	return ret;
> +}
> +
> +/* USB */
>   static int usb_power_on(struct platform_device *pdev)
>   {
> -	if (IS_ERR(phy))
> -		return PTR_ERR(phy);
> +	int ret = r8a7778_usb_phy_power(1);

    s/1/true/.

> +
> +	if (ret)
> +		return ret;
>
>   	pm_runtime_enable(&pdev->dev);
>   	pm_runtime_get_sync(&pdev->dev);
>
> -	usb_phy_init(phy);
> -
>   	return 0;
>   }
>
>   static void usb_power_off(struct platform_device *pdev)
>   {
> -	if (IS_ERR(phy))
> +	if (r8a7778_usb_phy_power(0))

    s/0/false/.

WBR, Sergei


      reply	other threads:[~2013-07-10 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  2:28 [PATCH 1/4 v2] ARM: shmobile: r8a7778: add usb phy power control function Kuninori Morimoto
2013-07-10 11:54 ` Sergei Shtylyov [this message]

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=51DD4B5E.5030007@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-sh@vger.kernel.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).