Commit 3b3cd24a authored by Manu Gautam's avatar Manu Gautam Committed by Kishon Vijay Abraham I

phy: Add USB speed related PHY modes

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: default avatarManu Gautam <mgautam@codeaurora.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent efb05a50
...@@ -351,6 +351,8 @@ int phy_set_mode(struct phy *phy, enum phy_mode mode) ...@@ -351,6 +351,8 @@ int phy_set_mode(struct phy *phy, enum phy_mode mode)
mutex_lock(&phy->mutex); mutex_lock(&phy->mutex);
ret = phy->ops->set_mode(phy, mode); ret = phy->ops->set_mode(phy, mode);
if (!ret)
phy->attrs.mode = mode;
mutex_unlock(&phy->mutex); mutex_unlock(&phy->mutex);
return ret; return ret;
......
...@@ -25,7 +25,15 @@ struct phy; ...@@ -25,7 +25,15 @@ struct phy;
enum phy_mode { enum phy_mode {
PHY_MODE_INVALID, PHY_MODE_INVALID,
PHY_MODE_USB_HOST, 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,
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_USB_OTG,
PHY_MODE_SGMII, PHY_MODE_SGMII,
PHY_MODE_10GKR, PHY_MODE_10GKR,
...@@ -61,6 +69,7 @@ struct phy_ops { ...@@ -61,6 +69,7 @@ struct phy_ops {
*/ */
struct phy_attrs { struct phy_attrs {
u32 bus_width; u32 bus_width;
enum phy_mode mode;
}; };
/** /**
...@@ -144,6 +153,10 @@ int phy_exit(struct phy *phy); ...@@ -144,6 +153,10 @@ int phy_exit(struct phy *phy);
int phy_power_on(struct phy *phy); int phy_power_on(struct phy *phy);
int phy_power_off(struct phy *phy); int phy_power_off(struct phy *phy);
int phy_set_mode(struct phy *phy, enum phy_mode mode); 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_reset(struct phy *phy);
int phy_calibrate(struct phy *phy); int phy_calibrate(struct phy *phy);
static inline int phy_get_bus_width(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) ...@@ -260,6 +273,11 @@ static inline int phy_set_mode(struct phy *phy, enum phy_mode mode)
return -ENOSYS; 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) static inline int phy_reset(struct phy *phy)
{ {
if (!phy) if (!phy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment