From: Manu Gautam <mgautam@codeaurora.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
Manu Gautam <mgautam@codeaurora.org>,
linux-kernel@vger.kernel.org (open list:GENERIC PHY FRAMEWORK)
Subject: [PATCH v5 14/17] phy: Add USB speed related PHY modes
Date: Tue, 16 Jan 2018 16:27:09 +0530 [thread overview]
Message-ID: <1516100232-18623-15-git-send-email-mgautam@codeaurora.org> (raw)
In-Reply-To: <1516100232-18623-1-git-send-email-mgautam@codeaurora.org>
Add following USB speed related PHY modes:
LS (Low Speed), FS (Full Speed), HS (High Speed), SS (Super Speed)
Speed related information is required by some QCOM PHY drivers
to program PHY monitor resume/remote-wakeup events in suspended
state. Speed is needed in order to set correct polarity of wakeup
events for detection. E.g. QUSB2 PHY monitors DP/DM line state
depending on whether speed is LS or FS/HS to detect resume.
Similarly QMP USB3 PHY in SS mode should monitor RX terminations
attach/detach and LFPS events depending on SSPHY is active or not.
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
---
drivers/phy/phy-core.c | 2 ++
include/linux/phy/phy.h | 18 ++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index b4964b0..3c31ce5 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -351,6 +351,8 @@ int phy_set_mode(struct phy *phy, enum phy_mode mode)
mutex_lock(&phy->mutex);
ret = phy->ops->set_mode(phy, mode);
+ if (!ret)
+ phy->attrs.mode = mode;
mutex_unlock(&phy->mutex);
return ret;
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index d8da3e5..b951f90 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -25,7 +25,15 @@
enum phy_mode {
PHY_MODE_INVALID,
PHY_MODE_USB_HOST,
+ PHY_MODE_USB_HOST_LS,
+ PHY_MODE_USB_HOST_FS,
+ PHY_MODE_USB_HOST_HS,
+ PHY_MODE_USB_HOST_SS,
PHY_MODE_USB_DEVICE,
+ PHY_MODE_USB_DEVICE_LS,
+ PHY_MODE_USB_DEVICE_FS,
+ PHY_MODE_USB_DEVICE_HS,
+ PHY_MODE_USB_DEVICE_SS,
PHY_MODE_USB_OTG,
PHY_MODE_SGMII,
PHY_MODE_10GKR,
@@ -61,6 +69,7 @@ struct phy_ops {
*/
struct phy_attrs {
u32 bus_width;
+ enum phy_mode mode;
};
/**
@@ -144,6 +153,10 @@ static inline void *phy_get_drvdata(struct phy *phy)
int phy_power_on(struct phy *phy);
int phy_power_off(struct phy *phy);
int phy_set_mode(struct phy *phy, enum phy_mode mode);
+static inline enum phy_mode phy_get_mode(struct phy *phy)
+{
+ return phy->attrs.mode;
+}
int phy_reset(struct phy *phy);
int phy_calibrate(struct phy *phy);
static inline int phy_get_bus_width(struct phy *phy)
@@ -260,6 +273,11 @@ static inline int phy_set_mode(struct phy *phy, enum phy_mode mode)
return -ENOSYS;
}
+static inline enum phy_mode phy_get_mode(struct phy *phy)
+{
+ return PHY_MODE_INVALID;
+}
+
static inline int phy_reset(struct phy *phy)
{
if (!phy)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2018-01-16 11:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1516100232-18623-1-git-send-email-mgautam@codeaurora.org>
2018-01-16 10:56 ` [PATCH v5 01/17] phy: qcom-qmp: Fix phy pipe clock gating Manu Gautam
2018-01-16 10:56 ` [PATCH v5 02/17] phy: qcom-qmp: Adapt to clk_bulk_* APIs Manu Gautam
2018-01-16 10:56 ` [PATCH v5 03/17] phy: qcom-qmp: Power-on PHY before initialization Manu Gautam
2018-01-16 10:56 ` [PATCH v5 04/17] phy: qcom-qusb2: " Manu Gautam
2018-01-16 10:57 ` [PATCH v5 05/17] phy: qcom-qmp: Fix PHY block reset sequence Manu Gautam
2018-01-16 10:57 ` [PATCH v5 06/17] phy: qcom-qmp: Move SERDES/PCS START after PHY reset Manu Gautam
2018-01-16 10:57 ` [PATCH v5 07/17] phy: qcom-qusb2: Add support for different register layouts Manu Gautam
2018-01-16 10:57 ` [PATCH v5 08/17] dt-bindings: phy-qcom-qusb2: Update binding for QUSB2 V2 version Manu Gautam
2018-01-16 10:57 ` [PATCH v5 09/17] phy: qcom-qusb2: Add support " Manu Gautam
2018-01-16 10:57 ` [PATCH v5 10/17] phy: qcom-qmp: Move register offsets to header file Manu Gautam
2018-01-16 10:57 ` [PATCH v5 11/17] phy: qcom-qmp: Add register offsets for QMP V3 PHY Manu Gautam
2018-01-16 10:57 ` [PATCH v5 12/17] dt-bindings: phy-qcom-qmp: Update bindings for QMP V3 USB PHY Manu Gautam
2018-01-16 10:57 ` [PATCH v5 13/17] phy: qcom-qmp: Add support for QMP V3 USB3 PHY Manu Gautam
2018-01-16 10:57 ` Manu Gautam [this message]
2018-01-16 10:57 ` [PATCH v5 15/17] phy: qcom-qusb2: Add support for runtime PM Manu Gautam
2018-01-16 10:57 ` [PATCH v5 16/17] phy: qcom-qmp: " Manu Gautam
2018-01-16 10:57 ` [PATCH v5 17/17] phy: add SPDX identifier to QMP and QUSB2 PHY drivers Manu Gautam
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=1516100232-18623-15-git-send-email-mgautam@codeaurora.org \
--to=mgautam@codeaurora.org \
--cc=kishon@ti.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).