linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: fabio.baltieri@linaro.org (Fabio Baltieri)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/16] dmaengine: ste_dma40: physical channels number correction
Date: Mon,  7 Jan 2013 12:21:50 +0100	[thread overview]
Message-ID: <1357557718-15676-9-git-send-email-fabio.baltieri@linaro.org> (raw)
In-Reply-To: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org>

From: Gerald Baeza <gerald.baeza@stericsson.com>

DMAC_ICFG[0:2]=SCHNB only allows to count 'multiple of 4' physical
channels so it was ok with platforms having 8 channels but cannot be
used for next versions (with 10 or 14 channels).  This patch allows to
provide the number of physical channels for a DMA device via
platform_data, or still rely on SCHNB if platform_data announces 0
channel.

Signed-off-by: Gerald Baeza <gerald.baeza@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
---
 drivers/dma/ste_dma40.c                     | 15 ++++++++++-----
 include/linux/platform_data/dma-ste-dma40.h |  4 ++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 5feab7db9..ca18117 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3004,14 +3004,21 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	 * ? has revision 1
 	 * DB8500v1 has revision 2
 	 * DB8500v2 has revision 3
+	 * AP9540v1 has revision 4
+	 * DB8540v1 has revision 4
 	 */
 	rev = AMBA_REV_BITS(pid);
 
+	plat_data = pdev->dev.platform_data;
+
 	/* The number of physical channels on this HW */
-	num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4;
+	if (plat_data->num_of_phy_chans)
+		num_phy_chans = plat_data->num_of_phy_chans;
+	else
+		num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4;
 
-	dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n",
-		 rev, res->start);
+	dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n",
+		 rev, res->start, num_phy_chans);
 
 	if (rev < 2) {
 		d40_err(&pdev->dev, "hardware revision: %d is not supported",
@@ -3019,8 +3026,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 		goto failure;
 	}
 
-	plat_data = pdev->dev.platform_data;
-
 	/* Count the number of logical channels in use */
 	for (i = 0; i < plat_data->dev_len; i++)
 		if (plat_data->dev_rx[i] != 0)
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
index 9ff93b0..833cb95 100644
--- a/include/linux/platform_data/dma-ste-dma40.h
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -147,6 +147,9 @@ struct stedma40_chan_cfg {
  * @memcpy_conf_log: default configuration of logical channel memcpy
  * @disabled_channels: A vector, ending with -1, that marks physical channels
  * that are for different reasons not available for the driver.
+ * @num_of_phy_chans: The number of physical channels implemented in HW.
+ * 0 means reading the number of channels from DMA HW but this is only valid
+ * for 'multiple of 4' channels, like 8.
  */
 struct stedma40_platform_data {
 	u32				 dev_len;
@@ -158,6 +161,7 @@ struct stedma40_platform_data {
 	struct stedma40_chan_cfg	*memcpy_conf_log;
 	int				 disabled_channels[STEDMA40_MAX_PHYS];
 	bool				 use_esram_lcla;
+	int				 num_of_phy_chans;
 };
 
 #ifdef CONFIG_STE_DMA40
-- 
1.7.12.1

  parent reply	other threads:[~2013-01-07 11:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 11:21 [PATCH v2 00/16] various fixes and updates for ste_dma40 Fabio Baltieri
2013-01-07 11:21 ` [PATCH 01/16] dmaengine: ste_dma40: reset priority bit for logical channels Fabio Baltieri
2013-01-07 11:21 ` [PATCH 02/16] dmaengine: ste_dma40: use writel_relaxed for lcxa Fabio Baltieri
2013-01-07 11:21 ` [PATCH 03/16] dmaengine: ste_dma40: set dma max seg size Fabio Baltieri
2013-01-07 11:21 ` [PATCH 04/16] dmaengine: ste_dma40: limit burst size to 16 Fabio Baltieri
2013-01-07 11:21 ` [PATCH 05/16] dmaengine: ste_dma40: don't check for pm_runtime_suspended() Fabio Baltieri
2013-01-07 11:21 ` [PATCH 06/16] dmaengine: ste_dma40: don't allow high priority dest event lines Fabio Baltieri
2013-01-07 11:21 ` [PATCH 07/16] dmaengine: ste_dma40: support fixed physical channel allocation Fabio Baltieri
2013-01-07 11:21 ` Fabio Baltieri [this message]
2013-01-07 11:21 ` [PATCH 09/16] dmaengine: ste_dma40: support more than 128 event lines Fabio Baltieri
2013-01-07 11:21 ` [PATCH 10/16] dmaengine: ste_dma40: add a done queue for completed descriptors Fabio Baltieri
2013-01-07 11:21 ` [PATCH 11/16] dmaengine: ste_dma40: add missing kernel-doc entry Fabio Baltieri
2013-01-07 11:21 ` [PATCH 12/16] dmaengine: ste_dma40: minor cosmetic fixes Fabio Baltieri
2013-01-07 11:21 ` [PATCH 13/16] dmaengine: ste_dma40: minor code readability fixes Fabio Baltieri
2013-01-07 11:21 ` [PATCH 14/16] dmaengine: ste_dma40: add software lli support Fabio Baltieri
2013-01-07 11:21 ` [PATCH 15/16] dmaengine: set_dma40: ignore spurious interrupts Fabio Baltieri
2013-01-07 11:21 ` [PATCH 16/16] dmaengine: set_dma40: balance clock in probe fail code Fabio Baltieri
2013-01-07 14:33 ` [PATCH v2 00/16] various fixes and updates for ste_dma40 Vinod Koul
2013-01-07 16:59   ` Fabio Baltieri

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=1357557718-15676-9-git-send-email-fabio.baltieri@linaro.org \
    --to=fabio.baltieri@linaro.org \
    --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 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).