linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Viresh Kumar <viresh.linux@gmail.com>,
	Vinod Koul <vinod.koul@intel.com>,
	linux-kernel@vger.kernel.org,
	spear-devel <spear-devel@list.st.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH] dw_dmac: adjust slave_id accordingly to request line base
Date: Mon, 28 Jan 2013 13:04:20 +0200	[thread overview]
Message-ID: <1359371060-9044-1-git-send-email-andriy.shevchenko@linux.intel.com> (raw)

On some hardware configurations we have got the request line with the offset.
The patch introduces convert_slave_id() helper for that cases. The request line
base is got from the platform device resources provided by the IORESOURCE_DMA
type.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c      |   13 +++++++++++++
 drivers/dma/dw_dmac_regs.h |    1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 3155c11..8484ca1 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -995,6 +995,13 @@ static inline void convert_burst(u32 *maxburst)
 		*maxburst = 0;
 }
 
+static inline void convert_slave_id(struct dw_dma_chan *dwc)
+{
+	struct dw_dma *dw = to_dw_dma(dwc->chan.device);
+
+	dwc->dma_sconfig.slave_id -= dw->request_line_base;
+}
+
 static int
 set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
 {
@@ -1009,6 +1016,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
 
 	convert_burst(&dwc->dma_sconfig.src_maxburst);
 	convert_burst(&dwc->dma_sconfig.dst_maxburst);
+	convert_slave_id(dwc);
 
 	return 0;
 }
@@ -1717,6 +1725,11 @@ static int dw_probe(struct platform_device *pdev)
 		memcpy(dw->data_width, pdata->data_width, 4);
 	}
 
+	/* Get the base request line if set */
+	io = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+	if (io)
+		dw->request_line_base = (unsigned int)io->start;
+
 	/* Calculate all channel mask before DMA setup */
 	dw->all_chan_mask = (1 << nr_channels) - 1;
 
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 88dd8eb..3eeb766 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -248,6 +248,7 @@ struct dw_dma {
 	/* hardware configuration */
 	unsigned char		nr_masters;
 	unsigned char		data_width[4];
+	unsigned int		request_line_base;
 
 	struct dw_dma_chan	chan[0];
 };
-- 
1.7.10.4


             reply	other threads:[~2013-01-28 11:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 11:04 Andy Shevchenko [this message]
2013-01-29  4:59 ` [PATCH] dw_dmac: adjust slave_id accordingly to request line base Viresh Kumar
2013-01-29  5:22   ` Mika Westerberg
2013-01-29 15:27     ` Viresh Kumar
2013-01-30  7:32       ` Andy Shevchenko
2013-01-30  8:01         ` Viresh Kumar
2013-01-30  8:07           ` Andy Shevchenko
2013-02-07 13:22             ` Shevchenko, Andriy
2013-02-12 15:56         ` Vinod Koul
2013-02-12 16:34           ` Andy Shevchenko
2013-02-12 15:53   ` Vinod Koul
2013-02-12 16:43     ` Mika Westerberg
2013-02-12 17:34       ` Vinod Koul
2013-02-12 19:02         ` Mika Westerberg
2013-02-14  9:57           ` Vinod Koul
2013-02-14 10:17             ` Mika Westerberg
2013-02-07 13:28 ` Viresh Kumar
2013-02-19  9:02 ` Andy Shevchenko
2013-02-19 22:17   ` Rafael J. Wysocki
2013-02-20  6:04   ` Vinod Koul

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=1359371060-9044-1-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=spear-devel@list.st.com \
    --cc=vinod.koul@intel.com \
    --cc=viresh.linux@gmail.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;
as well as URLs for NNTP newsgroup(s).