1
0
Fork 0

MLK-23412-11 phy: freescale: imx8mq-usb: enable RxTermination_override_sel

This is to resolve the problem of wakeup system by USB3 device
insertion if hsiomix on, in that case, the USB3 device detects
rx term on so doesn't donwgrade to USB2, so DP/DM wakeup can't
happen, with this override bit we can force the rx term off when
enters system suspend, and disable the override after system resume.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Li Jun 2020-03-16 15:56:22 +08:00
parent 41541f1540
commit a9762d30a1
1 changed files with 18 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#define PHY_CTRL2_OTG_DISABLE BIT(9)
#define PHY_CTRL6 0x18
#define PHY_CTRL6_RXTERM_OVERRIDE_SEL BIT(29)
#define PHY_CTRL6_ALT_CLK_SEL BIT(0)
struct imx8mq_usb_phy {
@ -114,18 +115,34 @@ static int imx8m_usb_phy_init(struct phy *phy)
static int imx8mq_phy_power_on(struct phy *phy)
{
struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
u32 value;
int ret;
ret = regulator_enable(imx_phy->vbus);
if (ret)
return ret;
return clk_prepare_enable(imx_phy->clk);
ret = clk_prepare_enable(imx_phy->clk);
if (ret)
return ret;
/* Disable rx term override */
value = readl(imx_phy->base + PHY_CTRL6);
value &= ~PHY_CTRL6_RXTERM_OVERRIDE_SEL;
writel(value, imx_phy->base + PHY_CTRL6);
return 0;
}
static int imx8mq_phy_power_off(struct phy *phy)
{
struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
u32 value;
/* Override rx term to be 0 */
value = readl(imx_phy->base + PHY_CTRL6);
value |= PHY_CTRL6_RXTERM_OVERRIDE_SEL;
writel(value, imx_phy->base + PHY_CTRL6);
clk_disable_unprepare(imx_phy->clk);
regulator_disable(imx_phy->vbus);