[PATCH 4/5] usb: ehci-msm: Fix register initialization

2015-12-09 Thread Timur Tabi
From: Jack Pham 

The default value for the 'transceiver select' field of
the PORTSC register may not always be correct. Previously
the phy-msm-usb driver would do this for us, but since
ehci-msm can now be instantiated standalone without any PHY
driver, the register needs to be explicitly initialized to
ULPI mode to properly communicate with the PHY.

This is not readily apparent, as firmware or bootloader code
also happen to pre-initialize this for us. However, it can
manifest when performing a driver unbind/rebind as follows:

 cd /sys/bus/platform/drivers/msm_hsusb_host
 echo QCOM8040:00 > unbind
 echo QCOM8040:00 > bind

The EHCI core executes a controller reset as part of this,
and as a result the register in question would revert to
its default state and must be re-initialized properly.
Furthermore this may be useful in the future when adding
PM suspend/resume support.

Also, update to use the correct value of AHBMODE to allow
data transfers to be posted AHB transactions. This aligns
with the value used in the downstream MSM kernel.

Signed-off-by: Jack Pham 
Signed-off-by: Timur Tabi 
---
 drivers/usb/host/ehci-msm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index fc666ef..b8c0df0 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -56,10 +56,12 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
if (retval)
return retval;
 
+   /* select ULPI phy and clear other status/control bits in PORTSC */
+   writel(PORTSC_PTS_ULPI, USB_PORTSC);
/* bursts of unspecified length. */
writel(0, USB_AHBBURST);
/* Use the AHB transactor */
-   writel(0, USB_AHBMODE);
+   writel(0x8, USB_AHBMODE);
/* Disable streaming mode and select host mode */
writel(0x13, USB_USBMODE);
/* Disable ULPI_TX_PKT_EN_CLR_FIX which is valid only for HSIC */
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] usb: ehci-msm: Fix register initialization

2015-12-09 Thread Jack Pham
Hi Timur,

Thanks for sending these patches upstream on my behalf.

On Wed, Dec 09, 2015 at 05:41:07PM -0600, Timur Tabi wrote:
> Also, update to use the correct value of AHBMODE to allow
> data transfers to be posted AHB transactions. This aligns
> with the value used in the downstream MSM kernel.

>   /* Use the AHB transactor */
> - writel(0, USB_AHBMODE);
> + writel(0x8, USB_AHBMODE);

Andy already sent a patch for just this register change.
http://marc.info/?l=linux-usb=144678991912202=2

I see it's already been queued on Greg's usb-next. I think it would be
good to rebase.

Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] usb: ehci-msm: Fix register initialization

2015-12-09 Thread Timur Tabi

Jack Pham wrote:

Andy already sent a patch for just this register change.
http://marc.info/?l=linux-usb=144678991912202=2

I see it's already been queued on Greg's usb-next. I think it would be
good to rebase.


Ok, I will do that in my next patch version.

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html