All of lore.kernel.org
 help / color / mirror / Atom feed
From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/29] arm: plat-orion: convert the registration of the xor0 engine to the single driver
Date: Thu, 15 Nov 2012 18:20:10 +0100	[thread overview]
Message-ID: <1353000034-30567-6-git-send-email-thomas.petazzoni@free-electrons.com> (raw)
In-Reply-To: <1353000034-30567-1-git-send-email-thomas.petazzoni@free-electrons.com>

Instead of registering one 'mv_xor_shared' device for the XOR engine,
and then two 'mv_xor' devices for the XOR channels, pass the channels
properties as platform_data for the main 'mv_xor_shared' device.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/plat-orion/common.c |   94 +++++++++++++++++++-----------------------
 1 file changed, 42 insertions(+), 52 deletions(-)

diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index b8a688c..800af19 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -636,61 +636,43 @@ static struct resource orion_xor0_shared_resources[] = {
 	}, {
 		.name	= "xor 0 high",
 		.flags	= IORESOURCE_MEM,
+	}, {
+		.name   = "irq channel 0",
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "irq channel 1",
+		.flags  = IORESOURCE_IRQ,
 	},
 };
 
-static struct platform_device orion_xor0_shared = {
-	.name		= MV_XOR_SHARED_NAME,
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(orion_xor0_shared_resources),
-	.resource	= orion_xor0_shared_resources,
-};
-
-static struct resource orion_xor00_resources[] = {
-	[0] = {
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct mv_xor_platform_data orion_xor00_data = {
-	.shared		= &orion_xor0_shared,
-	.hw_id		= 0,
-	.pool_size	= PAGE_SIZE,
-};
+static struct platform_device orion_xor0_shared;
 
-static struct platform_device orion_xor00_channel = {
-	.name		= MV_XOR_NAME,
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(orion_xor00_resources),
-	.resource	= orion_xor00_resources,
-	.dev		= {
-		.dma_mask		= &orion_xor_dmamask,
-		.coherent_dma_mask	= DMA_BIT_MASK(64),
-		.platform_data		= &orion_xor00_data,
+static struct mv_xor_platform_data orion_xor0_channels_pdata[2] = {
+	{
+		.shared		= &orion_xor0_shared,
+		.hw_id		= 0,
+		.pool_size	= PAGE_SIZE,
 	},
-};
-
-static struct resource orion_xor01_resources[] = {
-	[0] = {
-		.flags	= IORESOURCE_IRQ,
+	{
+		.shared		= &orion_xor0_shared,
+		.hw_id		= 1,
+		.pool_size	= PAGE_SIZE,
 	},
 };
 
-static struct mv_xor_platform_data orion_xor01_data = {
-	.shared		= &orion_xor0_shared,
-	.hw_id		= 1,
-	.pool_size	= PAGE_SIZE,
+static struct mv_xor_shared_platform_data orion_xor0_pdata = {
+	.channels = orion_xor0_channels_pdata,
 };
 
-static struct platform_device orion_xor01_channel = {
-	.name		= MV_XOR_NAME,
-	.id		= 1,
-	.num_resources	= ARRAY_SIZE(orion_xor01_resources),
-	.resource	= orion_xor01_resources,
-	.dev		= {
-		.dma_mask		= &orion_xor_dmamask,
-		.coherent_dma_mask	= DMA_BIT_MASK(64),
-		.platform_data		= &orion_xor01_data,
+static struct platform_device orion_xor0_shared = {
+	.name		= MV_XOR_SHARED_NAME,
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(orion_xor0_shared_resources),
+	.resource	= orion_xor0_shared_resources,
+	.dev            = {
+		.dma_mask               = &orion_xor_dmamask,
+		.coherent_dma_mask      = DMA_BIT_MASK(64),
+		.platform_data          = &orion_xor0_pdata,
 	},
 };
 
@@ -704,15 +686,23 @@ void __init orion_xor0_init(unsigned long mapbase_low,
 	orion_xor0_shared_resources[1].start = mapbase_high;
 	orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
 
-	orion_xor00_resources[0].start = irq_0;
-	orion_xor00_resources[0].end = irq_0;
-	orion_xor01_resources[0].start = irq_1;
-	orion_xor01_resources[0].end = irq_1;
+	orion_xor0_shared_resources[2].start = irq_0;
+	orion_xor0_shared_resources[2].end = irq_0;
+	orion_xor0_shared_resources[3].start = irq_1;
+	orion_xor0_shared_resources[3].end = irq_1;
 
-	platform_device_register(&orion_xor0_shared);
+	/*
+	 * two engines can't do memset simultaneously, this limitation
+	 * satisfied by removing memset support from one of the engines.
+	 */
+	dma_cap_set(DMA_MEMCPY, orion_xor0_channels_pdata[0].cap_mask);
+	dma_cap_set(DMA_XOR, orion_xor0_channels_pdata[0].cap_mask);
 
-	orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel,
-				&orion_xor01_data, &orion_xor01_channel);
+	dma_cap_set(DMA_MEMSET, orion_xor0_channels_pdata[1].cap_mask);
+	dma_cap_set(DMA_MEMCPY, orion_xor0_channels_pdata[1].cap_mask);
+	dma_cap_set(DMA_XOR, orion_xor0_channels_pdata[1].cap_mask);
+
+	platform_device_register(&orion_xor0_shared);
 }
 
 /*****************************************************************************
-- 
1.7.9.5

  parent reply	other threads:[~2012-11-15 17:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 17:20 [PATCH] Device Tree binding for the 'mv_xor' XOR engine DMA driver Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 01/29] mv_xor: use dev_(err|info|notice) instead of dev_printk Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 02/29] mv_xor: do not use pool_size from platform_data within the driver Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 03/29] mv_xor: split initialization/cleanup of XOR channels Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 04/29] mv_xor: allow channels to be registered directly from the main device Thomas Petazzoni
2012-11-15 17:20 ` Thomas Petazzoni [this message]
2012-11-15 17:20 ` [PATCH 06/29] arm: plat-orion: convert the registration of the xor1 engine to the single driver Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 07/29] arm: plat-orion: remove unused orion_xor_init_channels() Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 08/29] mv_xor: remove sub-driver 'mv_xor' Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 09/29] mv_xor: remove 'shared' from mv_xor_platform_data Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 10/29] mv_xor: rename mv_xor_platform_data to mv_xor_channel_data Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 11/29] mv_xor: rename mv_xor_shared_platform_data to mv_xor_platform_data Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 12/29] mv_xor: change the driver name to 'mv_xor' Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 13/29] mv_xor: rename many symbols to remove the 'shared' word Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 14/29] mv_xor: remove unused id field in mv_xor_device structure Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 15/29] mv_xor: remove unused to_mv_xor_device() macro Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 16/29] mv_xor: simplify dma_sync_single_for_cpu() calls Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 17/29] mv_xor: introduce a mv_chan_to_devp() helper Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 18/29] mv_xor: get rid of the pdev pointer in mv_xor_device Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 19/29] mv_xor: in mv_xor_chan, rename 'common' to 'dmachan' Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 20/29] mv_xor: in mv_xor_device, rename 'common' to 'dmadev' Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 21/29] mv_xor: use mv_xor_chan pointers as arguments to self-test functions Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 22/29] mv_xor: merge mv_xor_device and mv_xor_chan Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 23/29] mv_xor: rename mv_xor_private to mv_xor_device Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 24/29] mv_xor: remove useless backpointer from mv_xor_chan " Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 25/29] mv_xor: remove hw_id field from platform_data Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 26/29] mv_xor: remove the pool_size " Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 27/29] mv_xor: add missing free_irq() call Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 28/29] mv_xor: add Device Tree binding Thomas Petazzoni
2012-11-15 17:20   ` Thomas Petazzoni
2012-11-15 17:20 ` [PATCH 29/29] arm: mvebu: add XOR engines to Armada 370/XP .dtsi Thomas Petazzoni
2012-11-18 10:36 ` [PATCH] Device Tree binding for the 'mv_xor' XOR engine DMA driver Andrew Lunn
2012-11-18 10:50   ` Thomas Petazzoni
2012-11-18 10:57     ` Andrew Lunn
2012-11-18 12:16   ` Lior Amsalem
2012-11-19  6:40     ` Andrew Lunn
2012-11-19 11:40       ` Lior Amsalem

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=1353000034-30567-6-git-send-email-thomas.petazzoni@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.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 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.