diff options
author | Frank Li <Frank.Li@freescale.com> | 2009-08-14 17:28:15 +0800 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2009-10-13 11:05:11 -0400 |
commit | 5971f8517a3ff8b5b3bc6ac9473458787dab20f9 (patch) | |
tree | f5caf55c571d79ae50f753f416fa98a3d42a2713 | |
parent | 62d7cb3e7c392fcaf240b7b7fff0e26d2bf348e3 (diff) |
ENGR00115081-2 iMX233 Merge UUT Patch
Merge UUT patch from EA
Signed-off-by: Frank Li <Frank.Li@freescale.com>
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 2529b1f578e6..b9c0619aa331 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -692,8 +692,16 @@ struct fsg_dev { unsigned int nluns; struct lun *luns; struct lun *curlun; + +#ifdef CONFIG_STMP_UTP + void *utp; +#endif }; +#ifdef CONFIG_STMP_UTP +#include "stmp_updater.h" +#endif + typedef void (*fsg_routine_t)(struct fsg_dev *); static int exception_in_progress(struct fsg_dev *fsg) @@ -735,7 +743,7 @@ static void dump_msg(struct fsg_dev *fsg, const char *label, if (length < 512) { DBG(fsg, "%s, length %u:\n", label, length); print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, - 16, 1, buf, length, 0); + 16, 1, buf, length, !0); } } @@ -795,6 +803,11 @@ static u32 get_be32(u8 *buf) ((u32) buf[2] << 8) | ((u32) buf[3]); } +static u64 get_be64(u8 *buf) +{ + return ((u64)get_be32(buf) << 32) | get_be32(buf + 4); +} + static void put_be16(u8 *buf, u16 val) { buf[0] = val >> 8; @@ -2077,6 +2090,13 @@ static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) } #endif +#ifdef CONFIG_STMP_UTP + if (utp_get_sense(fsg) == 0) { /* got the sense from the UTP */ + sd = UTP_CTX(fsg)->sd; + sdinfo = UTP_CTX(fsg)->sdinfo; + valid = 0; + } else +#endif if (!curlun) { // Unsupported LUNs are okay fsg->bad_lun_okay = 1; sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; @@ -2098,6 +2118,9 @@ static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) buf[7] = 18 - 8; // Additional sense length buf[12] = ASC(sd); buf[13] = ASCQ(sd); +#ifdef CONFIG_STMP_UTP + put_be32(&buf[8], UTP_CTX(fsg)->sdinfo_h); +#endif return 18; } @@ -2784,6 +2807,13 @@ static int do_scsi_command(struct fsg_dev *fsg) fsg->phase_error = 0; fsg->short_packet_received = 0; +#ifdef CONFIG_STMP_UTP + reply = utp_handle_message(fsg, fsg->cmnd, reply); + + if (reply != -EINVAL) + return reply; +#endif + down_read(&fsg->filesem); // We're using the backing file switch (fsg->cmnd[0]) { @@ -3447,10 +3477,12 @@ static int fsg_main_thread(void *fsg_) /* Allow the thread to be frozen */ set_freezable(); +#ifndef CONFIG_STMP_UTP /* Arrange for userspace references to be interpreted as kernel * pointers. That way we can pass a kernel pointer to a routine * that expects a __user pointer and it will work okay. */ set_fs(get_ds()); +#endif /* The main loop */ while (fsg->state != FSG_STATE_TERMINATED) { @@ -3758,6 +3790,9 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) } set_gadget_data(gadget, NULL); +#ifdef CONFIG_STMP_UTP + utp_exit(fsg); +#endif } @@ -3792,6 +3827,17 @@ static int __init check_parameters(struct fsg_dev *fsg) prot = simple_strtol(mod_data.protocol_parm, NULL, 0); +#ifdef CONFIG_STMP_UTP + mod_data.can_stall = 0; + mod_data.removable = 1; + mod_data.nluns = 1; + mod_data.file[0] = NULL; + mod_data.vendor = 0x066F; + mod_data.product = 0x37FF; + pr_info("%s:UTP settings are in place now, overriding defaults\n", + __func__); +#endif + #ifdef CONFIG_USB_FILE_STORAGE_TEST if (strnicmp(mod_data.transport_parm, "BBB", 10) == 0) { ; // Use default setting @@ -3844,8 +3890,9 @@ static int __init check_parameters(struct fsg_dev *fsg) return 0; } - - +#ifdef CONFIG_STMP_UTP +#include "stmp_updater.c" +#endif static int __init fsg_bind(struct usb_gadget *gadget) { struct fsg_dev *fsg = the_fsg; @@ -3870,6 +3917,10 @@ static int __init fsg_bind(struct usb_gadget *gadget) dev_attr_file.store = store_file; } +#ifdef CONFIG_STMP_UTP + utp_init(fsg); +#endif + /* Find out how many LUNs there should be */ i = mod_data.nluns; if (i == 0) |