Patchwork [U-Boot,v2] usb: Prevent using reserved registers on DM36x usb

login
register
mail settings
Submitter Andrew Murray
Date Sept. 29, 2013, 5:02 p.m.
Message ID <1380474142-16686-1-git-send-email-amurray@embedded-bits.co.uk>
Download mbox | patch
Permalink /patch/278878/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Andrew Murray - Sept. 29, 2013, 5:02 p.m.
The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
bit is reserved on the DM36x. Thus this patch ensures that the
reserved bit is not accesssed.

It has been observed that some USB devices will fail to enumerate
with errors such as 'error in inquiry' without this patch.

See http://www.ti.com/litv/pdf/sprufh9a for details.

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
---
 drivers/usb/musb/musb_hcd.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
Marek Vasut - Sept. 29, 2013, 11:26 p.m.
Dear Andrew Murray,

> The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
> bit is reserved on the DM36x. Thus this patch ensures that the
> reserved bit is not accesssed.
> 
> It has been observed that some USB devices will fail to enumerate
> with errors such as 'error in inquiry' without this patch.
> 
> See http://www.ti.com/litv/pdf/sprufh9a for details.
> 
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>

Tom, can you check this and if it's OK with you, pick this by hand?

For my part, I'm fine here,

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Andrew Murray - Oct. 9, 2013, 5:16 p.m.
On 30 September 2013 00:26, Marek Vasut <marex@denx.de> wrote:
> Dear Andrew Murray,
>
>> The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
>> bit is reserved on the DM36x. Thus this patch ensures that the
>> reserved bit is not accesssed.
>>
>> It has been observed that some USB devices will fail to enumerate
>> with errors such as 'error in inquiry' without this patch.
>>
>> See http://www.ti.com/litv/pdf/sprufh9a for details.
>>
>> Cc: Marek Vasut <marex@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
>
> Tom, can you check this and if it's OK with you, pick this by hand?
>
> For my part, I'm fine here,
>
> Acked-by: Marek Vasut <marex@denx.de>

Tom, was this version OK?

Andrew Murray
Tom Rini - Oct. 9, 2013, 5:44 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/09/2013 01:16 PM, Andrew Murray wrote:
> On 30 September 2013 00:26, Marek Vasut <marex@denx.de> wrote:
>> Dear Andrew Murray,
>>
>>> The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
>>> bit is reserved on the DM36x. Thus this patch ensures that the
>>> reserved bit is not accesssed.
>>>
>>> It has been observed that some USB devices will fail to enumerate
>>> with errors such as 'error in inquiry' without this patch.
>>>
>>> See http://www.ti.com/litv/pdf/sprufh9a for details.
>>>
>>> Cc: Marek Vasut <marex@denx.de>
>>> Cc: Tom Rini <trini@ti.com>
>>> Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
>>
>> Tom, can you check this and if it's OK with you, pick this by hand?
>>
>> For my part, I'm fine here,
>>
>> Acked-by: Marek Vasut <marex@denx.de>
> 
> Tom, was this version OK?

Yes, this is now in master, sorry I've been slacking in sending my
replies to all patches.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSVZYHAAoJENk4IS6UOR1WJzIP/3mWVIYFD041O91GjbyNymW3
5Tjh7zXQ0MjrHHD86diZk4EsdhS3ucfQ1YP9yiDM4DhruGiO0MGRheQoND6MxqAK
Ab7q3QBDp5qdIvoepUb8UZVe15IK5PyZ86q3xraJYZ4uN6lS+FfnP//3UwdgD/Sr
bw+9vfHWFjmZvPVOXQoMebmnClWaHY5MCjkMwi4K4/DYjWcWyQLA9tAotvMa/Xhc
yBx1jwnTtqBAMWJnJD+ZTKkssPLZTF+B/IV+waZIX5upviV5fg1JKtdwRw0BAQUz
SATsWiKAEczztYttQfz39lzyOS+VFvtYKDEJb8B24BlFRn11udgZk4RNKWixxDCT
j7+q74e4mVzD529Qb5aqhf5PyyaKcmxlkHDHk3xRRGsaUOHLLv/j/pXUGG7CAc7d
v9oGIpa9J4fIN8y8im1tMfJjXuq/gspqTmJo0F0tfUtzUHIJIXy7zptmhANoVLu2
nmL+owCesTlLQc0y6gQMUXAqiBdBSzSgMkGmcSkD+J+C6XfdSZBTu9zX3dUDmX7y
tuwx01l9k6iP8oqC7TQGycLgWNzenJH2YuvFS3yctTtwmQd0RtqbSHgCzW7FjAzX
WFRUzTLz20OtR0O+sXCKtxnv/BvwkE3i4Ohe+LRJxCuorIa8KMRad+88sMaya927
2LgEI3U1cQrpT2zgZ6QN
=zGv4
-----END PGP SIGNATURE-----
Tom Rini - Oct. 10, 2013, 12:57 p.m.
On Sun, Sep 29, 2013 at 06:02:22PM +0100, Andrew Murray wrote:
> The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
> bit is reserved on the DM36x. Thus this patch ensures that the
> reserved bit is not accesssed.
> 
> It has been observed that some USB devices will fail to enumerate
> with errors such as 'error in inquiry' without this patch.
> 
> See http://www.ti.com/litv/pdf/sprufh9a for details.
> 
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot/master (and thanks for the reminder) !

Patch

diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 3dc5d6a..ae39c4a 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -417,8 +417,12 @@  static int ctrlreq_out_data_phase(struct usb_device *dev, u32 len, void *buffer)
 
 		/* Set TXPKTRDY bit */
 		csr = readw(&musbr->txcsr);
-		writew(csr | MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY,
-					&musbr->txcsr);
+			
+		csr |= MUSB_CSR0_TXPKTRDY;
+#if !defined(CONFIG_SOC_DM365)
+		csr |= MUSB_CSR0_H_DIS_PING;
+#endif
+		writew(csr, &musbr->txcsr);
 		result = wait_until_ep0_ready(dev, MUSB_CSR0_TXPKTRDY);
 		if (result < 0)
 			break;
@@ -439,8 +443,10 @@  static int ctrlreq_out_status_phase(struct usb_device *dev)
 
 	/* Set the StatusPkt bit */
 	csr = readw(&musbr->txcsr);
-	csr |= (MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY |
-			MUSB_CSR0_H_STATUSPKT);
+	csr |= (MUSB_CSR0_TXPKTRDY | MUSB_CSR0_H_STATUSPKT);
+#if !defined(CONFIG_SOC_DM365)
+	csr |= MUSB_CSR0_H_DIS_PING;
+#endif
 	writew(csr, &musbr->txcsr);
 
 	/* Wait until TXPKTRDY bit is cleared */
@@ -457,7 +463,10 @@  static int ctrlreq_in_status_phase(struct usb_device *dev)
 	int result;
 
 	/* Set the StatusPkt bit and ReqPkt bit */
-	csr = MUSB_CSR0_H_DIS_PING | MUSB_CSR0_H_REQPKT | MUSB_CSR0_H_STATUSPKT;
+	csr = MUSB_CSR0_H_REQPKT | MUSB_CSR0_H_STATUSPKT;
+#if !defined(CONFIG_SOC_DM365)
+	csr |= MUSB_CSR0_H_DIS_PING;
+#endif
 	writew(csr, &musbr->txcsr);
 	result = wait_until_ep0_ready(dev, MUSB_CSR0_H_REQPKT);