The short_not_ok field is used by class drivers to indicate udc whether short 
packet is expected during a particular transfer.
In case of mass storage, during command and status phase this field is set as 
false and set to true during data phase.
musb driver uses this field to decide whether to program DMA for mode1.
This code is essential for musb driver to program DMA.
Signed-off-by: Balakumar Rajendran <balakumar.rajend...@stericsson.com>
Signed-off-by: Rajaram R <ragupathy.raja...@stericsson.com>
---
 drivers/usb/gadget/f_mass_storage.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index f67b453..db8bf4a 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -878,6 +878,7 @@ static int do_write(struct fsg_common *common)
        unsigned int            amount;
        ssize_t                 nwritten;
        int                     rc;
+       struct usb_gadget *gadget = common->cdev->gadget;
 
        if (curlun->ro) {
                curlun->sense_data = SS_WRITE_PROTECTED; @@ -960,6 +961,8 @@ 
static int do_write(struct fsg_common *common)
                         * the bulk-out maxpacket size.
                         */
                        set_bulk_out_req_length(common, bh, amount);
+                       if (!gadget_is_superspeed(gadget))
+                               bh->outreq->short_not_ok = 1;
                        if (!start_out_transfer(common, bh))
                                /* Dunno what to do if common->fsg is NULL */
                                return -EIO;
@@ -1584,6 +1587,7 @@ static int throw_away_data(struct fsg_common *common)
        struct fsg_buffhd       *bh;
        u32                     amount;
        int                     rc;
+       struct usb_gadget *gadget = common->cdev->gadget;
 
        for (bh = common->next_buffhd_to_drain;
             bh->state != BUF_STATE_EMPTY || common->usb_amount_left > 0; @@ 
-1617,6 +1621,8 @@ static int throw_away_data(struct fsg_common *common)
                         * the bulk-out maxpacket size.
                         */
                        set_bulk_out_req_length(common, bh, amount);
+                       if (!gadget_is_superspeed(gadget))
+                               bh->outreq->short_not_ok = 1;
                        if (!start_out_transfer(common, bh))
                                /* Dunno what to do if common->fsg is NULL */
                                return -EIO;
@@ -2292,6 +2298,7 @@ static int get_next_command(struct fsg_common *common)  {
        struct fsg_buffhd       *bh;
        int                     rc = 0;
+       struct usb_gadget *gadget = common->cdev->gadget;
 
        /* Wait for the next buffer to become available */
        bh = common->next_buffhd_to_fill;
@@ -2303,6 +2310,8 @@ static int get_next_command(struct fsg_common *common)
 
        /* Queue a request to read a Bulk-only CBW */
        set_bulk_out_req_length(common, bh, US_BULK_CB_WRAP_LEN);
+       if (!gadget_is_superspeed(gadget))
+               bh->outreq->short_not_ok = 0;
        if (!start_out_transfer(common, bh))
                /* Don't know what to do if common->fsg is NULL */
                return -EIO;
--
1.7.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to