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


Groups > linux.kernel > #1466864 > unrolled thread

[PATCH 0/4 v4] usb: dwc2: fix the usb host for host port at RK32

Started byRandy Li <ayaka@soulik.info>
First post2016-08-20 22:50 +0200
Last post2016-08-22 15:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

#1466864 — [PATCH 0/4 v4] usb: dwc2: fix the usb host for host port at RK32

FromRandy Li <ayaka@soulik.info>
Date2016-08-20 22:50 +0200
Subject[PATCH 0/4 v4] usb: dwc2: fix the usb host for host port at RK32
Message-ID<s8lnj-7QB-5@gated-at.bofh.it>
Hello All:
 This version would move reset into phy. I wanted to implement a hard
code version but I meet some problem with ioremap reset controller,
in order to keep my word, I offer this version this time.

Randy Li (4):
  phy: Add reset callback
  phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during
    wakeup
  usb: dwc2: assert phy reset when waking up in rk3288 platform
  ARM: dts: rockchip: Point rk3288 dwc2 usb at the full PHY reset

 arch/arm/boot/dts/rk3288.dtsi  |  5 +++++
 drivers/phy/phy-rockchip-usb.c | 20 ++++++++++++++++++++
 drivers/usb/dwc2/core_intr.c   |  9 +++++++++
 include/linux/phy/phy.h        |  2 ++
 4 files changed, 36 insertions(+)

-- 
2.7.4

[toc] | [next] | [standalone]


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

FromRandy Li <ayaka@soulik.info>
Date2016-08-20 22:50 +0200
Subject[PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Message-ID<s8lnj-7QB-11@gated-at.bofh.it>
In reply to#1466864
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,
 	.owner		= THIS_MODULE,
 };
 
@@ -185,6 +201,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
 		return -EINVAL;
 	}
 
+	rk_phy->reset = of_reset_control_get(child, "phy-reset");
+	if (IS_ERR(rk_phy->reset))
+		rk_phy->reset = NULL;
+
 	rk_phy->reg_offset = reg_offset;
 
 	rk_phy->clk = of_clk_get_by_name(child, "phyclk");
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


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

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-08-22 13:50 +0200
SubjectRe: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Message-ID<s8VTP-5KC-9@gated-at.bofh.it>
In reply to#1466865
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

[toc] | [prev] | [next] | [standalone]


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

FromHeiko Stübner <heiko@sntech.de>
Date2016-08-22 15:10 +0200
SubjectRe: [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Message-ID<s8X9g-6I9-25@gated-at.bofh.it>
In reply to#1467565
Am Montag, 22. August 2016, 17:17:41 schrieb Kishon Vijay Abraham I:
> 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?

The naming of power_on + power_off and init + exit probably suggests that they 
are supposed to be used in pairs. (aka module_init + module_exit and probably 
more)

But in fact I've seen different combinations so far (phy_init + phy_power_on 
... phy_power_off + phy_exit but also phy_power_on + phy_init ... phy_exit + 
phy_power_off), so I guess the semantics are not that strictly defined.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web