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

Commit b82c271b authored by Sujeet Kumar's avatar Sujeet Kumar Committed by Gerrit - the friendly Code Review server
Browse files

USB: phy-msm-usb: Enable APF only during peripheral mode



APF feature is only helpful in case of peripheral mode
where it helps improve the throughput related to data
call, media transfer protocol or mass storage based
transfers. Enabling this feature during host mode
is not needed.

Hence, disable this feature when hcd is about to get
added, and enable this back again before remove hcd.

Change-Id: I9702f6f739b1ab43c30f14b3a795fb81cf06724b
Signed-off-by: default avatarSujeet Kumar <ksujeet@codeaurora.org>
parent 0597b5d5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1834,6 +1834,7 @@ static void msm_otg_start_host(struct usb_otg *otg, int on)
	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
	struct msm_otg_platform_data *pdata = motg->pdata;
	struct usb_hcd *hcd;
	u32 val;

	if (!otg->host)
		return;
@@ -1849,6 +1850,11 @@ static void msm_otg_start_host(struct usb_otg *otg, int on)
			ulpi_write(otg->phy, OTG_COMP_DISABLE,
				ULPI_SET(ULPI_PWR_CLK_MNG_REG));

		if (pdata->enable_axi_prefetch) {
			val = readl_relaxed(USB_HS_APF_CTRL);
			val &= ~APF_CTRL_EN;
			writel_relaxed(val, USB_HS_APF_CTRL);
		}
		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
	} else {
		dev_dbg(otg->phy->dev, "host off\n");
@@ -1857,6 +1863,11 @@ static void msm_otg_start_host(struct usb_otg *otg, int on)
		msm_hsusb_vbus_power(motg, 0);
		wake_up(&motg->host_suspend_wait);
		usb_remove_hcd(hcd);

		if (pdata->enable_axi_prefetch)
			writel_relaxed(readl_relaxed(USB_HS_APF_CTRL)
					| (APF_CTRL_EN), USB_HS_APF_CTRL);

		/* HCD core reset all bits of PORTSC. select ULPI phy */
		writel_relaxed(0x80000000, USB_PORTSC);