All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add device tree probe for imx-sdma driver
@ 2011-07-14 16:14 ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	patches-QSEj5FYQhm4dnm+yROfE0A

The first patch remove the use of software defined sdma version, and
instead uses platform_device_id to handle the sdma differences from
one soc to another.  And the second one adds the actual device tree
probe support.

Shawn Guo (2):
      dmaengine: imx-sdma: use platform_device_id to identify sdma version
      dmaengine: imx-sdma: add device tree probe support

 .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++
 arch/arm/mach-imx/clock-imx25.c                    |    3 +-
 arch/arm/mach-imx/clock-imx31.c                    |    2 +-
 arch/arm/mach-imx/clock-imx35.c                    |    2 +-
 arch/arm/mach-imx/mm-imx25.c                       |    4 +-
 arch/arm/mach-imx/mm-imx31.c                       |    3 +-
 arch/arm/mach-imx/mm-imx35.c                       |    3 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c                |    6 +-
 arch/arm/mach-mx5/mm.c                             |    8 +-
 arch/arm/plat-mxc/devices/platform-imx-dma.c       |    4 +-
 arch/arm/plat-mxc/include/mach/devices-common.h    |    2 +-
 arch/arm/plat-mxc/include/mach/dma.h               |    3 +-
 arch/arm/plat-mxc/include/mach/sdma.h              |    2 -
 drivers/dma/imx-sdma.c                             |   68 ++++++++++++++++----
 14 files changed, 131 insertions(+), 34 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/2] Add device tree probe for imx-sdma driver
@ 2011-07-14 16:14 ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

The first patch remove the use of software defined sdma version, and
instead uses platform_device_id to handle the sdma differences from
one soc to another.  And the second one adds the actual device tree
probe support.

Shawn Guo (2):
      dmaengine: imx-sdma: use platform_device_id to identify sdma version
      dmaengine: imx-sdma: add device tree probe support

 .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++
 arch/arm/mach-imx/clock-imx25.c                    |    3 +-
 arch/arm/mach-imx/clock-imx31.c                    |    2 +-
 arch/arm/mach-imx/clock-imx35.c                    |    2 +-
 arch/arm/mach-imx/mm-imx25.c                       |    4 +-
 arch/arm/mach-imx/mm-imx31.c                       |    3 +-
 arch/arm/mach-imx/mm-imx35.c                       |    3 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c                |    6 +-
 arch/arm/mach-mx5/mm.c                             |    8 +-
 arch/arm/plat-mxc/devices/platform-imx-dma.c       |    4 +-
 arch/arm/plat-mxc/include/mach/devices-common.h    |    2 +-
 arch/arm/plat-mxc/include/mach/dma.h               |    3 +-
 arch/arm/plat-mxc/include/mach/sdma.h              |    2 -
 drivers/dma/imx-sdma.c                             |   68 ++++++++++++++++----
 14 files changed, 131 insertions(+), 34 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
  2011-07-14 16:14 ` Shawn Guo
@ 2011-07-14 16:14     ` Shawn Guo
  -1 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Sascha Hauer, patches-QSEj5FYQhm4dnm+yROfE0A

It might be not good to use software defined version to identify sdma
device type, when hardware does not define such version.  Instead,
soc name is stable enough to define the device type.

The patch uses platform_device_id rather than version number passed
by platform data to identify sdma device type/version.

Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 arch/arm/mach-imx/clock-imx25.c                 |    3 +-
 arch/arm/mach-imx/clock-imx31.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-imx/mm-imx25.c                    |    4 +-
 arch/arm/mach-imx/mm-imx31.c                    |    3 +-
 arch/arm/mach-imx/mm-imx35.c                    |    3 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    6 ++-
 arch/arm/mach-mx5/mm.c                          |    8 ++--
 arch/arm/plat-mxc/devices/platform-imx-dma.c    |    4 +-
 arch/arm/plat-mxc/include/mach/devices-common.h |    2 +-
 arch/arm/plat-mxc/include/mach/dma.h            |    3 +-
 arch/arm/plat-mxc/include/mach/sdma.h           |    2 -
 drivers/dma/imx-sdma.c                          |   39 +++++++++++++++++------
 13 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
index 17d6d1b..5736e04 100644
--- a/arch/arm/mach-imx/clock-imx25.c
+++ b/arch/arm/mach-imx/clock-imx25.c
@@ -308,7 +308,8 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
 	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
 	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx25 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 };
 
 int __init mx25_clocks_init(void)
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
index 8d212a9..d973770 100644
--- a/arch/arm/mach-imx/clock-imx31.c
+++ b/arch/arm/mach-imx/clock-imx31.c
@@ -565,7 +565,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
 	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
 	_REGISTER_CLOCK(NULL, "rng", rng_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1)
+	_REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
 	_REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
 	_REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
 	_REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index 2d0b4c8..749acff 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -481,7 +481,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
 	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
 	_REGISTER_CLOCK(NULL, "scc", scc_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK(NULL, "spba", spba_clk)
 	_REGISTER_CLOCK(NULL, "spdif", spdif_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 8bf0291..cc4d152 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -79,7 +79,6 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx25_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx25.bin",
 	.script_addrs = &imx25_sdma_script,
 };
@@ -92,5 +91,6 @@ void __init imx25_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
 	mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
 
-	imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
+	/* i.mx25 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
 }
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
index 61bff38..b7c55e7 100644
--- a/arch/arm/mach-imx/mm-imx31.c
+++ b/arch/arm/mach-imx/mm-imx31.c
@@ -69,7 +69,6 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx31_sdma_pdata __initdata = {
-	.sdma_version = 1,
 	.fw_name = "sdma-imx31-to2.bin",
 	.script_addrs = &imx31_to2_sdma_script,
 };
@@ -88,5 +87,5 @@ void __init imx31_soc_init(void)
 		imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
 	}
 
-	imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
+	imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
 }
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
index 98769ae..f49bac7 100644
--- a/arch/arm/mach-imx/mm-imx35.c
+++ b/arch/arm/mach-imx/mm-imx35.c
@@ -86,7 +86,6 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx35_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx35-to2.bin",
 	.script_addrs = &imx35_to2_sdma_script,
 };
@@ -106,5 +105,5 @@ void __init imx35_soc_init(void)
 		imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
 	}
 
-	imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
+	imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
 }
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 31d904c..0a2fa8e 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1447,7 +1447,8 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx51 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK(NULL, "ckih", ckih_clk)
 	_REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
 	_REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
@@ -1494,7 +1495,8 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
 	_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx53 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index ef8aec9..baea6e5 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -115,7 +115,6 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx51_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx51.bin",
 	.script_addrs = &imx51_sdma_script,
 };
@@ -135,7 +134,6 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx53_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx53.bin",
 	.script_addrs = &imx53_sdma_script,
 };
@@ -148,7 +146,8 @@ void __init imx51_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
 	mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
 
-	imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
+	/* i.mx51 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
 }
 
 void __init imx53_soc_init(void)
@@ -162,5 +161,6 @@ void __init imx53_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
 	mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
 
-	imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
+	/* i.mx53 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
 }
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
index 2b0fdb2..7fa7e9c 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
@@ -14,7 +14,7 @@ struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
 			"imx-dma", -1, NULL, 0, NULL, 0);
 }
 
-struct platform_device __init __maybe_unused *imx_add_imx_sdma(
+struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
 	resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
 {
 	struct resource res[] = {
@@ -29,6 +29,6 @@ struct platform_device __init __maybe_unused *imx_add_imx_sdma(
 		},
 	};
 
-	return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma",
+	return platform_device_register_resndata(&mxc_ahb_bus, name,
 			-1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index c9e7b66..f5cb8d5 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -298,5 +298,5 @@ struct platform_device *__init imx_add_spi_imx(
 		const struct spi_imx_master *pdata);
 
 struct platform_device *imx_add_imx_dma(void);
-struct platform_device *imx_add_imx_sdma(
+struct platform_device *imx_add_imx_sdma(char *name,
 	resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
index ef77515..233d0a5 100644
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
 
 static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
 {
-	return !strcmp(dev_name(chan->device->dev), "imx-sdma") ||
+	return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
+		!strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
 		!strcmp(dev_name(chan->device->dev), "imx-dma");
 }
 
diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
index f495c87..3a39428 100644
--- a/arch/arm/plat-mxc/include/mach/sdma.h
+++ b/arch/arm/plat-mxc/include/mach/sdma.h
@@ -48,12 +48,10 @@ struct sdma_script_start_addrs {
 /**
  * struct sdma_platform_data - platform specific data for SDMA engine
  *
- * @sdma_version	The version of this SDMA engine
  * @fw_name		The firmware name
  * @script_addrs	SDMA scripts addresses in SDMA ROM
  */
 struct sdma_platform_data {
-	int sdma_version;
 	char *fw_name;
 	struct sdma_script_start_addrs *script_addrs;
 };
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1ea47db..4a7aa72 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -65,8 +65,8 @@
 #define SDMA_ONCE_RTB		0x060
 #define SDMA_XTRIG_CONF1	0x070
 #define SDMA_XTRIG_CONF2	0x074
-#define SDMA_CHNENBL0_V2	0x200
-#define SDMA_CHNENBL0_V1	0x080
+#define SDMA_CHNENBL0_IMX35	0x200
+#define SDMA_CHNENBL0_IMX31	0x080
 #define SDMA_CHNPRI_0		0x100
 
 /*
@@ -299,13 +299,18 @@ struct sdma_firmware_header {
 	u32	ram_code_size;
 };
 
+enum sdma_devtype {
+	IMX31_SDMA,	/* runs on i.mx31 */
+	IMX35_SDMA,	/* runs on i.mx35 and later */
+};
+
 struct sdma_engine {
 	struct device			*dev;
 	struct device_dma_parameters	dma_parms;
 	struct sdma_channel		channel[MAX_DMA_CHANNELS];
 	struct sdma_channel_control	*channel_control;
 	void __iomem			*regs;
-	unsigned int			version;
+	enum sdma_devtype		devtype;
 	unsigned int			num_events;
 	struct sdma_context_data	*context;
 	dma_addr_t			context_phys;
@@ -314,6 +319,18 @@ struct sdma_engine {
 	struct sdma_script_start_addrs	*script_addrs;
 };
 
+static struct platform_device_id sdma_devtypes[] = {
+	{
+		.name = "imx31-sdma",
+		.driver_data = IMX31_SDMA,
+	}, {
+		.name = "imx35-sdma",
+		.driver_data = IMX35_SDMA,
+	}, {
+		/* sentinel */
+	}
+};
+
 #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
 #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
 #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
@@ -321,8 +338,8 @@ struct sdma_engine {
 
 static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
 {
-	u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1);
-
+	u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 :
+						      SDMA_CHNENBL0_IMX35);
 	return chnenbl0 + event * 4;
 }
 
@@ -1162,15 +1179,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
 	int i, ret;
 	dma_addr_t ccb_phys;
 
