Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47d1845f authored by Peter Chen's avatar Peter Chen Committed by Felipe Balbi
Browse files

usb: phy: mxs: Add sync time after controller clear phcd



After clear portsc.phcd, PHY needs 200us stable time for switch
32K clock to AHB clock.

Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent bf783438
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
	return mxs_phy->data == &imx6sl_phy_data;
	return mxs_phy->data == &imx6sl_phy_data;
}
}


/*
 * PHY needs some 32K cycles to switch from 32K clock to
 * bus (such as AHB/AXI, etc) clock.
 */
static void mxs_phy_clock_switch_delay(void)
{
	usleep_range(300, 400);
}

static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
{
{
	int ret;
	int ret;
@@ -261,6 +270,7 @@ static int mxs_phy_init(struct usb_phy *phy)
	int ret;
	int ret;
	struct mxs_phy *mxs_phy = to_mxs_phy(phy);
	struct mxs_phy *mxs_phy = to_mxs_phy(phy);


	mxs_phy_clock_switch_delay();
	ret = clk_prepare_enable(mxs_phy->clk);
	ret = clk_prepare_enable(mxs_phy->clk);
	if (ret)
	if (ret)
		return ret;
		return ret;
@@ -289,6 +299,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend)
		       x->io_priv + HW_USBPHY_CTRL_SET);
		       x->io_priv + HW_USBPHY_CTRL_SET);
		clk_disable_unprepare(mxs_phy->clk);
		clk_disable_unprepare(mxs_phy->clk);
	} else {
	} else {
		mxs_phy_clock_switch_delay();
		ret = clk_prepare_enable(mxs_phy->clk);
		ret = clk_prepare_enable(mxs_phy->clk);
		if (ret)
		if (ret)
			return ret;
			return ret;