From: rmk+kernel@arm.linux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 18/34] dmaengine: PL08x: move DMA signal muxing into pl08x_dma_chan struct
Date: Tue, 29 May 2012 10:41:19 +0100 [thread overview]
Message-ID: <E1SZIvX-0006zu-R9@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20120529093015.GF12217@n2100.arm.linux.org.uk>
Move the signal handling out of the physical channel structure into
the virtual channel structure, where it should belong as it has more
to do with the virtual channel than the physical one.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
drivers/dma/amba-pl08x.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 7156d49..e5b13e6 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -132,8 +132,6 @@ struct pl08x_bus_data {
* struct pl08x_phy_chan - holder for the physical channels
* @id: physical index to this channel
* @lock: a lock to use when altering an instance of this struct
- * @signal: the physical signal (aka channel) serving this physical channel
- * right now
* @serving: the virtual channel currently being served by this physical
* channel
*/
@@ -141,7 +139,6 @@ struct pl08x_phy_chan {
unsigned int id;
void __iomem *base;
spinlock_t lock;
- int signal;
struct pl08x_dma_chan *serving;
};
@@ -222,6 +219,7 @@ enum pl08x_dma_chan_state {
* @slave: whether this channel is a device (slave) or for memcpy
* @waiting: a TX descriptor on this channel which is waiting for a physical
* channel to become available
+ * @signal: the physical DMA request signal which this channel is using
*/
struct pl08x_dma_chan {
struct dma_chan chan;
@@ -238,6 +236,7 @@ struct pl08x_dma_chan {
enum pl08x_dma_chan_state state;
bool slave;
struct pl08x_txd *waiting;
+ int signal;
};
/**
@@ -299,7 +298,7 @@ static inline struct pl08x_txd *to_pl08x_txd(struct dma_async_tx_descriptor *tx)
* via a board/SoC specific external MUX. One important point to note
* here is that this does not depend on the physical channel.
*/
-static int pl08x_request_mux(struct pl08x_dma_chan *plchan, struct pl08x_phy_chan *ch)
+static int pl08x_request_mux(struct pl08x_dma_chan *plchan)
{
const struct pl08x_platform_data *pd = plchan->host->pd;
int ret;
@@ -309,7 +308,7 @@ static int pl08x_request_mux(struct pl08x_dma_chan *plchan, struct pl08x_phy_cha
if (ret < 0)
return ret;
- ch->signal = ret;
+ plchan->signal = ret;
}
return 0;
}
@@ -318,9 +317,9 @@ static void pl08x_release_mux(struct pl08x_dma_chan *plchan)
{
const struct pl08x_platform_data *pd = plchan->host->pd;
- if (plchan->phychan->signal >= 0 && pd->put_signal) {
- pd->put_signal(plchan->cd, plchan->phychan->signal);
- plchan->phychan->signal = -1;
+ if (plchan->signal >= 0 && pd->put_signal) {
+ pd->put_signal(plchan->cd, plchan->signal);
+ plchan->signal = -1;
}
}
@@ -545,7 +544,6 @@ pl08x_get_phy_channel(struct pl08x_driver_data *pl08x,
if (!ch->serving) {
ch->serving = virt_chan;
- ch->signal = -1;
spin_unlock_irqrestore(&ch->lock, flags);
break;
}
@@ -1029,7 +1027,7 @@ static int prep_phy_channel(struct pl08x_dma_chan *plchan,
* Can the platform allow us to use this channel?
*/
if (plchan->slave) {
- ret = pl08x_request_mux(plchan, ch);
+ ret = pl08x_request_mux(plchan);
if (ret < 0) {
dev_dbg(&pl08x->adev->dev,
"unable to use physical channel %d for transfer on %s due to platform restrictions\n",
@@ -1043,15 +1041,15 @@ static int prep_phy_channel(struct pl08x_dma_chan *plchan,
plchan->phychan = ch;
dev_dbg(&pl08x->adev->dev, "allocated physical channel %d and signal %d for xfer on %s\n",
ch->id,
- ch->signal,
+ plchan->signal,
plchan->name);
got_channel:
/* Assign the flow control signal to this channel */
if (txd->direction == DMA_MEM_TO_DEV)
- txd->ccfg |= ch->signal << PL080_CONFIG_DST_SEL_SHIFT;
+ txd->ccfg |= plchan->signal << PL080_CONFIG_DST_SEL_SHIFT;
else if (txd->direction == DMA_DEV_TO_MEM)
- txd->ccfg |= ch->signal << PL080_CONFIG_SRC_SEL_SHIFT;
+ txd->ccfg |= plchan->signal << PL080_CONFIG_SRC_SEL_SHIFT;
plchan->phychan_hold++;
@@ -1818,6 +1816,7 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x,
chan->host = pl08x;
chan->state = PL08X_CHAN_IDLE;
+ chan->signal = -1;
if (slave) {
chan->cd = &pl08x->pd->slave_channels[i];
@@ -2054,7 +2053,6 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
ch->base = pl08x->base + PL080_Cx_BASE(i);
spin_lock_init(&ch->lock);
ch->serving = NULL;
- ch->signal = -1;
dev_dbg(&adev->dev, "physical channel %d is %s\n",
i, pl08x_phy_channel_busy(ch) ? "BUSY" : "FREE");
}
--
1.7.4.4
next prev parent reply other threads:[~2012-05-29 9:41 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 9:30 [RFC 00/34] PL08x DMA conversion to virt-dma Russell King - ARM Linux
2012-05-29 9:35 ` [RFC 01/34] dmaengine: split out virtual channel DMA support from sa11x0 driver Russell King
2012-05-29 9:35 ` [RFC 02/34] dmaengine: virt-dma: vchan_find_desc() Russell King
2012-05-30 7:48 ` Linus Walleij
2012-05-29 9:36 ` [RFC 03/34] dmaengine: virt-dma: add support for cyclic DMA periodic callbacks Russell King
2012-05-30 7:52 ` Linus Walleij
2012-05-30 8:02 ` Russell King - ARM Linux
2012-05-31 1:29 ` Linus Walleij
2012-05-31 3:45 ` zhangfei gao
2012-05-31 19:17 ` Russell King - ARM Linux
2012-06-01 2:26 ` zhangfei gao
2012-06-01 10:39 ` Russell King - ARM Linux
2012-05-29 9:36 ` [RFC 04/34] dmaengine: PL08x: remove runtime PM support Russell King
2012-05-31 0:46 ` Linus Walleij
2012-06-01 10:45 ` Russell King - ARM Linux
2012-05-29 9:36 ` [RFC 05/34] dmaengine: PL08x: fix missed dma_transfer_direction fixup Russell King
2012-05-31 0:47 ` Linus Walleij
2012-06-01 10:47 ` Russell King - ARM Linux
2012-05-29 9:37 ` [RFC 06/34] dmaengine: PL08x: remove redundant spinlock Russell King
2012-05-31 0:48 ` Linus Walleij
2012-05-29 9:37 ` [RFC 07/34] dmaengine: PL08x: remove circular_buffer boolean from channel data Russell King
2012-05-31 0:49 ` Linus Walleij
2012-05-29 9:37 ` [RFC 08/34] dmaengine: PL08x: clean up get_signal/put_signal Russell King
2012-05-31 0:53 ` Linus Walleij
2012-06-01 10:48 ` Russell King - ARM Linux
2012-05-29 9:38 ` [RFC 09/34] dmaengine: PL08x: move private data structures into amba-pl08x.c Russell King
2012-05-31 0:54 ` Linus Walleij
2012-05-29 9:38 ` [RFC 10/34] dmaengine: PL08x: constify channel names and bus_id strings Russell King
2012-05-31 0:55 ` Linus Walleij
2012-05-29 9:38 ` [RFC 11/34] dmaengine: PL08x: get src/dst addr direct from dma_slave_config struct Russell King
2012-05-31 0:56 ` Linus Walleij
2012-05-29 9:39 ` [RFC 12/34] dmaengine: PL08x: get rid of device_fc in struct pl08x_dma_chan Russell King
2012-05-31 0:57 ` Linus Walleij
2012-05-29 9:39 ` [RFC 13/34] dmaengine: PL08x: move the bus and increment selection to dma prepare function Russell King
2012-05-31 0:57 ` Linus Walleij
2012-05-29 9:39 ` [RFC 14/34] dmaengine: PL08x: extract function to to generate cctl values Russell King
2012-05-31 1:00 ` Linus Walleij
2012-05-29 9:40 ` [RFC 15/34] dmaengine: PL08x: ignore 'direction' argument in dma_slave_config Russell King
2012-05-31 1:01 ` Linus Walleij
2012-05-29 9:40 ` [RFC 16/34] dmaengine: PL08x: get rid of unnecessary checks " Russell King
2012-05-31 1:02 ` Linus Walleij
2012-05-29 9:40 ` [RFC 17/34] dmaengine: PL08x: split DMA signal muxing from channel alloc Russell King
2012-05-31 1:03 ` Linus Walleij
2012-05-29 9:41 ` Russell King [this message]
2012-05-31 1:03 ` [RFC 18/34] dmaengine: PL08x: move DMA signal muxing into pl08x_dma_chan struct Linus Walleij
2012-05-29 9:41 ` [RFC 19/34] dmaengine: PL08x: track mux usage on a per-channel basis Russell King
2012-05-31 1:04 ` Linus Walleij
2012-05-29 9:42 ` [RFC 20/34] dmaengine: PL08x: convert to a list of completed descriptors Russell King
2012-05-31 1:04 ` Linus Walleij
2012-05-29 9:42 ` [RFC 21/34] dmaengine: PL08x: move DMA signal muxing into slave prepare code Russell King
2012-05-31 1:11 ` Linus Walleij
2012-05-29 9:42 ` [RFC 22/34] dmaengine: PL08x: remove waiting descriptor pointer Russell King
2012-05-31 1:11 ` Linus Walleij
2012-05-29 9:43 ` [RFC 23/34] dmaengine: PL08x: re-jig the starting of txds Russell King
2012-05-31 1:14 ` Linus Walleij
2012-06-01 10:52 ` Russell King - ARM Linux
2012-06-04 15:54 ` Linus Walleij
2012-05-29 9:43 ` [RFC 24/34] dmaengine: PL08x: split the pend_list in two Russell King
2012-05-31 1:20 ` Linus Walleij
2012-05-29 9:43 ` [RFC 25/34] dmaengine: PL08x: start next descriptor from irq context Russell King
2012-05-31 1:21 ` Linus Walleij
2012-05-29 9:44 ` [RFC 26/34] dmaengine: PL08x: rejig physical channel allocation Russell King
2012-05-31 1:23 ` Linus Walleij
2012-05-29 9:44 ` [RFC 27/34] dmaengine: PL08x: convert to use virt-dma structs Russell King
2012-05-31 1:23 ` Linus Walleij
2012-05-29 9:44 ` [RFC 28/34] dmaengine: PL08x: use vchan's spinlock Russell King
2012-05-31 1:24 ` Linus Walleij
2012-05-29 9:45 ` [RFC 29/34] dmaengine: PL08x: convert to use vchan submitted/issued lists Russell King
2012-05-31 1:24 ` Linus Walleij
2012-05-29 9:45 ` [RFC 30/34] dmaengine: PL08x: convert to use vchan done list Russell King
2012-05-31 1:24 ` Linus Walleij
2012-05-29 9:45 ` [RFC 31/34] dmaengine: PL08x: fix tx_status function to return correct residue Russell King
2012-05-31 1:25 ` Linus Walleij
2012-05-29 9:46 ` [RFC 32/34] dmaengine: PL08x: get rid of pl08x_prep_channel_resources Russell King
2012-05-31 1:25 ` Linus Walleij
2012-05-29 9:46 ` [RFC 33/34] dmaengine: PL08x: get rid of write only pool_ctr and free_txd locking Russell King
2012-05-31 1:26 ` Linus Walleij
2012-05-29 9:46 ` [RFC 34/34] dmaengine: PL08x: ensure all descriptors are freed when channel is released Russell King
2012-05-31 1:27 ` Linus Walleij
2012-06-01 10:55 ` Russell King - ARM Linux
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=E1SZIvX-0006zu-R9@rmk-PC.arm.linux.org.uk \
--to=rmk+kernel@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.