-	switch (sdma->version) {
-	case 1:
+	switch (sdma->devtype) {
+	case IMX31_SDMA:
 		sdma->num_events = 32;
 		break;
-	case 2:
+	case IMX35_SDMA:
 		sdma->num_events = 48;
 		break;
 	default:
-		dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version);
+		dev_err(sdma->dev, "Unknown sdma type %d. aborting\n",
+			sdma->devtype);
 		return -ENODEV;
 	}
 
@@ -1284,7 +1302,7 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (!sdma->script_addrs)
 		goto err_alloc;
 
-	sdma->version = pdata->sdma_version;
+	sdma->devtype = pdev->id_entry->driver_data;
 
 	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
 	dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask);
@@ -1366,6 +1384,7 @@ static struct platform_driver sdma_driver = {
 	.driver		= {
 		.name	= "imx-sdma",
 	},
+	.id_table	= sdma_devtypes,
 	.remove		= __exit_p(sdma_remove),
 };
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
@ 2011-07-14 16:14     ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

It might be not good to use software defined version to identify sdma
device type, when hardware does not define such version.  Instead,
soc name is stable enough to define the device type.

The patch uses platform_device_id rather than version number passed
by platform data to identify sdma device type/version.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/clock-imx25.c                 |    3 +-
 arch/arm/mach-imx/clock-imx31.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-imx/mm-imx25.c                    |    4 +-
 arch/arm/mach-imx/mm-imx31.c                    |    3 +-
 arch/arm/mach-imx/mm-imx35.c                    |    3 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    6 ++-
 arch/arm/mach-mx5/mm.c                          |    8 ++--
 arch/arm/plat-mxc/devices/platform-imx-dma.c    |    4 +-
 arch/arm/plat-mxc/include/mach/devices-common.h |    2 +-
 arch/arm/plat-mxc/include/mach/dma.h            |    3 +-
 arch/arm/plat-mxc/include/mach/sdma.h           |    2 -
 drivers/dma/imx-sdma.c                          |   39 +++++++++++++++++------
 13 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
index 17d6d1b..5736e04 100644
--- a/arch/arm/mach-imx/clock-imx25.c
+++ b/arch/arm/mach-imx/clock-imx25.c
@@ -308,7 +308,8 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
 	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
 	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx25 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 };
 
 int __init mx25_clocks_init(void)
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
index 8d212a9..d973770 100644
--- a/arch/arm/mach-imx/clock-imx31.c
+++ b/arch/arm/mach-imx/clock-imx31.c
@@ -565,7 +565,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
 	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
 	_REGISTER_CLOCK(NULL, "rng", rng_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1)
+	_REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
 	_REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
 	_REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
 	_REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index 2d0b4c8..749acff 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -481,7 +481,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
 	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
 	_REGISTER_CLOCK(NULL, "scc", scc_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK(NULL, "spba", spba_clk)
 	_REGISTER_CLOCK(NULL, "spdif", spdif_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 8bf0291..cc4d152 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -79,7 +79,6 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx25_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx25.bin",
 	.script_addrs = &imx25_sdma_script,
 };
@@ -92,5 +91,6 @@ void __init imx25_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
 	mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
 
-	imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
+	/* i.mx25 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
 }
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
index 61bff38..b7c55e7 100644
--- a/arch/arm/mach-imx/mm-imx31.c
+++ b/arch/arm/mach-imx/mm-imx31.c
@@ -69,7 +69,6 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx31_sdma_pdata __initdata = {
-	.sdma_version = 1,
 	.fw_name = "sdma-imx31-to2.bin",
 	.script_addrs = &imx31_to2_sdma_script,
 };
@@ -88,5 +87,5 @@ void __init imx31_soc_init(void)
 		imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
 	}
 
-	imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
+	imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
 }
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
index 98769ae..f49bac7 100644
--- a/arch/arm/mach-imx/mm-imx35.c
+++ b/arch/arm/mach-imx/mm-imx35.c
@@ -86,7 +86,6 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx35_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx35-to2.bin",
 	.script_addrs = &imx35_to2_sdma_script,
 };
@@ -106,5 +105,5 @@ void __init imx35_soc_init(void)
 		imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
 	}
 
-	imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
+	imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
 }
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 31d904c..0a2fa8e 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1447,7 +1447,8 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx51 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK(NULL, "ckih", ckih_clk)
 	_REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
 	_REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
@@ -1494,7 +1495,8 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
 	_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
-	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+	/* i.mx53 has the i.mx35 type sdma */
+	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index ef8aec9..baea6e5 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -115,7 +115,6 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx51_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx51.bin",
 	.script_addrs = &imx51_sdma_script,
 };
@@ -135,7 +134,6 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
 };
 
 static struct sdma_platform_data imx53_sdma_pdata __initdata = {
-	.sdma_version = 2,
 	.fw_name = "sdma-imx53.bin",
 	.script_addrs = &imx53_sdma_script,
 };
@@ -148,7 +146,8 @@ void __init imx51_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
 	mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
 
-	imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
+	/* i.mx51 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
 }
 
 void __init imx53_soc_init(void)
@@ -162,5 +161,6 @@ void __init imx53_soc_init(void)
 	mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
 	mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
 
-	imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
+	/* i.mx53 has the i.mx35 type sdma */
+	imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
 }
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
index 2b0fdb2..7fa7e9c 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
@@ -14,7 +14,7 @@ struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
 			"imx-dma", -1, NULL, 0, NULL, 0);
 }
 
