Re: [PATCH v2] usb: musb: do not use dma for control transfers

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

 



On Wed, 4 Aug 2010, Anand Gadiyar wrote:

> The Inventra DMA engine used with the MUSB controller in many
> SoCs cannot use DMA for control transfers on EP0, but can use
> DMA for all other transfers.
> 
> The USB core maps urbs for DMA if hcd->self.uses_dma is true.
> (hcd->self.uses_dma is true for MUSB as well).
> 
> Split the uses_dma flag into two - one that says if the
> controller needs to use PIO for control transfers, and
> another which says if the controller uses DMA (for all
> other transfers).
> 
> Also, populate this flag for all MUSB by default.
> 
> (Tested on OMAP3 and OMAP4 boards, with EHCI and MUSB HCDs
> simultaneously in use).
> 
> Signed-off-by: Anand Gadiyar <gadiyar@xxxxxx>
> Cc: Oliver Neukum <oliver@xxxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Praveena NADAHALLY <praveen.nadahally@xxxxxxxxxxxxxx>
> Cc: Felipe Balbi <felipe.balbi@xxxxxxxxx>
> Cc: Ajay Kumar Gupta <ajay.gupta@xxxxxx>
> ---
> v2:
> - Updated patch addressing Alan's comments
> - Remove RFC tag
> - Cc Felipe and Ajay for the MUSB parts
> 
> - I've populated the uses_pio_for_control flag for all
> MUSB HCDs. Even though some DMA engines used with MUSB may
> be able to carry out control transfers using DMA, there may
> not be much to be gained. If someone disagrees, I'll respin
> the patch to populate this flag for the Inventra engine alone.
> 
>  drivers/usb/core/hcd.c         |    4 +++-
>  drivers/usb/musb/musb_core.c   |    3 +++
>  drivers/usb/musb/musb_gadget.c |    4 ++++
>  include/linux/usb.h            |    4 ++++
>  4 files changed, 14 insertions(+), 1 deletion(-)
> 
> Index: kernel-omap4-base/drivers/usb/core/hcd.c
> ===================================================================
> --- kernel-omap4-base.orig/drivers/usb/core/hcd.c	2010-08-04 14:57:04.129928076 +0530
> +++ kernel-omap4-base/drivers/usb/core/hcd.c	2010-08-04 15:02:18.577938877 +0530
> @@ -1321,7 +1321,9 @@
>  	 */
>  
>  	if (usb_endpoint_xfer_control(&urb->ep->desc)) {
> -		if (hcd->self.uses_dma) {
> +		if (hcd->self.uses_pio_for_control) {
> +			urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
> +		} else if (hcd->self.uses_dma) {

Come to think of it, you don't need to touch transfer_flags at all.  
Instead just do

			return ret;

Then the following "if" statement can remain unchanged.

Alan Stern

--
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