diff mbox

[1/3] dma: pl08x: support fixed signal assignment

Message ID 1444127233-636-1-git-send-email-linus.walleij@linaro.org (mailing list archive)
State Changes Requested
Headers show

Commit Message

Linus Walleij Oct. 6, 2015, 10:27 a.m. UTC
Some implementations such as the Nomadik do not place a mux
in front of the DMA single/burst request signals into the
PL08x DMA controller, instead they lock a certain signal to
a certain device. This makes things simpler and the platform
does not need to implement a muxing function.

Implement this scheme and flag that the Nomadik uses this
method.

While we're at it, add a missing kerneldoc entry.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Joachim: I think I need your teste-by on this to make sure
the LPC machine survives this patch set.
---
 drivers/dma/amba-pl08x.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
diff mbox

Patch

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 9b42c0588550..dc864846f0a9 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -113,6 +113,11 @@  struct pl08x_driver_data;
  *	missing
  * @pl080s: whether this version is a PL080S, which has separate register and
  *	LLI word for transfer size.
+ * @fixed_signals: if the channel signal allocation on the PL08x is fixed,
+ *	i.e. each device burst/single control signals are connected directly
+ *	to the DMAC signal lines without any mux.
+ * @max_transfer_size: the maximum single element transfer size for this
+ *	PL08x variant.
  */
 struct vendor_data {
 	u8 config_offset;
@@ -120,6 +125,7 @@  struct vendor_data {
 	bool dualmaster;
 	bool nomadik;
 	bool pl080s;
+	bool fixed_signals;
 	u32 max_transfer_size;
 };
 
@@ -319,6 +325,15 @@  static int pl08x_request_mux(struct pl08x_dma_chan *plchan)
 	const struct pl08x_platform_data *pd = plchan->host->pd;
 	int ret;
 
+	/*
+	 * For engines with fixed signal assignment for slave transfers,
+	 * this signal is assigned during probe.
+	 */
+	if (plchan->host->vd->fixed_signals) {
+		BUG_ON(plchan->signal < 0);
+		return 0;
+	}
+
 	if (plchan->mux_use++ == 0 && pd->get_xfer_signal) {
 		ret = pd->get_xfer_signal(plchan->cd);
 		if (ret < 0) {
@@ -335,6 +350,9 @@  static void pl08x_release_mux(struct pl08x_dma_chan *plchan)
 {
 	const struct pl08x_platform_data *pd = plchan->host->pd;
 
+	if (plchan->host->vd->fixed_signals)
+		return;
+
 	if (plchan->signal >= 0) {
 		WARN_ON(plchan->mux_use == 0);
 
@@ -1909,6 +1927,18 @@  static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x,
 
 		if (slave) {
 			chan->cd = &pl08x->pd->slave_channels[i];
+			/*
+			 * Some implementations have muxed signals, whereas some
+			 * use a mux in front of the signals and need dynamic
+			 * assignment of signals.
+			 */
+			if (pl08x->vd->fixed_signals) {
+				chan->signal = i;
+				chan->name = chan->cd->bus_id;
+				dev_dbg(&pl08x->adev->dev,
+					"assign fixed signal %u to channel %s",
+					chan->signal, chan->name);
+			}
 			pl08x_dma_slave_init(chan);
 		} else {
 			chan->cd = &pl08x->pd->memcpy_channel;
@@ -2447,6 +2477,7 @@  static struct vendor_data vendor_nomadik = {
 	.channels = 8,
 	.dualmaster = true,
 	.nomadik = true,
+	.fixed_signals = true,
 	.max_transfer_size = PL080_CONTROL_TRANSFER_SIZE_MASK,
 };