From patchwork Wed Mar 6 19:56:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 2228001 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork2.kernel.org (Postfix) with ESMTP id 1B7FFDF23A for ; Wed, 6 Mar 2013 19:56:00 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r26JtwmO028545 for ; Wed, 6 Mar 2013 13:55:58 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r26JtwwL011130 for ; Wed, 6 Mar 2013 13:55:58 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Wed, 6 Mar 2013 13:55:58 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r26JtwOO015077 for ; Wed, 6 Mar 2013 13:55:58 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9C29A80626 for ; Wed, 6 Mar 2013 13:55:58 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 627C38062A for ; Wed, 6 Mar 2013 13:55:48 -0600 (CST) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r26JtmOS002509 for ; Wed, 6 Mar 2013 13:55:48 -0600 (CST) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id r26JtlQ4009227 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Mar 2013 13:55:47 -0600 Received: from [216.82.242.131:52257] by server-3.bemta-8.messagelabs.com id 53/82-22382-34F97315; Wed, 06 Mar 2013 19:55:47 +0000 X-Env-Sender: ohiomdp@gmail.com X-Msg-Ref: server-14.tower-76.messagelabs.com!1362599742!29138626!1 X-Originating-IP: [209.85.223.173] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.8.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10770 invoked from network); 6 Mar 2013 19:55:42 -0000 Received: from mail-ie0-f173.google.com (HELO mail-ie0-f173.google.com) (209.85.223.173) by server-14.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 6 Mar 2013 19:55:42 -0000 Received: by mail-ie0-f173.google.com with SMTP id 9so10033338iec.32 for ; Wed, 06 Mar 2013 11:55:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=s/N+gP6vGhP3ZtETry8cm4f/rrDttcmow2KGhs4SUPM=; b=jk3NQ0c5b3NleQ3LPaMmVnptS/YMh1+1/x0lv0mmhB7MvbkEDQOs5XW2l3vu/eOJvc Jt5bGwz20CC/ebgil7yFiL2QBtxyiTi6MFJPulYjRqRurm69FmYXEl9lwtFn/c4FNlLm b2yvSgtsfweutS2Mj9mecSfUEU60dmdSnW9mWE8LWtLVpZCs1pTbZ5zUA6WGvaHwf3x0 06+5bXMRT1YtVebsr4uVUhXcRGGlKKzmDk0Z4pPyvVozctFTdo2zR681MEbWy+nKMSme l1/NezgH/UG8Y/Sr8DwpEQ5viPcWetP9gdmByVBls5QcUScLBJ6Hyoh14TNac0l7fITV kIhA== X-Received: by 10.50.194.164 with SMTP id hx4mr11973706igc.35.1362599741722; Wed, 06 Mar 2013 11:55:41 -0800 (PST) Received: from beef.ohporter.com (cpe-98-27-254-98.neo.res.rr.com. [98.27.254.98]) by mx.google.com with ESMTPS id wx2sm25991191igb.4.2013.03.06.11.55.40 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Mar 2013 11:55:41 -0800 (PST) From: Matt Porter To: Vinod Koul , Chris Ball Subject: [PATCH v4 2/3] dma: edma: add device_slave_sg_limits() support Date: Wed, 6 Mar 2013 14:56:06 -0500 Message-ID: <1362599767-11292-3-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362599767-11292-1-git-send-email-mporter@ti.com> References: <1362599767-11292-1-git-send-email-mporter@ti.com> CC: Linux DaVinci Kernel List , Linux MMC List , Linux Kernel Mailing List , Grant Likely , Dan Williams X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Implement device_slave_sg_limits(). EDMA has a finite set of PaRAM slots available for linking a multi-segment SG transfer. In order to prevent any one channel from consuming all PaRAM slots to fulfill a large SG transfer, the driver reports a static per-channel max number of SG segments it will handle. The maximum size of an SG segment is limited by the addr_width and maxburst of a given transfer request. These values are provided by the client driver and used to calculate and return the maximum segment length. Signed-off-by: Matt Porter --- drivers/dma/edma.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index cd7e328..42373bf 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -70,6 +70,7 @@ struct edma_chan { bool alloced; int slot[EDMA_MAX_SLOTS]; struct dma_slave_config cfg; + struct dma_slave_sg_limits sg_limits; }; struct edma_cc { @@ -462,6 +463,20 @@ static void edma_issue_pending(struct dma_chan *chan) spin_unlock_irqrestore(&echan->vchan.lock, flags); } +static struct dma_slave_sg_limits +*edma_get_slave_sg_limits(struct dma_chan *chan, + enum dma_slave_buswidth addr_width, + u32 maxburst) +{ + struct edma_chan *echan; + + echan = to_edma_chan(chan); + echan->sg_limits.max_seg_len = + (SZ_64K - 1) * addr_width * maxburst; + + return &echan->sg_limits; +} + static size_t edma_desc_size(struct edma_desc *edesc) { int i; @@ -521,6 +536,7 @@ static void __init edma_chan_init(struct edma_cc *ecc, echan->ch_num = EDMA_CTLR_CHAN(ecc->ctlr, i); echan->ecc = ecc; echan->vchan.desc_free = edma_desc_free; + echan->sg_limits.max_seg_nr = MAX_NR_SG; vchan_init(&echan->vchan, dma); @@ -537,6 +553,7 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma, dma->device_alloc_chan_resources = edma_alloc_chan_resources; dma->device_free_chan_resources = edma_free_chan_resources; dma->device_issue_pending = edma_issue_pending; + dma->device_slave_sg_limits = edma_get_slave_sg_limits; dma->device_tx_status = edma_tx_status; dma->device_control = edma_control; dma->dev = dev;