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


Groups > linux.kernel > #1475794

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

From Randy Li <ayaka@soulik.info>
Newsgroups linux.kernel
Subject [PATCH v7 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Date 2016-09-04 00:00 +0200
Message-ID <sdr8J-2bm-9@gated-at.bofh.it> (permalink)
References <sdr8J-2bm-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 .../devicetree/bindings/phy/rockchip-usb-phy.txt     |  3 +++
 drivers/phy/phy-rockchip-usb.c                       | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
index cc6be96..57dc388 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
@@ -27,6 +27,9 @@ Optional Properties:
 - clocks : phandle + clock specifier for the phy clocks
 - clock-names: string, clock name, must be "phyclk"
 - #clock-cells: for users of the phy-pll, should be 0
+- reset-names: Only allow the following entries:
+ - phy-reset
+- resets: Must contain an entry for each entry in reset-names.
 
 Example:
 
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

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


Thread

[PATCH v7 0/4] the fix for the USB HOST1 at rk3288 platform Randy Li <ayaka@soulik.info> - 2016-09-04 00:00 +0200
  [PATCH v7 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Randy Li <ayaka@soulik.info> - 2016-09-04 00:00 +0200
  [PATCH v7 1/4] phy: Add reset callback Randy Li <ayaka@soulik.info> - 2016-09-04 00:00 +0200
  [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform Randy Li <ayaka@soulik.info> - 2016-09-04 00:00 +0200
    Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in  rk3288 platform Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-09-04 00:40 +0200
    RE: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in  rk3288 platform David Laight <David.Laight@ACULAB.COM> - 2016-09-05 15:50 +0200
      Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform Ayaka <ayaka@soulik.info> - 2016-09-06 01:40 +0200
    Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in  rk3288 platform Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-06 07:20 +0200
      Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in  rk3288 platform John Youn <John.Youn@synopsys.com> - 2016-09-06 21:00 +0200
        Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform Ayaka <ayaka@soulik.info> - 2016-09-07 03:30 +0200
          Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in  rk3288 platform John Youn <John.Youn@synopsys.com> - 2016-09-07 04:10 +0200

csiph-web