[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191007124607.20618-2-igor.opaniuk@gmail.com>
Date: Mon, 7 Oct 2019 15:46:06 +0300
From: Igor Opaniuk <igor.opaniuk@...il.com>
To: linux-usb@...r.kernel.org
Cc: Marcel Ziswiler <marcel.ziswiler@...adex.com>,
Philippe Schenker <philippe.schenker@...adex.com>,
Stefan Agner <stefan.agner@...adex.com>,
Max Krummenacher <max.krummenacher@...adex.com>,
Oleksandr Suvorov <oleksandr.suvorov@...adex.com>,
Igor Opaniuk <igor.opaniuk@...adex.com>,
Li Jun <jun.li@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Chen <Peter.Chen@....com>, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v1 2/3] usb: chipidea: set mode for usb phy driver
From: Igor Opaniuk <igor.opaniuk@...adex.com>
After enters one specific role, notify usb phy driver.
Signed-off-by: Li Jun <jun.li@....com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@...adex.com>
---
drivers/usb/chipidea/ci.h | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 6911aef500e9..a11d23910b12 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -275,9 +275,21 @@ static inline int ci_role_start(struct ci_hdrc *ci, enum ci_role role)
return -ENXIO;
ret = ci->roles[role]->start(ci);
- if (!ret)
- ci->role = role;
- return ret;
+ if (ret)
+ return ret;
+
+ ci->role = role;
+
+ if (ci->usb_phy) {
+ if (role == CI_ROLE_HOST)
+ usb_phy_set_mode(ci->usb_phy,
+ USB_MODE_HOST);
+ else
+ usb_phy_set_mode(ci->usb_phy,
+ USB_MODE_DEVICE);
+ }
+
+ return 0;
}
static inline void ci_role_stop(struct ci_hdrc *ci)
@@ -290,6 +302,9 @@ static inline void ci_role_stop(struct ci_hdrc *ci)
ci->role = CI_ROLE_END;
ci->roles[role]->stop(ci);
+
+ if (ci->usb_phy)
+ usb_phy_set_mode(ci->usb_phy, USB_MODE_NONE);
}
static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci)
--
2.17.1
Powered by blists - more mailing lists