Re: Question about calculate trbs in xhci

2014-10-06 Thread Mathias Nyman
On 10/06/2014 11:37 AM, vichy wrote: > hi Mathias: >> As I understood it, it is ok to cross page boundaries as long as the buffer >> is physically contiguous. As our dma case should be. >> xhci specification section 3.2.8 says that: >> >> "Note that no constraints are placed on the TRB Length fiel

RE: Question about calculate trbs in xhci

2014-10-06 Thread David Laight
From: vichy > hi Mathias: > > As I understood it, it is ok to cross page boundaries as long as the buffer > > is physically > contiguous. As our dma case should be. > > xhci specification section 3.2.8 says that: > > > > "Note that no constraints are placed on the TRB Length fields in a > > Scatt

RE: Question about calculate trbs in xhci

2014-10-06 Thread David Laight
From: Paul Zimmerman ... > > The xhi hardware doesn't have that constraint, but has the different > > constraints: > > 1) A buffer must not cross a 64k address boundary. > > 2) A LINK TRB (at the end of the ring) must only occur at a USB message > > boundary > >(actually it is a slightly tigh

Re: Question about calculate trbs in xhci

2014-10-06 Thread vichy
hi Mathias: > As I understood it, it is ok to cross page boundaries as long as the buffer > is physically contiguous. As our dma case should be. > xhci specification section 3.2.8 says that: > > "Note that no constraints are placed on the TRB Length fields in a > Scatter/Gather list. Classically

RE: Question about calculate trbs in xhci

2014-10-03 Thread Paul Zimmerman
> From: linux-usb-ow...@vger.kernel.org > [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of David Laight > Sent: Friday, October 03, 2014 6:08 AM > > From: Mathias Nyman > > On 10/01/2014 05:50 PM, vichy wrote: > > > hi Mathias: > > > > > >> > > >> In xhci-ring.c, static int xhci_queue_isoc_

RE: Question about calculate trbs in xhci

2014-10-03 Thread David Laight
From: Mathias Nyman > On 10/01/2014 05:50 PM, vichy wrote: > > hi Mathias: > > > >> > >> In xhci-ring.c, static int xhci_queue_isoc_tx(): > >> > >> /* Calculate TRB length */ > >> trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & ((1 << TRB_MAX_BUFF_SHIFT) - > >> 1)); > >> > >> where addr = start_add

Re: Question about calculate trbs in xhci

2014-10-03 Thread Mathias Nyman
On 10/01/2014 05:50 PM, vichy wrote: > hi Mathias: > >> >> In xhci-ring.c, static int xhci_queue_isoc_tx(): >> >> /* Calculate TRB length */ >> trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & ((1 << TRB_MAX_BUFF_SHIFT) - >> 1)); >> >> where addr = start_addr + urb->iso_frame_desc[i].offset; >> >>

Re: Question about calculate trbs in xhci

2014-10-01 Thread vichy
hi Mathias: > > In xhci-ring.c, static int xhci_queue_isoc_tx(): > > /* Calculate TRB length */ > trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); > > where addr = start_addr + urb->iso_frame_desc[i].offset; > > this limits the trb_buff_len to stop the trb buffer at

RE: Question about calculate trbs in xhci

2014-10-01 Thread David Laight
From: vichy > hi David and All: > >> > Because the trb buffers can't cross a 64k physical address boundary. > >> > >> Is it only specific to iso scheduling or bulk also need to take care? > >> from your kind explanation, the trb buffer for Bulk also need to take > >> care crossing 64k physical boun

Re: Question about calculate trbs in xhci

2014-10-01 Thread Mathias Nyman
On 10/01/2014 03:16 PM, vichy wrote: > hi David and All: Because the trb buffers can't cross a 64k physical address boundary. >>> >>> Is it only specific to iso scheduling or bulk also need to take care? >>> from your kind explanation, the trb buffer for Bulk also need to take >>> care crossin

Re: Question about calculate trbs in xhci

2014-10-01 Thread Mathias Nyman
On 10/01/2014 11:28 AM, vichy wrote: > hi all: > for iso transactions, we use below function to calculate trbs >addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); > td_len = urb->iso_frame_desc[i].length; > num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUF

Re: Question about calculate trbs in xhci

2014-10-01 Thread vichy
hi David and All: >> > Because the trb buffers can't cross a 64k physical address boundary. >> >> Is it only specific to iso scheduling or bulk also need to take care? >> from your kind explanation, the trb buffer for Bulk also need to take >> care crossing 64k physical boundary. >> But i don't fin

RE: Question about calculate trbs in xhci

2014-10-01 Thread David Laight
From: vichy [mailto:vichy@gmail.com] > hi David: > > > Because the trb buffers can't cross a 64k physical address boundary. > > Is it only specific to iso scheduling or bulk also need to take care? > from your kind explanation, the trb buffer for Bulk also need to take > care crossing 64k ph

Re: Question about calculate trbs in xhci

2014-10-01 Thread vichy
hi David: > Because the trb buffers can't cross a 64k physical address boundary. Is it only specific to iso scheduling or bulk also need to take care? from your kind explanation, the trb buffer for Bulk also need to take care crossing 64k physical boundary. But i don't find it for bulk transfer. B

RE: Question about calculate trbs in xhci

2014-10-01 Thread David Laight
From: vichy > hi all: > for iso transactions, we use below function to calculate trbs >addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); > td_len = urb->iso_frame_desc[i].length; > num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUFF_SIZE - 1)), >

Question about calculate trbs in xhci

2014-10-01 Thread vichy
hi all: for iso transactions, we use below function to calculate trbs addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); td_len = urb->iso_frame_desc[i].length; num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUFF_SIZE - 1)), TRB_MAX_B