From patchwork Tue May 18 12:08:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar Gupta X-Patchwork-Id: 100439 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4IC8peV021616 for ; Tue, 18 May 2010 12:08:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757162Ab0ERMIq (ORCPT ); Tue, 18 May 2010 08:08:46 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:34230 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756176Ab0ERMIq (ORCPT ); Tue, 18 May 2010 08:08:46 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o4IC8gJ0022575 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 May 2010 07:08:45 -0500 Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o4IC8fxY008233; Tue, 18 May 2010 17:38:41 +0530 (IST) Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by psplinux050.india.ti.com (8.13.1/8.13.1) with ESMTP id o4IC8f1F028815; Tue, 18 May 2010 17:38:41 +0530 Received: (from a0393629@localhost) by psplinux050.india.ti.com (8.13.1/8.13.1/Submit) id o4IC8eWG028812; Tue, 18 May 2010 17:38:40 +0530 From: Ajay Kumar Gupta To: linux-usb@vger.kernel.org Cc: linux-omap@vger.kernel.org, Ajay Kumar Gupta Subject: [PATCH 6/6 v2] musb: dma: use optimal transfer element for sdma Date: Tue, 18 May 2010 17:38:40 +0530 Message-Id: <1274184520-28783-1-git-send-email-ajay.gupta@ti.com> X-Mailer: git-send-email 1.6.2.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 12:08:51 +0000 (UTC) diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index d29e487..22a2978 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -52,11 +52,34 @@ static void musb_sdma_channel_program(struct musb *musb, struct musb_dma_channel *musb_channel, dma_addr_t dma_addr, u32 len) { + u16 frame = len; + int data_type = OMAP_DMA_DATA_TYPE_S8; + + switch (dma_addr & 0x3) { + case 0: + if ((len % 4) == 0) { + data_type = OMAP_DMA_DATA_TYPE_S32; + frame = len / 4; + break; + } + case 2: + if ((len % 2) == 0) { + data_type = OMAP_DMA_DATA_TYPE_S16; + frame = len / 2; + break; + } + case 1: + case 3: + default: + data_type = OMAP_DMA_DATA_TYPE_S8; + frame = len; + break; + } /* set transfer parameters */ omap_set_dma_transfer_params(musb_channel->sysdma_channel, - OMAP_DMA_DATA_TYPE_S8, - len ? len : 1, 1, /* One frame */ - OMAP_DMA_SYNC_ELEMENT, + data_type, + len ? frame : 1, 1, /* One frame */ + OMAP_DMA_SYNC_FRAME, OMAP24XX_DMA_NO_DEVICE, 0); /* Src Sync */