linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 01/11] dma: amba-pl08x: Use bitmap to pass variant specific quirks
Date: Sun, 16 Jun 2013 22:54:08 +0200	[thread overview]
Message-ID: <1371416058-22047-2-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1371416058-22047-1-git-send-email-tomasz.figa@gmail.com>

Instead of defining new bool field in vendor_data struct for each quirk,
it is more reasonable to use a single flags field and make each quirk
use single bits.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/dma/amba-pl08x.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 8bad254..d443a68 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -93,18 +93,22 @@
 static struct amba_driver pl08x_amba_driver;
 struct pl08x_driver_data;
 
+/** Controller supports dual AHB masters. */
+#define PL08X_IS_DUALMASTER	(1 << 0)
+/**
+ * Controller has Nomadik security extension bits that need to be checked
+ * for permission before use and some registers are missing.
+ */
+#define PL08X_IS_NOMADIK	(1 << 1)
+
 /**
  * struct vendor_data - vendor-specific config parameters for PL08x derivatives
  * @channels: the number of channels available in this variant
- * @dualmaster: whether this version supports dual AHB masters or not.
- * @nomadik: whether the channels have Nomadik security extension bits
- *	that need to be checked for permission before use and some registers are
- *	missing
+ * @flags: Vendor-specific flags, see PL08X_IS_*
  */
 struct vendor_data {
 	u8 channels;
-	bool dualmaster;
-	bool nomadik;
+	u32 flags;
 };
 
 /*
@@ -1391,7 +1395,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
 	/* Both to be incremented or the code will break */
 	txd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR;
 
-	if (pl08x->vd->dualmaster)
+	if (pl08x->vd->flags & PL08X_IS_DUALMASTER)
 		txd->cctl |= pl08x_select_bus(pl08x->mem_buses,
 					      pl08x->mem_buses);
 
@@ -1612,7 +1616,7 @@ bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
 static void pl08x_ensure_on(struct pl08x_driver_data *pl08x)
 {
 	/* The Nomadik variant does not have the config register */
-	if (pl08x->vd->nomadik)
+	if (pl08x->vd->flags & PL08X_IS_NOMADIK)
 		return;
 	writel(PL080_CONFIG_ENABLE, pl08x->base + PL080_CONFIG);
 }
@@ -1897,7 +1901,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 	/* By default, AHB1 only.  If dualmaster, from platform */
 	pl08x->lli_buses = PL08X_AHB1;
 	pl08x->mem_buses = PL08X_AHB1;
