From: Matt Porter <mporter@ti.com>
To: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>, Chris Ball <cjb@laptop.org>,
Grant Likely <grant.likely@secretlab.ca>,
Linux DaVinci Kernel List
<davinci-linux-open-source@linux.davincidsp.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux MMC List <linux-mmc@vger.kernel.org>
Subject: [PATCH v2 2/3] dma: edma: add device_channel_caps() support
Date: Thu, 10 Jan 2013 14:07:05 -0500 [thread overview]
Message-ID: <1357844826-30746-3-git-send-email-mporter@ti.com> (raw)
In-Reply-To: <1357844826-30746-1-git-send-email-mporter@ti.com>
Implement device_channel_caps().
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 SG segment is limited by the slave config
maxburst and addr_width for the channel in question. These values
are used from the current channel config to calculate and return
the max segment length cap.
Signed-off-by: Matt Porter <mporter@ti.com>
---
drivers/dma/edma.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 82c8672..fc4b9db 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 dmaengine_chan_caps caps;
};
struct edma_cc {
@@ -462,6 +463,28 @@ static void edma_issue_pending(struct dma_chan *chan)
spin_unlock_irqrestore(&echan->vchan.lock, flags);
}
+static struct dmaengine_chan_caps
+*edma_get_channel_caps(struct dma_chan *chan, enum dma_transfer_direction dir)
+{
+ struct edma_chan *echan;
+ enum dma_slave_buswidth width = 0;
+ u32 burst = 0;
+
+ if (chan) {
+ echan = to_edma_chan(chan);
+ if (dir == DMA_MEM_TO_DEV) {
+ width = echan->cfg.dst_addr_width;
+ burst = echan->cfg.dst_maxburst;
+ } else if (dir == DMA_DEV_TO_MEM) {
+ width = echan->cfg.src_addr_width;
+ burst = echan->cfg.src_maxburst;
+ }
+ echan->caps.seg_len = (SZ_64K - 1) * width * burst;
+ return &echan->caps;
+ }
+ return NULL;
+}
+
static size_t edma_desc_size(struct edma_desc *edesc)
{
int i;
@@ -521,6 +544,9 @@ 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;
+ dma_cap_set(DMA_SLAVE, echan->caps.cap_mask);
+ dma_cap_set(DMA_SG, echan->caps.cap_mask);
+ echan->caps.seg_nr = MAX_NR_SG;
vchan_init(&echan->vchan, dma);
@@ -537,6 +563,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_channel_caps = edma_get_channel_caps;
dma->device_tx_status = edma_tx_status;
dma->device_control = edma_control;
dma->dev = dev;
--
1.7.9.5
next prev parent reply other threads:[~2013-01-10 19:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 19:07 [PATCH v2 0/3] dmaengine: add per channel capabilities api Matt Porter
2013-01-10 19:07 ` [PATCH v2 1/3] dmaengine: add dma_get_channel_caps() Matt Porter
2013-01-20 12:52 ` Vinod Koul
[not found] ` <a5337a28bf454c3ca73e28ffb530ac40@DLEE74.ent.ti.com>
2013-01-20 16:41 ` Matt Porter
2013-01-10 19:07 ` Matt Porter [this message]
2013-01-20 13:03 ` [PATCH v2 2/3] dma: edma: add device_channel_caps() support Vinod Koul
[not found] ` <7bca07cce8884261b9828946dff5a076@DFLE72.ent.ti.com>
2013-01-20 16:51 ` Matt Porter
2013-01-21 3:16 ` Vinod Koul
[not found] ` <bfaa71fba6ed468cbfd2d79604729b77@DFLE72.ent.ti.com>
2013-01-21 18:29 ` Matt Porter
2013-01-10 19:07 ` [PATCH v2 3/3] mmc: davinci: get SG segment limits with dma_get_channel_caps() Matt Porter
2013-01-20 12:37 ` [PATCH v2 0/3] dmaengine: add per channel capabilities api Vinod Koul
[not found] ` <abcd725c6216491da2b1054e5e11ad82@DFLE72.ent.ti.com>
2013-01-20 16:37 ` Matt Porter
2013-01-21 3:15 ` Vinod Koul
[not found] ` <c4113bae604945b586e9613814be737a@DLEE74.ent.ti.com>
2013-01-21 18:19 ` Matt Porter
2013-01-28 10:06 ` Vinod Koul
[not found] ` <f97c0fe89e4643069c177f549a2e5628@DLEE74.ent.ti.com>
2013-01-31 22:25 ` Matt Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357844826-30746-3-git-send-email-mporter@ti.com \
--to=mporter@ti.com \
--cc=cjb@laptop.org \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=djbw@fb.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®