-struct platform_device __init __maybe_unused *imx_add_imx_sdma(
+struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
 	resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
 {
 	struct resource res[] = {
@@ -29,6 +29,6 @@ struct platform_device __init __maybe_unused *imx_add_imx_sdma(
 		},
 	};
 
-	return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma",
+	return platform_device_register_resndata(&mxc_ahb_bus, name,
 			-1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index c9e7b66..f5cb8d5 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -298,5 +298,5 @@ struct platform_device *__init imx_add_spi_imx(
 		const struct spi_imx_master *pdata);
 
 struct platform_device *imx_add_imx_dma(void);
-struct platform_device *imx_add_imx_sdma(
+struct platform_device *imx_add_imx_sdma(char *name,
 	resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
index ef77515..233d0a5 100644
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
 
 static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
 {
-	return !strcmp(dev_name(chan->device->dev), "imx-sdma") ||
+	return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
+		!strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
 		!strcmp(dev_name(chan->device->dev), "imx-dma");
 }
 
diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
index f495c87..3a39428 100644
--- a/arch/arm/plat-mxc/include/mach/sdma.h
+++ b/arch/arm/plat-mxc/include/mach/sdma.h
@@ -48,12 +48,10 @@ struct sdma_script_start_addrs {
 /**
  * struct sdma_platform_data - platform specific data for SDMA engine
  *
- * @sdma_version	The version of this SDMA engine
  * @fw_name		The firmware name
  * @script_addrs	SDMA scripts addresses in SDMA ROM
  */
 struct sdma_platform_data {
-	int sdma_version;
 	char *fw_name;
 	struct sdma_script_start_addrs *script_addrs;
 };
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1ea47db..4a7aa72 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -65,8 +65,8 @@
 #define SDMA_ONCE_RTB		0x060
 #define SDMA_XTRIG_CONF1	0x070
 #define SDMA_XTRIG_CONF2	0x074
-#define SDMA_CHNENBL0_V2	0x200
-#define SDMA_CHNENBL0_V1	0x080
+#define SDMA_CHNENBL0_IMX35	0x200
+#define SDMA_CHNENBL0_IMX31	0x080
 #define SDMA_CHNPRI_0		0x100
 
 /*
@@ -299,13 +299,18 @@ struct sdma_firmware_header {
 	u32	ram_code_size;
 };
 
+enum sdma_devtype {
+	IMX31_SDMA,	/* runs on i.mx31 */
+	IMX35_SDMA,	/* runs on i.mx35 and later */
+};
+
 struct sdma_engine {
 	struct device			*dev;
 	struct device_dma_parameters	dma_parms;
 	struct sdma_channel		channel[MAX_DMA_CHANNELS];
 	struct sdma_channel_control	*channel_control;
 	void __iomem			*regs;
-	unsigned int			version;
+	enum sdma_devtype		devtype;
 	unsigned int			num_events;
 	struct sdma_context_data	*context;
 	dma_addr_t			context_phys;
@@ -314,6 +319,18 @@ struct sdma_engine {
 	struct sdma_script_start_addrs	*script_addrs;
 };
 
+static struct platform_device_id sdma_devtypes[] = {
+	{
+		.name = "imx31-sdma",
+		.driver_data = IMX31_SDMA,
+	}, {
+		.name = "imx35-sdma",
+		.driver_data = IMX35_SDMA,
+	}, {
+		/* sentinel */
+	}
+};
+
 #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
 #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
 #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
@@ -321,8 +338,8 @@ struct sdma_engine {
 
 static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
 {
-	u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1);
-
+	u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 :
+						      SDMA_CHNENBL0_IMX35);
 	return chnenbl0 + event * 4;
 }
 
@@ -1162,15 +1179,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
 	int i, ret;
 	dma_addr_t ccb_phys;
 
-	switch (sdma->version) {
-	case 1:
+	switch (sdma->devtype) {
+	case IMX31_SDMA:
 		sdma->num_events = 32;
 		break;
-	case 2:
+	case IMX35_SDMA:
 		sdma->num_events = 48;
 		break;
 	default:
-		dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version);
+		dev_err(sdma->dev, "Unknown sdma type %d. aborting\n",
+			sdma->devtype);
 		return -ENODEV;
 	}
 
@@ -1284,7 +1302,7 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (!sdma->script_addrs)
 		goto err_alloc;
 
-	sdma->version = pdata->sdma_version;
+	sdma->devtype = pdev->id_entry->driver_data;
 
 	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
 	dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask);
@@ -1366,6 +1384,7 @@ static struct platform_driver sdma_driver = {
 	.driver		= {
 		.name	= "imx-sdma",
 	},
+	.id_table	= sdma_devtypes,
 	.remove		= __exit_p(sdma_remove),
 };
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
  2011-07-14 16:14 ` Shawn Guo
@ 2011-07-14 16:14     ` Shawn Guo
  -1 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: patches-QSEj5FYQhm4dnm+yROfE0A, Vinod Koul,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Sascha Hauer

It adds device tree probe support for imx-sdma driver.

Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
 drivers/dma/imx-sdma.c                             |   29 +++++++++-
 2 files changed, 81 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt

diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
new file mode 100644
index 0000000..71f4525
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
@@ -0,0 +1,55 @@
+* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
+
+Required properties:
+- compatible : Should be "fsl,<chip>-sdma"
+- reg : Should contain SDMA registers location and length
+- interrupts : Should contain SDMA interrupt
+- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
+  firmware
+- fsl,sdma-script-address : Should be an array giving entry address for each
+  script.  The address should be 0 in case that the specified script is not
+  included in the firmware.  See example below for the array details.
+
+Examples:
+
+sdma@83fb0000 {
+	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
+	reg = <0x83fb0000 0x4000>;
+	interrupts = <6>;
+	fsl,sdma-script-name = "sdma-imx51.bin";
+	fsl,sdma-script-address = <642>,	/* ap_2_ap */
+				  <0>,		/* ap_2_bp */
+				  <0>,		/* ap_2_ap_fixed */
+				  <0>,		/* bp_2_ap */
+				  <0>,		/* loopback_on_dsp_side */
+				  <0>,		/* mcu_interrupt_only */
+				  <0>,		/* firi_2_per */
+				  <0>,		/* firi_2_mcu */
+				  <0>,		/* per_2_firi */
+				  <0>,		/* mcu_2_firi */
+				  <0>,		/* uart_2_per */
+				  <817>,	/* uart_2_mcu */
+				  <0>,		/* per_2_app */
+				  <747>,	/* mcu_2_app */
+				  <0>,		/* per_2_per */
+				  <0>,		/* uartsh_2_per */
+				  <0>,		/* uartsh_2_mcu */
+				  <0>,		/* per_2_shp */
+				  <961>,	/* mcu_2_shp */
+				  <1473>,	/* ata_2_mcu */
+				  <1392>,	/* mcu_2_ata */
+				  <1033>,	/* app_2_per */
+				  <683>,	/* app_2_mcu */
+				  <1251>,	/* shp_2_per */
+				  <892>,	/* shp_2_mcu */
+				  <0>,		/* mshc_2_mcu */
+				  <0>,		/* mcu_2_mshc */
+				  <0>,		/* spdif_2_mcu */
+				  <0>,		/* mcu_2_spdif */
+				  <0>,		/* asrc_2_mcu */
+				  <0>,		/* ext_mem_2_ipu */
+				  <0>,		/* descrambler */
+				  <0>,		/* dptc_dvfs */
+				  <0>,		/* utra_addr */
+				  <0>;		/* ram_code_start */
+};
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 4a7aa72..664f7bc 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -32,6 +32,8 @@
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/dmaengine.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <asm/irq.h>
 #include <mach/sdma.h>
@@ -331,6 +333,12 @@ static struct platform_device_id sdma_devtypes[] = {
 	}
 };
 
+static const struct of_device_id sdma_dt_ids[] = {
+	{ .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], },
+	{ .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], },
+	{ /* sentinel */ }
+};
+
 #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
 #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
 #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
@@ -1257,6 +1265,10 @@ err_dma_alloc:
 
 static int __init sdma_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id =
+			of_match_device(sdma_dt_ids, &pdev->dev);
+	struct device_node *np = pdev->dev.of_node;
+	const char *fw_name;
 	int ret;
 	int irq;
 	struct resource *iores;
@@ -1272,7 +1284,7 @@ static int __init sdma_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if (!iores || irq < 0 || !pdata) {
+	if (!iores || irq < 0) {
 		ret = -EINVAL;
 		goto err_irq;
 	}
@@ -1302,6 +1314,8 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (!sdma->script_addrs)
 		goto err_alloc;
 
+	if (of_id)
+		pdev->id_entry = of_id->data;
 	sdma->devtype = pdev->id_entry->driver_data;
 
 	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
@@ -1332,10 +1346,18 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_init;
 
-	if (pdata->script_addrs)
+	ret = of_property_read_u32_array(np, "fsl,sdma-script-address",
+				(u32 *) sdma->script_addrs,
+				sizeof(*sdma->script_addrs) / sizeof(u32));
+	if (ret < 0 && pdata && pdata->script_addrs)
 		sdma_add_scripts(sdma, pdata->script_addrs);
 
-	sdma_get_firmware(sdma, pdata->fw_name);
+	ret = of_property_read_string(np, "fsl,sdma-script-name",
+				      &fw_name);
+	if (!ret)
+		sdma_get_firmware(sdma, fw_name);
+	else if (pdata)
+		sdma_get_firmware(sdma, pdata->fw_name);
 
 	sdma->dma_device.dev = &pdev->dev;
 
@@ -1383,6 +1405,7 @@ static int __exit sdma_remove(struct platform_device *pdev)
 static struct platform_driver sdma_driver = {
 	.driver		= {
 		.name	= "imx-sdma",
+		.of_match_table = sdma_dt_ids,
 	},
 	.id_table	= sdma_devtypes,
 	.remove		= __exit_p(sdma_remove),
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
@ 2011-07-14 16:14     ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-14 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

It adds device tree probe support for imx-sdma driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
 drivers/dma/imx-sdma.c                             |   29 +++++++++-
 2 files changed, 81 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt

diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
new file mode 100644
index 0000000..71f4525
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
@@ -0,0 +1,55 @@
+* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
+
+Required properties:
+- compatible : Should be "fsl,<chip>-sdma"
+- reg : Should contain SDMA registers location and length
+- interrupts : Should contain SDMA interrupt
+- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
+  firmware
+- fsl,sdma-script-address : Should be an array giving entry address for each
+  script.  The address should be 0 in case that the specified script is not
+  included in the firmware.  See example below for the array details.
+
+Examples:
+
+sdma at 83fb0000 {
+	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
+	reg = <0x83fb0000 0x4000>;
+	interrupts = <6>;
+	fsl,sdma-script-name = "sdma-imx51.bin";
+	fsl,sdma-script-address = <642>,	/* ap_2_ap */
+				  <0>,		/* ap_2_bp */
+				  <0>,		/* ap_2_ap_fixed */
+				  <0>,		/* bp_2_ap */
+				  <0>,		/* loopback_on_dsp_side */
+				  <0>,		/* mcu_interrupt_only */
+				  <0>,		/* firi_2_per */
+				  <0>,		/* firi_2_mcu */
+				  <0>,		/* per_2_firi */
+				  <0>,		/* mcu_2_firi */
+				  <0>,		/* uart_2_per */
+				  <817>,	/* uart_2_mcu */
+				  <0>,		/* per_2_app */
+				  <747>,	/* mcu_2_app */
+				  <0>,		/* per_2_per */
+				  <0>,		/* uartsh_2_per */
+				  <0>,		/* uartsh_2_mcu */
+				  <0>,		/* per_2_shp */
+				  <961>,	/* mcu_2_shp */
+				  <1473>,	/* ata_2_mcu */
+				  <1392>,	/* mcu_2_ata */
+				  <1033>,	/* app_2_per */
+				  <683>,	/* app_2_mcu */
+				  <1251>,	/* shp_2_per */
+				  <892>,	/* shp_2_mcu */
+				  <0>,		/* mshc_2_mcu */
+				  <0>,		/* mcu_2_mshc */
+				  <0>,		/* spdif_2_mcu */
+				  <0>,		/* mcu_2_spdif */
+				  <0>,		/* asrc_2_mcu */
+				  <0>,		/* ext_mem_2_ipu */
+				  <0>,		/* descrambler */
+				  <0>,		/* dptc_dvfs */
+				  <0>,		/* utra_addr */
+				  <0>;		/* ram_code_start */
+};
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 4a7aa72..664f7bc 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -32,6 +32,8 @@
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/dmaengine.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <asm/irq.h>
 #include <mach/sdma.h>
@@ -331,6 +333,12 @@ static struct platform_device_id sdma_devtypes[] = {
 	}
 };
 
+static const struct of_device_id sdma_dt_ids[] = {
+	{ .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], },
+	{ .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], },
+	{ /* sentinel */ }
+};
+
 #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
 #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
 #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
@@ -1257,6 +1265,10 @@ err_dma_alloc:
 
 static int __init sdma_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id =
+			of_match_device(sdma_dt_ids, &pdev->dev);
+	struct device_node *np = pdev->dev.of_node;
+	const char *fw_name;
 	int ret;
 	int irq;
 	struct resource *iores;
