devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: sundeep subbaraya <sundeep.lkml@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Felipe Balbi <balbi@ti.com>,
	Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michal Simek <michals@xilinx.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
Subject: Re: [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support
Date: Tue, 22 Apr 2014 09:49:44 -0500	[thread overview]
Message-ID: <20140422144944.GF5524@saruman.home> (raw)
In-Reply-To: <CALHRZur7+MaYXbWOfbvjggPN7_eYAE+th5VNbcLP=ehvm0HGsA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3514 bytes --]

Hi,

On Tue, Apr 22, 2014 at 12:58:41PM +0530, sundeep subbaraya wrote:
> Hi,
> 
> On Mon, Apr 21, 2014 at 10:09 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Mon, 21 Apr 2014, Felipe Balbi wrote:
> >
> >> Hi,
> >>
> >> On Fri, Apr 18, 2014 at 07:34:08PM +0530, sundeep subbaraya wrote:
> >>
> >> <snip>
> >>
> >> > >> in ep_queue driver starts dma transfer from/to IP buffer to/from req->buf.
> >> > >> If transfer is completed then request is not added to ep request queue
> >> > >> and returns from ep_queue.
> >> > >> If transfer is not completed (actual < length) then request is added
> >> > >> to queue and returns from ep_queue.
> >> > >
> >> > > This is wrong. Why wouldn't you give gadget driver the chance to decide
> >> > > if it needs to queue the request again or not ?
> >> >
> >> > When does gadget driver decides to queue the same request again?
> >> > if -EBUSY is returned from ep_queue or req.status != 0 in completion
> >> > routine?
> >>
> >> whenever it so decides. Different gadget drivers might have different
> >> requirements. The code is open and sits under drivers/usb/gadget/ why
> >> don't you have a read ?
> >
> > I get the impression that the two of you are arguing past each other.
> > It appears that Sundeep is talking about transferring data from the
> > gadget driver's buffer to an internal buffer in the UDC hardware, but
> > Felipe is talking about transferring data from the UDC to the host.
> >
> > As I understand it, Sundeep said that when the gadget driver queues a
> > data-IN request, the UDC driver copies as much of the data buffer as
> > possible into a hardware FIFO.  If it succeeds in copying all the data
> > into the FIFO then the request's completion routine gets called
> > immediately, even though the data doesn't get sent from the FIFO to the
> > host until the host asks for it.
> >
> > If only part of the data can be copied into the FIFO then the request
> > is added to the ep's request queue before the usb_ep_queue() call
> > returns.  When space becomes available in the FIFO, the data will be
> > copied and eventually sent to the host.  When all the data has been
> > copied to the FIFO, the request's completion routine will be called.

there seems to be a slight problem with this approach: how will the IP
know that even though you copied X bytes into the FIFO, it should wait
for another Y bytes before shifting data to the wire ? How will it know
that it shouldn't generate CRC yet because there's still data to be
added ?

If there's no space in the FIFO yet, why copy data at all ?

> > Thus there never is any need for the gadget driver to queue the request
> > again.  An incomplete transfer means the FIFO didn't have enough room
> > when the request was submitted; it doesn't mean that the data didn't
> > eventually get sent to the host.
> 
> Exactly Alan,this is what I was trying to say. Probably I was not
> clear in explaining. I didnt see any harm this way and even this
> implementation is same like at91_udc.c. I have been reading
> mas_storage to understand when does gadget driver tries to enqueue a
> request again. Since different gadget drivers might have different
> requirements (agree with Felipe), wanted to know criteria for queuing
> a same request again.
> 
> I will change this implementation as per Felipe comments and test with
> some of the gadgets.

Let's see, please help me understand the questions above.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-04-22 14:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1396510519-8555-1-git-send-email-sbhatta@xilinx.com>
2014-04-03  7:35 ` [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support Subbaraya Sundeep Bhatta
     [not found]   ` <113d0620-4003-417d-806b-0b79ae692829-+Ck8Kgl/v0/RNLY4SpiB+rjjLBE8jN/0@public.gmane.org>
2014-04-03 14:58     ` Felipe Balbi
     [not found]       ` <20140403145853.GD14162-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-03 15:23         ` Michal Simek
     [not found]           ` <533D7CF0.2000702-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-04-07  9:01             ` sundeep subbaraya
     [not found]       ` <CALHRZupk2ywMNKjzAtCPgg=9-KsDqrVBAKFNoHOoSJOQ4FDJkA@mail.gmail.com>
     [not found]         ` <CALHRZupk2ywMNKjzAtCPgg=9-KsDqrVBAKFNoHOoSJOQ4FDJkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-07  9:06           ` Fwd: " sundeep subbaraya
     [not found]             ` <CALHRZuqtEpK98vTS=RQ+f3yu-L_M1SnZSJOMTaBnDT8z+YqccQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-07 16:35               ` Felipe Balbi
2014-04-08 16:01                 ` sundeep subbaraya
     [not found]                   ` <CALHRZuotnNf-sCaeQJQ_PnSVET=+GvZ_PmvF7E3oEg8bKZ8a2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-08 21:24                     ` Felipe Balbi
2014-04-16 10:39       ` sundeep subbaraya
2014-04-16 18:02         ` Felipe Balbi
     [not found]           ` <20140416180228.GK28035-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-17  9:31             ` sundeep subbaraya
     [not found]               ` <CALHRZuq6=TMryHtbjTw7rYoGwbu2w0BTdxiOA95HYS3_CG6vwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-17 15:01                 ` Felipe Balbi
2014-04-18 14:04                   ` sundeep subbaraya
2014-04-21 16:08                     ` Felipe Balbi
2014-04-21 16:39                       ` Alan Stern
     [not found]                         ` <Pine.LNX.4.44L0.1404211228190.1201-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-04-22  7:28                           ` sundeep subbaraya
2014-04-22 13:57                             ` Alan Stern
2014-04-22 14:49                             ` Felipe Balbi [this message]
     [not found]                               ` <20140422144944.GF5524-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-23  4:27                                 ` sundeep subbaraya
     [not found]                                   ` <CALHRZuoq32qoh70hbb2LtVJNgkwB1j6bvzmYONmxcn3mBnGONQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-30 16:54                                     ` Felipe Balbi
2014-05-25 17:40                                       ` sundeep subbaraya
2014-07-02 16:46                                         ` Felipe Balbi
     [not found]                                           ` <20140702164629.GI5541-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-07-07  6:28                                             ` sundeep subbaraya
     [not found]         ` <CALHRZuoCtEz5-CmU17dUpVS_MjSDdYVLMSvgXq_RwxLj_KJMDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-16 20:08           ` Paul Zimmerman
     [not found]             ` <A2CA0424C0A6F04399FB9E1CD98E03046D18F4A6-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2014-04-17 14:27               ` sundeep subbaraya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140422144944.GF5524@saruman.home \
    --to=balbi@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michals@xilinx.com \
    --cc=sbhatta@xilinx.com \
    --cc=stern@rowland.harvard.edu \
    --cc=subbaraya.sundeep.bhatta@xilinx.com \
    --cc=sundeep.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).