Patchwork [APPLIED] UBUNTU: SAUCE: IMX51: skip ATA PASS THROUGH command for USB storage disk from JMicron

login
register
mail settings
Submitter Andy Whitcroft
Date Feb. 27, 2010, 9:46 p.m.
Message ID <20100227214611.GK10544@shadowen.org>
Download mbox | patch
Permalink /patch/46450/
State Accepted
Delegated to: Andy Whitcroft
Headers show

Comments

Andy Whitcroft - Feb. 27, 2010, 9:46 p.m.
On Sat, Feb 27, 2010 at 09:45:28PM +0000, Andy Whitcroft wrote:
> I applied this in a slightly modified form as below.  If you could check
> it is semantically the same.  I'll be posting test kernels soon.
> 
> Applied to Lucid.
> 
> -apw

From cd3949ca71dd3f84358df9b670a094981d8e2901 Mon Sep 17 00:00:00 2001
From: Bryan Wu <bryan.wu@canonical.com>
Date: Tue, 23 Feb 2010 22:20:11 +0000
Subject: [PATCH] UBUNTU: SAUCE: IMX51: skip ATA PASS THROUGH command for USB storage disk from JMicron

BugLink: http://bugs.launchpad.net/bugs/499881

This issue is the same as LP431963, which was fixed in commit
a60f8dfc868778889c180a50a13032fa93384115. The USB storage disk from JMircon
uses the same USB-TO-SATA controller as our Babbage board. But it use different
USB VID and PID.

Add JMircon USB VIP and PID to the checking list.

[apw@canonical.com: pulled matches out to separate function.]
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/usb/storage/usb.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index b8355ca..59cd5bd 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -257,6 +257,17 @@  void fill_inquiry_response(struct us_data *us, unsigned char *data,
 }
 EXPORT_SYMBOL_GPL(fill_inquiry_response);
 
+#ifdef CONFIG_MACH_MX51_BABBAGE
+static int skip_ata_passthrough(struct us_data *us)
+{
+	int v = le16_to_cpu(us->pusb_dev->descriptor.idVendor);
+	int p = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
+
+	/* GL830 || JMicron */
+	return (v == 0x05e3 && p == 0x0718) || (v == 0x152d && p == 0x2329);
+}
+#endif
+
 static int usb_stor_control_thread(void * __us)
 {
 	struct us_data *us = (struct us_data *)__us;
@@ -333,10 +344,7 @@  static int usb_stor_control_thread(void * __us)
 			US_DEBUG(usb_stor_show_command(us->srb));
 #ifdef CONFIG_MACH_MX51_BABBAGE
 			if ((us->srb->cmnd[0] == 0x85) &&
-			    (le16_to_cpu(us->pusb_dev->descriptor.idVendor)
-								== 0x05e3) &&
-			    (le16_to_cpu(us->pusb_dev->descriptor.idProduct)
-								== 0x0718))
+			    skip_ata_passthrough(us))
 				US_DEBUGP("Skip ATA PASS-THROUGH command\n");
 			else
 #endif