phy-spacemit-k1x-combphy: add lfps_thres, rename suspend_term to rx_always_on

lfps_thres control lfps signal threshold, affects polling.lfps handshake.
rx_always_on control if rx circuit is always on, affects rx detect.

Change-Id: I9c7a7d8a1e9c850bb94dfe122ceb45e37ea8110a
This commit is contained in:
Pan Junzhong
2024-12-13 09:05:33 +08:00
committed by 张猛
parent acefd6ae20
commit 1c0b3b4b9c

View File

@@ -30,6 +30,7 @@
#define SPACEMIT_COMBPHY_USB_PLL_MASK 0x1
#define SPACEMIT_COMBPHY_USB_PLL_VAL 0x1
#define SPACEMIT_COMBPHY_USB_TERM_SHORT 0x3000
#define SPACEMIT_COMBPHY_USB_LFPS_THRES_DEFAULT (0x3)
struct spacemit_combphy_priv;
@@ -42,7 +43,8 @@ struct spacemit_combphy_priv {
void __iomem *puphy_base;
struct phy *phy;
u8 type;
bool suspend_term_quirk;
bool rx_always_on;
u8 lfps_thres;
};
static inline void spacemit_reg_updatel(void __iomem *reg, u32 offset, u32 mask,
@@ -95,8 +97,11 @@ static int spacemit_combphy_init_usb(struct spacemit_combphy_priv *priv)
SPACEMIT_COMBPHY_USB_PLL_MASK,
SPACEMIT_COMBPHY_USB_PLL_VAL);
if (priv->suspend_term_quirk) {
spacemit_reg_updatel(base, 0x18, 0, SPACEMIT_COMBPHY_USB_TERM_SHORT);
dev_info(priv->dev, "USB3 PHY init lfps thres %d\n", priv->lfps_thres);
spacemit_reg_updatel(base, 0x58, (0x7 << 8), ((priv->lfps_thres) << 8));
if (priv->rx_always_on) {
spacemit_reg_updatel(base, 0x18, 0x3000, SPACEMIT_COMBPHY_USB_TERM_SHORT);
}
if (ret)
@@ -214,7 +219,11 @@ static int spacemit_combphy_probe(struct platform_device *pdev)
ret = PTR_ERR(priv->phy_sel);
return ret;
}
priv->suspend_term_quirk = device_property_read_bool(&pdev->dev, "suspend-term-quirk");
priv->lfps_thres = SPACEMIT_COMBPHY_USB_LFPS_THRES_DEFAULT;
device_property_read_u8(&pdev->dev, "lfps-threshold", &priv->lfps_thres);
priv->rx_always_on = device_property_read_bool(&pdev->dev, "rx-always-on");
priv->dev = dev;
priv->type = PHY_NONE;