Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467565

Re: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup

From Kishon Vijay Abraham I <kishon@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Date 2016-08-22 13:50 +0200
Message-ID <s8VTP-5KC-9@gated-at.bofh.it> (permalink)
References <s8lnj-7QB-3@gated-at.bofh.it> <s8lnj-7QB-5@gated-at.bofh.it> <s8lnj-7QB-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Sunday 21 August 2016 02:02 AM, Randy Li wrote:
> It is a hardware bug in RK3288, the only way to solve it is to
> reset the phy.
> 
> Signed-off-by: Randy Li <ayaka@soulik.info>
> ---
>  drivers/phy/phy-rockchip-usb.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> index 2a7381f..734987f 100644
> --- a/drivers/phy/phy-rockchip-usb.c
> +++ b/drivers/phy/phy-rockchip-usb.c
> @@ -29,6 +29,7 @@
>  #include <linux/reset.h>
>  #include <linux/regmap.h>
>  #include <linux/mfd/syscon.h>
> +#include <linux/delay.h>
>  
>  static int enable_usb_uart;
>  
> @@ -64,6 +65,7 @@ struct rockchip_usb_phy {
>  	struct clk_hw	clk480m_hw;
>  	struct phy	*phy;
>  	bool		uart_enabled;
> +	struct reset_control *reset;
>  };
>  
>  static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
> @@ -144,9 +146,23 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
>  	return clk_prepare_enable(phy->clk480m);
>  }
>  
> +static int rockchip_usb_phy_reset(struct phy *_phy)
> +{
> +	struct rockchip_usb_phy *phy = phy_get_drvdata(_phy);
> +
> +	if (phy->reset) {
> +		reset_control_assert(phy->reset);
> +		udelay(10);
> +		reset_control_deassert(phy->reset);
> +	}
> +
> +	return 0;
> +}
> +
>  static const struct phy_ops ops = {
>  	.power_on	= rockchip_usb_phy_power_on,
>  	.power_off	= rockchip_usb_phy_power_off,
> +	.reset		= rockchip_usb_phy_reset,

why not just reuse the .init ops? reset can be done during initialization right?

Thanks
Kishon

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4 v4] usb: dwc2: fix the usb host for host port at RK32 Randy Li <ayaka@soulik.info> - 2016-08-20 22:50 +0200
  [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Randy Li <ayaka@soulik.info> - 2016-08-20 22:50 +0200
    Re: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to  reset phy during wakeup Kishon Vijay Abraham I <kishon@ti.com> - 2016-08-22 13:50 +0200
      Re: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Heiko Stübner <heiko@sntech.de> - 2016-08-22 15:10 +0200

csiph-web