summaryrefslogtreecommitdiff
path: root/patches.tizen/1098-Revert-usb-gadget-f_mass_storage-use-fsg_common_set_.patch
blob: a941258013bfcb978fe4c317695f69cddad2d409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From a049580b53afb5c80afe867e41a5e2b129418565 Mon Sep 17 00:00:00 2001
From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Date: Tue, 14 Jan 2014 14:27:07 +0100
Subject: [PATCH 1098/1302] Revert "usb/gadget: f_mass_storage: use
 fsg_common_set_cdev in fsg_common_init"

This reverts commit 03aec556a53d26977be1c16b3307eae731960cd8.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
---
 drivers/usb/gadget/f_mass_storage.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 9dde453..8aa6c86 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -3002,6 +3002,7 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 	struct usb_gadget *gadget = cdev->gadget;
 	struct fsg_lun **curlun_it;
 	struct fsg_lun_config *lcfg;
+	struct usb_string *us;
 	int nluns, i, rc;
 	char *pathbuf;
 
@@ -3022,9 +3023,19 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 	fsg_common_set_ops(common, cfg->ops);
 	fsg_common_set_private_data(common, cfg->private_data);
 
-	rc = fsg_common_set_cdev(common, cdev, cfg->can_stall);
-	if (rc)
+	common->gadget = gadget;
+	common->ep0 = gadget->ep0;
+	common->ep0req = cdev->req;
+	common->cdev = cdev;
+
+	us = usb_gstrings_attach(cdev, fsg_strings_array,
+				 ARRAY_SIZE(fsg_strings));
+	if (IS_ERR(us)) {
+		rc = PTR_ERR(us);
 		goto error_release;
+	}
+	fsg_intf_desc.iInterface = us[FSG_STRING_INTERFACE].id;
+
 
 	rc = fsg_common_set_nluns(common, cfg->nluns);
 	if (rc)
@@ -3106,6 +3117,14 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 				     : "File-Stor Gadget"),
 		 i);
 
+	/*
+	 * Some peripheral controllers are known not to be able to
+	 * halt bulk endpoints correctly.  If one of them is present,
+	 * disable stalls.
+	 */
+	common->can_stall = cfg->can_stall &&
+		!(gadget_is_at91(common->gadget));
+
 
 	/* Tell the thread to start working */
 	common->thread_task =
-- 
1.8.3.2