All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Sjoerd Simons <sjoerd.simons@collabora.co.uk>,
	John Youn <johnyoun@synopsys.com>,
	Heiko Stuebner <heiko@sntech.de>
Cc: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Randy Li <ayaka@soulik.info>,
	<linux-rockchip@lists.infradead.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/3] phy: rockchip-usb: Add vbus regulator support.
Date: Thu, 6 Apr 2017 16:07:55 +0530	[thread overview]
Message-ID: <59ed8834-75d4-2001-73d4-6081d42d2aeb@ti.com> (raw)
In-Reply-To: <20170405140613.4444-2-sjoerd.simons@collabora.co.uk>



On Wednesday 05 April 2017 07:36 PM, Sjoerd Simons wrote:
> On rockchip devices vbus is supplied by a separate power supply, often
> through a regulator. Add support for describing the the regulator in
> device-tree following the same convention as several other usb phy's.
> 
merged, thanks.

-Kishon
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
> 
>  .../devicetree/bindings/phy/rockchip-usb-phy.txt      |  1 +
>  drivers/phy/phy-rockchip-usb.c                        | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> index 57dc388e2fa2..4ed569046daf 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> @@ -30,6 +30,7 @@ Optional Properties:
>  - reset-names: Only allow the following entries:
>   - phy-reset
>  - resets: Must contain an entry for each entry in reset-names.
> +- vbus-supply: power-supply phandle for vbus power source
>  
>  Example:
>  
> diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> index 734987fa0ad7..3378eeb7a562 100644
> --- a/drivers/phy/phy-rockchip-usb.c
> +++ b/drivers/phy/phy-rockchip-usb.c
> @@ -66,6 +66,7 @@ struct rockchip_usb_phy {
>  	struct phy	*phy;
>  	bool		uart_enabled;
>  	struct reset_control *reset;
> +	struct regulator *vbus;
>  };
>  
>  static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
> @@ -88,6 +89,9 @@ static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
>  						    struct rockchip_usb_phy,
>  						    clk480m_hw);
>  
> +	if (phy->vbus)
> +		regulator_disable(phy->vbus);
> +
>  	/* Power down usb phy analog blocks by set siddq 1 */
>  	rockchip_usb_phy_power(phy, 1);
>  }
> @@ -143,6 +147,14 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
>  	if (phy->uart_enabled)
>  		return -EBUSY;
>  
> +	if (phy->vbus) {
> +		int ret;
> +
> +		ret = regulator_enable(phy->vbus);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return clk_prepare_enable(phy->clk480m);
>  }
>  
> @@ -268,6 +280,13 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
>  	}
>  	phy_set_drvdata(rk_phy->phy, rk_phy);
>  
> +	rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> +	if (IS_ERR(rk_phy->vbus)) {
> +		if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
> +			return PTR_ERR(rk_phy->vbus);
> +		rk_phy->vbus = NULL;
> +	}
> +
>  	/*
>  	 * When acting as uart-pipe, just keep clock on otherwise
>  	 * only power up usb phy when it use, so disable it when init
> 

WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
To: Sjoerd Simons
	<sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>,
	John Youn <johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>,
	Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Randy Li <ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/3] phy: rockchip-usb: Add vbus regulator support.
Date: Thu, 6 Apr 2017 16:07:55 +0530	[thread overview]
Message-ID: <59ed8834-75d4-2001-73d4-6081d42d2aeb@ti.com> (raw)
In-Reply-To: <20170405140613.4444-2-sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>



On Wednesday 05 April 2017 07:36 PM, Sjoerd Simons wrote:
> On rockchip devices vbus is supplied by a separate power supply, often
> through a regulator. Add support for describing the the regulator in
> device-tree following the same convention as several other usb phy's.
> 
merged, thanks.

-Kishon
> Signed-off-by: Sjoerd Simons <sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
> ---
> 
>  .../devicetree/bindings/phy/rockchip-usb-phy.txt      |  1 +
>  drivers/phy/phy-rockchip-usb.c                        | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> index 57dc388e2fa2..4ed569046daf 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> @@ -30,6 +30,7 @@ Optional Properties:
>  - reset-names: Only allow the following entries:
>   - phy-reset
>  - resets: Must contain an entry for each entry in reset-names.
> +- vbus-supply: power-supply phandle for vbus power source
>  
>  Example:
>  
> diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> index 734987fa0ad7..3378eeb7a562 100644
> --- a/drivers/phy/phy-rockchip-usb.c
> +++ b/drivers/phy/phy-rockchip-usb.c
> @@ -66,6 +66,7 @@ struct rockchip_usb_phy {
>  	struct phy	*phy;
>  	bool		uart_enabled;
>  	struct reset_control *reset;
> +	struct regulator *vbus;
>  };
>  
>  static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
> @@ -88,6 +89,9 @@ static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
>  						    struct rockchip_usb_phy,
>  						    clk480m_hw);
>  
> +	if (phy->vbus)
> +		regulator_disable(phy->vbus);
> +
>  	/* Power down usb phy analog blocks by set siddq 1 */
>  	rockchip_usb_phy_power(phy, 1);
>  }
> @@ -143,6 +147,14 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
>  	if (phy->uart_enabled)
>  		return -EBUSY;
>  
> +	if (phy->vbus) {
> +		int ret;
> +
> +		ret = regulator_enable(phy->vbus);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return clk_prepare_enable(phy->clk480m);
>  }
>  
> @@ -268,6 +280,13 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
>  	}
>  	phy_set_drvdata(rk_phy->phy, rk_phy);
>  
> +	rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> +	if (IS_ERR(rk_phy->vbus)) {
> +		if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
> +			return PTR_ERR(rk_phy->vbus);
> +		rk_phy->vbus = NULL;
> +	}
> +
>  	/*
>  	 * When acting as uart-pipe, just keep clock on otherwise
>  	 * only power up usb phy when it use, so disable it when init
> 

WARNING: multiple messages have this Message-ID (diff)
From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] phy: rockchip-usb: Add vbus regulator support.
Date: Thu, 6 Apr 2017 16:07:55 +0530	[thread overview]
Message-ID: <59ed8834-75d4-2001-73d4-6081d42d2aeb@ti.com> (raw)
In-Reply-To: <20170405140613.4444-2-sjoerd.simons@collabora.co.uk>



On Wednesday 05 April 2017 07:36 PM, Sjoerd Simons wrote:
> On rockchip devices vbus is supplied by a separate power supply, often
> through a regulator. Add support for describing the the regulator in
> device-tree following the same convention as several other usb phy's.
> 
merged, thanks.

-Kishon
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
> 
>  .../devicetree/bindings/phy/rockchip-usb-phy.txt      |  1 +
>  drivers/phy/phy-rockchip-usb.c                        | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> index 57dc388e2fa2..4ed569046daf 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
> @@ -30,6 +30,7 @@ Optional Properties:
>  - reset-names: Only allow the following entries:
>   - phy-reset
>  - resets: Must contain an entry for each entry in reset-names.
> +- vbus-supply: power-supply phandle for vbus power source
>  
>  Example:
>  
> diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> index 734987fa0ad7..3378eeb7a562 100644
> --- a/drivers/phy/phy-rockchip-usb.c
> +++ b/drivers/phy/phy-rockchip-usb.c
> @@ -66,6 +66,7 @@ struct rockchip_usb_phy {
>  	struct phy	*phy;
>  	bool		uart_enabled;
>  	struct reset_control *reset;
> +	struct regulator *vbus;
>  };
>  
>  static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
> @@ -88,6 +89,9 @@ static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
>  						    struct rockchip_usb_phy,
>  						    clk480m_hw);
>  
> +	if (phy->vbus)
> +		regulator_disable(phy->vbus);
> +
>  	/* Power down usb phy analog blocks by set siddq 1 */
>  	rockchip_usb_phy_power(phy, 1);
>  }
> @@ -143,6 +147,14 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
>  	if (phy->uart_enabled)
>  		return -EBUSY;
>  
> +	if (phy->vbus) {
> +		int ret;
> +
> +		ret = regulator_enable(phy->vbus);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return clk_prepare_enable(phy->clk480m);
>  }
>  
> @@ -268,6 +280,13 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
>  	}
>  	phy_set_drvdata(rk_phy->phy, rk_phy);
>  
> +	rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> +	if (IS_ERR(rk_phy->vbus)) {
> +		if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
> +			return PTR_ERR(rk_phy->vbus);
> +		rk_phy->vbus = NULL;
> +	}
> +
>  	/*
>  	 * When acting as uart-pipe, just keep clock on otherwise
>  	 * only power up usb phy when it use, so disable it when init
> 

  reply	other threads:[~2017-04-06 10:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 14:06 [PATCH 0/3] rockchip dwc2: Turn off vbus on shutdown Sjoerd Simons
2017-04-05 14:06 ` Sjoerd Simons
2017-04-05 14:06 ` Sjoerd Simons
2017-04-05 14:06 ` [PATCH 1/3] phy: rockchip-usb: Add vbus regulator support Sjoerd Simons
2017-04-05 14:06   ` Sjoerd Simons
2017-04-05 14:06   ` Sjoerd Simons
2017-04-06 10:37   ` Kishon Vijay Abraham I [this message]
2017-04-06 10:37     ` Kishon Vijay Abraham I
2017-04-06 10:37     ` Kishon Vijay Abraham I
2017-04-05 14:06 ` [PATCH 2/3] ARM: dts: rockchip: rock2: Setup usb vbus-supply Sjoerd Simons
2017-04-05 14:06   ` Sjoerd Simons
2017-04-05 14:06   ` Sjoerd Simons
2017-04-06 22:23   ` Heiko Stuebner
2017-04-06 22:23     ` Heiko Stuebner
2017-04-06 22:23     ` Heiko Stuebner
2017-04-05 14:06 ` [PATCH 3/3] usb: dwc2: Power off the phy on shutdown Sjoerd Simons

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=59ed8834-75d4-2001-73d4-6081d42d2aeb@ti.com \
    --to=kishon@ti.com \
    --cc=ayaka@soulik.info \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=johnyoun@synopsys.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sjoerd.simons@collabora.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.