-	if (pl08x->vd->dualmaster) {
+	if (pl08x->vd->flags & PL08X_IS_DUALMASTER) {
 		pl08x->lli_buses = pl08x->pd->lli_buses;
 		pl08x->mem_buses = pl08x->pd->mem_buses;
 	}
@@ -1954,7 +1958,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 		 * down for the secure world only. Lock up these channels
 		 * by perpetually serving a dummy virtual channel.
 		 */
-		if (vd->nomadik) {
+		if (vd->flags & PL08X_IS_NOMADIK) {
 			u32 val;
 
 			val = readl(ch->base + PL080_CH_CONFIG);
@@ -2039,18 +2043,17 @@ out_no_pl08x:
 /* PL080 has 8 channels and the PL080 have just 2 */
 static struct vendor_data vendor_pl080 = {
 	.channels = 8,
-	.dualmaster = true,
+	.flags = PL08X_IS_DUALMASTER,
 };
 
 static struct vendor_data vendor_nomadik = {
 	.channels = 8,
-	.dualmaster = true,
-	.nomadik = true,
+	.flags = PL08X_IS_DUALMASTER | PL08X_IS_NOMADIK,
 };
 
 static struct vendor_data vendor_pl081 = {
 	.channels = 2,
-	.dualmaster = false,
+	.flags = 0,
 };
 
 static struct amba_id pl08x_ids[] = {
-- 
1.8.2.1

  reply	other threads:[~2013-06-16 20:54 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 20:54 [RFC PATCH 00/11] ARM: s3c64xx: Let amba-pl08x driver handle DMA Tomasz Figa
2013-06-16 20:54 ` Tomasz Figa [this message]
2013-06-17 13:25   ` [RFC PATCH 01/11] dma: amba-pl08x: Use bitmap to pass variant specific quirks Linus Walleij
2013-06-17 18:48   ` Russell King - ARM Linux
2013-06-17 18:56     ` Tomasz Figa
2013-06-18  7:47       ` Linus Walleij
2013-06-18 13:33         ` Arnd Bergmann
2013-06-16 20:54 ` [RFC PATCH 02/11] dma: amba-pl08x: Refactor pl08x_getbytes_chan() to lower indentation Tomasz Figa
2013-06-17 13:29   ` Linus Walleij
2013-06-16 20:54 ` [RFC PATCH 03/11] dma: amba-pl08x: Add support for different offset of CONFIG register Tomasz Figa
2013-06-17 13:31   ` Linus Walleij
2013-06-17 18:52   ` Russell King - ARM Linux
2013-06-17 19:02     ` Tomasz Figa
2013-06-16 20:54 ` [RFC PATCH 04/11] dma: amba-pl08x: Add support for PL080S variant Tomasz Figa
2013-06-17 13:39   ` Linus Walleij
2013-06-17 18:22     ` Tomasz Figa
2013-06-16 20:54 ` [RFC PATCH 05/11] dma: amba-pl08x: Add support for different maximum transfer size Tomasz Figa
2013-06-17 13:42   ` Linus Walleij
2013-06-17 18:27     ` Tomasz Figa
2013-06-16 20:54 ` [RFC PATCH 06/11] dma: amba-pl08x: Keep LLIs aligned to 4-word boundary Tomasz Figa
2013-06-17 13:51   ` Linus Walleij
2013-06-17 18:28     ` Tomasz Figa
2013-06-17 19:01     ` Russell King - ARM Linux
2013-06-16 20:54 ` [RFC PATCH 07/11] dmaengine: PL08x: Fix reading the byte count in cctl Tomasz Figa
2013-06-17 13:53   ` Linus Walleij
2013-06-17 18:32     ` Tomasz Figa
2013-06-17 19:03     ` Russell King - ARM Linux
2013-06-16 20:54 ` [RFC PATCH 08/11] dmaengine: PL08x: Add cyclic transfer support Tomasz Figa
2013-06-17 13:57   ` Linus Walleij
2013-06-17 18:52     ` Tomasz Figa
2013-06-17 18:56   ` Russell King - ARM Linux
2013-06-16 20:54 ` [RFC PATCH 09/11] spi: s3c64xx: Do not require legacy DMA API in case of S3C64XX Tomasz Figa
2013-06-17 13:59   ` Linus Walleij
2013-06-17 16:06     ` Mark Brown
2013-06-17 19:36       ` Tomasz Figa
2013-06-16 20:54 ` [RFC PATCH 10/11] ASoC: samsung: " Tomasz Figa
2013-06-17 14:01   ` Linus Walleij
2013-06-16 20:54 ` [RFC PATCH 11/11] ARM: s3c64xx: Add support for DMA using generic amba-pl08x driver Tomasz Figa
2013-06-17 14:04   ` Linus Walleij
2013-06-19 18:23     ` Tomasz Figa
2013-06-19 19:50       ` Linus Walleij
2013-06-17 14:06 ` [RFC PATCH 00/11] ARM: s3c64xx: Let amba-pl08x driver handle DMA Linus Walleij
2013-06-17 19:38   ` Tomasz Figa
2013-06-19 17:40 ` Mark Brown
2013-06-19 18:26   ` Tomasz Figa
2013-06-19 19:01     ` Arnd Bergmann
2013-06-19 19:24       ` Mark Brown
2013-06-19 19:22     ` Mark Brown
2013-06-19 19:32       ` Tomasz Figa
2013-06-19 22:48         ` Mark Brown
2013-06-20  9:24       ` Phil Carmody
2013-06-20 10:35         ` Mark Brown
2013-06-20 11:14           ` Phil Carmody
2013-06-21  9:47             ` Mark Brown

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=1371416058-22047-2-git-send-email-tomasz.figa@gmail.com \
    --to=tomasz.figa@gmail.com \
    --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).