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

Commit fc7f40d5 authored by Maya Erez's avatar Maya Erez
Browse files

usb: phy: Expose new PHY callback for performing PHY reset



Add a new PHY callback for performing PHY reset, which is required
by some targets during their initialization sequence.
As usb_phy_reset name was already in use by local msm PHY APIs,
change the previous usb_phy_reset to msm_usb_phy_reset.

Change-Id: Ieb5099d12e107c123d8889058aa564d0b091d6f9
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent 614d6d7e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ static int msm_ehci_phy_reset(struct msm_hcd *mhcd)
	return 0;
}

static void usb_phy_reset(struct msm_hcd *mhcd)
static void msm_usb_phy_reset(struct msm_hcd *mhcd)
{
	u32 val;

@@ -661,7 +661,7 @@ static int msm_hsusb_reset(struct msm_hcd *mhcd)
								USB_PHY_CTRL2);

	/* Reset USB PHY after performing USB Link RESET */
	usb_phy_reset(mhcd);
	msm_usb_phy_reset(mhcd);

	msleep(100);

+3 −3
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ static int msm_otg_link_reset(struct msm_otg *motg)
	return 0;
}

static void usb_phy_reset(struct msm_otg *motg)
static void msm_usb_phy_reset(struct msm_otg *motg)
{
	u32 val;

@@ -598,7 +598,7 @@ static int msm_otg_reset(struct usb_phy *phy)
	msleep(100);

	/* Reset USB PHY after performing USB Link RESET */
	usb_phy_reset(motg);
	msm_usb_phy_reset(motg);

	/* Program USB PHY Override registers. */
	ulpi_init(motg);
@@ -607,7 +607,7 @@ static int msm_otg_reset(struct usb_phy *phy)
	 * It is recommended in HPG to reset USB PHY after programming
	 * USB PHY Override registers.
	 */
	usb_phy_reset(motg);
	msm_usb_phy_reset(motg);

	if (motg->clk)
		clk_disable_unprepare(motg->clk);
+12 −0
Original line number Diff line number Diff line
@@ -122,6 +122,9 @@ struct usb_phy {
			enum usb_device_speed speed);
	int	(*notify_disconnect)(struct usb_phy *x,
			enum usb_device_speed speed);

	/* reset the PHY clocks */
	int	(*reset)(struct usb_phy *x);
};

/**
@@ -214,6 +217,15 @@ usb_phy_post_init(struct usb_phy *x)
	return 0;
}

static inline int
usb_phy_reset(struct usb_phy *x)
{
	if (x && x->reset)
		return x->reset(x);

	return 0;
}

/* for usb host and peripheral controller drivers */
#if IS_ENABLED(CONFIG_USB_PHY)
extern struct usb_phy *usb_get_phy(enum usb_phy_type type);