All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Wang <frank.wang@rock-chips.com>
To: heiko@sntech.de, kishon@ti.com, robh+dt@kernel.org,
	mark.rutland@arm.com, william.wu@rock-chips.com
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-rockchip@lists.infradead.org, charles.chen@rock-chips.com,
	cody.xie@rock-chips.com, kevan.lan@rock-chips.com,
	huangtao@rock-chips.com, wmc@rock-chips.com,
	Frank Wang <frank.wang@rock-chips.com>
Subject: [PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support
Date: Fri,  2 Jun 2017 11:20:25 +0800	[thread overview]
Message-ID: <1496373626-27856-4-git-send-email-frank.wang@rock-chips.com> (raw)
In-Reply-To: <1496373626-27856-1-git-send-email-frank.wang@rock-chips.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: frank.wang@rock-chips.com (Frank Wang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support
Date: Fri,  2 Jun 2017 11:20:25 +0800	[thread overview]
Message-ID: <1496373626-27856-4-git-send-email-frank.wang@rock-chips.com> (raw)
In-Reply-To: <1496373626-27856-1-git-send-email-frank.wang@rock-chips.com>

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

  parent reply	other threads:[~2017-06-02  3:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  3:20 [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support Frank Wang
2017-06-02  3:20 ` Frank Wang
2017-06-02  3:20 ` Frank Wang
2017-06-02  3:20 ` [PATCH v2 1/4] phy: rockchip-inno-usb2: add a delay after phy resume Frank Wang
2017-06-02  3:20   ` Frank Wang
2017-06-02  3:20   ` Frank Wang
2017-06-02  3:20 ` [PATCH v2 2/4] phy: rockchip-inno-usb2: increase otg sm work first schedule time Frank Wang
2017-06-02  3:20   ` Frank Wang
2017-06-02  3:20 ` Frank Wang [this message]
2017-06-02  3:20   ` [PATCH v2 3/4] phy: rockchip-inno-usb2: add one phy comprises with two host-ports support Frank Wang
2017-06-02  3:20 ` [PATCH v2 4/4] phy: rockchip-inno-usb2: add support of usb2-phy for rk3228 SoCs Frank Wang
2017-06-02  3:20   ` Frank Wang
2017-06-02 10:17 ` [PATCH v2 0/4] fix some issues for Rockchip usb2-phy and add rk3228 SoCs' support Kishon Vijay Abraham I
2017-06-02 10:17   ` Kishon Vijay Abraham I
2017-06-02 10:17   ` Kishon Vijay Abraham I

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=1496373626-27856-4-git-send-email-frank.wang@rock-chips.com \
    --to=frank.wang@rock-chips.com \
    --cc=charles.chen@rock-chips.com \
    --cc=cody.xie@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=kevan.lan@rock-chips.com \
    --cc=kishon@ti.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=william.wu@rock-chips.com \
    --cc=wmc@rock-chips.com \
    /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.