RE: [rfc/rft/patch v2 07/19] usb: musb: gadget: avoid allocating several dma channels

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

 



 

> -----Original Message-----
> From: linux-usb-owner@xxxxxxxxxxxxxxx 
> [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Felipe Balbi
> Sent: Tuesday, November 17, 2009 6:42 PM
> To: linux-usb@xxxxxxxxxxxxxxx
> Cc: Pandita, Vikram; David Brownell; Bryan Wu; Gupta, Ajay 
> Kumar; Arnaud Mandy; Felipe Balbi
> Subject: [rfc/rft/patch v2 07/19] usb: musb: gadget: avoid 
> allocating several dma channels
> 
> From: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx>
> 
> omap3 has a silicon bug where it can't handle dma transfers
> concurrently, meaning the dma will get stuck if we try to
> use two different dma channels simultaneously.
> 
> In order to avoid that bug, let's not allocate more than one
> dma channel at a time.
> 

I don't think this is a good idea - other OMAP chips including
the recently introduced OMAP3630 and OMAP4 do not have this bug
and would be unnecessarily hampered.

Additionally, the issue on 3430 is limited to channels enabled
in both directions at the same time. There is no restriction
on multiple channels enabled in the same direction.

There's a workaround based on this fact that Ajay and I developed.
I'd like to post that instead.

- Anand

> Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx>
> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx>
> ---
>  drivers/usb/musb/musbhsdma.c |   40 +++++++++++++++++++++++-----------------
>  1 files changed, 23 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
> index 5e83f96..9371578 100644
> --- a/drivers/usb/musb/musbhsdma.c
> +++ b/drivers/usb/musb/musbhsdma.c
> @@ -79,23 +79,29 @@ static struct dma_channel *dma_channel_allocate(struct dma_controller *c,
>  	struct dma_channel *channel = NULL;
>  	u8 bit;
>  
> -	for (bit = 0; bit < MUSB_HSDMA_CHANNELS; bit++) {
> -		if (!(controller->used_channels & (1 << bit))) {
> -			controller->used_channels |= (1 << bit);
> -			musb_channel = &(controller->channel[bit]);
> -			musb_channel->controller = controller;
> -			musb_channel->idx = bit;
> -			musb_channel->epnum = hw_ep->epnum;
> -			musb_channel->transmit = transmit;
> -			channel = &(musb_channel->channel);
> -			channel->private_data = musb_channel;
> -			channel->status = MUSB_DMA_STATUS_FREE;
> -			channel->max_len = 0x10000;
> -			/* Tx => mode 1; Rx => mode 0 */
> -			channel->desired_mode = transmit;
> -			channel->actual_len = 0;
> -			break;
> -		}
> +	/* musb on omap3 has a problem with using dma channels simultaneously
> +	 * so we will only allocate 1 dma channel at a time to avoid problems
> +	 * related to that bug
> +	 */
> +	for (bit = 0; bit < 1; bit++) {
> +		if (controller->used_channels & (1 << bit))
> +			continue;
> +
> +		controller->used_channels |= (1 << bit);
> +		musb_channel = &(controller->channel[bit]);
> +		musb_channel->controller = controller;
> +		musb_channel->idx = bit;
> +		musb_channel->epnum = hw_ep->epnum;
> +		musb_channel->transmit = transmit;
> +		channel = &(musb_channel->channel);
> +		channel->private_data = musb_channel;
> +		channel->status = MUSB_DMA_STATUS_FREE;
> +		channel->max_len = 0x7fffffff;
> +		/* always use mode1 */
> +		channel->desired_mode = true;
> +		channel->actual_len = 0;
> +
> +		break;
>  	}
>  
>  	return channel;
> -- 
> 1.6.4.2.253.g0b1fac
> 
> --
> 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
> 
> --
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