summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorGary King <gking@nvidia.com>2010-02-12 18:35:19 -0800
committerGary King <gking@nvidia.com>2010-02-12 18:35:19 -0800
commit3f2d6f61dbe70cb8bed9a7e69c2a9b6adae874a5 (patch)
tree7c4e9d381600a53361430f5acca929aa4ed79d41 /drivers/usb
parente61d2802714a27bd39bf96d912ff1b172e9f5771 (diff)
f_mass_storage: allow platform to set bulk buffer size
add a field to the android_usb_platform_data structure to allow platforms to specify the size of the bulk transfer buffer; if unspecified, default to the BULK_BUFFER_SIZE defined by f_mass_storage.c (previously defined as 4KiB). on harmony (tegra 2), performance of a class 10 SD card mounted as USB mass storage through this gadget has been measured to increase from ~7MB/sec read to ~17MB/sec read by increasing the buffer size from 4KiB to 16KiB. Change-Id: I0da025f1317506cbd3257fe697a9297b0516d9e9
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/android.c5
-rw-r--r--drivers/usb/gadget/f_mass_storage.c4
-rw-r--r--drivers/usb/gadget/f_mass_storage.h2
3 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index d3c028d45cbc..3a9d6e69b924 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -71,6 +71,7 @@ struct android_dev {
int adb_enabled;
int nluns;
+ size_t bulk_size;
};
static atomic_t adb_enable_excl;
@@ -128,7 +129,8 @@ static int __init android_bind_config(struct usb_configuration *c)
int ret;
printk(KERN_DEBUG "android_bind_config\n");
- ret = mass_storage_function_add(dev->cdev, c, dev->nluns);
+ ret = mass_storage_function_add(dev->cdev, c, dev->nluns,
+ dev->bulk_size);
if (ret)
return ret;
return adb_function_add(dev->cdev, c);
@@ -297,6 +299,7 @@ static int __init android_probe(struct platform_device *pdev)
if (pdata->serial_number)
strings_dev[STRING_SERIAL_IDX].s = pdata->serial_number;
dev->nluns = pdata->nluns;
+ dev->bulk_size = pdata->bulk_size;
}
return 0;
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index f63f572adfe3..10edc0f77eda 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2913,7 +2913,7 @@ static struct platform_driver fsg_platform_driver = {
};
int __init mass_storage_function_add(struct usb_composite_dev *cdev,
- struct usb_configuration *c, int nluns)
+ struct usb_configuration *c, int nluns, size_t bulk_size)
{
int rc;
struct fsg_dev *fsg;
@@ -2930,7 +2930,7 @@ int __init mass_storage_function_add(struct usb_composite_dev *cdev,
kref_init(&fsg->ref);
init_completion(&fsg->thread_notifier);
- the_fsg->buf_size = BULK_BUFFER_SIZE;
+ the_fsg->buf_size = (bulk_size) ? bulk_size : BULK_BUFFER_SIZE;
the_fsg->sdev.name = DRIVER_NAME;
the_fsg->sdev.print_name = print_switch_name;
the_fsg->sdev.print_state = print_switch_state;
diff --git a/drivers/usb/gadget/f_mass_storage.h b/drivers/usb/gadget/f_mass_storage.h
index 8e63ac0cbe93..4dd3789fcedf 100644
--- a/drivers/usb/gadget/f_mass_storage.h
+++ b/drivers/usb/gadget/f_mass_storage.h
@@ -47,6 +47,6 @@
#define __F_MASS_STORAGE_H
int mass_storage_function_add(struct usb_composite_dev *cdev,
- struct usb_configuration *c, int nluns);
+ struct usb_configuration *c, int nluns, size_t bulk_size);
#endif /* __F_MASS_STORAGE_H */