Re: Endpoint is not halted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ah, ok, I thought your host was a 0.96 host.  I see that the xHCI driver
does handle the TD size field differently, based on whether the host is
a 1.0 host or not (see xhci_td_remainder and xhci_v1_0_td_remainder).
I'll have to take a look at that code again to see if it's compliant
with the xHCI 1.0 spec.

Sarah Sharp

In-Reply-To: <CAEro0YF+Ard65B7cysAcaicB4PaSEWkerevwTHXjJx1OvmtDUA@xxxxxxxxxxxxxx>

On Fri, Oct 19, 2012 at 11:29:44AM +0530, Chintan Mehta wrote:
> Hi Sarah,
> 
> Thanks for the reply.
> 
> Regarding section 4.11.2.4:
> TD size is the number of bytes remaining, right shifted by 10.
> This is as per the spec version 0.96
> As per spec 1.0 (which I believe is the latest one):
> TD Size calculation is having two major changes -
> 1. TDSize shows the remaining transfer size for TD including current TRB.
> 2. TDSize calculation requires ROUNDUP( TD Transfer Size / Max Packet Size
> ).
> 
> Also it states that,
> The value of the TD Size in the last Transfer TRB of a TD (TD Size (x))
> shall be cleared to '0' to
> explicitly indicate that it is the last Transfer TRB of the TD.
> 
> It seems like driver is still calculating TDSize as per old spec.
> 
> Can you please, share your view on this?
> 
> Thanks,
> Chintan
> 
> 
> On Fri, Oct 19, 2012 at 3:24 AM, Sarah Sharp
> <sarah.a.sharp@xxxxxxxxxxxxxxx>wrote:
> 
> > Since you both seem to be asking the same question:
> >
> > On Wed, Oct 17, 2012 at 10:34:39AM +0530, ankit patel wrote:
> > > Thanks Sarah,
> > >    I just need to know that driver is doing reset when device is not
> > > attached by writing HCRST to 1 in USB Command Register of xHC. Does
> > > the host controller needs to propagate HOT/WARM reset to USB3 layer when
> > > device is not attached ?  If yes then when should we consider it to be
> > > complete?
> >
> > Steve McGowan, the xHCI spec architect, is on sabbatical.  He'll be back
> > on Oct 30, and I'm sure he'll answer your questions then.
> >
> > Until that point, I suggest you fix your host controller bug for when
> > the host gives a TRB pointer for the TRB *after* the TD that finished.
> >
> > On Wed, Oct 17, 2012 at 03:06:48PM +0530, Chintan Mehta wrote:
> > > Hi Sarah,
> > >
> > > I have got your mail ID from http://gmane.org during my search regarding
> > > USB3 xHCI Driver.
> > >
> > > We have some doubts about xHCI Host Spec.
> > >
> > > We tried to contact on xhcisupport@xxxxxxxxx, but we have not received
> > any
> > > reply yet.
> > >
> > > Can you please, help us to resolve our queries?
> > >
> > > One more question:
> > > xHCI Driver seems to be doing HCRST on startup.
> > > If device is not connected, xHCI should propagate Hot/Warm reset to USB3
> > > layer?
> >
> > I don't know.  Ask Steve.  More comments below.
> >
> > > On Fri, Sep 28, 2012 at 4:49 PM, Chintan Mehta <
> > > chintan.mehta@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > > Hi,
> > > >
> > > > We have some queries regarding TDSize in different TRBs.
> > > >
> > > > 1. In setup-data-status control transfer case:
> > > >
> > > >    - Device is informed about the transfer length of data stage through
> > > >    wLength filed in setup stage.
> >
> > You should not rely on the transfer length in the setup stage.  Section
> > 4.11.2.2 says, "Note: Some (non-compliant) USB devices use the SETUP
> > Data wLength field as a custom parameter for non-data control transfers.
> > xHCI implementations should not tie a non-zero wLength value to the
> > existence of a Data Stage TD in a control transfer to ensure
> > compatibility with those devices."
> >
> > Don't use the setup stage.  Instead, fetch the first data stage TRB, and
> > use the TD size field.
> >
> > > >    - Now, data stage may contain data stage trb followed by chained
> > > >    normal trbs to complete the data stage transfer.
> > > >    - Question is as below:
> > > >       - *Chained normal TRB should be placed only when the total data
> > > >       transfer is more than maxpacket size or data transfer can be
> > broken into
> > > >       different TRBs?*
> >
> > Data transfers can be broken down into any number of TRBs.  There is no
> > requirement that they are broken into maxpacket sized chunks.  Each TRB
> > could have more or less bytes than maxpacket size.  Your host will have
> > to deal with both.
> >
> > > >       - *If chained normal TRB can be placed without considering the
> > > >       maxpacket size rule, what should be the value of TDSize in data
> > stage TRB?
> >
> > The number of bytes remaining in the TD, *including* this TRB.  So
> > TDSize will decrease on each TRB in the TD.  (Or stay the same for
> > several TDs, if this TD is bigger than what can be represented in the TD
> > size field).
> >
> > > >       *
> > > >    - To elaborate above question, If 9 Bytes are requested in setup
> > > >    stage. Driver may either put data stage trb with TRB transfer
> > length 9
> > > >    Bytes or may put a chained normal trb after data stage trb.
> >
> > Don't rely on the setup stage wLength.
> >
> > > >    - Lets say driver is breaking transfer in two stages and puts data
> > > >    stage trb with TRB transfer length 8 Bytes, chain bit 1 and TDSize
> > 0 -
> > > >    followed by Normal trb with TRB transfer size 1 Byte, Chain bit 0
> > and
> > > >    TDSize 0.
> > > >    - *Is this breaking is proper/valid from driver side?*
> >
> > See section 4.11.2.4.  TD size is the number of bytes remaining, right
> > shifted by 10.  (8 >> 10) = 0.  (1 >> 10) = 0.  The TD size is just an
> > estimation of the number of bytes remaining.  You'll have to look at the
> > chain bit to know whether you need to fetch more data for this TD.
> >
> > > > 2. For Bulk Endpoint:
> > > >
> > > >    - *Driver can put a TD with total TD transfer size less than
> > maxpacket
> > > >    size and more than 1 TRB?*
> > > >    - For example, Maxpacketsize is 1K. And TD contains 3 TRBs as below:
> > > >       - 1st trb with TRB transfer length 600 Bytes, chain bit 1 and
> > > >       TDSize 0
> > > >       - 2nd trb with TRB transfer length 200 Bytes, chain bit 1 and
> > > >       TDSize 0
> > > >       - 3rd trb with TRB transfer length 100 Bytes, chain bit 0 and
> > > >       TDSize 0
> > > >    - *What should be the value of TDSize in above TRBs of TD?*
> >
> > Again, see section 4.11.2.4.
> >
> > TRB 1   600     (600 + 200 + 100) >> 10 = 0
> > TRB 2   200     (200 + 100) >> 10 = 0
> > TRB 3   100     (100) >> 10 = 0
> >
> > Let me know if Steve disagrees.  The xHCI driver works with many other
> > host controllers, and that's how it implements TD size.
> >
> > Sarah Sharp
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux