Hi,

I messed up the register names in the commit log. Will fix in v2.

On 05/22/2014 05:30 PM, Daniel Mack wrote:
> When a 0-length packet is received on the bus, desc->pd6 contains 1, and

... 'desc->pd0' ...

> the current residue calculation reports back that 1 byte has been
> transferred. This is not according to what the datasheet says, but it's
> been the case on an AM335x board, very reproducible.
> 
> Fix this by looking at bit 19 in PD2 of the completed packet. This bit
> will tell us if a zero-length packet was received on a queue. If it's
> set, ignore pd2 and report a total length of 0.

... 'ignore pd0' ...

> 
> Signed-off-by: Daniel Mack <[email protected]>
> ---
>  drivers/dma/cppi41.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
> index d028f36..8f8b0b6 100644
> --- a/drivers/dma/cppi41.c
> +++ b/drivers/dma/cppi41.c
> @@ -86,6 +86,9 @@
>  
>  #define USBSS_IRQ_PD_COMP    (1 <<  2)
>  
> +/* Packet Descriptor */
> +#define PD2_ZERO_LENGTH              (1 << 19)
> +
>  struct cppi41_channel {
>       struct dma_chan chan;
>       struct dma_async_tx_descriptor txd;
> @@ -307,7 +310,7 @@ static irqreturn_t cppi41_irq(int irq, void *data)
>                       __iormb();
>  
>               while (val) {
> -                     u32 desc;
> +                     u32 desc, len;
>  
>                       q_num = __fls(val);
>                       val &= ~(1 << q_num);
> @@ -319,9 +322,13 @@ static irqreturn_t cppi41_irq(int irq, void *data)
>                                               q_num, desc);
>                               continue;
>                       }
> -                     c->residue = pd_trans_len(c->desc->pd6) -
> -                             pd_trans_len(c->desc->pd0);
>  
> +                     if (c->desc->pd2 & PD2_ZERO_LENGTH)
> +                             len = 0;
> +                     else
> +                             len = pd_trans_len(c->desc->pd0);
> +
> +                     c->residue = pd_trans_len(c->desc->pd6) - len;
>                       dma_cookie_complete(&c->txd);
>                       c->txd.callback(c->txd.callback_param);
>               }
> 

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

Reply via email to