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


Groups > linux.kernel > #1655868 > unrolled thread

[PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support

Started byFrank Wang <frank.wang@rock-chips.com>
First post2017-06-02 05:30 +0200
Last post2017-06-02 12:20 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support Frank Wang <frank.wang@rock-chips.com> - 2017-06-02 05:30 +0200
    [PATCH v2 1/4] phy: rockchip-inno-usb2: add a delay after phy resume Frank Wang <frank.wang@rock-chips.com> - 2017-06-02 05:30 +0200
    [PATCH v2 2/4] phy: rockchip-inno-usb2: increase otg sm work first schedule time Frank Wang <frank.wang@rock-chips.com> - 2017-06-02 05:30 +0200
    [PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support Frank Wang <frank.wang@rock-chips.com> - 2017-06-02 05:30 +0200
    Re: [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add  rk3228 SoCs' support Kishon Vijay Abraham I <kishon@ti.com> - 2017-06-02 12:20 +0200

#1655868 — [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support

FromFrank Wang <frank.wang@rock-chips.com>
Date2017-06-02 05:30 +0200
Subject[PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support
Message-ID<tNLrH-3yD-7@gated-at.bofh.it>
These series of patches fix some issues for rockchip usb2-phy and amend
usb2-phy framework to support one phy which comprises with two host-ports.

In addition, this change also add rk3228 usb2-phy support.

Changes from v1:
 - Replaced rk322x with rk3228 for PATCH 4/4.
 - Included devicetree people in the recipient list.

Frank Wang (1):
  phy: rockchip-inno-usb2: add support of usb2-phy for rk3228 SoCs

William Wu (3):
  phy: rockchip-inno-usb2: add a delay after phy resume
  phy: rockchip-inno-usb2: increase otg sm work first schedule time
  phy: rockchip-inno-usb2: add one phy comprises with two host-ports
    support

 .../bindings/phy/phy-rockchip-inno-usb2.txt        |  1 +
 drivers/phy/phy-rockchip-inno-usb2.c               | 74 ++++++++++++++++++++--
 2 files changed, 71 insertions(+), 4 deletions(-)

-- 
2.0.0

[toc] | [next] | [standalone]


#1655870 — [PATCH v2 1/4] phy: rockchip-inno-usb2: add a delay after phy resume

FromFrank Wang <frank.wang@rock-chips.com>
Date2017-06-02 05:30 +0200
Subject[PATCH v2 1/4] phy: rockchip-inno-usb2: add a delay after phy resume
Message-ID<tNLrI-3yD-17@gated-at.bofh.it>
In reply to#1655868
From: William Wu <william.wu@rock-chips.com>

When resume phy, it need about 1.5 ~ 2ms to wait for
utmi_clk which used for USB controller to become stable.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
---
 drivers/phy/phy-rockchip-inno-usb2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c
index 8efe78a..f12dc8d 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -463,6 +463,9 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
 	if (ret)
 		return ret;
 
+	/* waiting for the utmi_clk to become stable */
+	usleep_range(1500, 2000);
+
 	rport->suspended = false;
 	return 0;
 }
-- 
2.0.0

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


#1655872 — [PATCH v2 2/4] phy: rockchip-inno-usb2: increase otg sm work first schedule time

FromFrank Wang <frank.wang@rock-chips.com>
Date2017-06-02 05:30 +0200
Subject[PATCH v2 2/4] phy: rockchip-inno-usb2: increase otg sm work first schedule time
Message-ID<tNLrI-3yD-11@gated-at.bofh.it>
In reply to#1655868
From: William Wu <william.wu@rock-chips.com>

In rockchip-inno-usb2 phy driver, we use otg_sm_work to
dynamically manage power consumption for phy otg-port.
If the otg-port works as peripheral mode and does not
communicate with usb host, we will suspend phy.

But once suspend phy, the phy no longer has any internal
clock running, include the utmi_clk which supplied for
usb controller. So if we suspend phy before usb controller
init, it will cause usb controller fail to initialize.

Specifically, without this patch, the observed order is:
 1. unplug usb cable
 2. start system, do dwc2 controller probe
 3. dwc2_lowlevel_hw_enable()
    - phy_init()
     - rockchip_usb2phy_init()
      - schedule otg_sm_work after 2s
        put phy in suspend, and close utmi_clk
 4. dwc2_hsotg_udc_start() - fail to initialize the usb core

Generally, dwc2_hsotg_udc_start() can be called within 5s
after start system on Rockchip platform, so we increase the
the first schedule delay time to 6s for otg_sm_work afer usb
controller calls phy_init(), this can make sure that the usb
controller completes initialization before phy enter suspend.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
---
 drivers/phy/phy-rockchip-inno-usb2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c
index f12dc8d..d6e459d 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -421,7 +421,7 @@ static int rockchip_usb2phy_init(struct phy *phy)
 				goto out;
 
 			schedule_delayed_work(&rport->otg_sm_work,
-					      OTG_SCHEDULE_DELAY);
+					      OTG_SCHEDULE_DELAY * 3);
 		} else {
 			/* If OTG works in host only mode, do nothing. */
 			dev_dbg(&rport->phy->dev, "mode %d\n", rport->mode);
-- 
2.0.0

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


#1655877 — [PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support

FromFrank Wang <frank.wang@rock-chips.com>
Date2017-06-02 05:30 +0200
Subject[PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support
Message-ID<tNLrI-3yD-25@gated-at.bofh.it>
In reply to#1655868
From: William Wu <william.wu@rock-chips.com>

At the current rockchip-inno-usb2 phy driver framework, it can
only support usb2-phy which comprises with one otg-port and one
host-port.

However, some Rockchip SoCs' (e.g RK3228, RK3229) usb2-phy comprises
with two host-ports, so we use index of otg id for one host-port
configuration, and make it work the same as otg-port host mode.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
---
 drivers/phy/phy-rockchip-inno-usb2.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c
index d6e459d..d026b4cf 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -406,7 +406,8 @@ static int rockchip_usb2phy_init(struct phy *phy)
 	mutex_lock(&rport->mutex);
 
 	if (rport->port_id == USB2PHY_PORT_OTG) {
-		if (rport->mode != USB_DR_MODE_HOST) {
+		if (rport->mode != USB_DR_MODE_HOST &&
+		    rport->mode != USB_DR_MODE_UNKNOWN) {
 			/* clear bvalid status and enable bvalid detect irq */
 			ret = property_enable(rphy,
 					      &rport->port_cfg->bvalid_det_clr,
@@ -496,7 +497,8 @@ static int rockchip_usb2phy_exit(struct phy *phy)
 	struct rockchip_usb2phy_port *rport = phy_get_drvdata(phy);
 
 	if (rport->port_id == USB2PHY_PORT_OTG &&
-	    rport->mode != USB_DR_MODE_HOST) {
+	    rport->mode != USB_DR_MODE_HOST &&
+	    rport->mode != USB_DR_MODE_UNKNOWN) {
 		cancel_delayed_work_sync(&rport->otg_sm_work);
 		cancel_delayed_work_sync(&rport->chg_work);
 	} else if (rport->port_id == USB2PHY_PORT_HOST)
@@ -973,7 +975,8 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
 	mutex_init(&rport->mutex);
 
 	rport->mode = of_usb_get_dr_mode_by_phy(child_np, -1);
-	if (rport->mode == USB_DR_MODE_HOST) {
+	if (rport->mode == USB_DR_MODE_HOST ||
+	    rport->mode == USB_DR_MODE_UNKNOWN) {
 		ret = 0;
 		goto out;
 	}
-- 
2.0.0

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


#1656108 — Re: [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support

FromKishon Vijay Abraham I <kishon@ti.com>
Date2017-06-02 12:20 +0200
SubjectRe: [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support
Message-ID<tNRQt-87W-9@gated-at.bofh.it>
In reply to#1655868

On Friday 02 June 2017 08:50 AM, Frank Wang wrote:
> These series of patches fix some issues for rockchip usb2-phy and amend
> usb2-phy framework to support one phy which comprises with two host-ports.
> 
> In addition, this change also add rk3228 usb2-phy support.

merged, thanks!

-Kishon
> 
> Changes from v1:
>  - Replaced rk322x with rk3228 for PATCH 4/4.
>  - Included devicetree people in the recipient list.
> 
> Frank Wang (1):
>   phy: rockchip-inno-usb2: add support of usb2-phy for rk3228 SoCs
> 
> William Wu (3):
>   phy: rockchip-inno-usb2: add a delay after phy resume
>   phy: rockchip-inno-usb2: increase otg sm work first schedule time
>   phy: rockchip-inno-usb2: add one phy comprises with two host-ports
>     support
> 
>  .../bindings/phy/phy-rockchip-inno-usb2.txt        |  1 +
>  drivers/phy/phy-rockchip-inno-usb2.c               | 74 ++++++++++++++++++++--
>  2 files changed, 71 insertions(+), 4 deletions(-)
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web