@@ -1272,7 +1284,7 @@ static int __init sdma_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if (!iores || irq < 0 || !pdata) {
+	if (!iores || irq < 0) {
 		ret = -EINVAL;
 		goto err_irq;
 	}
@@ -1302,6 +1314,8 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (!sdma->script_addrs)
 		goto err_alloc;
 
+	if (of_id)
+		pdev->id_entry = of_id->data;
 	sdma->devtype = pdev->id_entry->driver_data;
 
 	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
@@ -1332,10 +1346,18 @@ static int __init sdma_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_init;
 
-	if (pdata->script_addrs)
+	ret = of_property_read_u32_array(np, "fsl,sdma-script-address",
+				(u32 *) sdma->script_addrs,
+				sizeof(*sdma->script_addrs) / sizeof(u32));
+	if (ret < 0 && pdata && pdata->script_addrs)
 		sdma_add_scripts(sdma, pdata->script_addrs);
 
-	sdma_get_firmware(sdma, pdata->fw_name);
+	ret = of_property_read_string(np, "fsl,sdma-script-name",
+				      &fw_name);
+	if (!ret)
+		sdma_get_firmware(sdma, fw_name);
+	else if (pdata)
+		sdma_get_firmware(sdma, pdata->fw_name);
 
 	sdma->dma_device.dev = &pdev->dev;
 
@@ -1383,6 +1405,7 @@ static int __exit sdma_remove(struct platform_device *pdev)
 static struct platform_driver sdma_driver = {
 	.driver		= {
 		.name	= "imx-sdma",
+		.of_match_table = sdma_dt_ids,
 	},
 	.id_table	= sdma_devtypes,
 	.remove		= __exit_p(sdma_remove),
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
  2011-07-14 16:14     ` Shawn Guo
@ 2011-07-15  2:54         ` Grant Likely
  -1 siblings, 0 replies; 20+ messages in thread
From: Grant Likely @ 2011-07-15  2:54 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> It might be not good to use software defined version to identify sdma
> device type, when hardware does not define such version.  Instead,
> soc name is stable enough to define the device type.
> 
> The patch uses platform_device_id rather than version number passed
> by platform data to identify sdma device type/version.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/mach-imx/clock-imx25.c                 |    3 +-
>  arch/arm/mach-imx/clock-imx31.c                 |    2 +-
>  arch/arm/mach-imx/clock-imx35.c                 |    2 +-
>  arch/arm/mach-imx/mm-imx25.c                    |    4 +-
>  arch/arm/mach-imx/mm-imx31.c                    |    3 +-
>  arch/arm/mach-imx/mm-imx35.c                    |    3 +-
>  arch/arm/mach-mx5/clock-mx51-mx53.c             |    6 ++-
>  arch/arm/mach-mx5/mm.c                          |    8 ++--
>  arch/arm/plat-mxc/devices/platform-imx-dma.c    |    4 +-
>  arch/arm/plat-mxc/include/mach/devices-common.h |    2 +-
>  arch/arm/plat-mxc/include/mach/dma.h            |    3 +-
>  arch/arm/plat-mxc/include/mach/sdma.h           |    2 -
>  drivers/dma/imx-sdma.c                          |   39 +++++++++++++++++------
>  13 files changed, 50 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
> index 17d6d1b..5736e04 100644
> --- a/arch/arm/mach-imx/clock-imx25.c
> +++ b/arch/arm/mach-imx/clock-imx25.c
> @@ -308,7 +308,8 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
>  	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
>  	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx25 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  };
>  
>  int __init mx25_clocks_init(void)
> diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
> index 8d212a9..d973770 100644
> --- a/arch/arm/mach-imx/clock-imx31.c
> +++ b/arch/arm/mach-imx/clock-imx31.c
> @@ -565,7 +565,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "ata", ata_clk)
>  	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
>  	_REGISTER_CLOCK(NULL, "rng", rng_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1)
> +	_REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
>  	_REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
>  	_REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
>  	_REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
> diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
> index 2d0b4c8..749acff 100644
> --- a/arch/arm/mach-imx/clock-imx35.c
> +++ b/arch/arm/mach-imx/clock-imx35.c
> @@ -481,7 +481,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
>  	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
>  	_REGISTER_CLOCK(NULL, "scc", scc_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK(NULL, "spba", spba_clk)
>  	_REGISTER_CLOCK(NULL, "spdif", spdif_clk)
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
> diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
> index 8bf0291..cc4d152 100644
> --- a/arch/arm/mach-imx/mm-imx25.c
> +++ b/arch/arm/mach-imx/mm-imx25.c
> @@ -79,7 +79,6 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx25_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx25.bin",
>  	.script_addrs = &imx25_sdma_script,
>  };
> @@ -92,5 +91,6 @@ void __init imx25_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
>  	mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
>  
> -	imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
> +	/* i.mx25 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
> index 61bff38..b7c55e7 100644
> --- a/arch/arm/mach-imx/mm-imx31.c
> +++ b/arch/arm/mach-imx/mm-imx31.c
> @@ -69,7 +69,6 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx31_sdma_pdata __initdata = {
> -	.sdma_version = 1,
>  	.fw_name = "sdma-imx31-to2.bin",
>  	.script_addrs = &imx31_to2_sdma_script,
>  };
> @@ -88,5 +87,5 @@ void __init imx31_soc_init(void)
>  		imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
>  	}
>  
> -	imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
> +	imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
> index 98769ae..f49bac7 100644
> --- a/arch/arm/mach-imx/mm-imx35.c
> +++ b/arch/arm/mach-imx/mm-imx35.c
> @@ -86,7 +86,6 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx35_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx35-to2.bin",
>  	.script_addrs = &imx35_to2_sdma_script,
>  };
> @@ -106,5 +105,5 @@ void __init imx35_soc_init(void)
>  		imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
>  	}
>  
> -	imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
> +	imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 31d904c..0a2fa8e 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1447,7 +1447,8 @@ static struct clk_lookup mx51_lookups[] = {
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
>  	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
>  	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx51 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK(NULL, "ckih", ckih_clk)
>  	_REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
>  	_REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
> @@ -1494,7 +1495,8 @@ static struct clk_lookup mx53_lookups[] = {
>  	_REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
>  	_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
>  	_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx53 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
>  	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
>  	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
> diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
> index ef8aec9..baea6e5 100644
> --- a/arch/arm/mach-mx5/mm.c
> +++ b/arch/arm/mach-mx5/mm.c
> @@ -115,7 +115,6 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx51_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx51.bin",
>  	.script_addrs = &imx51_sdma_script,
>  };
> @@ -135,7 +134,6 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx53_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx53.bin",
>  	.script_addrs = &imx53_sdma_script,
>  };
> @@ -148,7 +146,8 @@ void __init imx51_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
>  	mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
>  
> -	imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
> +	/* i.mx51 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
>  }
>  
>  void __init imx53_soc_init(void)
> @@ -162,5 +161,6 @@ void __init imx53_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
>  	mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
>  
> -	imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
> +	/* i.mx53 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
>  }
> diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
> index 2b0fdb2..7fa7e9c 100644
> --- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
> +++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
> @@ -14,7 +14,7 @@ struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
>  			"imx-dma", -1, NULL, 0, NULL, 0);
>  }
>  
> -struct platform_device __init __maybe_unused *imx_add_imx_sdma(
> +struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
>  	resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
>  {
>  	struct resource res[] = {
> @@ -29,6 +29,6 @@ struct platform_device __init __maybe_unused *imx_add_imx_sdma(
>  		},
>  	};
>  
> -	return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma",
> +	return platform_device_register_resndata(&mxc_ahb_bus, name,
>  			-1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
>  }
> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
> index c9e7b66..f5cb8d5 100644
> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
> @@ -298,5 +298,5 @@ struct platform_device *__init imx_add_spi_imx(
>  		const struct spi_imx_master *pdata);
>  
>  struct platform_device *imx_add_imx_dma(void);
> -struct platform_device *imx_add_imx_sdma(
> +struct platform_device *imx_add_imx_sdma(char *name,
>  	resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
> diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
> index ef77515..233d0a5 100644
> --- a/arch/arm/plat-mxc/include/mach/dma.h
> +++ b/arch/arm/plat-mxc/include/mach/dma.h
> @@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
>  
>  static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
>  {
> -	return !strcmp(dev_name(chan->device->dev), "imx-sdma") ||
> +	return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
> +		!strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
>  		!strcmp(dev_name(chan->device->dev), "imx-dma");
>  }
>  
> diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
> index f495c87..3a39428 100644
> --- a/arch/arm/plat-mxc/include/mach/sdma.h
> +++ b/arch/arm/plat-mxc/include/mach/sdma.h
> @@ -48,12 +48,10 @@ struct sdma_script_start_addrs {
>  /**
>   * struct sdma_platform_data - platform specific data for SDMA engine
>   *
> - * @sdma_version	The version of this SDMA engine
>   * @fw_name		The firmware name
>   * @script_addrs	SDMA scripts addresses in SDMA ROM
>   */
>  struct sdma_platform_data {
> -	int sdma_version;
>  	char *fw_name;
>  	struct sdma_script_start_addrs *script_addrs;
>  };
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 1ea47db..4a7aa72 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -65,8 +65,8 @@
>  #define SDMA_ONCE_RTB		0x060
>  #define SDMA_XTRIG_CONF1	0x070
>  #define SDMA_XTRIG_CONF2	0x074
> -#define SDMA_CHNENBL0_V2	0x200
> -#define SDMA_CHNENBL0_V1	0x080
> +#define SDMA_CHNENBL0_IMX35	0x200
> +#define SDMA_CHNENBL0_IMX31	0x080
>  #define SDMA_CHNPRI_0		0x100
>  
>  /*
> @@ -299,13 +299,18 @@ struct sdma_firmware_header {
>  	u32	ram_code_size;
>  };
>  
> +enum sdma_devtype {
> +	IMX31_SDMA,	/* runs on i.mx31 */
> +	IMX35_SDMA,	/* runs on i.mx35 and later */
> +};
> +
>  struct sdma_engine {
>  	struct device			*dev;
>  	struct device_dma_parameters	dma_parms;
>  	struct sdma_channel		channel[MAX_DMA_CHANNELS];
>  	struct sdma_channel_control	*channel_control;
>  	void __iomem			*regs;
> -	unsigned int			version;
> +	enum sdma_devtype		devtype;
>  	unsigned int			num_events;
>  	struct sdma_context_data	*context;
>  	dma_addr_t			context_phys;
> @@ -314,6 +319,18 @@ struct sdma_engine {
>  	struct sdma_script_start_addrs	*script_addrs;
>  };
>  
> +static struct platform_device_id sdma_devtypes[] = {
> +	{
> +		.name = "imx31-sdma",
> +		.driver_data = IMX31_SDMA,
> +	}, {
> +		.name = "imx35-sdma",
> +		.driver_data = IMX35_SDMA,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
>  #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
>  #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
> @@ -321,8 +338,8 @@ struct sdma_engine {
>  
>  static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
>  {
> -	u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1);
> -
> +	u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 :
> +						      SDMA_CHNENBL0_IMX35);
>  	return chnenbl0 + event * 4;
>  }
>  
> @@ -1162,15 +1179,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
>  	int i, ret;
>  	dma_addr_t ccb_phys;
>  
> -	switch (sdma->version) {
> -	case 1:
> +	switch (sdma->devtype) {
> +	case IMX31_SDMA:
>  		sdma->num_events = 32;
>  		break;
> -	case 2:
> +	case IMX35_SDMA:
>  		sdma->num_events = 48;
>  		break;
>  	default:
> -		dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version);
> +		dev_err(sdma->dev, "Unknown sdma type %d. aborting\n",
> +			sdma->devtype);
>  		return -ENODEV;
>  	}
>  
> @@ -1284,7 +1302,7 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (!sdma->script_addrs)
>  		goto err_alloc;
>  
> -	sdma->version = pdata->sdma_version;
> +	sdma->devtype = pdev->id_entry->driver_data;
>  
>  	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
>  	dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask);
> @@ -1366,6 +1384,7 @@ static struct platform_driver sdma_driver = {
>  	.driver		= {
>  		.name	= "imx-sdma",
>  	},
> +	.id_table	= sdma_devtypes,
>  	.remove		= __exit_p(sdma_remove),
>  };
>  
> -- 
> 1.7.4.1
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
@ 2011-07-15  2:54         ` Grant Likely
  0 siblings, 0 replies; 20+ messages in thread
From: Grant Likely @ 2011-07-15  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> It might be not good to use software defined version to identify sdma
> device type, when hardware does not define such version.  Instead,
> soc name is stable enough to define the device type.
> 
> The patch uses platform_device_id rather than version number passed
> by platform data to identify sdma device type/version.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-imx/clock-imx25.c                 |    3 +-
>  arch/arm/mach-imx/clock-imx31.c                 |    2 +-
>  arch/arm/mach-imx/clock-imx35.c                 |    2 +-
>  arch/arm/mach-imx/mm-imx25.c                    |    4 +-
>  arch/arm/mach-imx/mm-imx31.c                    |    3 +-
>  arch/arm/mach-imx/mm-imx35.c                    |    3 +-
>  arch/arm/mach-mx5/clock-mx51-mx53.c             |    6 ++-
>  arch/arm/mach-mx5/mm.c                          |    8 ++--
>  arch/arm/plat-mxc/devices/platform-imx-dma.c    |    4 +-
>  arch/arm/plat-mxc/include/mach/devices-common.h |    2 +-
>  arch/arm/plat-mxc/include/mach/dma.h            |    3 +-
>  arch/arm/plat-mxc/include/mach/sdma.h           |    2 -
>  drivers/dma/imx-sdma.c                          |   39 +++++++++++++++++------
>  13 files changed, 50 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
> index 17d6d1b..5736e04 100644
> --- a/arch/arm/mach-imx/clock-imx25.c
> +++ b/arch/arm/mach-imx/clock-imx25.c
> @@ -308,7 +308,8 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
>  	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
>  	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx25 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  };
>  
>  int __init mx25_clocks_init(void)
> diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
> index 8d212a9..d973770 100644
> --- a/arch/arm/mach-imx/clock-imx31.c
> +++ b/arch/arm/mach-imx/clock-imx31.c
> @@ -565,7 +565,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "ata", ata_clk)
>  	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
>  	_REGISTER_CLOCK(NULL, "rng", rng_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1)
> +	_REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
>  	_REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
>  	_REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
>  	_REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
> diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
> index 2d0b4c8..749acff 100644
> --- a/arch/arm/mach-imx/clock-imx35.c
> +++ b/arch/arm/mach-imx/clock-imx35.c
> @@ -481,7 +481,7 @@ static struct clk_lookup lookups[] = {
>  	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
>  	_REGISTER_CLOCK(NULL, "rtic", rtic_clk)
>  	_REGISTER_CLOCK(NULL, "scc", scc_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK(NULL, "spba", spba_clk)
>  	_REGISTER_CLOCK(NULL, "spdif", spdif_clk)
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
> diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
> index 8bf0291..cc4d152 100644
> --- a/arch/arm/mach-imx/mm-imx25.c
> +++ b/arch/arm/mach-imx/mm-imx25.c
> @@ -79,7 +79,6 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx25_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx25.bin",
>  	.script_addrs = &imx25_sdma_script,
>  };
> @@ -92,5 +91,6 @@ void __init imx25_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
>  	mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
>  
> -	imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
> +	/* i.mx25 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
> index 61bff38..b7c55e7 100644
> --- a/arch/arm/mach-imx/mm-imx31.c
> +++ b/arch/arm/mach-imx/mm-imx31.c
> @@ -69,7 +69,6 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx31_sdma_pdata __initdata = {
> -	.sdma_version = 1,
>  	.fw_name = "sdma-imx31-to2.bin",
>  	.script_addrs = &imx31_to2_sdma_script,
>  };
> @@ -88,5 +87,5 @@ void __init imx31_soc_init(void)
>  		imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
>  	}
>  
> -	imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
> +	imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
> index 98769ae..f49bac7 100644
> --- a/arch/arm/mach-imx/mm-imx35.c
> +++ b/arch/arm/mach-imx/mm-imx35.c
> @@ -86,7 +86,6 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx35_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx35-to2.bin",
>  	.script_addrs = &imx35_to2_sdma_script,
>  };
> @@ -106,5 +105,5 @@ void __init imx35_soc_init(void)
>  		imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
>  	}
>  
> -	imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
> +	imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
>  }
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 31d904c..0a2fa8e 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1447,7 +1447,8 @@ static struct clk_lookup mx51_lookups[] = {
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
>  	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
>  	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx51 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK(NULL, "ckih", ckih_clk)
>  	_REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
>  	_REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
> @@ -1494,7 +1495,8 @@ static struct clk_lookup mx53_lookups[] = {
>  	_REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
>  	_REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
>  	_REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
> -	_REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
> +	/* i.mx53 has the i.mx35 type sdma */
> +	_REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
>  	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
>  	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
>  	_REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
> diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
> index ef8aec9..baea6e5 100644
> --- a/arch/arm/mach-mx5/mm.c
> +++ b/arch/arm/mach-mx5/mm.c
> @@ -115,7 +115,6 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx51_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx51.bin",
>  	.script_addrs = &imx51_sdma_script,
>  };
> @@ -135,7 +134,6 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
>  };
>  
>  static struct sdma_platform_data imx53_sdma_pdata __initdata = {
> -	.sdma_version = 2,
>  	.fw_name = "sdma-imx53.bin",
>  	.script_addrs = &imx53_sdma_script,
>  };
> @@ -148,7 +146,8 @@ void __init imx51_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
>  	mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
>  
> -	imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
> +	/* i.mx51 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
>  }
>  
>  void __init imx53_soc_init(void)
> @@ -162,5 +161,6 @@ void __init imx53_soc_init(void)
>  	mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
>  	mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
>  
> -	imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
> +	/* i.mx53 has the i.mx35 type sdma */
> +	imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
>  }
> diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
> index 2b0fdb2..7fa7e9c 100644
> --- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
> +++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
> @@ -14,7 +14,7 @@ struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
>  			"imx-dma", -1, NULL, 0, NULL, 0);
>  }
>  
> -struct platform_device __init __maybe_unused *imx_add_imx_sdma(
> +struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
>  	resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
>  {
>  	struct resource res[] = {
> @@ -29,6 +29,6 @@ struct platform_device __init __maybe_unused *imx_add_imx_sdma(
>  		},
>  	};
>  
> -	return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma",
> +	return platform_device_register_resndata(&mxc_ahb_bus, name,
>  			-1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
>  }
> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
> index c9e7b66..f5cb8d5 100644
> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
> @@ -298,5 +298,5 @@ struct platform_device *__init imx_add_spi_imx(
>  		const struct spi_imx_master *pdata);
>  
>  struct platform_device *imx_add_imx_dma(void);
> -struct platform_device *imx_add_imx_sdma(
> +struct platform_device *imx_add_imx_sdma(char *name,
>  	resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
> diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
> index ef77515..233d0a5 100644
> --- a/arch/arm/plat-mxc/include/mach/dma.h
> +++ b/arch/arm/plat-mxc/include/mach/dma.h
> @@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
>  
>  static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
>  {
> -	return !strcmp(dev_name(chan->device->dev), "imx-sdma") ||
> +	return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
> +		!strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
>  		!strcmp(dev_name(chan->device->dev), "imx-dma");
>  }
>  
> diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
> index f495c87..3a39428 100644
> --- a/arch/arm/plat-mxc/include/mach/sdma.h
> +++ b/arch/arm/plat-mxc/include/mach/sdma.h
> @@ -48,12 +48,10 @@ struct sdma_script_start_addrs {
>  /**
>   * struct sdma_platform_data - platform specific data for SDMA engine
>   *
> - * @sdma_version	The version of this SDMA engine
>   * @fw_name		The firmware name
>   * @script_addrs	SDMA scripts addresses in SDMA ROM
>   */
>  struct sdma_platform_data {
> -	int sdma_version;
>  	char *fw_name;
>  	struct sdma_script_start_addrs *script_addrs;
>  };
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 1ea47db..4a7aa72 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -65,8 +65,8 @@
>  #define SDMA_ONCE_RTB		0x060
>  #define SDMA_XTRIG_CONF1	0x070
>  #define SDMA_XTRIG_CONF2	0x074
> -#define SDMA_CHNENBL0_V2	0x200
> -#define SDMA_CHNENBL0_V1	0x080
> +#define SDMA_CHNENBL0_IMX35	0x200
> +#define SDMA_CHNENBL0_IMX31	0x080
>  #define SDMA_CHNPRI_0		0x100
>  
>  /*
> @@ -299,13 +299,18 @@ struct sdma_firmware_header {
>  	u32	ram_code_size;
>  };
>  
> +enum sdma_devtype {
> +	IMX31_SDMA,	/* runs on i.mx31 */
> +	IMX35_SDMA,	/* runs on i.mx35 and later */
> +};
> +
>  struct sdma_engine {
>  	struct device			*dev;
>  	struct device_dma_parameters	dma_parms;
>  	struct sdma_channel		channel[MAX_DMA_CHANNELS];
>  	struct sdma_channel_control	*channel_control;
>  	void __iomem			*regs;
> -	unsigned int			version;
> +	enum sdma_devtype		devtype;
>  	unsigned int			num_events;
>  	struct sdma_context_data	*context;
>  	dma_addr_t			context_phys;
> @@ -314,6 +319,18 @@ struct sdma_engine {
>  	struct sdma_script_start_addrs	*script_addrs;
>  };
>  
> +static struct platform_device_id sdma_devtypes[] = {
> +	{
> +		.name = "imx31-sdma",
> +		.driver_data = IMX31_SDMA,
> +	}, {
> +		.name = "imx35-sdma",
> +		.driver_data = IMX35_SDMA,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
>  #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
>  #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
> @@ -321,8 +338,8 @@ struct sdma_engine {
>  
>  static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
>  {
> -	u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1);
> -
> +	u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 :
> +						      SDMA_CHNENBL0_IMX35);
>  	return chnenbl0 + event * 4;
>  }
>  
> @@ -1162,15 +1179,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
>  	int i, ret;
>  	dma_addr_t ccb_phys;
>  
> -	switch (sdma->version) {
> -	case 1:
> +	switch (sdma->devtype) {
> +	case IMX31_SDMA:
>  		sdma->num_events = 32;
>  		break;
> -	case 2:
> +	case IMX35_SDMA:
>  		sdma->num_events = 48;
>  		break;
>  	default:
> -		dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version);
> +		dev_err(sdma->dev, "Unknown sdma type %d. aborting\n",
> +			sdma->devtype);
>  		return -ENODEV;
>  	}
>  
> @@ -1284,7 +1302,7 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (!sdma->script_addrs)
>  		goto err_alloc;
>  
> -	sdma->version = pdata->sdma_version;
> +	sdma->devtype = pdev->id_entry->driver_data;
>  
>  	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
>  	dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask);
> @@ -1366,6 +1384,7 @@ static struct platform_driver sdma_driver = {
>  	.driver		= {
>  		.name	= "imx-sdma",
>  	},
> +	.id_table	= sdma_devtypes,
>  	.remove		= __exit_p(sdma_remove),
>  };
>  
> -- 
> 1.7.4.1
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
  2011-07-14 16:14     ` Shawn Guo
@ 2011-07-15  2:54         ` Grant Likely
  -1 siblings, 0 replies; 20+ messages in thread
From: Grant Likely @ 2011-07-15  2:54 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> It adds device tree probe support for imx-sdma driver.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
>  drivers/dma/imx-sdma.c                             |   29 +++++++++-
>  2 files changed, 81 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> new file mode 100644
> index 0000000..71f4525
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> @@ -0,0 +1,55 @@
> +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-sdma"
> +- reg : Should contain SDMA registers location and length
> +- interrupts : Should contain SDMA interrupt
> +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> +  firmware
> +- fsl,sdma-script-address : Should be an array giving entry address for each
> +  script.  The address should be 0 in case that the specified script is not
> +  included in the firmware.  See example below for the array details.
> +
> +Examples:
> +
> +sdma@83fb0000 {
> +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> +	reg = <0x83fb0000 0x4000>;
> +	interrupts = <6>;
> +	fsl,sdma-script-name = "sdma-imx51.bin";
> +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> +				  <0>,		/* ap_2_bp */
> +				  <0>,		/* ap_2_ap_fixed */
> +				  <0>,		/* bp_2_ap */
> +				  <0>,		/* loopback_on_dsp_side */
> +				  <0>,		/* mcu_interrupt_only */
> +				  <0>,		/* firi_2_per */
> +				  <0>,		/* firi_2_mcu */
> +				  <0>,		/* per_2_firi */
> +				  <0>,		/* mcu_2_firi */
> +				  <0>,		/* uart_2_per */
> +				  <817>,	/* uart_2_mcu */
> +				  <0>,		/* per_2_app */
> +				  <747>,	/* mcu_2_app */
> +				  <0>,		/* per_2_per */
> +				  <0>,		/* uartsh_2_per */
> +				  <0>,		/* uartsh_2_mcu */
> +				  <0>,		/* per_2_shp */
> +				  <961>,	/* mcu_2_shp */
> +				  <1473>,	/* ata_2_mcu */
> +				  <1392>,	/* mcu_2_ata */
> +				  <1033>,	/* app_2_per */
> +				  <683>,	/* app_2_mcu */
> +				  <1251>,	/* shp_2_per */
> +				  <892>,	/* shp_2_mcu */
> +				  <0>,		/* mshc_2_mcu */
> +				  <0>,		/* mcu_2_mshc */
> +				  <0>,		/* spdif_2_mcu */
> +				  <0>,		/* mcu_2_spdif */
> +				  <0>,		/* asrc_2_mcu */
> +				  <0>,		/* ext_mem_2_ipu */
> +				  <0>,		/* descrambler */
> +				  <0>,		/* dptc_dvfs */
> +				  <0>,		/* utra_addr */
> +				  <0>;		/* ram_code_start */

This looks icky.  Where do these numbers come from?  How are the
offsets loaded into ram?  Are they properties of the firmware blob?
If so, then maybe they should be embedded in the firmware blob instead
of encoded in a DT that may become out of sync.

> +};
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 4a7aa72..664f7bc 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -32,6 +32,8 @@
>  #include <linux/slab.h>
>  #include <linux/platform_device.h>
>  #include <linux/dmaengine.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/irq.h>
>  #include <mach/sdma.h>
> @@ -331,6 +333,12 @@ static struct platform_device_id sdma_devtypes[] = {
>  	}
>  };
>  
> +static const struct of_device_id sdma_dt_ids[] = {
> +	{ .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], },
> +	{ .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], },
> +	{ /* sentinel */ }
> +};
> +
>  #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
>  #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
>  #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
> @@ -1257,6 +1265,10 @@ err_dma_alloc:
>  
>  static int __init sdma_probe(struct platform_device *pdev)
>  {
> +	const struct of_device_id *of_id =
> +			of_match_device(sdma_dt_ids, &pdev->dev);
> +	struct device_node *np = pdev->dev.of_node;
> +	const char *fw_name;
>  	int ret;
>  	int irq;
>  	struct resource *iores;
> @@ -1272,7 +1284,7 @@ static int __init sdma_probe(struct platform_device *pdev)
>  
>  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	irq = platform_get_irq(pdev, 0);
> -	if (!iores || irq < 0 || !pdata) {
> +	if (!iores || irq < 0) {
>  		ret = -EINVAL;
>  		goto err_irq;
>  	}
> @@ -1302,6 +1314,8 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (!sdma->script_addrs)
>  		goto err_alloc;
>  
> +	if (of_id)
> +		pdev->id_entry = of_id->data;
>  	sdma->devtype = pdev->id_entry->driver_data;
>  
>  	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
> @@ -1332,10 +1346,18 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_init;
>  
> -	if (pdata->script_addrs)
> +	ret = of_property_read_u32_array(np, "fsl,sdma-script-address",
> +				(u32 *) sdma->script_addrs,
> +				sizeof(*sdma->script_addrs) / sizeof(u32));
> +	if (ret < 0 && pdata && pdata->script_addrs)
>  		sdma_add_scripts(sdma, pdata->script_addrs);
>  
> -	sdma_get_firmware(sdma, pdata->fw_name);
> +	ret = of_property_read_string(np, "fsl,sdma-script-name",
> +				      &fw_name);
> +	if (!ret)
> +		sdma_get_firmware(sdma, fw_name);
> +	else if (pdata)
> +		sdma_get_firmware(sdma, pdata->fw_name);
>  
>  	sdma->dma_device.dev = &pdev->dev;
>  
> @@ -1383,6 +1405,7 @@ static int __exit sdma_remove(struct platform_device *pdev)
>  static struct platform_driver sdma_driver = {
>  	.driver		= {
>  		.name	= "imx-sdma",
> +		.of_match_table = sdma_dt_ids,
>  	},
>  	.id_table	= sdma_devtypes,
>  	.remove		= __exit_p(sdma_remove),
> -- 
> 1.7.4.1
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
@ 2011-07-15  2:54         ` Grant Likely
  0 siblings, 0 replies; 20+ messages in thread
From: Grant Likely @ 2011-07-15  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> It adds device tree probe support for imx-sdma driver.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
>  drivers/dma/imx-sdma.c                             |   29 +++++++++-
>  2 files changed, 81 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> new file mode 100644
> index 0000000..71f4525
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> @@ -0,0 +1,55 @@
> +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-sdma"
> +- reg : Should contain SDMA registers location and length
> +- interrupts : Should contain SDMA interrupt
> +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> +  firmware
> +- fsl,sdma-script-address : Should be an array giving entry address for each
> +  script.  The address should be 0 in case that the specified script is not
> +  included in the firmware.  See example below for the array details.
> +
> +Examples:
> +
> +sdma at 83fb0000 {
> +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> +	reg = <0x83fb0000 0x4000>;
> +	interrupts = <6>;
> +	fsl,sdma-script-name = "sdma-imx51.bin";
> +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> +				  <0>,		/* ap_2_bp */
> +				  <0>,		/* ap_2_ap_fixed */
> +				  <0>,		/* bp_2_ap */
> +				  <0>,		/* loopback_on_dsp_side */
> +				  <0>,		/* mcu_interrupt_only */
> +				  <0>,		/* firi_2_per */
> +				  <0>,		/* firi_2_mcu */
> +				  <0>,		/* per_2_firi */
> +				  <0>,		/* mcu_2_firi */
> +				  <0>,		/* uart_2_per */
> +				  <817>,	/* uart_2_mcu */
> +				  <0>,		/* per_2_app */
> +				  <747>,	/* mcu_2_app */
> +				  <0>,		/* per_2_per */
> +				  <0>,		/* uartsh_2_per */
> +				  <0>,		/* uartsh_2_mcu */
> +				  <0>,		/* per_2_shp */
> +				  <961>,	/* mcu_2_shp */
> +				  <1473>,	/* ata_2_mcu */
> +				  <1392>,	/* mcu_2_ata */
> +				  <1033>,	/* app_2_per */
> +				  <683>,	/* app_2_mcu */
> +				  <1251>,	/* shp_2_per */
> +				  <892>,	/* shp_2_mcu */
> +				  <0>,		/* mshc_2_mcu */
> +				  <0>,		/* mcu_2_mshc */
> +				  <0>,		/* spdif_2_mcu */
> +				  <0>,		/* mcu_2_spdif */
> +				  <0>,		/* asrc_2_mcu */
> +				  <0>,		/* ext_mem_2_ipu */
> +				  <0>,		/* descrambler */
> +				  <0>,		/* dptc_dvfs */
> +				  <0>,		/* utra_addr */
> +				  <0>;		/* ram_code_start */

This looks icky.  Where do these numbers come from?  How are the
offsets loaded into ram?  Are they properties of the firmware blob?
If so, then maybe they should be embedded in the firmware blob instead
of encoded in a DT that may become out of sync.

> +};
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 4a7aa72..664f7bc 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -32,6 +32,8 @@
>  #include <linux/slab.h>
>  #include <linux/platform_device.h>
>  #include <linux/dmaengine.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/irq.h>
>  #include <mach/sdma.h>
> @@ -331,6 +333,12 @@ static struct platform_device_id sdma_devtypes[] = {
>  	}
>  };
>  
> +static const struct of_device_id sdma_dt_ids[] = {
> +	{ .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], },
> +	{ .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], },
> +	{ /* sentinel */ }
> +};
> +
>  #define SDMA_H_CONFIG_DSPDMA	(1 << 12) /* indicates if the DSPDMA is used */
>  #define SDMA_H_CONFIG_RTD_PINS	(1 << 11) /* indicates if Real-Time Debug pins are enabled */
>  #define SDMA_H_CONFIG_ACR	(1 << 4)  /* indicates if AHB freq /core freq = 2 or 1 */
> @@ -1257,6 +1265,10 @@ err_dma_alloc:
>  
>  static int __init sdma_probe(struct platform_device *pdev)
>  {
> +	const struct of_device_id *of_id =
> +			of_match_device(sdma_dt_ids, &pdev->dev);
> +	struct device_node *np = pdev->dev.of_node;
> +	const char *fw_name;
>  	int ret;
>  	int irq;
>  	struct resource *iores;
> @@ -1272,7 +1284,7 @@ static int __init sdma_probe(struct platform_device *pdev)
>  
>  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	irq = platform_get_irq(pdev, 0);
> -	if (!iores || irq < 0 || !pdata) {
> +	if (!iores || irq < 0) {
>  		ret = -EINVAL;
>  		goto err_irq;
>  	}
> @@ -1302,6 +1314,8 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (!sdma->script_addrs)
>  		goto err_alloc;
>  
> +	if (of_id)
> +		pdev->id_entry = of_id->data;
>  	sdma->devtype = pdev->id_entry->driver_data;
>  
>  	dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
> @@ -1332,10 +1346,18 @@ static int __init sdma_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_init;
>  
> -	if (pdata->script_addrs)
> +	ret = of_property_read_u32_array(np, "fsl,sdma-script-address",
> +				(u32 *) sdma->script_addrs,
> +				sizeof(*sdma->script_addrs) / sizeof(u32));
> +	if (ret < 0 && pdata && pdata->script_addrs)
>  		sdma_add_scripts(sdma, pdata->script_addrs);
>  
> -	sdma_get_firmware(sdma, pdata->fw_name);
> +	ret = of_property_read_string(np, "fsl,sdma-script-name",
> +				      &fw_name);
> +	if (!ret)
> +		sdma_get_firmware(sdma, fw_name);
> +	else if (pdata)
> +		sdma_get_firmware(sdma, pdata->fw_name);
>  
>  	sdma->dma_device.dev = &pdev->dev;
>  
> @@ -1383,6 +1405,7 @@ static int __exit sdma_remove(struct platform_device *pdev)
>  static struct platform_driver sdma_driver = {
>  	.driver		= {
>  		.name	= "imx-sdma",
> +		.of_match_table = sdma_dt_ids,
>  	},
>  	.id_table	= sdma_devtypes,
>  	.remove		= __exit_p(sdma_remove),
> -- 
> 1.7.4.1
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
  2011-07-15  2:54         ` Grant Likely
@ 2011-07-15  7:32             ` Sascha Hauer
  -1 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  7:32 UTC (permalink / raw)
  To: Grant Likely
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Thu, Jul 14, 2011 at 08:54:13PM -0600, Grant Likely wrote:
> On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> > It adds device tree probe support for imx-sdma driver.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> > Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > ---
> >  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
> >  drivers/dma/imx-sdma.c                             |   29 +++++++++-
> >  2 files changed, 81 insertions(+), 3 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > new file mode 100644
> > index 0000000..71f4525
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > @@ -0,0 +1,55 @@
> > +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> > +
> > +Required properties:
> > +- compatible : Should be "fsl,<chip>-sdma"
> > +- reg : Should contain SDMA registers location and length
> > +- interrupts : Should contain SDMA interrupt
> > +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> > +  firmware
> > +- fsl,sdma-script-address : Should be an array giving entry address for each
> > +  script.  The address should be 0 in case that the specified script is not
> > +  included in the firmware.  See example below for the array details.
> > +
> > +Examples:
> > +
> > +sdma@83fb0000 {
> > +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> > +	reg = <0x83fb0000 0x4000>;
> > +	interrupts = <6>;
> > +	fsl,sdma-script-name = "sdma-imx51.bin";
> > +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> > +				  <0>,		/* ap_2_bp */
> > +				  <0>,		/* ap_2_ap_fixed */
> > +				  <0>,		/* bp_2_ap */
> > +				  <0>,		/* loopback_on_dsp_side */
> > +				  <0>,		/* mcu_interrupt_only */
> > +				  <0>,		/* firi_2_per */
> > +				  <0>,		/* firi_2_mcu */
> > +				  <0>,		/* per_2_firi */
> > +				  <0>,		/* mcu_2_firi */
> > +				  <0>,		/* uart_2_per */
> > +				  <817>,	/* uart_2_mcu */
> > +				  <0>,		/* per_2_app */
> > +				  <747>,	/* mcu_2_app */
> > +				  <0>,		/* per_2_per */
> > +				  <0>,		/* uartsh_2_per */
> > +				  <0>,		/* uartsh_2_mcu */
> > +				  <0>,		/* per_2_shp */
> > +				  <961>,	/* mcu_2_shp */
> > +				  <1473>,	/* ata_2_mcu */
> > +				  <1392>,	/* mcu_2_ata */
> > +				  <1033>,	/* app_2_per */
> > +				  <683>,	/* app_2_mcu */
> > +				  <1251>,	/* shp_2_per */
> > +				  <892>,	/* shp_2_mcu */
> > +				  <0>,		/* mshc_2_mcu */
> > +				  <0>,		/* mcu_2_mshc */
> > +				  <0>,		/* spdif_2_mcu */
> > +				  <0>,		/* mcu_2_spdif */
> > +				  <0>,		/* asrc_2_mcu */
> > +				  <0>,		/* ext_mem_2_ipu */
> > +				  <0>,		/* descrambler */
> > +				  <0>,		/* dptc_dvfs */
> > +				  <0>,		/* utra_addr */
> > +				  <0>;		/* ram_code_start */
> 
> This looks icky.  Where do these numbers come from?  How are the
> offsets loaded into ram?  Are they properties of the firmware blob?
> If so, then maybe they should be embedded in the firmware blob instead
> of encoded in a DT that may become out of sync.

They are embedded in the firmware blob already and the current dma
driver uses these values to initialize the script addresses.

The SDMA firmware is split into two parts, one in an internal ROM
and one in RAM. So it's possible to run the SDMA engine (with limited
functionality) without an external firmware blob. The ROM addresses are currently contained
in platform_data. Don't know if it makes sense to move them to the
device tree though.

(That said, the current implementation of the SDMA driver does not
work without external firmware, but this is a software issue only)

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
@ 2011-07-15  7:32             ` Sascha Hauer
  0 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  7:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 14, 2011 at 08:54:13PM -0600, Grant Likely wrote:
> On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> > It adds device tree probe support for imx-sdma driver.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Grant Likely <grant.likely@secretlab.ca>
> > Cc: Vinod Koul <vinod.koul@intel.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
> >  drivers/dma/imx-sdma.c                             |   29 +++++++++-
> >  2 files changed, 81 insertions(+), 3 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > new file mode 100644
> > index 0000000..71f4525
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > @@ -0,0 +1,55 @@
> > +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> > +
> > +Required properties:
> > +- compatible : Should be "fsl,<chip>-sdma"
> > +- reg : Should contain SDMA registers location and length
> > +- interrupts : Should contain SDMA interrupt
> > +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> > +  firmware
> > +- fsl,sdma-script-address : Should be an array giving entry address for each
> > +  script.  The address should be 0 in case that the specified script is not
> > +  included in the firmware.  See example below for the array details.
> > +
> > +Examples:
> > +
> > +sdma at 83fb0000 {
> > +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> > +	reg = <0x83fb0000 0x4000>;
> > +	interrupts = <6>;
> > +	fsl,sdma-script-name = "sdma-imx51.bin";
> > +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> > +				  <0>,		/* ap_2_bp */
> > +				  <0>,		/* ap_2_ap_fixed */
> > +				  <0>,		/* bp_2_ap */
> > +				  <0>,		/* loopback_on_dsp_side */
> > +				  <0>,		/* mcu_interrupt_only */
> > +				  <0>,		/* firi_2_per */
> > +				  <0>,		/* firi_2_mcu */
> > +				  <0>,		/* per_2_firi */
> > +				  <0>,		/* mcu_2_firi */
> > +				  <0>,		/* uart_2_per */
> > +				  <817>,	/* uart_2_mcu */
> > +				  <0>,		/* per_2_app */
> > +				  <747>,	/* mcu_2_app */
> > +				  <0>,		/* per_2_per */
> > +				  <0>,		/* uartsh_2_per */
> > +				  <0>,		/* uartsh_2_mcu */
> > +				  <0>,		/* per_2_shp */
> > +				  <961>,	/* mcu_2_shp */
> > +				  <1473>,	/* ata_2_mcu */
> > +				  <1392>,	/* mcu_2_ata */
> > +				  <1033>,	/* app_2_per */
> > +				  <683>,	/* app_2_mcu */
> > +				  <1251>,	/* shp_2_per */
> > +				  <892>,	/* shp_2_mcu */
> > +				  <0>,		/* mshc_2_mcu */
> > +				  <0>,		/* mcu_2_mshc */
> > +				  <0>,		/* spdif_2_mcu */
> > +				  <0>,		/* mcu_2_spdif */
> > +				  <0>,		/* asrc_2_mcu */
> > +				  <0>,		/* ext_mem_2_ipu */
> > +				  <0>,		/* descrambler */
> > +				  <0>,		/* dptc_dvfs */
> > +				  <0>,		/* utra_addr */
> > +				  <0>;		/* ram_code_start */
> 
> This looks icky.  Where do these numbers come from?  How are the
> offsets loaded into ram?  Are they properties of the firmware blob?
> If so, then maybe they should be embedded in the firmware blob instead
> of encoded in a DT that may become out of sync.

They are embedded in the firmware blob already and the current dma
driver uses these values to initialize the script addresses.

The SDMA firmware is split into two parts, one in an internal ROM
and one in RAM. So it's possible to run the SDMA engine (with limited
functionality) without an external firmware blob. The ROM addresses are currently contained
in platform_data. Don't know if it makes sense to move them to the
device tree though.

(That said, the current implementation of the SDMA driver does not
work without external firmware, but this is a software issue only)

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
  2011-07-15  7:32             ` Sascha Hauer
@ 2011-07-15  7:55                 ` Shawn Guo
  -1 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-15  7:55 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: patches-QSEj5FYQhm4dnm+yROfE0A, Vinod Koul,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Jul 15, 2011 at 09:32:50AM +0200, Sascha Hauer wrote:
> On Thu, Jul 14, 2011 at 08:54:13PM -0600, Grant Likely wrote:
> > On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> > > It adds device tree probe support for imx-sdma driver.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> > > Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > > ---
> > >  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
> > >  drivers/dma/imx-sdma.c                             |   29 +++++++++-
> > >  2 files changed, 81 insertions(+), 3 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > new file mode 100644
> > > index 0000000..71f4525
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > @@ -0,0 +1,55 @@
> > > +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> > > +
> > > +Required properties:
> > > +- compatible : Should be "fsl,<chip>-sdma"
> > > +- reg : Should contain SDMA registers location and length
> > > +- interrupts : Should contain SDMA interrupt
> > > +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> > > +  firmware
> > > +- fsl,sdma-script-address : Should be an array giving entry address for each
> > > +  script.  The address should be 0 in case that the specified script is not
> > > +  included in the firmware.  See example below for the array details.
> > > +
> > > +Examples:
> > > +
> > > +sdma@83fb0000 {
> > > +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> > > +	reg = <0x83fb0000 0x4000>;
> > > +	interrupts = <6>;
> > > +	fsl,sdma-script-name = "sdma-imx51.bin";
> > > +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> > > +				  <0>,		/* ap_2_bp */
> > > +				  <0>,		/* ap_2_ap_fixed */
> > > +				  <0>,		/* bp_2_ap */
> > > +				  <0>,		/* loopback_on_dsp_side */
> > > +				  <0>,		/* mcu_interrupt_only */
> > > +				  <0>,		/* firi_2_per */
> > > +				  <0>,		/* firi_2_mcu */
> > > +				  <0>,		/* per_2_firi */
> > > +				  <0>,		/* mcu_2_firi */
> > > +				  <0>,		/* uart_2_per */
> > > +				  <817>,	/* uart_2_mcu */
> > > +				  <0>,		/* per_2_app */
> > > +				  <747>,	/* mcu_2_app */
> > > +				  <0>,		/* per_2_per */
> > > +				  <0>,		/* uartsh_2_per */
> > > +				  <0>,		/* uartsh_2_mcu */
> > > +				  <0>,		/* per_2_shp */
> > > +				  <961>,	/* mcu_2_shp */
> > > +				  <1473>,	/* ata_2_mcu */
> > > +				  <1392>,	/* mcu_2_ata */
> > > +				  <1033>,	/* app_2_per */
> > > +				  <683>,	/* app_2_mcu */
> > > +				  <1251>,	/* shp_2_per */
> > > +				  <892>,	/* shp_2_mcu */
> > > +				  <0>,		/* mshc_2_mcu */
> > > +				  <0>,		/* mcu_2_mshc */
> > > +				  <0>,		/* spdif_2_mcu */
> > > +				  <0>,		/* mcu_2_spdif */
> > > +				  <0>,		/* asrc_2_mcu */
> > > +				  <0>,		/* ext_mem_2_ipu */
> > > +				  <0>,		/* descrambler */
> > > +				  <0>,		/* dptc_dvfs */
> > > +				  <0>,		/* utra_addr */
> > > +				  <0>;		/* ram_code_start */
> > 
> > This looks icky.  Where do these numbers come from?  How are the
> > offsets loaded into ram?  Are they properties of the firmware blob?
> > If so, then maybe they should be embedded in the firmware blob instead
> > of encoded in a DT that may become out of sync.
> 
> They are embedded in the firmware blob already and the current dma
> driver uses these values to initialize the script addresses.
> 
> The SDMA firmware is split into two parts, one in an internal ROM
> and one in RAM. So it's possible to run the SDMA engine (with limited
> functionality) without an external firmware blob. The ROM addresses are currently contained
> in platform_data. Don't know if it makes sense to move them to the
> device tree though.
> 
I just noticed that I messed the thing up.  Right, RAM script already
encodes address in the firmware.  And what platform data passes are
address of ROM script.

Considering icky binding above and the fact that we usually need a
RAM version script to get full functionality and possible bug fix /
improvements, I would not bother to move ROM script address into
device tree.

I would send updates to force dt probe to use RAM script (firmware).
If it's missing, dt probe fails.

-- 
Regards,
Shawn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support
@ 2011-07-15  7:55                 ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-15  7:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2011 at 09:32:50AM +0200, Sascha Hauer wrote:
> On Thu, Jul 14, 2011 at 08:54:13PM -0600, Grant Likely wrote:
> > On Fri, Jul 15, 2011 at 12:14:17AM +0800, Shawn Guo wrote:
> > > It adds device tree probe support for imx-sdma driver.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > > Cc: Grant Likely <grant.likely@secretlab.ca>
> > > Cc: Vinod Koul <vinod.koul@intel.com>
> > > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > >  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |   55 ++++++++++++++++++++
> > >  drivers/dma/imx-sdma.c                             |   29 +++++++++-
> > >  2 files changed, 81 insertions(+), 3 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > new file mode 100644
> > > index 0000000..71f4525
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
> > > @@ -0,0 +1,55 @@
> > > +* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
> > > +
> > > +Required properties:
> > > +- compatible : Should be "fsl,<chip>-sdma"
> > > +- reg : Should contain SDMA registers location and length
> > > +- interrupts : Should contain SDMA interrupt
> > > +- fsl,sdma-script-name : Should contain the full path of SDMA RAM scripts
> > > +  firmware
> > > +- fsl,sdma-script-address : Should be an array giving entry address for each
> > > +  script.  The address should be 0 in case that the specified script is not
> > > +  included in the firmware.  See example below for the array details.
> > > +
> > > +Examples:
> > > +
> > > +sdma at 83fb0000 {
> > > +	compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
> > > +	reg = <0x83fb0000 0x4000>;
> > > +	interrupts = <6>;
> > > +	fsl,sdma-script-name = "sdma-imx51.bin";
> > > +	fsl,sdma-script-address = <642>,	/* ap_2_ap */
> > > +				  <0>,		/* ap_2_bp */
> > > +				  <0>,		/* ap_2_ap_fixed */
> > > +				  <0>,		/* bp_2_ap */
> > > +				  <0>,		/* loopback_on_dsp_side */
> > > +				  <0>,		/* mcu_interrupt_only */
> > > +				  <0>,		/* firi_2_per */
> > > +				  <0>,		/* firi_2_mcu */
> > > +				  <0>,		/* per_2_firi */
> > > +				  <0>,		/* mcu_2_firi */
> > > +				  <0>,		/* uart_2_per */
> > > +				  <817>,	/* uart_2_mcu */
> > > +				  <0>,		/* per_2_app */
> > > +				  <747>,	/* mcu_2_app */
> > > +				  <0>,		/* per_2_per */
> > > +				  <0>,		/* uartsh_2_per */
> > > +				  <0>,		/* uartsh_2_mcu */
> > > +				  <0>,		/* per_2_shp */
> > > +				  <961>,	/* mcu_2_shp */
> > > +				  <1473>,	/* ata_2_mcu */
> > > +				  <1392>,	/* mcu_2_ata */
> > > +				  <1033>,	/* app_2_per */
> > > +				  <683>,	/* app_2_mcu */
> > > +				  <1251>,	/* shp_2_per */
> > > +				  <892>,	/* shp_2_mcu */
> > > +				  <0>,		/* mshc_2_mcu */
> > > +				  <0>,		/* mcu_2_mshc */
> > > +				  <0>,		/* spdif_2_mcu */
> > > +				  <0>,		/* mcu_2_spdif */
> > > +				  <0>,		/* asrc_2_mcu */
> > > +				  <0>,		/* ext_mem_2_ipu */
> > > +				  <0>,		/* descrambler */
> > > +				  <0>,		/* dptc_dvfs */
> > > +				  <0>,		/* utra_addr */
> > > +				  <0>;		/* ram_code_start */
> > 
> > This looks icky.  Where do these numbers come from?  How are the
> > offsets loaded into ram?  Are they properties of the firmware blob?
> > If so, then maybe they should be embedded in the firmware blob instead
> > of encoded in a DT that may become out of sync.
> 
> They are embedded in the firmware blob already and the current dma
> driver uses these values to initialize the script addresses.
> 
> The SDMA firmware is split into two parts, one in an internal ROM
> and one in RAM. So it's possible to run the SDMA engine (with limited
> functionality) without an external firmware blob. The ROM addresses are currently contained
> in platform_data. Don't know if it makes sense to move them to the
> device tree though.
> 
I just noticed that I messed the thing up.  Right, RAM script already
encodes address in the firmware.  And what platform data passes are
address of ROM script.

Considering icky binding above and the fact that we usually need a
RAM version script to get full functionality and possible bug fix /
improvements, I would not bother to move ROM script address into
device tree.

I would send updates to force dt probe to use RAM script (firmware).
If it's missing, dt probe fails.

-- 
Regards,
Shawn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
  2011-07-14 16:14     ` Shawn Guo
@ 2011-07-15  8:01         ` Sascha Hauer
  -1 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  8:01 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> It might be not good to use software defined version to identify sdma
> device type, when hardware does not define such version.  Instead,
> soc name is stable enough to define the device type.
> 
> The patch uses platform_device_id rather than version number passed
> by platform data to identify sdma device type/version.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Generally Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

However, I find no branch to apply this on. This patch *mostly* applied
after I merged Grants gpio-next branch into mine and resolved the
resulting merge conflicts.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
@ 2011-07-15  8:01         ` Sascha Hauer
  0 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> It might be not good to use software defined version to identify sdma
> device type, when hardware does not define such version.  Instead,
> soc name is stable enough to define the device type.
> 
> The patch uses platform_device_id rather than version number passed
> by platform data to identify sdma device type/version.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Generally Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

However, I find no branch to apply this on. This patch *mostly* applied
after I merged Grants gpio-next branch into mine and resolved the
resulting merge conflicts.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
  2011-07-15  8:01         ` Sascha Hauer
@ 2011-07-15  8:22           ` Shawn Guo
  -1 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-15  8:22 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Vinod Koul, devicetree-discuss, Shawn Guo, linux-arm-kernel, patches

Hi Sascha,

On Fri, Jul 15, 2011 at 10:01:32AM +0200, Sascha Hauer wrote:
> On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> > It might be not good to use software defined version to identify sdma
> > device type, when hardware does not define such version.  Instead,
> > soc name is stable enough to define the device type.
> > 
> > The patch uses platform_device_id rather than version number passed
> > by platform data to identify sdma device type/version.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> 
> Generally Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> However, I find no branch to apply this on. This patch *mostly* applied
> after I merged Grants gpio-next branch into mine and resolved the
> resulting merge conflicts.
> 
I appreciate it, if you can do that.  Otherwise, maybe we can let it
rest for a while until all trees get merged in coming -rc window.

-- 
Regards,
Shawn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
@ 2011-07-15  8:22           ` Shawn Guo
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2011-07-15  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha,

On Fri, Jul 15, 2011 at 10:01:32AM +0200, Sascha Hauer wrote:
> On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> > It might be not good to use software defined version to identify sdma
> > device type, when hardware does not define such version.  Instead,
> > soc name is stable enough to define the device type.
> > 
> > The patch uses platform_device_id rather than version number passed
> > by platform data to identify sdma device type/version.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> 
> Generally Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> However, I find no branch to apply this on. This patch *mostly* applied
> after I merged Grants gpio-next branch into mine and resolved the
> resulting merge conflicts.
> 
I appreciate it, if you can do that.  Otherwise, maybe we can let it
rest for a while until all trees get merged in coming -rc window.

-- 
Regards,
Shawn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
  2011-07-15  8:22           ` Shawn Guo
@ 2011-07-15  8:25               ` Sascha Hauer
  -1 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  8:25 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Vinod Koul, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Fri, Jul 15, 2011 at 04:22:05PM +0800, Shawn Guo wrote:
> Hi Sascha,
> 
> On Fri, Jul 15, 2011 at 10:01:32AM +0200, Sascha Hauer wrote:
> > On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> > > It might be not good to use software defined version to identify sdma
> > > device type, when hardware does not define such version.  Instead,
> > > soc name is stable enough to define the device type.
> > > 
> > > The patch uses platform_device_id rather than version number passed
> > > by platform data to identify sdma device type/version.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > 
> > Generally Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > 
> > However, I find no branch to apply this on. This patch *mostly* applied
> > after I merged Grants gpio-next branch into mine and resolved the
> > resulting merge conflicts.
> > 
> I appreciate it, if you can do that.

Do what? apply it mostly?

>  Otherwise, maybe we can let it
> rest for a while until all trees get merged in coming -rc window.

Yes please. I don't want to move i.MX in the merge conflict focus again,
this wouldn't be good for all of us.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version
@ 2011-07-15  8:25               ` Sascha Hauer
  0 siblings, 0 replies; 20+ messages in thread
From: Sascha Hauer @ 2011-07-15  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2011 at 04:22:05PM +0800, Shawn Guo wrote:
> Hi Sascha,
> 
> On Fri, Jul 15, 2011 at 10:01:32AM +0200, Sascha Hauer wrote:
> > On Fri, Jul 15, 2011 at 12:14:16AM +0800, Shawn Guo wrote:
> > > It might be not good to use software defined version to identify sdma
> > > device type, when hardware does not define such version.  Instead,
> > > soc name is stable enough to define the device type.
> > > 
> > > The patch uses platform_device_id rather than version number passed
> > > by platform data to identify sdma device type/version.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > 
> > Generally Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > However, I find no branch to apply this on. This patch *mostly* applied
> > after I merged Grants gpio-next branch into mine and resolved the
> > resulting merge conflicts.
> > 
> I appreciate it, if you can do that.

Do what? apply it mostly?

>  Otherwise, maybe we can let it
> rest for a while until all trees get merged in coming -rc window.

Yes please. I don't want to move i.MX in the merge conflict focus again,
this wouldn't be good for all of us.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-07-15  8:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14 16:14 [PATCH 0/2] Add device tree probe for imx-sdma driver Shawn Guo
2011-07-14 16:14 ` Shawn Guo
     [not found] ` <1310660057-17953-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-14 16:14   ` [PATCH 1/2] dmaengine: imx-sdma: use platform_device_id to identify sdma version Shawn Guo
2011-07-14 16:14     ` Shawn Guo
     [not found]     ` <1310660057-17953-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:54       ` Grant Likely
2011-07-15  2:54         ` Grant Likely
2011-07-15  8:01       ` Sascha Hauer
2011-07-15  8:01         ` Sascha Hauer
2011-07-15  8:22         ` Shawn Guo
2011-07-15  8:22           ` Shawn Guo
     [not found]           ` <20110715082204.GD1840-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-15  8:25             ` Sascha Hauer
2011-07-15  8:25               ` Sascha Hauer
2011-07-14 16:14   ` [PATCH 2/2] dmaengine: imx-sdma: add device tree probe support Shawn Guo
2011-07-14 16:14     ` Shawn Guo
     [not found]     ` <1310660057-17953-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:54       ` Grant Likely
2011-07-15  2:54         ` Grant Likely
     [not found]         ` <20110715025413.GJ2927-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-15  7:32           ` Sascha Hauer
2011-07-15  7:32             ` Sascha Hauer
     [not found]             ` <20110715073250.GH6069-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-07-15  7:55               ` Shawn Guo
2011-07-15  7:55                 ` Shawn Guo

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.