Skip to content

Commit 3b3cd24

Browse files
Manu Gautamkishon
authored andcommitted
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: Manu Gautam <mgautam@codeaurora.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
1 parent efb05a5 commit 3b3cd24

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎drivers/phy/phy-core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ int phy_set_mode(struct phy *phy, enum phy_mode mode)
351351

352352
mutex_lock(&phy->mutex);
353353
ret = phy->ops->set_mode(phy, mode);
354+
if (!ret)
355+
phy->attrs.mode = mode;
354356
mutex_unlock(&phy->mutex);
355357

356358
return ret;

‎include/linux/phy/phy.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ struct phy;
2525
enum phy_mode {
2626
PHY_MODE_INVALID,
2727
PHY_MODE_USB_HOST,
28+
PHY_MODE_USB_HOST_LS,
29+
PHY_MODE_USB_HOST_FS,
30+
PHY_MODE_USB_HOST_HS,
31+
PHY_MODE_USB_HOST_SS,
2832
PHY_MODE_USB_DEVICE,
33+
PHY_MODE_USB_DEVICE_LS,
34+
PHY_MODE_USB_DEVICE_FS,
35+
PHY_MODE_USB_DEVICE_HS,
36+
PHY_MODE_USB_DEVICE_SS,
2937
PHY_MODE_USB_OTG,
3038
PHY_MODE_SGMII,
3139
PHY_MODE_10GKR,
@@ -61,6 +69,7 @@ struct phy_ops {
6169
*/
6270
struct phy_attrs {
6371
u32 bus_width;
72+
enum phy_mode mode;
6473
};
6574

6675
/**
@@ -144,6 +153,10 @@ int phy_exit(struct phy *phy);
144153
int phy_power_on(struct phy *phy);
145154
int phy_power_off(struct phy *phy);
146155
int phy_set_mode(struct phy *phy, enum phy_mode mode);
156+
static inline enum phy_mode phy_get_mode(struct phy *phy)
157+
{
158+
return phy->attrs.mode;
159+
}
147160
int phy_reset(struct phy *phy);
148161
int phy_calibrate(struct phy *phy);
149162
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)
260273
return -ENOSYS;
261274
}
262275

276+
static inline enum phy_mode phy_get_mode(struct phy *phy)
277+
{
278+
return PHY_MODE_INVALID;
279+
}
280+
263281
static inline int phy_reset(struct phy *phy)
264282
{
265283
if (!phy)

0 commit comments

Comments
 (0)