* [PATCH 0/5] dma: mxs-dma: make driver mach-independent and add dt support
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: b32955-KZfg59tc24xl57MIdRCFDg, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ
This patch series make the mxs-dma driver mach-independent which can be
used by imx6q and other compatible platforms in the future and also add
the dt support.
This first patch depends on Wolfram's
[PATCH V2 1/3] lib: add support for stmp-style devices
http://www.spinics.net/lists/arm-kernel/msg166232.html
which is still not in mainline.
Dong Aisheng (5):
dma: mxs-dma: use global stmp_device functionality
dma: mxs-dma: make platform_device_id more generic
dma: mxs-dma: add device tree probe support
ARM: mxs: do not add dma device by default
ARM: mx28evk: add mxs-dma dt support
.../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++
arch/arm/boot/dts/imx28.dtsi | 4 +-
arch/arm/mach-mxs/clock-mx23.c | 4 +-
arch/arm/mach-mxs/clock-mx28.c | 6 +-
arch/arm/mach-mxs/devices-mx23.h | 2 +
arch/arm/mach-mxs/devices-mx28.h | 2 +
arch/arm/mach-mxs/devices/platform-dma.c | 17 +-
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
drivers/dma/Kconfig | 1 +
drivers/dma/mxs-dma.c | 163 +++++++++++++++-----
include/linux/fsl/mxs-dma.h | 12 +--
16 files changed, 174 insertions(+), 64 deletions(-)
create mode 100644 Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 0/5] dma: mxs-dma: make driver mach-independent and add dt support
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
This patch series make the mxs-dma driver mach-independent which can be
used by imx6q and other compatible platforms in the future and also add
the dt support.
This first patch depends on Wolfram's
[PATCH V2 1/3] lib: add support for stmp-style devices
http://www.spinics.net/lists/arm-kernel/msg166232.html
which is still not in mainline.
Dong Aisheng (5):
dma: mxs-dma: use global stmp_device functionality
dma: mxs-dma: make platform_device_id more generic
dma: mxs-dma: add device tree probe support
ARM: mxs: do not add dma device by default
ARM: mx28evk: add mxs-dma dt support
.../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++
arch/arm/boot/dts/imx28.dtsi | 4 +-
arch/arm/mach-mxs/clock-mx23.c | 4 +-
arch/arm/mach-mxs/clock-mx28.c | 6 +-
arch/arm/mach-mxs/devices-mx23.h | 2 +
arch/arm/mach-mxs/devices-mx28.h | 2 +
arch/arm/mach-mxs/devices/platform-dma.c | 17 +-
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
drivers/dma/Kconfig | 1 +
drivers/dma/mxs-dma.c | 163 +++++++++++++++-----
include/linux/fsl/mxs-dma.h | 12 +--
16 files changed, 174 insertions(+), 64 deletions(-)
create mode 100644 Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 1/5] dma: mxs-dma: use global stmp_device functionality
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 12:46 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: b32955-KZfg59tc24xl57MIdRCFDg, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ
From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
This can get rid of the mach-dependency.
Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
This patch depends on Wolfram's
[PATCH V2 1/3] lib: add support for stmp-style devices
http://www.spinics.net/lists/arm-kernel/msg166232.html
which is still not in mainline.
---
drivers/dma/Kconfig | 1 +
drivers/dma/mxs-dma.c | 27 +++++++++++++--------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index cf9da36..af2a29f 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -239,6 +239,7 @@ config IMX_DMA
config MXS_DMA
bool "MXS DMA support"
depends on SOC_IMX23 || SOC_IMX28
+ select STMP_DEVICE
select DMA_ENGINE
help
Support the MXS DMA engine. This engine including APBH-DMA
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index c81ef7e..b0051a8 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -23,10 +23,9 @@
#include <linux/dmaengine.h>
#include <linux/delay.h>
#include <linux/fsl/mxs-dma.h>
+#include <linux/stmp_device.h>
#include <asm/irq.h>
-#include <mach/mxs.h>
-#include <mach/common.h>
#include "dmaengine.h"
@@ -138,10 +137,10 @@ static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
if (dma_is_apbh() && apbh_is_old())
writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL),
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
else
writel(1 << (chan_id + BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL),
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_SET);
}
static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
@@ -170,10 +169,10 @@ static void mxs_dma_pause_chan(struct mxs_dma_chan *mxs_chan)
/* freeze the channel */
if (dma_is_apbh() && apbh_is_old())
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
else
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_SET);
mxs_chan->status = DMA_PAUSED;
}
@@ -186,10 +185,10 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
/* unfreeze the channel */
if (dma_is_apbh() && apbh_is_old())
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_CLR);
else
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_CLR_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_CLR);
mxs_chan->status = DMA_IN_PROGRESS;
}
@@ -224,11 +223,11 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id)
/* completion status */
stat1 = readl(mxs_dma->base + HW_APBHX_CTRL1);
stat1 &= MXS_DMA_CHANNELS_MASK;
- writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + MXS_CLR_ADDR);
+ writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_CLR);
/* error status */
stat2 = readl(mxs_dma->base + HW_APBHX_CTRL2);
- writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + MXS_CLR_ADDR);
+ writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + STMP_OFFSET_REG_CLR);
/*
* When both completion and error of termination bits set at the
@@ -571,7 +570,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
if (ret)
return ret;
- ret = mxs_reset_block(mxs_dma->base);
+ ret = stmp_reset_block(mxs_dma->base);
if (ret)
goto err_out;
@@ -584,14 +583,14 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
/* enable apbh burst */
if (dma_is_apbh()) {
writel(BM_APBH_CTRL0_APB_BURST_EN,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
writel(BM_APBH_CTRL0_APB_BURST8_EN,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
}
/* enable irq for all the channels */
writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
- mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_SET);
err_out:
clk_disable_unprepare(mxs_dma->clk);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 1/5] dma: mxs-dma: use global stmp_device functionality
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
This can get rid of the mach-dependency.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
This patch depends on Wolfram's
[PATCH V2 1/3] lib: add support for stmp-style devices
http://www.spinics.net/lists/arm-kernel/msg166232.html
which is still not in mainline.
---
drivers/dma/Kconfig | 1 +
drivers/dma/mxs-dma.c | 27 +++++++++++++--------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index cf9da36..af2a29f 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -239,6 +239,7 @@ config IMX_DMA
config MXS_DMA
bool "MXS DMA support"
depends on SOC_IMX23 || SOC_IMX28
+ select STMP_DEVICE
select DMA_ENGINE
help
Support the MXS DMA engine. This engine including APBH-DMA
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index c81ef7e..b0051a8 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -23,10 +23,9 @@
#include <linux/dmaengine.h>
#include <linux/delay.h>
#include <linux/fsl/mxs-dma.h>
+#include <linux/stmp_device.h>
#include <asm/irq.h>
-#include <mach/mxs.h>
-#include <mach/common.h>
#include "dmaengine.h"
@@ -138,10 +137,10 @@ static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
if (dma_is_apbh() && apbh_is_old())
writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL),
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
else
writel(1 << (chan_id + BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL),
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_SET);
}
static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
@@ -170,10 +169,10 @@ static void mxs_dma_pause_chan(struct mxs_dma_chan *mxs_chan)
/* freeze the channel */
if (dma_is_apbh() && apbh_is_old())
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
else
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_SET);
mxs_chan->status = DMA_PAUSED;
}
@@ -186,10 +185,10 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
/* unfreeze the channel */
if (dma_is_apbh() && apbh_is_old())
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_CLR);
else
writel(1 << chan_id,
- mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_CLR_ADDR);
+ mxs_dma->base + HW_APBHX_CHANNEL_CTRL + STMP_OFFSET_REG_CLR);
mxs_chan->status = DMA_IN_PROGRESS;
}
@@ -224,11 +223,11 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id)
/* completion status */
stat1 = readl(mxs_dma->base + HW_APBHX_CTRL1);
stat1 &= MXS_DMA_CHANNELS_MASK;
- writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + MXS_CLR_ADDR);
+ writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_CLR);
/* error status */
stat2 = readl(mxs_dma->base + HW_APBHX_CTRL2);
- writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + MXS_CLR_ADDR);
+ writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + STMP_OFFSET_REG_CLR);
/*
* When both completion and error of termination bits set at the
@@ -571,7 +570,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
if (ret)
return ret;
- ret = mxs_reset_block(mxs_dma->base);
+ ret = stmp_reset_block(mxs_dma->base);
if (ret)
goto err_out;
@@ -584,14 +583,14 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
/* enable apbh burst */
if (dma_is_apbh()) {
writel(BM_APBH_CTRL0_APB_BURST_EN,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
writel(BM_APBH_CTRL0_APB_BURST8_EN,
- mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
}
/* enable irq for all the channels */
writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
- mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
+ mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_SET);
err_out:
clk_disable_unprepare(mxs_dma->clk);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 12:46 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: b32955, vinod.koul, devicetree-discuss, rob.herring,
grant.likely, marek.vasut, kernel, dan.j.williams, s.hauer,
shawn.guo
From: Dong Aisheng <dong.aisheng@linaro.org>
Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
other SoCs like imx6q and reform the platform_device_id for the
better further dt support.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/mach-mxs/clock-mx23.c | 4 +-
arch/arm/mach-mxs/clock-mx28.c | 4 +-
arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
include/linux/fsl/mxs-dma.h | 12 +---
5 files changed, 101 insertions(+), 44 deletions(-)
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index e3ac52c..1e67b85 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("duart", NULL, uart_clk)
_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
_REGISTER_CLOCK("rtc", NULL, rtc_clk)
- _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
- _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
+ _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
_REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
_REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
_REGISTER_CLOCK(NULL, "usb", usb_clk)
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 1867a17..cca2cf7 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
_REGISTER_CLOCK("rtc", NULL, rtc_clk)
_REGISTER_CLOCK("pll2", NULL, pll2_clk)
- _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
- _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
+ _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
_REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
_REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
_REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index 6a0202b..aff4813 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
static int __init mxs_add_mxs_dma(void)
{
- char *apbh = "mxs-dma-apbh";
- char *apbx = "mxs-dma-apbx";
+ char *mx23_apbh = "imx23-dma-apbh";
+ char *mx23_apbx = "imx23-dma-apbx";
+ char *mx28_apbh = "imx28-dma-apbh";
+ char *mx28_apbx = "imx28-dma-apbx";
if (cpu_is_mx23()) {
- mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
- mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
+ mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
+ mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
}
if (cpu_is_mx28()) {
- mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
- mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
+ mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
+ mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
}
return 0;
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index b0051a8..51a29f9 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -50,7 +50,8 @@
#define HW_APBHX_CTRL2 0x020
#define HW_APBHX_CHANNEL_CTRL 0x030
#define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
-#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
+#define HW_APBH_VERSION_IMX23 0x3f0
+#define HW_APBH_VERSION_IMX28 0x800
#define HW_APBX_VERSION 0x800
#define BP_APBHX_VERSION_MAJOR 24
#define HW_APBHX_CHn_NXTCMDAR(n) \
@@ -121,7 +122,8 @@ struct mxs_dma_chan {
#define MXS_DMA_CHANNELS_MASK 0xffff
struct mxs_dma_engine {
- int dev_id;
+ unsigned int type;
+ unsigned int dev_id;
unsigned int version;
void __iomem *base;
struct clk *clk;
@@ -130,6 +132,74 @@ struct mxs_dma_engine {
struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
};
+enum mxs_dma_devtype {
+ IMX23_DMA,
+ IMX28_DMA,
+};
+
+struct mxs_dma_type {
+ unsigned int type;
+ unsigned int id;
+};
+
+static struct mxs_dma_type mxs_dma_types[] = {
+ {
+ .type = IMX23_DMA,
+ .id = MXS_DMA_APBH,
+ }, {
+ .type = IMX23_DMA,
+ .id = MXS_DMA_APBX,
+ }, {
+ .type = IMX28_DMA,
+ .id = MXS_DMA_APBH,
+ }, {
+ .type = IMX28_DMA,
+ .id = MXS_DMA_APBX,
+ }, {
+ /* end of list */
+ }
+};
+
+static struct platform_device_id mxs_dma_idt[] = {
+ {
+ .name = "imx23-dma-apbh",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
+ }, {
+ .name = "imx23-dma-apbx",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
+ }, {
+ .name = "imx28-dma-apbh",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
+ }, {
+ .name = "imx28-dma-apbx",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
+ }, {
+ /* end of list */
+ }
+};
+
+static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
+{
+ return container_of(chan, struct mxs_dma_chan, chan);
+}
+
+int mxs_dma_is_apbh(struct dma_chan *chan)
+{
+ struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
+ struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+
+ return dma_is_apbh();
+}
+
+int mxs_dma_is_apbx(struct dma_chan *chan)
+{
+ struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
+ struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+
+ return !dma_is_apbh();
+}
+
+
static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
{
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
mxs_chan->status = DMA_IN_PROGRESS;
}
-static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
-{
- return container_of(chan, struct mxs_dma_chan, chan);
-}
-
static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
{
struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
@@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
if (ret)
goto err_out;
- /* only major version matters */
- mxs_dma->version = readl(mxs_dma->base +
+ if (mxs_dma->type == IMX23_DMA) {
+ /* only major version matters */
+ mxs_dma->version = readl(mxs_dma->base +
((mxs_dma->dev_id == MXS_DMA_APBX) ?
- HW_APBX_VERSION : HW_APBH_VERSION)) >>
+ HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
BP_APBHX_VERSION_MAJOR;
+ } else if (mxs_dma->type == IMX28_DMA) {
+ mxs_dma->version = readl(mxs_dma->base +
+ ((mxs_dma->dev_id == MXS_DMA_APBX) ?
+ HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
+ BP_APBHX_VERSION_MAJOR;
+ }
/* enable apbh burst */
if (dma_is_apbh()) {
@@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
{
const struct platform_device_id *id_entry =
platform_get_device_id(pdev);
+ const struct mxs_dma_type *mtype =
+ (struct mxs_dma_type *)id_entry->driver_data;
struct mxs_dma_engine *mxs_dma;
struct resource *iores;
int ret, i;
@@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
if (!mxs_dma)
return -ENOMEM;
- mxs_dma->dev_id = id_entry->driver_data;
+ mxs_dma->type = mtype->type;
+ mxs_dma->dev_id = mtype->id;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -692,23 +767,11 @@ err_request_region:
return ret;
}
-static struct platform_device_id mxs_dma_type[] = {
- {
- .name = "mxs-dma-apbh",
- .driver_data = MXS_DMA_APBH,
- }, {
- .name = "mxs-dma-apbx",
- .driver_data = MXS_DMA_APBX,
- }, {
- /* end of list */
- }
-};
-
static struct platform_driver mxs_dma_driver = {
.driver = {
.name = "mxs-dma",
},
- .id_table = mxs_dma_type,
+ .id_table = mxs_dma_idt,
};
static int __init mxs_dma_module_init(void)
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
index 203d7c4..55d8702 100644
--- a/include/linux/fsl/mxs-dma.h
+++ b/include/linux/fsl/mxs-dma.h
@@ -15,14 +15,6 @@ struct mxs_dma_data {
int chan_irq;
};
-static inline int mxs_dma_is_apbh(struct dma_chan *chan)
-{
- return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
-}
-
-static inline int mxs_dma_is_apbx(struct dma_chan *chan)
-{
- return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
-}
-
+extern int mxs_dma_is_apbh(struct dma_chan *chan);
+extern int mxs_dma_is_apbx(struct dma_chan *chan);
#endif /* __MACH_MXS_DMA_H__ */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
other SoCs like imx6q and reform the platform_device_id for the
better further dt support.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/mach-mxs/clock-mx23.c | 4 +-
arch/arm/mach-mxs/clock-mx28.c | 4 +-
arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
include/linux/fsl/mxs-dma.h | 12 +---
5 files changed, 101 insertions(+), 44 deletions(-)
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index e3ac52c..1e67b85 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("duart", NULL, uart_clk)
_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
_REGISTER_CLOCK("rtc", NULL, rtc_clk)
- _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
- _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
+ _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
_REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
_REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
_REGISTER_CLOCK(NULL, "usb", usb_clk)
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 1867a17..cca2cf7 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
_REGISTER_CLOCK("rtc", NULL, rtc_clk)
_REGISTER_CLOCK("pll2", NULL, pll2_clk)
- _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
- _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
+ _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
_REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
_REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
_REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index 6a0202b..aff4813 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
static int __init mxs_add_mxs_dma(void)
{
- char *apbh = "mxs-dma-apbh";
- char *apbx = "mxs-dma-apbx";
+ char *mx23_apbh = "imx23-dma-apbh";
+ char *mx23_apbx = "imx23-dma-apbx";
+ char *mx28_apbh = "imx28-dma-apbh";
+ char *mx28_apbx = "imx28-dma-apbx";
if (cpu_is_mx23()) {
- mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
- mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
+ mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
+ mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
}
if (cpu_is_mx28()) {
- mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
- mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
+ mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
+ mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
}
return 0;
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index b0051a8..51a29f9 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -50,7 +50,8 @@
#define HW_APBHX_CTRL2 0x020
#define HW_APBHX_CHANNEL_CTRL 0x030
#define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
-#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
+#define HW_APBH_VERSION_IMX23 0x3f0
+#define HW_APBH_VERSION_IMX28 0x800
#define HW_APBX_VERSION 0x800
#define BP_APBHX_VERSION_MAJOR 24
#define HW_APBHX_CHn_NXTCMDAR(n) \
@@ -121,7 +122,8 @@ struct mxs_dma_chan {
#define MXS_DMA_CHANNELS_MASK 0xffff
struct mxs_dma_engine {
- int dev_id;
+ unsigned int type;
+ unsigned int dev_id;
unsigned int version;
void __iomem *base;
struct clk *clk;
@@ -130,6 +132,74 @@ struct mxs_dma_engine {
struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
};
+enum mxs_dma_devtype {
+ IMX23_DMA,
+ IMX28_DMA,
+};
+
+struct mxs_dma_type {
+ unsigned int type;
+ unsigned int id;
+};
+
+static struct mxs_dma_type mxs_dma_types[] = {
+ {
+ .type = IMX23_DMA,
+ .id = MXS_DMA_APBH,
+ }, {
+ .type = IMX23_DMA,
+ .id = MXS_DMA_APBX,
+ }, {
+ .type = IMX28_DMA,
+ .id = MXS_DMA_APBH,
+ }, {
+ .type = IMX28_DMA,
+ .id = MXS_DMA_APBX,
+ }, {
+ /* end of list */
+ }
+};
+
+static struct platform_device_id mxs_dma_idt[] = {
+ {
+ .name = "imx23-dma-apbh",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
+ }, {
+ .name = "imx23-dma-apbx",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
+ }, {
+ .name = "imx28-dma-apbh",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
+ }, {
+ .name = "imx28-dma-apbx",
+ .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
+ }, {
+ /* end of list */
+ }
+};
+
+static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
+{
+ return container_of(chan, struct mxs_dma_chan, chan);
+}
+
+int mxs_dma_is_apbh(struct dma_chan *chan)
+{
+ struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
+ struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+
+ return dma_is_apbh();
+}
+
+int mxs_dma_is_apbx(struct dma_chan *chan)
+{
+ struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
+ struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+
+ return !dma_is_apbh();
+}
+
+
static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
{
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
mxs_chan->status = DMA_IN_PROGRESS;
}
-static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
-{
- return container_of(chan, struct mxs_dma_chan, chan);
-}
-
static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
{
struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
@@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
if (ret)
goto err_out;
- /* only major version matters */
- mxs_dma->version = readl(mxs_dma->base +
+ if (mxs_dma->type == IMX23_DMA) {
+ /* only major version matters */
+ mxs_dma->version = readl(mxs_dma->base +
((mxs_dma->dev_id == MXS_DMA_APBX) ?
- HW_APBX_VERSION : HW_APBH_VERSION)) >>
+ HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
BP_APBHX_VERSION_MAJOR;
+ } else if (mxs_dma->type == IMX28_DMA) {
+ mxs_dma->version = readl(mxs_dma->base +
+ ((mxs_dma->dev_id == MXS_DMA_APBX) ?
+ HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
+ BP_APBHX_VERSION_MAJOR;
+ }
/* enable apbh burst */
if (dma_is_apbh()) {
@@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
{
const struct platform_device_id *id_entry =
platform_get_device_id(pdev);
+ const struct mxs_dma_type *mtype =
+ (struct mxs_dma_type *)id_entry->driver_data;
struct mxs_dma_engine *mxs_dma;
struct resource *iores;
int ret, i;
@@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
if (!mxs_dma)
return -ENOMEM;
- mxs_dma->dev_id = id_entry->driver_data;
+ mxs_dma->type = mtype->type;
+ mxs_dma->dev_id = mtype->id;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -692,23 +767,11 @@ err_request_region:
return ret;
}
-static struct platform_device_id mxs_dma_type[] = {
- {
- .name = "mxs-dma-apbh",
- .driver_data = MXS_DMA_APBH,
- }, {
- .name = "mxs-dma-apbx",
- .driver_data = MXS_DMA_APBX,
- }, {
- /* end of list */
- }
-};
-
static struct platform_driver mxs_dma_driver = {
.driver = {
.name = "mxs-dma",
},
- .id_table = mxs_dma_type,
+ .id_table = mxs_dma_idt,
};
static int __init mxs_dma_module_init(void)
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
index 203d7c4..55d8702 100644
--- a/include/linux/fsl/mxs-dma.h
+++ b/include/linux/fsl/mxs-dma.h
@@ -15,14 +15,6 @@ struct mxs_dma_data {
int chan_irq;
};
-static inline int mxs_dma_is_apbh(struct dma_chan *chan)
-{
- return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
-}
-
-static inline int mxs_dma_is_apbx(struct dma_chan *chan)
-{
- return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
-}
-
+extern int mxs_dma_is_apbh(struct dma_chan *chan);
+extern int mxs_dma_is_apbx(struct dma_chan *chan);
#endif /* __MACH_MXS_DMA_H__ */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 12:46 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: b32955, vinod.koul, devicetree-discuss, rob.herring,
grant.likely, marek.vasut, kernel, dan.j.williams, s.hauer,
shawn.guo
From: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Rob Landley <rob@landley.net>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
.../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
new file mode 100644
index 0000000..ded0398
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
@@ -0,0 +1,19 @@
+* Freescale MXS DMA
+
+Required properties:
+- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
+- reg : Should contain registers location and length
+
+Supported chips:
+imx23, imx28.
+
+Examples:
+dma-apbh@80004000 {
+ compatible = "fsl,imx28-dma-apbh";
+ reg = <0x80004000 2000>;
+};
+
+dma-apbx@80024000 {
+ compatible = "fsl,imx28-dma-apbx";
+ reg = <0x80024000 2000>;
+};
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 51a29f9..74c3275 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -22,8 +22,11 @@
#include <linux/platform_device.h>
#include <linux/dmaengine.h>
#include <linux/delay.h>
+#include <linux/module.h>
#include <linux/fsl/mxs-dma.h>
#include <linux/stmp_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <asm/irq.h>
@@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
}
};
+#ifdef CONFIG_OF
+static const struct of_device_id mxs_dma_dt_ids[] = {
+ { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
+ { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
+ { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
+ { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
+#endif
+
static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
{
return container_of(chan, struct mxs_dma_chan, chan);
@@ -671,10 +685,9 @@ err_out:
static int __init mxs_dma_probe(struct platform_device *pdev)
{
- const struct platform_device_id *id_entry =
- platform_get_device_id(pdev);
- const struct mxs_dma_type *mtype =
- (struct mxs_dma_type *)id_entry->driver_data;
+ const struct platform_device_id *id_entry;
+ const struct of_device_id *of_id;
+ const struct mxs_dma_type *mtype;
struct mxs_dma_engine *mxs_dma;
struct resource *iores;
int ret, i;
@@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
if (!mxs_dma)
return -ENOMEM;
+ of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
+ if (of_id)
+ id_entry = of_id->data;
+ else
+ id_entry = platform_get_device_id(pdev);
+
+ mtype = (struct mxs_dma_type *)id_entry->driver_data;
mxs_dma->type = mtype->type;
mxs_dma->dev_id = mtype->id;
@@ -770,6 +790,7 @@ err_request_region:
static struct platform_driver mxs_dma_driver = {
.driver = {
.name = "mxs-dma",
+ .of_match_table = of_match_ptr(mxs_dma_dt_ids),
},
.id_table = mxs_dma_idt,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Rob Landley <rob@landley.net>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
.../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
new file mode 100644
index 0000000..ded0398
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
@@ -0,0 +1,19 @@
+* Freescale MXS DMA
+
+Required properties:
+- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
+- reg : Should contain registers location and length
+
+Supported chips:
+imx23, imx28.
+
+Examples:
+dma-apbh at 80004000 {
+ compatible = "fsl,imx28-dma-apbh";
+ reg = <0x80004000 2000>;
+};
+
+dma-apbx at 80024000 {
+ compatible = "fsl,imx28-dma-apbx";
+ reg = <0x80024000 2000>;
+};
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 51a29f9..74c3275 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -22,8 +22,11 @@
#include <linux/platform_device.h>
#include <linux/dmaengine.h>
#include <linux/delay.h>
+#include <linux/module.h>
#include <linux/fsl/mxs-dma.h>
#include <linux/stmp_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <asm/irq.h>
@@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
}
};
+#ifdef CONFIG_OF
+static const struct of_device_id mxs_dma_dt_ids[] = {
+ { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
+ { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
+ { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
+ { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
+#endif
+
static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
{
return container_of(chan, struct mxs_dma_chan, chan);
@@ -671,10 +685,9 @@ err_out:
static int __init mxs_dma_probe(struct platform_device *pdev)
{
- const struct platform_device_id *id_entry =
- platform_get_device_id(pdev);
- const struct mxs_dma_type *mtype =
- (struct mxs_dma_type *)id_entry->driver_data;
+ const struct platform_device_id *id_entry;
+ const struct of_device_id *of_id;
+ const struct mxs_dma_type *mtype;
struct mxs_dma_engine *mxs_dma;
struct resource *iores;
int ret, i;
@@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
if (!mxs_dma)
return -ENOMEM;
+ of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
+ if (of_id)
+ id_entry = of_id->data;
+ else
+ id_entry = platform_get_device_id(pdev);
+
+ mtype = (struct mxs_dma_type *)id_entry->driver_data;
mxs_dma->type = mtype->type;
mxs_dma->dev_id = mtype->id;
@@ -770,6 +790,7 @@ err_request_region:
static struct platform_driver mxs_dma_driver = {
.driver = {
.name = "mxs-dma",
+ .of_match_table = of_match_ptr(mxs_dma_dt_ids),
},
.id_table = mxs_dma_idt,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 4/5] ARM: mxs: do not add dma device by default
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 12:46 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: b32955, vinod.koul, devicetree-discuss, rob.herring,
grant.likely, marek.vasut, kernel, dan.j.williams, s.hauer,
shawn.guo
From: Dong Aisheng <dong.aisheng@linaro.org>
This will cause conflict when dt is enabled.
So let each platform add dma devices respectively.
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/mach-mxs/devices-mx23.h | 2 ++
arch/arm/mach-mxs/devices-mx28.h | 2 ++
arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
9 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 4d1329d..5fc6b50 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
const struct mxsfb_platform_data *pdata);
struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
+
+#define mx23_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9dbeae1..0b3a62d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst;
mxs_add_saif(&mx28_saif_data[id], pdata)
struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
+
+#define mx28_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index aff4813..d0126ea 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
DMA_BIT_MASK(32));
}
-static int __init mxs_add_mxs_dma(void)
+int __init mxs_add_mxs_dma(void)
{
char *mx23_apbh = "imx23-dma-apbh";
char *mx23_apbx = "imx23-dma-apbx";
@@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
return 0;
}
-arch_initcall(mxs_add_mxs_dma);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index f2e3839..544b38d 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -116,3 +116,6 @@ struct mxs_saif_data {
struct platform_device *__init mxs_add_saif(
const struct mxs_saif_data *data,
const struct mxs_saif_platform_data *pdata);
+
+/* dma */
+int __init mxs_add_mxs_dma(void);
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 48a7fab..92f47e9 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
mxs_iomux_setup_multiple_pads(apx4devkit_pads,
ARRAY_SIZE(apx4devkit_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart1();
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 06d7996..9a74ce6 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -321,6 +321,7 @@ static void __init m28evk_init(void)
{
mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c
index 5ea1c57..cabc884 100644
--- a/arch/arm/mach-mxs/mach-mx23evk.c
+++ b/arch/arm/mach-mxs/mach-mx23evk.c
@@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c
index a626c07..a391b9e 100644
--- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
+++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
@@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
ARRAY_SIZE(stmp378x_dvb_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
mx23_add_rtc_stmp3xxx();
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 2c0862e..e17e262 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
ARRAY_SIZE(tx28_stk5v3_pads));
+ mx28_add_dma();
mx28_add_duart(); /* UART1 */
mx28_add_auart(1); /* UART2 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 4/5] ARM: mxs: do not add dma device by default
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
This will cause conflict when dt is enabled.
So let each platform add dma devices respectively.
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/mach-mxs/devices-mx23.h | 2 ++
arch/arm/mach-mxs/devices-mx28.h | 2 ++
arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
9 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 4d1329d..5fc6b50 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
const struct mxsfb_platform_data *pdata);
struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
+
+#define mx23_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9dbeae1..0b3a62d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst;
mxs_add_saif(&mx28_saif_data[id], pdata)
struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
+
+#define mx28_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index aff4813..d0126ea 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
DMA_BIT_MASK(32));
}
-static int __init mxs_add_mxs_dma(void)
+int __init mxs_add_mxs_dma(void)
{
char *mx23_apbh = "imx23-dma-apbh";
char *mx23_apbx = "imx23-dma-apbx";
@@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
return 0;
}
-arch_initcall(mxs_add_mxs_dma);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index f2e3839..544b38d 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -116,3 +116,6 @@ struct mxs_saif_data {
struct platform_device *__init mxs_add_saif(
const struct mxs_saif_data *data,
const struct mxs_saif_platform_data *pdata);
+
+/* dma */
+int __init mxs_add_mxs_dma(void);
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 48a7fab..92f47e9 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
mxs_iomux_setup_multiple_pads(apx4devkit_pads,
ARRAY_SIZE(apx4devkit_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart1();
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 06d7996..9a74ce6 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -321,6 +321,7 @@ static void __init m28evk_init(void)
{
mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c
index 5ea1c57..cabc884 100644
--- a/arch/arm/mach-mxs/mach-mx23evk.c
+++ b/arch/arm/mach-mxs/mach-mx23evk.c
@@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c
index a626c07..a391b9e 100644
--- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
+++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
@@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
ARRAY_SIZE(stmp378x_dvb_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
mx23_add_rtc_stmp3xxx();
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 2c0862e..e17e262 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
ARRAY_SIZE(tx28_stk5v3_pads));
+ mx28_add_dma();
mx28_add_duart(); /* UART1 */
mx28_add_auart(1); /* UART2 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 5/5] ARM: mx28evk: add mxs-dma dt support
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 12:46 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: b32955, vinod.koul, devicetree-discuss, rob.herring,
grant.likely, marek.vasut, kernel, dan.j.williams, s.hauer,
shawn.guo
From: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/boot/dts/imx28.dtsi | 4 ++--
arch/arm/mach-mxs/clock-mx28.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index d1f4f8c..5f61777 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -52,8 +52,8 @@
};
dma-apbh@80004000 {
+ compatible = "fsl,imx28-dma-apbh";
reg = <0x80004000 2000>;
- status = "disabled";
};
perfmon@80006000 {
@@ -115,8 +115,8 @@
};
dma-apbx@80024000 {
+ compatible = "fsl,imx28-dma-apbx";
reg = <0x80024000 2000>;
- status = "disabled";
};
dcp@80028000 {
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index cca2cf7..9c926b6 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -652,6 +652,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("80074000.serial", NULL, uart_clk)
_REGISTER_CLOCK("800f0000.ethernet", NULL, fec_clk)
_REGISTER_CLOCK("800f4000.ethernet", NULL, fec_clk)
+ _REGISTER_CLOCK("80004000.dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("80024000.dma-apbx", NULL, xbus_clk)
};
static int clk_misc_init(void)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 5/5] ARM: mx28evk: add mxs-dma dt support
@ 2012-04-18 12:46 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-18 12:46 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
arch/arm/boot/dts/imx28.dtsi | 4 ++--
arch/arm/mach-mxs/clock-mx28.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index d1f4f8c..5f61777 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -52,8 +52,8 @@
};
dma-apbh at 80004000 {
+ compatible = "fsl,imx28-dma-apbh";
reg = <0x80004000 2000>;
- status = "disabled";
};
perfmon at 80006000 {
@@ -115,8 +115,8 @@
};
dma-apbx at 80024000 {
+ compatible = "fsl,imx28-dma-apbx";
reg = <0x80024000 2000>;
- status = "disabled";
};
dcp at 80028000 {
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index cca2cf7..9c926b6 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -652,6 +652,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("80074000.serial", NULL, uart_clk)
_REGISTER_CLOCK("800f0000.ethernet", NULL, fec_clk)
_REGISTER_CLOCK("800f4000.ethernet", NULL, fec_clk)
+ _REGISTER_CLOCK("80004000.dma-apbh", NULL, hbus_clk)
+ _REGISTER_CLOCK("80024000.dma-apbx", NULL, xbus_clk)
};
static int clk_misc_init(void)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 1/5] dma: mxs-dma: use global stmp_device functionality
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 18:00 ` Marek Vasut
-1 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:00 UTC (permalink / raw)
To: Dong Aisheng
Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> This can get rid of the mach-dependency.
Reviewed-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> This patch depends on Wolfram's
> [PATCH V2 1/3] lib: add support for stmp-style devices
> http://www.spinics.net/lists/arm-kernel/msg166232.html
> which is still not in mainline.
> ---
> drivers/dma/Kconfig | 1 +
> drivers/dma/mxs-dma.c | 27 +++++++++++++--------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index cf9da36..af2a29f 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -239,6 +239,7 @@ config IMX_DMA
> config MXS_DMA
> bool "MXS DMA support"
> depends on SOC_IMX23 || SOC_IMX28
> + select STMP_DEVICE
> select DMA_ENGINE
> help
> Support the MXS DMA engine. This engine including APBH-DMA
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index c81ef7e..b0051a8 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -23,10 +23,9 @@
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> #include <linux/fsl/mxs-dma.h>
> +#include <linux/stmp_device.h>
>
> #include <asm/irq.h>
> -#include <mach/mxs.h>
> -#include <mach/common.h>
>
> #include "dmaengine.h"
>
> @@ -138,10 +137,10 @@ static void mxs_dma_reset_chan(struct mxs_dma_chan
> *mxs_chan)
>
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL),
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> else
> writel(1 << (chan_id + BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL),
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_SET);
> }
>
> static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
> @@ -170,10 +169,10 @@ static void mxs_dma_pause_chan(struct mxs_dma_chan
> *mxs_chan) /* freeze the channel */
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> else
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_SET);
>
> mxs_chan->status = DMA_PAUSED;
> }
> @@ -186,10 +185,10 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan
> *mxs_chan) /* unfreeze the channel */
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_CLR);
> else
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_CLR_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_CLR);
>
> mxs_chan->status = DMA_IN_PROGRESS;
> }
> @@ -224,11 +223,11 @@ static irqreturn_t mxs_dma_int_handler(int irq, void
> *dev_id) /* completion status */
> stat1 = readl(mxs_dma->base + HW_APBHX_CTRL1);
> stat1 &= MXS_DMA_CHANNELS_MASK;
> - writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + MXS_CLR_ADDR);
> + writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_CLR);
>
> /* error status */
> stat2 = readl(mxs_dma->base + HW_APBHX_CTRL2);
> - writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + MXS_CLR_ADDR);
> + writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + STMP_OFFSET_REG_CLR);
>
> /*
> * When both completion and error of termination bits set at the
> @@ -571,7 +570,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) if (ret)
> return ret;
>
> - ret = mxs_reset_block(mxs_dma->base);
> + ret = stmp_reset_block(mxs_dma->base);
> if (ret)
> goto err_out;
>
> @@ -584,14 +583,14 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) /* enable apbh burst */
> if (dma_is_apbh()) {
> writel(BM_APBH_CTRL0_APB_BURST_EN,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> writel(BM_APBH_CTRL0_APB_BURST8_EN,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> }
>
> /* enable irq for all the channels */
> writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
> - mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_SET);
>
> err_out:
> clk_disable_unprepare(mxs_dma->clk);
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 1/5] dma: mxs-dma: use global stmp_device functionality
@ 2012-04-18 18:00 ` Marek Vasut
0 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:00 UTC (permalink / raw)
To: linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> This can get rid of the mach-dependency.
Reviewed-by: Marek Vasut <marex@denx.de>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> ---
> This patch depends on Wolfram's
> [PATCH V2 1/3] lib: add support for stmp-style devices
> http://www.spinics.net/lists/arm-kernel/msg166232.html
> which is still not in mainline.
> ---
> drivers/dma/Kconfig | 1 +
> drivers/dma/mxs-dma.c | 27 +++++++++++++--------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index cf9da36..af2a29f 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -239,6 +239,7 @@ config IMX_DMA
> config MXS_DMA
> bool "MXS DMA support"
> depends on SOC_IMX23 || SOC_IMX28
> + select STMP_DEVICE
> select DMA_ENGINE
> help
> Support the MXS DMA engine. This engine including APBH-DMA
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index c81ef7e..b0051a8 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -23,10 +23,9 @@
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> #include <linux/fsl/mxs-dma.h>
> +#include <linux/stmp_device.h>
>
> #include <asm/irq.h>
> -#include <mach/mxs.h>
> -#include <mach/common.h>
>
> #include "dmaengine.h"
>
> @@ -138,10 +137,10 @@ static void mxs_dma_reset_chan(struct mxs_dma_chan
> *mxs_chan)
>
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL),
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> else
> writel(1 << (chan_id + BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL),
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_SET);
> }
>
> static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
> @@ -170,10 +169,10 @@ static void mxs_dma_pause_chan(struct mxs_dma_chan
> *mxs_chan) /* freeze the channel */
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> else
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_SET);
>
> mxs_chan->status = DMA_PAUSED;
> }
> @@ -186,10 +185,10 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan
> *mxs_chan) /* unfreeze the channel */
> if (dma_is_apbh() && apbh_is_old())
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_CLR);
> else
> writel(1 << chan_id,
> - mxs_dma->base + HW_APBHX_CHANNEL_CTRL + MXS_CLR_ADDR);
> + mxs_dma->base + HW_APBHX_CHANNEL_CTRL +
STMP_OFFSET_REG_CLR);
>
> mxs_chan->status = DMA_IN_PROGRESS;
> }
> @@ -224,11 +223,11 @@ static irqreturn_t mxs_dma_int_handler(int irq, void
> *dev_id) /* completion status */
> stat1 = readl(mxs_dma->base + HW_APBHX_CTRL1);
> stat1 &= MXS_DMA_CHANNELS_MASK;
> - writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + MXS_CLR_ADDR);
> + writel(stat1, mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_CLR);
>
> /* error status */
> stat2 = readl(mxs_dma->base + HW_APBHX_CTRL2);
> - writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + MXS_CLR_ADDR);
> + writel(stat2, mxs_dma->base + HW_APBHX_CTRL2 + STMP_OFFSET_REG_CLR);
>
> /*
> * When both completion and error of termination bits set at the
> @@ -571,7 +570,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) if (ret)
> return ret;
>
> - ret = mxs_reset_block(mxs_dma->base);
> + ret = stmp_reset_block(mxs_dma->base);
> if (ret)
> goto err_out;
>
> @@ -584,14 +583,14 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) /* enable apbh burst */
> if (dma_is_apbh()) {
> writel(BM_APBH_CTRL0_APB_BURST_EN,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> writel(BM_APBH_CTRL0_APB_BURST8_EN,
> - mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> }
>
> /* enable irq for all the channels */
> writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
> - mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
> + mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_SET);
>
> err_out:
> clk_disable_unprepare(mxs_dma->clk);
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 18:01 ` Marek Vasut
-1 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:01 UTC (permalink / raw)
To: Dong Aisheng
Cc: vinod.koul, devicetree-discuss, rob.herring, grant.likely,
b32955, shawn.guo, kernel, dan.j.williams, s.hauer,
linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> other SoCs like imx6q and reform the platform_device_id for the
> better further dt support.
>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> arch/arm/mach-mxs/clock-mx23.c | 4 +-
> arch/arm/mach-mxs/clock-mx28.c | 4 +-
> arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> drivers/dma/mxs-dma.c | 111
> +++++++++++++++++++++++------- include/linux/fsl/mxs-dma.h |
> 12 +---
> 5 files changed, 101 insertions(+), 44 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/clock-mx23.c
> b/arch/arm/mach-mxs/clock-mx23.c index e3ac52c..1e67b85 100644
> --- a/arch/arm/mach-mxs/clock-mx23.c
> +++ b/arch/arm/mach-mxs/clock-mx23.c
> @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("duart", NULL, uart_clk)
> _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> _REGISTER_CLOCK(NULL, "usb", usb_clk)
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index 1867a17..cca2cf7 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c
> b/arch/arm/mach-mxs/devices/platform-dma.c index 6a0202b..aff4813 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const
> char *devid,
>
> static int __init mxs_add_mxs_dma(void)
> {
> - char *apbh = "mxs-dma-apbh";
> - char *apbx = "mxs-dma-apbx";
> + char *mx23_apbh = "imx23-dma-apbh";
> + char *mx23_apbx = "imx23-dma-apbx";
> + char *mx28_apbh = "imx28-dma-apbh";
> + char *mx28_apbx = "imx28-dma-apbx";
>
> if (cpu_is_mx23()) {
> - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> }
>
> if (cpu_is_mx28()) {
> - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> }
>
> return 0;
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index b0051a8..51a29f9 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -50,7 +50,8 @@
> #define HW_APBHX_CTRL2 0x020
> #define HW_APBHX_CHANNEL_CTRL 0x030
> #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 :
0x800)
> +#define HW_APBH_VERSION_IMX23 0x3f0
> +#define HW_APBH_VERSION_IMX28 0x800
> #define HW_APBX_VERSION 0x800
> #define BP_APBHX_VERSION_MAJOR 24
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> #define MXS_DMA_CHANNELS_MASK 0xffff
>
> struct mxs_dma_engine {
> - int dev_id;
> + unsigned int type;
> + unsigned int dev_id;
> unsigned int version;
> void __iomem *base;
> struct clk *clk;
> @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> };
>
> +enum mxs_dma_devtype {
> + IMX23_DMA,
> + IMX28_DMA,
> +};
> +
> +struct mxs_dma_type {
> + unsigned int type;
> + unsigned int id;
> +};
> +
> +static struct mxs_dma_type mxs_dma_types[] = {
> + {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct platform_device_id mxs_dma_idt[] = {
> + {
> + .name = "imx23-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> + }, {
> + .name = "imx23-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> + }, {
> + .name = "imx28-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> + }, {
> + .name = "imx28-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> +{
> + return container_of(chan, struct mxs_dma_chan, chan);
> +}
> +
> +int mxs_dma_is_apbh(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return dma_is_apbh();
> +}
> +
> +int mxs_dma_is_apbx(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return !dma_is_apbh();
> +}
> +
> +
> static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> {
> struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan
> *mxs_chan) mxs_chan->status = DMA_IN_PROGRESS;
> }
>
> -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> -{
> - return container_of(chan, struct mxs_dma_chan, chan);
> -}
> -
> static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> {
> struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) if (ret)
> goto err_out;
>
> - /* only major version matters */
> - mxs_dma->version = readl(mxs_dma->base +
> + if (mxs_dma->type == IMX23_DMA) {
> + /* only major version matters */
> + mxs_dma->version = readl(mxs_dma->base +
> ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> BP_APBHX_VERSION_MAJOR;
> + } else if (mxs_dma->type == IMX28_DMA) {
> + mxs_dma->version = readl(mxs_dma->base +
> + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> + BP_APBHX_VERSION_MAJOR;
> + }
>
> /* enable apbh burst */
> if (dma_is_apbh()) {
> @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) {
> const struct platform_device_id *id_entry =
> platform_get_device_id(pdev);
> + const struct mxs_dma_type *mtype =
> + (struct mxs_dma_type *)id_entry->driver_data;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) if (!mxs_dma)
> return -ENOMEM;
>
> - mxs_dma->dev_id = id_entry->driver_data;
> + mxs_dma->type = mtype->type;
> + mxs_dma->dev_id = mtype->id;
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> @@ -692,23 +767,11 @@ err_request_region:
> return ret;
> }
>
> -static struct platform_device_id mxs_dma_type[] = {
> - {
> - .name = "mxs-dma-apbh",
> - .driver_data = MXS_DMA_APBH,
> - }, {
> - .name = "mxs-dma-apbx",
> - .driver_data = MXS_DMA_APBX,
> - }, {
> - /* end of list */
> - }
> -};
> -
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> },
> - .id_table = mxs_dma_type,
> + .id_table = mxs_dma_idt,
> };
>
> static int __init mxs_dma_module_init(void)
> diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> index 203d7c4..55d8702 100644
> --- a/include/linux/fsl/mxs-dma.h
> +++ b/include/linux/fsl/mxs-dma.h
> @@ -15,14 +15,6 @@ struct mxs_dma_data {
> int chan_irq;
> };
>
> -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> -}
> -
> -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> -}
> -
> +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> +extern int mxs_dma_is_apbx(struct dma_chan *chan);
> #endif /* __MACH_MXS_DMA_H__ */
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
@ 2012-04-18 18:01 ` Marek Vasut
0 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:01 UTC (permalink / raw)
To: linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> other SoCs like imx6q and reform the platform_device_id for the
> better further dt support.
>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> arch/arm/mach-mxs/clock-mx23.c | 4 +-
> arch/arm/mach-mxs/clock-mx28.c | 4 +-
> arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> drivers/dma/mxs-dma.c | 111
> +++++++++++++++++++++++------- include/linux/fsl/mxs-dma.h |
> 12 +---
> 5 files changed, 101 insertions(+), 44 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/clock-mx23.c
> b/arch/arm/mach-mxs/clock-mx23.c index e3ac52c..1e67b85 100644
> --- a/arch/arm/mach-mxs/clock-mx23.c
> +++ b/arch/arm/mach-mxs/clock-mx23.c
> @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("duart", NULL, uart_clk)
> _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> _REGISTER_CLOCK(NULL, "usb", usb_clk)
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index 1867a17..cca2cf7 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c
> b/arch/arm/mach-mxs/devices/platform-dma.c index 6a0202b..aff4813 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const
> char *devid,
>
> static int __init mxs_add_mxs_dma(void)
> {
> - char *apbh = "mxs-dma-apbh";
> - char *apbx = "mxs-dma-apbx";
> + char *mx23_apbh = "imx23-dma-apbh";
> + char *mx23_apbx = "imx23-dma-apbx";
> + char *mx28_apbh = "imx28-dma-apbh";
> + char *mx28_apbx = "imx28-dma-apbx";
>
> if (cpu_is_mx23()) {
> - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> }
>
> if (cpu_is_mx28()) {
> - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> }
>
> return 0;
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index b0051a8..51a29f9 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -50,7 +50,8 @@
> #define HW_APBHX_CTRL2 0x020
> #define HW_APBHX_CHANNEL_CTRL 0x030
> #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 :
0x800)
> +#define HW_APBH_VERSION_IMX23 0x3f0
> +#define HW_APBH_VERSION_IMX28 0x800
> #define HW_APBX_VERSION 0x800
> #define BP_APBHX_VERSION_MAJOR 24
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> #define MXS_DMA_CHANNELS_MASK 0xffff
>
> struct mxs_dma_engine {
> - int dev_id;
> + unsigned int type;
> + unsigned int dev_id;
> unsigned int version;
> void __iomem *base;
> struct clk *clk;
> @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> };
>
> +enum mxs_dma_devtype {
> + IMX23_DMA,
> + IMX28_DMA,
> +};
> +
> +struct mxs_dma_type {
> + unsigned int type;
> + unsigned int id;
> +};
> +
> +static struct mxs_dma_type mxs_dma_types[] = {
> + {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct platform_device_id mxs_dma_idt[] = {
> + {
> + .name = "imx23-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> + }, {
> + .name = "imx23-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> + }, {
> + .name = "imx28-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> + }, {
> + .name = "imx28-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> +{
> + return container_of(chan, struct mxs_dma_chan, chan);
> +}
> +
> +int mxs_dma_is_apbh(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return dma_is_apbh();
> +}
> +
> +int mxs_dma_is_apbx(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return !dma_is_apbh();
> +}
> +
> +
> static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> {
> struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan
> *mxs_chan) mxs_chan->status = DMA_IN_PROGRESS;
> }
>
> -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> -{
> - return container_of(chan, struct mxs_dma_chan, chan);
> -}
> -
> static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> {
> struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> *mxs_dma) if (ret)
> goto err_out;
>
> - /* only major version matters */
> - mxs_dma->version = readl(mxs_dma->base +
> + if (mxs_dma->type == IMX23_DMA) {
> + /* only major version matters */
> + mxs_dma->version = readl(mxs_dma->base +
> ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> BP_APBHX_VERSION_MAJOR;
> + } else if (mxs_dma->type == IMX28_DMA) {
> + mxs_dma->version = readl(mxs_dma->base +
> + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> + BP_APBHX_VERSION_MAJOR;
> + }
>
> /* enable apbh burst */
> if (dma_is_apbh()) {
> @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) {
> const struct platform_device_id *id_entry =
> platform_get_device_id(pdev);
> + const struct mxs_dma_type *mtype =
> + (struct mxs_dma_type *)id_entry->driver_data;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) if (!mxs_dma)
> return -ENOMEM;
>
> - mxs_dma->dev_id = id_entry->driver_data;
> + mxs_dma->type = mtype->type;
> + mxs_dma->dev_id = mtype->id;
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> @@ -692,23 +767,11 @@ err_request_region:
> return ret;
> }
>
> -static struct platform_device_id mxs_dma_type[] = {
> - {
> - .name = "mxs-dma-apbh",
> - .driver_data = MXS_DMA_APBH,
> - }, {
> - .name = "mxs-dma-apbx",
> - .driver_data = MXS_DMA_APBX,
> - }, {
> - /* end of list */
> - }
> -};
> -
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> },
> - .id_table = mxs_dma_type,
> + .id_table = mxs_dma_idt,
> };
>
> static int __init mxs_dma_module_init(void)
> diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> index 203d7c4..55d8702 100644
> --- a/include/linux/fsl/mxs-dma.h
> +++ b/include/linux/fsl/mxs-dma.h
> @@ -15,14 +15,6 @@ struct mxs_dma_data {
> int chan_irq;
> };
>
> -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> -}
> -
> -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> -}
> -
> +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> +extern int mxs_dma_is_apbx(struct dma_chan *chan);
> #endif /* __MACH_MXS_DMA_H__ */
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 18:02 ` Marek Vasut
-1 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:02 UTC (permalink / raw)
To: Dong Aisheng
Cc: vinod.koul, devicetree-discuss, rob.herring, grant.likely,
b32955, shawn.guo, kernel, dan.j.williams, s.hauer,
linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Rob Landley <rob@landley.net>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> drivers/dma/mxs-dma.c | 29
> +++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt new file mode
> 100644
> index 0000000..ded0398
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -0,0 +1,19 @@
> +* Freescale MXS DMA
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> +- reg : Should contain registers location and length
> +
> +Supported chips:
> +imx23, imx28.
> +
> +Examples:
> +dma-apbh@80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> + reg = <0x80004000 2000>;
> +};
> +
> +dma-apbx@80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> + reg = <0x80024000 2000>;
> +};
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 51a29f9..74c3275 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -22,8 +22,11 @@
> #include <linux/platform_device.h>
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> +#include <linux/module.h>
> #include <linux/fsl/mxs-dma.h>
> #include <linux/stmp_device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #include <asm/irq.h>
>
> @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> }
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mxs_dma_dt_ids[] = {
> + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> +#endif
> +
> static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> {
> return container_of(chan, struct mxs_dma_chan, chan);
> @@ -671,10 +685,9 @@ err_out:
>
> static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> - const struct platform_device_id *id_entry =
> - platform_get_device_id(pdev);
> - const struct mxs_dma_type *mtype =
> - (struct mxs_dma_type *)id_entry->driver_data;
> + const struct platform_device_id *id_entry;
> + const struct of_device_id *of_id;
> + const struct mxs_dma_type *mtype;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) if (!mxs_dma)
> return -ENOMEM;
>
> + of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
> + if (of_id)
> + id_entry = of_id->data;
> + else
> + id_entry = platform_get_device_id(pdev);
> +
> + mtype = (struct mxs_dma_type *)id_entry->driver_data;
> mxs_dma->type = mtype->type;
> mxs_dma->dev_id = mtype->id;
>
> @@ -770,6 +790,7 @@ err_request_region:
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> + .of_match_table = of_match_ptr(mxs_dma_dt_ids),
> },
> .id_table = mxs_dma_idt,
> };
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-18 18:02 ` Marek Vasut
0 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:02 UTC (permalink / raw)
To: linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Rob Landley <rob@landley.net>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> drivers/dma/mxs-dma.c | 29
> +++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt new file mode
> 100644
> index 0000000..ded0398
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -0,0 +1,19 @@
> +* Freescale MXS DMA
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> +- reg : Should contain registers location and length
> +
> +Supported chips:
> +imx23, imx28.
> +
> +Examples:
> +dma-apbh at 80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> + reg = <0x80004000 2000>;
> +};
> +
> +dma-apbx at 80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> + reg = <0x80024000 2000>;
> +};
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 51a29f9..74c3275 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -22,8 +22,11 @@
> #include <linux/platform_device.h>
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> +#include <linux/module.h>
> #include <linux/fsl/mxs-dma.h>
> #include <linux/stmp_device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #include <asm/irq.h>
>
> @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> }
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mxs_dma_dt_ids[] = {
> + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> +#endif
> +
> static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> {
> return container_of(chan, struct mxs_dma_chan, chan);
> @@ -671,10 +685,9 @@ err_out:
>
> static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> - const struct platform_device_id *id_entry =
> - platform_get_device_id(pdev);
> - const struct mxs_dma_type *mtype =
> - (struct mxs_dma_type *)id_entry->driver_data;
> + const struct platform_device_id *id_entry;
> + const struct of_device_id *of_id;
> + const struct mxs_dma_type *mtype;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device
> *pdev) if (!mxs_dma)
> return -ENOMEM;
>
> + of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
> + if (of_id)
> + id_entry = of_id->data;
> + else
> + id_entry = platform_get_device_id(pdev);
> +
> + mtype = (struct mxs_dma_type *)id_entry->driver_data;
> mxs_dma->type = mtype->type;
> mxs_dma->dev_id = mtype->id;
>
> @@ -770,6 +790,7 @@ err_request_region:
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> + .of_match_table = of_match_ptr(mxs_dma_dt_ids),
> },
> .id_table = mxs_dma_idt,
> };
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/5] ARM: mxs: do not add dma device by default
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 18:03 ` Marek Vasut
-1 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:03 UTC (permalink / raw)
To: Dong Aisheng
Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> This will cause conflict when dt is enabled.
> So let each platform add dma devices respectively.
>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Reviewed-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> ---
> arch/arm/mach-mxs/devices-mx23.h | 2 ++
> arch/arm/mach-mxs/devices-mx28.h | 2 ++
> arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> arch/arm/mach-mxs/mach-m28evk.c | 1 +
> arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> arch/arm/mach-mxs/mach-tx28.c | 1 +
> 9 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/devices-mx23.h
> b/arch/arm/mach-mxs/devices-mx23.h index 4d1329d..5fc6b50 100644
> --- a/arch/arm/mach-mxs/devices-mx23.h
> +++ b/arch/arm/mach-mxs/devices-mx23.h
> @@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
> const struct mxsfb_platform_data *pdata);
>
> struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
> +
> +#define mx23_add_dma() mxs_add_mxs_dma()
> diff --git a/arch/arm/mach-mxs/devices-mx28.h
> b/arch/arm/mach-mxs/devices-mx28.h index 9dbeae1..0b3a62d 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[]
> __initconst; mxs_add_saif(&mx28_saif_data[id], pdata)
>
> struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
> +
> +#define mx28_add_dma() mxs_add_mxs_dma()
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c
> b/arch/arm/mach-mxs/devices/platform-dma.c index aff4813..d0126ea 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const
> char *devid, DMA_BIT_MASK(32));
> }
>
> -static int __init mxs_add_mxs_dma(void)
> +int __init mxs_add_mxs_dma(void)
> {
> char *mx23_apbh = "imx23-dma-apbh";
> char *mx23_apbx = "imx23-dma-apbx";
> @@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
>
> return 0;
> }
> -arch_initcall(mxs_add_mxs_dma);
> diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> b/arch/arm/mach-mxs/include/mach/devices-common.h index f2e3839..544b38d
> 100644
> --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> @@ -116,3 +116,6 @@ struct mxs_saif_data {
> struct platform_device *__init mxs_add_saif(
> const struct mxs_saif_data *data,
> const struct mxs_saif_platform_data *pdata);
> +
> +/* dma */
> +int __init mxs_add_mxs_dma(void);
> diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c
> b/arch/arm/mach-mxs/mach-apx4devkit.c index 48a7fab..92f47e9 100644
> --- a/arch/arm/mach-mxs/mach-apx4devkit.c
> +++ b/arch/arm/mach-mxs/mach-apx4devkit.c
> @@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
> mxs_iomux_setup_multiple_pads(apx4devkit_pads,
> ARRAY_SIZE(apx4devkit_pads));
>
> + mx28_add_dma();
> mx28_add_duart();
> mx28_add_auart0();
> mx28_add_auart1();
> diff --git a/arch/arm/mach-mxs/mach-m28evk.c
> b/arch/arm/mach-mxs/mach-m28evk.c index 06d7996..9a74ce6 100644
> --- a/arch/arm/mach-mxs/mach-m28evk.c
> +++ b/arch/arm/mach-mxs/mach-m28evk.c
> @@ -321,6 +321,7 @@ static void __init m28evk_init(void)
> {
> mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
>
> + mx28_add_dma();
> mx28_add_duart();
> mx28_add_auart0();
> mx28_add_auart3();
> diff --git a/arch/arm/mach-mxs/mach-mx23evk.c
> b/arch/arm/mach-mxs/mach-mx23evk.c index 5ea1c57..cabc884 100644
> --- a/arch/arm/mach-mxs/mach-mx23evk.c
> +++ b/arch/arm/mach-mxs/mach-mx23evk.c
> @@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
>
> mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
>
> + mx23_add_dma();
> mx23_add_duart();
> mx23_add_auart0();
>
> diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c
> b/arch/arm/mach-mxs/mach-stmp378x_devb.c index a626c07..a391b9e 100644
> --- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
> +++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
> @@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
> mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
> ARRAY_SIZE(stmp378x_dvb_pads));
>
> + mx23_add_dma();
> mx23_add_duart();
> mx23_add_auart0();
> mx23_add_rtc_stmp3xxx();
> diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
> index 2c0862e..e17e262 100644
> --- a/arch/arm/mach-mxs/mach-tx28.c
> +++ b/arch/arm/mach-mxs/mach-tx28.c
> @@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
> mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
> ARRAY_SIZE(tx28_stk5v3_pads));
>
> + mx28_add_dma();
> mx28_add_duart(); /* UART1 */
> mx28_add_auart(1); /* UART2 */
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 4/5] ARM: mxs: do not add dma device by default
@ 2012-04-18 18:03 ` Marek Vasut
0 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:03 UTC (permalink / raw)
To: linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> This will cause conflict when dt is enabled.
> So let each platform add dma devices respectively.
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> arch/arm/mach-mxs/devices-mx23.h | 2 ++
> arch/arm/mach-mxs/devices-mx28.h | 2 ++
> arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> arch/arm/mach-mxs/mach-m28evk.c | 1 +
> arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> arch/arm/mach-mxs/mach-tx28.c | 1 +
> 9 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/devices-mx23.h
> b/arch/arm/mach-mxs/devices-mx23.h index 4d1329d..5fc6b50 100644
> --- a/arch/arm/mach-mxs/devices-mx23.h
> +++ b/arch/arm/mach-mxs/devices-mx23.h
> @@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
> const struct mxsfb_platform_data *pdata);
>
> struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
> +
> +#define mx23_add_dma() mxs_add_mxs_dma()
> diff --git a/arch/arm/mach-mxs/devices-mx28.h
> b/arch/arm/mach-mxs/devices-mx28.h index 9dbeae1..0b3a62d 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[]
> __initconst; mxs_add_saif(&mx28_saif_data[id], pdata)
>
> struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
> +
> +#define mx28_add_dma() mxs_add_mxs_dma()
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c
> b/arch/arm/mach-mxs/devices/platform-dma.c index aff4813..d0126ea 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const
> char *devid, DMA_BIT_MASK(32));
> }
>
> -static int __init mxs_add_mxs_dma(void)
> +int __init mxs_add_mxs_dma(void)
> {
> char *mx23_apbh = "imx23-dma-apbh";
> char *mx23_apbx = "imx23-dma-apbx";
> @@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
>
> return 0;
> }
> -arch_initcall(mxs_add_mxs_dma);
> diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> b/arch/arm/mach-mxs/include/mach/devices-common.h index f2e3839..544b38d
> 100644
> --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> @@ -116,3 +116,6 @@ struct mxs_saif_data {
> struct platform_device *__init mxs_add_saif(
> const struct mxs_saif_data *data,
> const struct mxs_saif_platform_data *pdata);
> +
> +/* dma */
> +int __init mxs_add_mxs_dma(void);
> diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c
> b/arch/arm/mach-mxs/mach-apx4devkit.c index 48a7fab..92f47e9 100644
> --- a/arch/arm/mach-mxs/mach-apx4devkit.c
> +++ b/arch/arm/mach-mxs/mach-apx4devkit.c
> @@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
> mxs_iomux_setup_multiple_pads(apx4devkit_pads,
> ARRAY_SIZE(apx4devkit_pads));
>
> + mx28_add_dma();
> mx28_add_duart();
> mx28_add_auart0();
> mx28_add_auart1();
> diff --git a/arch/arm/mach-mxs/mach-m28evk.c
> b/arch/arm/mach-mxs/mach-m28evk.c index 06d7996..9a74ce6 100644
> --- a/arch/arm/mach-mxs/mach-m28evk.c
> +++ b/arch/arm/mach-mxs/mach-m28evk.c
> @@ -321,6 +321,7 @@ static void __init m28evk_init(void)
> {
> mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
>
> + mx28_add_dma();
> mx28_add_duart();
> mx28_add_auart0();
> mx28_add_auart3();
> diff --git a/arch/arm/mach-mxs/mach-mx23evk.c
> b/arch/arm/mach-mxs/mach-mx23evk.c index 5ea1c57..cabc884 100644
> --- a/arch/arm/mach-mxs/mach-mx23evk.c
> +++ b/arch/arm/mach-mxs/mach-mx23evk.c
> @@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
>
> mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
>
> + mx23_add_dma();
> mx23_add_duart();
> mx23_add_auart0();
>
> diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c
> b/arch/arm/mach-mxs/mach-stmp378x_devb.c index a626c07..a391b9e 100644
> --- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
> +++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
> @@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
> mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
> ARRAY_SIZE(stmp378x_dvb_pads));
>
> + mx23_add_dma();
> mx23_add_duart();
> mx23_add_auart0();
> mx23_add_rtc_stmp3xxx();
> diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
> index 2c0862e..e17e262 100644
> --- a/arch/arm/mach-mxs/mach-tx28.c
> +++ b/arch/arm/mach-mxs/mach-tx28.c
> @@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
> mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
> ARRAY_SIZE(tx28_stk5v3_pads));
>
> + mx28_add_dma();
> mx28_add_duart(); /* UART1 */
> mx28_add_auart(1); /* UART2 */
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 5/5] ARM: mx28evk: add mxs-dma dt support
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-18 18:03 ` Marek Vasut
-1 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:03 UTC (permalink / raw)
To: Dong Aisheng
Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Reviewed-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> ---
> arch/arm/boot/dts/imx28.dtsi | 4 ++--
> arch/arm/mach-mxs/clock-mx28.c | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
> index d1f4f8c..5f61777 100644
> --- a/arch/arm/boot/dts/imx28.dtsi
> +++ b/arch/arm/boot/dts/imx28.dtsi
> @@ -52,8 +52,8 @@
> };
>
> dma-apbh@80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> reg = <0x80004000 2000>;
> - status = "disabled";
> };
>
> perfmon@80006000 {
> @@ -115,8 +115,8 @@
> };
>
> dma-apbx@80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> reg = <0x80024000 2000>;
> - status = "disabled";
> };
>
> dcp@80028000 {
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index cca2cf7..9c926b6 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -652,6 +652,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("80074000.serial", NULL, uart_clk)
> _REGISTER_CLOCK("800f0000.ethernet", NULL, fec_clk)
> _REGISTER_CLOCK("800f4000.ethernet", NULL, fec_clk)
> + _REGISTER_CLOCK("80004000.dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("80024000.dma-apbx", NULL, xbus_clk)
> };
>
> static int clk_misc_init(void)
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 5/5] ARM: mx28evk: add mxs-dma dt support
@ 2012-04-18 18:03 ` Marek Vasut
0 siblings, 0 replies; 42+ messages in thread
From: Marek Vasut @ 2012-04-18 18:03 UTC (permalink / raw)
To: linux-arm-kernel
Dear Dong Aisheng,
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> arch/arm/boot/dts/imx28.dtsi | 4 ++--
> arch/arm/mach-mxs/clock-mx28.c | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
> index d1f4f8c..5f61777 100644
> --- a/arch/arm/boot/dts/imx28.dtsi
> +++ b/arch/arm/boot/dts/imx28.dtsi
> @@ -52,8 +52,8 @@
> };
>
> dma-apbh at 80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> reg = <0x80004000 2000>;
> - status = "disabled";
> };
>
> perfmon at 80006000 {
> @@ -115,8 +115,8 @@
> };
>
> dma-apbx at 80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> reg = <0x80024000 2000>;
> - status = "disabled";
> };
>
> dcp at 80028000 {
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index cca2cf7..9c926b6 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -652,6 +652,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("80074000.serial", NULL, uart_clk)
> _REGISTER_CLOCK("800f0000.ethernet", NULL, fec_clk)
> _REGISTER_CLOCK("800f4000.ethernet", NULL, fec_clk)
> + _REGISTER_CLOCK("80004000.dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("80024000.dma-apbx", NULL, xbus_clk)
> };
>
> static int clk_misc_init(void)
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 4/5] ARM: mxs: do not add dma device by default
2012-04-18 18:03 ` Marek Vasut
@ 2012-04-20 15:11 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-20 15:11 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: b32955-KZfg59tc24xl57MIdRCFDg, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ
From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
This will cause conflict when dt is enabled.
So let each platform add dma devices respectively.
Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Reviewed-by: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
ChangeLog v1->v2:
* Add the missed mx28_add_dma() for mx28evk.c.
Thanks for Shijie's reminder.
---
arch/arm/mach-mxs/devices-mx23.h | 2 ++
arch/arm/mach-mxs/devices-mx28.h | 2 ++
arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-mx28evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
10 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 4d1329d..5fc6b50 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
const struct mxsfb_platform_data *pdata);
struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
+
+#define mx23_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9dbeae1..0b3a62d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst;
mxs_add_saif(&mx28_saif_data[id], pdata)
struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
+
+#define mx28_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index aff4813..d0126ea 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
DMA_BIT_MASK(32));
}
-static int __init mxs_add_mxs_dma(void)
+int __init mxs_add_mxs_dma(void)
{
char *mx23_apbh = "imx23-dma-apbh";
char *mx23_apbx = "imx23-dma-apbx";
@@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
return 0;
}
-arch_initcall(mxs_add_mxs_dma);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index f2e3839..544b38d 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -116,3 +116,6 @@ struct mxs_saif_data {
struct platform_device *__init mxs_add_saif(
const struct mxs_saif_data *data,
const struct mxs_saif_platform_data *pdata);
+
+/* dma */
+int __init mxs_add_mxs_dma(void);
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 48a7fab..92f47e9 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
mxs_iomux_setup_multiple_pads(apx4devkit_pads,
ARRAY_SIZE(apx4devkit_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart1();
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 06d7996..9a74ce6 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -321,6 +321,7 @@ static void __init m28evk_init(void)
{
mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c
index 5ea1c57..cabc884 100644
--- a/arch/arm/mach-mxs/mach-mx23evk.c
+++ b/arch/arm/mach-mxs/mach-mx23evk.c
@@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index e386c14..4b645eb 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -415,6 +415,7 @@ static void __init mx28evk_init(void)
mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c
index a626c07..a391b9e 100644
--- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
+++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
@@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
ARRAY_SIZE(stmp378x_dvb_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
mx23_add_rtc_stmp3xxx();
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 2c0862e..e17e262 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
ARRAY_SIZE(tx28_stk5v3_pads));
+ mx28_add_dma();
mx28_add_duart(); /* UART1 */
mx28_add_auart(1); /* UART2 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 4/5] ARM: mxs: do not add dma device by default
@ 2012-04-20 15:11 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-20 15:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
This will cause conflict when dt is enabled.
So let each platform add dma devices respectively.
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Huang Shijie <b32955@freescale.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
ChangeLog v1->v2:
* Add the missed mx28_add_dma() for mx28evk.c.
Thanks for Shijie's reminder.
---
arch/arm/mach-mxs/devices-mx23.h | 2 ++
arch/arm/mach-mxs/devices-mx28.h | 2 ++
arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
arch/arm/mach-mxs/mach-m28evk.c | 1 +
arch/arm/mach-mxs/mach-mx23evk.c | 1 +
arch/arm/mach-mxs/mach-mx28evk.c | 1 +
arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
arch/arm/mach-mxs/mach-tx28.c | 1 +
10 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 4d1329d..5fc6b50 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -35,3 +35,5 @@ struct platform_device *__init mx23_add_mxsfb(
const struct mxsfb_platform_data *pdata);
struct platform_device *__init mx23_add_rtc_stmp3xxx(void);
+
+#define mx23_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9dbeae1..0b3a62d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -55,3 +55,5 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst;
mxs_add_saif(&mx28_saif_data[id], pdata)
struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
+
+#define mx28_add_dma() mxs_add_mxs_dma()
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
index aff4813..d0126ea 100644
--- a/arch/arm/mach-mxs/devices/platform-dma.c
+++ b/arch/arm/mach-mxs/devices/platform-dma.c
@@ -30,7 +30,7 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
DMA_BIT_MASK(32));
}
-static int __init mxs_add_mxs_dma(void)
+int __init mxs_add_mxs_dma(void)
{
char *mx23_apbh = "imx23-dma-apbh";
char *mx23_apbx = "imx23-dma-apbx";
@@ -49,4 +49,3 @@ static int __init mxs_add_mxs_dma(void)
return 0;
}
-arch_initcall(mxs_add_mxs_dma);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index f2e3839..544b38d 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -116,3 +116,6 @@ struct mxs_saif_data {
struct platform_device *__init mxs_add_saif(
const struct mxs_saif_data *data,
const struct mxs_saif_platform_data *pdata);
+
+/* dma */
+int __init mxs_add_mxs_dma(void);
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 48a7fab..92f47e9 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -210,6 +210,7 @@ static void __init apx4devkit_init(void)
mxs_iomux_setup_multiple_pads(apx4devkit_pads,
ARRAY_SIZE(apx4devkit_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart1();
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 06d7996..9a74ce6 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -321,6 +321,7 @@ static void __init m28evk_init(void)
{
mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c
index 5ea1c57..cabc884 100644
--- a/arch/arm/mach-mxs/mach-mx23evk.c
+++ b/arch/arm/mach-mxs/mach-mx23evk.c
@@ -143,6 +143,7 @@ static void __init mx23evk_init(void)
mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index e386c14..4b645eb 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -415,6 +415,7 @@ static void __init mx28evk_init(void)
mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads));
+ mx28_add_dma();
mx28_add_duart();
mx28_add_auart0();
mx28_add_auart3();
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c
index a626c07..a391b9e 100644
--- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
+++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
@@ -88,6 +88,7 @@ static void __init stmp378x_dvb_init(void)
mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
ARRAY_SIZE(stmp378x_dvb_pads));
+ mx23_add_dma();
mx23_add_duart();
mx23_add_auart0();
mx23_add_rtc_stmp3xxx();
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 2c0862e..e17e262 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -149,6 +149,7 @@ static void __init tx28_stk5v3_init(void)
mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
ARRAY_SIZE(tx28_stk5v3_pads));
+ mx28_add_dma();
mx28_add_duart(); /* UART1 */
mx28_add_auart(1); /* UART2 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 4/5] ARM: mxs: do not add dma device by default
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-23 1:59 ` Shawn Guo
-1 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 1:59 UTC (permalink / raw)
To: Dong Aisheng
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Wed, Apr 18, 2012 at 08:46:36PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> This will cause conflict when dt is enabled.
> So let each platform add dma devices respectively.
>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> arch/arm/mach-mxs/devices-mx23.h | 2 ++
> arch/arm/mach-mxs/devices-mx28.h | 2 ++
> arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> arch/arm/mach-mxs/mach-m28evk.c | 1 +
> arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> arch/arm/mach-mxs/mach-tx28.c | 1 +
> 9 files changed, 13 insertions(+), 2 deletions(-)
>
I think instead of asking every board file to add dma device
explicitly, we probably need to do something similar to imx, having
functions imx23_soc_init and imx28_soc_init which will only be called
for non-dt boot, and adding devices like dma, gpio there.
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 4/5] ARM: mxs: do not add dma device by default
@ 2012-04-23 1:59 ` Shawn Guo
0 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 1:59 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Apr 18, 2012 at 08:46:36PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> This will cause conflict when dt is enabled.
> So let each platform add dma devices respectively.
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> ---
> arch/arm/mach-mxs/devices-mx23.h | 2 ++
> arch/arm/mach-mxs/devices-mx28.h | 2 ++
> arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> arch/arm/mach-mxs/mach-m28evk.c | 1 +
> arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> arch/arm/mach-mxs/mach-tx28.c | 1 +
> 9 files changed, 13 insertions(+), 2 deletions(-)
>
I think instead of asking every board file to add dma device
explicitly, we probably need to do something similar to imx, having
functions imx23_soc_init and imx28_soc_init which will only be called
for non-dt boot, and adding devices like dma, gpio there.
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-23 3:01 ` Shawn Guo
-1 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 3:01 UTC (permalink / raw)
To: Dong Aisheng
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Wed, Apr 18, 2012 at 08:46:34PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> other SoCs like imx6q and reform the platform_device_id for the
> better further dt support.
>
Nice cleanup. But I would like to ask more.
> Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> arch/arm/mach-mxs/clock-mx23.c | 4 +-
> arch/arm/mach-mxs/clock-mx28.c | 4 +-
> arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
> include/linux/fsl/mxs-dma.h | 12 +---
> 5 files changed, 101 insertions(+), 44 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
> index e3ac52c..1e67b85 100644
> --- a/arch/arm/mach-mxs/clock-mx23.c
> +++ b/arch/arm/mach-mxs/clock-mx23.c
> @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("duart", NULL, uart_clk)
> _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> _REGISTER_CLOCK(NULL, "usb", usb_clk)
> diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> index 1867a17..cca2cf7 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
> index 6a0202b..aff4813 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
>
> static int __init mxs_add_mxs_dma(void)
> {
> - char *apbh = "mxs-dma-apbh";
> - char *apbx = "mxs-dma-apbx";
> + char *mx23_apbh = "imx23-dma-apbh";
> + char *mx23_apbx = "imx23-dma-apbx";
> + char *mx28_apbh = "imx28-dma-apbh";
> + char *mx28_apbx = "imx28-dma-apbx";
>
> if (cpu_is_mx23()) {
> - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> }
>
> if (cpu_is_mx28()) {
> - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> }
>
> return 0;
With soc specific hook introduced, we can remove this mxs_add_mxs_dma
call completely.
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index b0051a8..51a29f9 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -50,7 +50,8 @@
> #define HW_APBHX_CTRL2 0x020
> #define HW_APBHX_CHANNEL_CTRL 0x030
> #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
> +#define HW_APBH_VERSION_IMX23 0x3f0
> +#define HW_APBH_VERSION_IMX28 0x800
Since the VERSION is broken for identifying the dma type and we are
introduce dma type field, I would suggest to remove the use of VERSION
completely and use mxs_dma_type everywhere.
> #define HW_APBX_VERSION 0x800
> #define BP_APBHX_VERSION_MAJOR 24
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> #define MXS_DMA_CHANNELS_MASK 0xffff
>
> struct mxs_dma_engine {
> - int dev_id;
> + unsigned int type;
> + unsigned int dev_id;
> unsigned int version;
> void __iomem *base;
> struct clk *clk;
> @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> };
>
> +enum mxs_dma_devtype {
> + IMX23_DMA,
> + IMX28_DMA,
> +};
> +
> +struct mxs_dma_type {
> + unsigned int type;
> + unsigned int id;
> +};
> +
> +static struct mxs_dma_type mxs_dma_types[] = {
> + {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBH,
To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
a type.
> + }, {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + /* end of list */
> + }
This end sign is not needed, I think.
> +};
> +
> +static struct platform_device_id mxs_dma_idt[] = {
s/mxs_dma_idt/mxs_dma_ids?
> + {
> + .name = "imx23-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> + }, {
> + .name = "imx23-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> + }, {
> + .name = "imx28-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> + }, {
> + .name = "imx28-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> +{
> + return container_of(chan, struct mxs_dma_chan, chan);
> +}
> +
> +int mxs_dma_is_apbh(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return dma_is_apbh();
I would expect it simply be
return (mxs_dma->dev_id == MXS_DMA_APBH);
And dma_is_apbh() can be removed completely now.
> +}
> +
> +int mxs_dma_is_apbx(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return !dma_is_apbh();
return (mxs_dma->dev_id == MXS_DMA_APBX);
> +}
> +
> +
> static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> {
> struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
> mxs_chan->status = DMA_IN_PROGRESS;
> }
>
> -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> -{
> - return container_of(chan, struct mxs_dma_chan, chan);
> -}
> -
> static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> {
> struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
> if (ret)
> goto err_out;
>
> - /* only major version matters */
> - mxs_dma->version = readl(mxs_dma->base +
> + if (mxs_dma->type == IMX23_DMA) {
> + /* only major version matters */
> + mxs_dma->version = readl(mxs_dma->base +
> ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> BP_APBHX_VERSION_MAJOR;
> + } else if (mxs_dma->type == IMX28_DMA) {
> + mxs_dma->version = readl(mxs_dma->base +
> + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> + BP_APBHX_VERSION_MAJOR;
> + }
Again, let's just get rid of the use of VERSION completely.
>
> /* enable apbh burst */
> if (dma_is_apbh()) {
> @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> const struct platform_device_id *id_entry =
> platform_get_device_id(pdev);
> + const struct mxs_dma_type *mtype =
> + (struct mxs_dma_type *)id_entry->driver_data;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> if (!mxs_dma)
> return -ENOMEM;
>
> - mxs_dma->dev_id = id_entry->driver_data;
> + mxs_dma->type = mtype->type;
> + mxs_dma->dev_id = mtype->id;
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> @@ -692,23 +767,11 @@ err_request_region:
> return ret;
> }
>
> -static struct platform_device_id mxs_dma_type[] = {
> - {
> - .name = "mxs-dma-apbh",
> - .driver_data = MXS_DMA_APBH,
> - }, {
> - .name = "mxs-dma-apbx",
> - .driver_data = MXS_DMA_APBX,
> - }, {
> - /* end of list */
> - }
> -};
> -
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> },
> - .id_table = mxs_dma_type,
> + .id_table = mxs_dma_idt,
> };
>
> static int __init mxs_dma_module_init(void)
> diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> index 203d7c4..55d8702 100644
> --- a/include/linux/fsl/mxs-dma.h
> +++ b/include/linux/fsl/mxs-dma.h
> @@ -15,14 +15,6 @@ struct mxs_dma_data {
> int chan_irq;
> };
>
> -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> -}
> -
> -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> -}
> -
> +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> +extern int mxs_dma_is_apbx(struct dma_chan *chan);
I would expect these two calls still be inline here.
> #endif /* __MACH_MXS_DMA_H__ */
> --
> 1.7.0.4
>
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
@ 2012-04-23 3:01 ` Shawn Guo
0 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 3:01 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Apr 18, 2012 at 08:46:34PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> other SoCs like imx6q and reform the platform_device_id for the
> better further dt support.
>
Nice cleanup. But I would like to ask more.
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> ---
> arch/arm/mach-mxs/clock-mx23.c | 4 +-
> arch/arm/mach-mxs/clock-mx28.c | 4 +-
> arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
> include/linux/fsl/mxs-dma.h | 12 +---
> 5 files changed, 101 insertions(+), 44 deletions(-)
>
> diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
> index e3ac52c..1e67b85 100644
> --- a/arch/arm/mach-mxs/clock-mx23.c
> +++ b/arch/arm/mach-mxs/clock-mx23.c
> @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("duart", NULL, uart_clk)
> _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> _REGISTER_CLOCK(NULL, "usb", usb_clk)
> diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> index 1867a17..cca2cf7 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
> index 6a0202b..aff4813 100644
> --- a/arch/arm/mach-mxs/devices/platform-dma.c
> +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
>
> static int __init mxs_add_mxs_dma(void)
> {
> - char *apbh = "mxs-dma-apbh";
> - char *apbx = "mxs-dma-apbx";
> + char *mx23_apbh = "imx23-dma-apbh";
> + char *mx23_apbx = "imx23-dma-apbx";
> + char *mx28_apbh = "imx28-dma-apbh";
> + char *mx28_apbx = "imx28-dma-apbx";
>
> if (cpu_is_mx23()) {
> - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> }
>
> if (cpu_is_mx28()) {
> - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> }
>
> return 0;
With soc specific hook introduced, we can remove this mxs_add_mxs_dma
call completely.
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index b0051a8..51a29f9 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -50,7 +50,8 @@
> #define HW_APBHX_CTRL2 0x020
> #define HW_APBHX_CHANNEL_CTRL 0x030
> #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
> +#define HW_APBH_VERSION_IMX23 0x3f0
> +#define HW_APBH_VERSION_IMX28 0x800
Since the VERSION is broken for identifying the dma type and we are
introduce dma type field, I would suggest to remove the use of VERSION
completely and use mxs_dma_type everywhere.
> #define HW_APBX_VERSION 0x800
> #define BP_APBHX_VERSION_MAJOR 24
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> #define MXS_DMA_CHANNELS_MASK 0xffff
>
> struct mxs_dma_engine {
> - int dev_id;
> + unsigned int type;
> + unsigned int dev_id;
> unsigned int version;
> void __iomem *base;
> struct clk *clk;
> @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> };
>
> +enum mxs_dma_devtype {
> + IMX23_DMA,
> + IMX28_DMA,
> +};
> +
> +struct mxs_dma_type {
> + unsigned int type;
> + unsigned int id;
> +};
> +
> +static struct mxs_dma_type mxs_dma_types[] = {
> + {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBH,
To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
a type.
> + }, {
> + .type = IMX23_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBH,
> + }, {
> + .type = IMX28_DMA,
> + .id = MXS_DMA_APBX,
> + }, {
> + /* end of list */
> + }
This end sign is not needed, I think.
> +};
> +
> +static struct platform_device_id mxs_dma_idt[] = {
s/mxs_dma_idt/mxs_dma_ids?
> + {
> + .name = "imx23-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> + }, {
> + .name = "imx23-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> + }, {
> + .name = "imx28-dma-apbh",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> + }, {
> + .name = "imx28-dma-apbx",
> + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> + }, {
> + /* end of list */
> + }
> +};
> +
> +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> +{
> + return container_of(chan, struct mxs_dma_chan, chan);
> +}
> +
> +int mxs_dma_is_apbh(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return dma_is_apbh();
I would expect it simply be
return (mxs_dma->dev_id == MXS_DMA_APBH);
And dma_is_apbh() can be removed completely now.
> +}
> +
> +int mxs_dma_is_apbx(struct dma_chan *chan)
> +{
> + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +
> + return !dma_is_apbh();
return (mxs_dma->dev_id == MXS_DMA_APBX);
> +}
> +
> +
> static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> {
> struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
> mxs_chan->status = DMA_IN_PROGRESS;
> }
>
> -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> -{
> - return container_of(chan, struct mxs_dma_chan, chan);
> -}
> -
> static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> {
> struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
> if (ret)
> goto err_out;
>
> - /* only major version matters */
> - mxs_dma->version = readl(mxs_dma->base +
> + if (mxs_dma->type == IMX23_DMA) {
> + /* only major version matters */
> + mxs_dma->version = readl(mxs_dma->base +
> ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> BP_APBHX_VERSION_MAJOR;
> + } else if (mxs_dma->type == IMX28_DMA) {
> + mxs_dma->version = readl(mxs_dma->base +
> + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> + BP_APBHX_VERSION_MAJOR;
> + }
Again, let's just get rid of the use of VERSION completely.
>
> /* enable apbh burst */
> if (dma_is_apbh()) {
> @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> const struct platform_device_id *id_entry =
> platform_get_device_id(pdev);
> + const struct mxs_dma_type *mtype =
> + (struct mxs_dma_type *)id_entry->driver_data;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> if (!mxs_dma)
> return -ENOMEM;
>
> - mxs_dma->dev_id = id_entry->driver_data;
> + mxs_dma->type = mtype->type;
> + mxs_dma->dev_id = mtype->id;
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> @@ -692,23 +767,11 @@ err_request_region:
> return ret;
> }
>
> -static struct platform_device_id mxs_dma_type[] = {
> - {
> - .name = "mxs-dma-apbh",
> - .driver_data = MXS_DMA_APBH,
> - }, {
> - .name = "mxs-dma-apbx",
> - .driver_data = MXS_DMA_APBX,
> - }, {
> - /* end of list */
> - }
> -};
> -
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> },
> - .id_table = mxs_dma_type,
> + .id_table = mxs_dma_idt,
> };
>
> static int __init mxs_dma_module_init(void)
> diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> index 203d7c4..55d8702 100644
> --- a/include/linux/fsl/mxs-dma.h
> +++ b/include/linux/fsl/mxs-dma.h
> @@ -15,14 +15,6 @@ struct mxs_dma_data {
> int chan_irq;
> };
>
> -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> -}
> -
> -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> -{
> - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> -}
> -
> +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> +extern int mxs_dma_is_apbx(struct dma_chan *chan);
I would expect these two calls still be inline here.
> #endif /* __MACH_MXS_DMA_H__ */
> --
> 1.7.0.4
>
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-18 12:46 ` Dong Aisheng
@ 2012-04-23 3:15 ` Shawn Guo
-1 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 3:15 UTC (permalink / raw)
To: Dong Aisheng
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
b32955-KZfg59tc24xl57MIdRCFDg, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Wed, Apr 18, 2012 at 08:46:35PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Rob Landley <rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
> Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
> 2 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> new file mode 100644
> index 0000000..ded0398
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -0,0 +1,19 @@
> +* Freescale MXS DMA
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> +- reg : Should contain registers location and length
> +
> +Supported chips:
> +imx23, imx28.
> +
> +Examples:
> +dma-apbh@80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> + reg = <0x80004000 2000>;
> +};
> +
> +dma-apbx@80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> + reg = <0x80024000 2000>;
> +};
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 51a29f9..74c3275 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -22,8 +22,11 @@
> #include <linux/platform_device.h>
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> +#include <linux/module.h>
> #include <linux/fsl/mxs-dma.h>
> #include <linux/stmp_device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #include <asm/irq.h>
>
> @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> }
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mxs_dma_dt_ids[] = {
> + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> +#endif
> +
As out goal is to convert mxs over to DT, you can remove the #ifdef
here ...
> static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> {
> return container_of(chan, struct mxs_dma_chan, chan);
> @@ -671,10 +685,9 @@ err_out:
>
> static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> - const struct platform_device_id *id_entry =
> - platform_get_device_id(pdev);
> - const struct mxs_dma_type *mtype =
> - (struct mxs_dma_type *)id_entry->driver_data;
> + const struct platform_device_id *id_entry;
> + const struct of_device_id *of_id;
> + const struct mxs_dma_type *mtype;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> if (!mxs_dma)
> return -ENOMEM;
>
> + of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
> + if (of_id)
> + id_entry = of_id->data;
> + else
> + id_entry = platform_get_device_id(pdev);
> +
> + mtype = (struct mxs_dma_type *)id_entry->driver_data;
> mxs_dma->type = mtype->type;
> mxs_dma->dev_id = mtype->id;
>
> @@ -770,6 +790,7 @@ err_request_region:
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> + .of_match_table = of_match_ptr(mxs_dma_dt_ids),
... then of_match_ptr is not needed here.
> },
> .id_table = mxs_dma_idt,
> };
> --
> 1.7.0.4
>
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-23 3:15 ` Shawn Guo
0 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 3:15 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Apr 18, 2012 at 08:46:35PM +0800, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Rob Landley <rob@landley.net>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Huang Shijie <b32955@freescale.com>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> ---
> .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
> 2 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> new file mode 100644
> index 0000000..ded0398
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -0,0 +1,19 @@
> +* Freescale MXS DMA
> +
> +Required properties:
> +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> +- reg : Should contain registers location and length
> +
> +Supported chips:
> +imx23, imx28.
> +
> +Examples:
> +dma-apbh at 80004000 {
> + compatible = "fsl,imx28-dma-apbh";
> + reg = <0x80004000 2000>;
> +};
> +
> +dma-apbx at 80024000 {
> + compatible = "fsl,imx28-dma-apbx";
> + reg = <0x80024000 2000>;
> +};
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 51a29f9..74c3275 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -22,8 +22,11 @@
> #include <linux/platform_device.h>
> #include <linux/dmaengine.h>
> #include <linux/delay.h>
> +#include <linux/module.h>
> #include <linux/fsl/mxs-dma.h>
> #include <linux/stmp_device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #include <asm/irq.h>
>
> @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> }
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mxs_dma_dt_ids[] = {
> + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> +#endif
> +
As out goal is to convert mxs over to DT, you can remove the #ifdef
here ...
> static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> {
> return container_of(chan, struct mxs_dma_chan, chan);
> @@ -671,10 +685,9 @@ err_out:
>
> static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> - const struct platform_device_id *id_entry =
> - platform_get_device_id(pdev);
> - const struct mxs_dma_type *mtype =
> - (struct mxs_dma_type *)id_entry->driver_data;
> + const struct platform_device_id *id_entry;
> + const struct of_device_id *of_id;
> + const struct mxs_dma_type *mtype;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -683,6 +696,13 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> if (!mxs_dma)
> return -ENOMEM;
>
> + of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
> + if (of_id)
> + id_entry = of_id->data;
> + else
> + id_entry = platform_get_device_id(pdev);
> +
> + mtype = (struct mxs_dma_type *)id_entry->driver_data;
> mxs_dma->type = mtype->type;
> mxs_dma->dev_id = mtype->id;
>
> @@ -770,6 +790,7 @@ err_request_region:
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> + .of_match_table = of_match_ptr(mxs_dma_dt_ids),
... then of_match_ptr is not needed here.
> },
> .id_table = mxs_dma_idt,
> };
> --
> 1.7.0.4
>
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/5] ARM: mxs: do not add dma device by default
2012-04-23 1:59 ` Shawn Guo
@ 2012-04-23 3:26 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 3:26 UTC (permalink / raw)
To: Shawn Guo
Cc: Guo Shawn-R65073, marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 09:59:57AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:36PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> > This will cause conflict when dt is enabled.
> > So let each platform add dma devices respectively.
> >
> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > ---
> > arch/arm/mach-mxs/devices-mx23.h | 2 ++
> > arch/arm/mach-mxs/devices-mx28.h | 2 ++
> > arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> > arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> > arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> > arch/arm/mach-mxs/mach-m28evk.c | 1 +
> > arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> > arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> > arch/arm/mach-mxs/mach-tx28.c | 1 +
> > 9 files changed, 13 insertions(+), 2 deletions(-)
> >
> I think instead of asking every board file to add dma device
> explicitly, we probably need to do something similar to imx, having
> functions imx23_soc_init and imx28_soc_init which will only be called
> for non-dt boot, and adding devices like dma, gpio there.
>
Yes, it's fine to me since gpio has the same issue.
Will revise the patch.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 4/5] ARM: mxs: do not add dma device by default
@ 2012-04-23 3:26 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 3:26 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 09:59:57AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:36PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng@linaro.org>
> >
> > This will cause conflict when dt is enabled.
> > So let each platform add dma devices respectively.
> >
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Huang Shijie <b32955@freescale.com>
> > Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> > ---
> > arch/arm/mach-mxs/devices-mx23.h | 2 ++
> > arch/arm/mach-mxs/devices-mx28.h | 2 ++
> > arch/arm/mach-mxs/devices/platform-dma.c | 3 +--
> > arch/arm/mach-mxs/include/mach/devices-common.h | 3 +++
> > arch/arm/mach-mxs/mach-apx4devkit.c | 1 +
> > arch/arm/mach-mxs/mach-m28evk.c | 1 +
> > arch/arm/mach-mxs/mach-mx23evk.c | 1 +
> > arch/arm/mach-mxs/mach-stmp378x_devb.c | 1 +
> > arch/arm/mach-mxs/mach-tx28.c | 1 +
> > 9 files changed, 13 insertions(+), 2 deletions(-)
> >
> I think instead of asking every board file to add dma device
> explicitly, we probably need to do something similar to imx, having
> functions imx23_soc_init and imx28_soc_init which will only be called
> for non-dt boot, and adding devices like dma, gpio there.
>
Yes, it's fine to me since gpio has the same issue.
Will revise the patch.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
2012-04-23 3:01 ` Shawn Guo
@ 2012-04-23 3:58 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 3:58 UTC (permalink / raw)
To: Shawn Guo
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 11:01:18AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:34PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> > Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> > other SoCs like imx6q and reform the platform_device_id for the
> > better further dt support.
> >
> Nice cleanup. But I would like to ask more.
>
> > Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > ---
> > arch/arm/mach-mxs/clock-mx23.c | 4 +-
> > arch/arm/mach-mxs/clock-mx28.c | 4 +-
> > arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> > drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
> > include/linux/fsl/mxs-dma.h | 12 +---
> > 5 files changed, 101 insertions(+), 44 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
> > index e3ac52c..1e67b85 100644
> > --- a/arch/arm/mach-mxs/clock-mx23.c
> > +++ b/arch/arm/mach-mxs/clock-mx23.c
> > @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> > _REGISTER_CLOCK("duart", NULL, uart_clk)
> > _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> > _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> > + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> > + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> > _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> > _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> > _REGISTER_CLOCK(NULL, "usb", usb_clk)
> > diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> > index 1867a17..cca2cf7 100644
> > --- a/arch/arm/mach-mxs/clock-mx28.c
> > +++ b/arch/arm/mach-mxs/clock-mx28.c
> > @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> > _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> > _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> > _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> > + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> > + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> > _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> > _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> > _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> > diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
> > index 6a0202b..aff4813 100644
> > --- a/arch/arm/mach-mxs/devices/platform-dma.c
> > +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> > @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
> >
> > static int __init mxs_add_mxs_dma(void)
> > {
> > - char *apbh = "mxs-dma-apbh";
> > - char *apbx = "mxs-dma-apbx";
> > + char *mx23_apbh = "imx23-dma-apbh";
> > + char *mx23_apbx = "imx23-dma-apbx";
> > + char *mx28_apbh = "imx28-dma-apbh";
> > + char *mx28_apbx = "imx28-dma-apbx";
> >
> > if (cpu_is_mx23()) {
> > - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> > - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> > + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> > + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> > }
> >
> > if (cpu_is_mx28()) {
> > - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> > - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> > + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> > + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> > }
> >
> > return 0;
>
> With soc specific hook introduced, we can remove this mxs_add_mxs_dma
> call completely.
>
Yes, it's true.
A mx23/mx28_soc_init can do it well.
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > index b0051a8..51a29f9 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -50,7 +50,8 @@
> > #define HW_APBHX_CTRL2 0x020
> > #define HW_APBHX_CHANNEL_CTRL 0x030
> > #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> > -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
> > +#define HW_APBH_VERSION_IMX23 0x3f0
> > +#define HW_APBH_VERSION_IMX28 0x800
>
> Since the VERSION is broken for identifying the dma type and we are
> introduce dma type field, I would suggest to remove the use of VERSION
> completely and use mxs_dma_type pbh_is_old() (mxs_dma->everywhere.
>
Remove HW_APBH_VERSION_*?
But i see the some other places in original code still need to use it.
Like:
#define apbh_is_old() (mxs_dma->version < APBH_VERSION_LATEST)
..
#define HW_APBHX_CHn_NXTCMDAR(n) \
(((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 0x70)
#define HW_APBHX_CHn_SEMA(n) \
(((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 0x70)
Do you mean apbh_is_old represents the same as SoC type and can be replaced
by mxs_dma_type?
> #define HW_APBX_VERSION 0x800
> > #define BP_APBHX_VERSION_MAJOR 24
> > #define HW_APBHX_CHn_NXTCMDAR(n) \
> > @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> > #define MXS_DMA_CHANNELS_MASK 0xffff
> >
> > struct mxs_dma_engine {
> > - int dev_id;
> > + unsigned int type;
> > + unsigned int dev_id;
> > unsigned int version;
> > void __iomem *base;
> > struct clk *clk;
> > @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> > struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> > };
> >
> > +enum mxs_dma_devtype {
> > + IMX23_DMA,
> > + IMX28_DMA,
> > +};
> > +
> > +struct mxs_dma_type {
> > + unsigned int type;
> > + unsigned int id;
> > +};
> > +
> > +static struct mxs_dma_type mxs_dma_types[] = {
> > + {
> > + .type = IMX23_DMA,
> > + .id = MXS_DMA_APBH,
>
> To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
> a type.
>
Well, i'm more like IMX23_DMA since they're different devices.
Id to me is more like a same device but different id.
And you see i already have enum mxs_dma_devtype.
> > + }, {
> > + .type = IMX23_DMA,
> > + .id = MXS_DMA_APBX,
> > + }, {
> > + .type = IMX28_DMA,
> > + .id = MXS_DMA_APBH,
> > + }, {
> > + .type = IMX28_DMA,
> > + .id = MXS_DMA_APBX,
> > + }, {
> > + /* end of list */
> > + }
>
> This end sign is not needed, I think.
>
Ok to me.
btw i always had this question before,
Can you tell what's purpose of adding a '/* end of list */'?
> > +};
> > +
> > +static struct platform_device_id mxs_dma_idt[] = {
>
> s/mxs_dma_idt/mxs_dma_ids?
>
Ok to me.
> > + {
> > + .name = "imx23-dma-apbh",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> > + }, {
> > + .name = "imx23-dma-apbx",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> > + }, {
> > + .name = "imx28-dma-apbh",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> > + }, {
> > + .name = "imx28-dma-apbx",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> > + }, {
> > + /* end of list */
> > + }
> > +};
> > +
> > +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> > +{
> > + return container_of(chan, struct mxs_dma_chan, chan);
> > +}
> > +
> > +int mxs_dma_is_apbh(struct dma_chan *chan)
> > +{
> > + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > +
> > + return dma_is_apbh();
>
> I would expect it simply be
>
> return (mxs_dma->dev_id == MXS_DMA_APBH);
>
> And dma_is_apbh() can be removed completely now.
>
Yes, it's ture.
Basically what i did in this patch is only convert the driver to
a more generic platform_device_id, seems i need to do more...
> > +}
> > +
> > +int mxs_dma_is_apbx(struct dma_chan *chan)
> > +{
> > + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > +
> > + return !dma_is_apbh();
>
> return (mxs_dma->dev_id == MXS_DMA_APBX);
>
> > +}
> > +
> > +
> > static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> > {
> > struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
> > mxs_chan->status = DMA_IN_PROGRESS;
> > }
> >
> > -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> > -{
> > - return container_of(chan, struct mxs_dma_chan, chan);
> > -}
> > -
> > static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> > {
> > struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> > @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
> > if (ret)
> > goto err_out;
> >
> > - /* only major version matters */
> > - mxs_dma->version = readl(mxs_dma->base +
> > + if (mxs_dma->type == IMX23_DMA) {
> > + /* only major version matters */
> > + mxs_dma->version = readl(mxs_dma->base +
> > ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> > - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> > + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> > BP_APBHX_VERSION_MAJOR;
> > + } else if (mxs_dma->type == IMX28_DMA) {
> > + mxs_dma->version = readl(mxs_dma->base +
> > + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> > + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> > + BP_APBHX_VERSION_MAJOR;
> > + }
>
> Again, let's just get rid of the use of VERSION completely.
>
> >
> > /* enable apbh burst */
> > if (dma_is_apbh()) {
> > @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> > {
> > const struct platform_device_id *id_entry =
> > platform_get_device_id(pdev);
> > + const struct mxs_dma_type *mtype =
> > + (struct mxs_dma_type *)id_entry->driver_data;
> > struct mxs_dma_engine *mxs_dma;
> > struct resource *iores;
> > int ret, i;
> > @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> > if (!mxs_dma)
> > return -ENOMEM;
> >
> > - mxs_dma->dev_id = id_entry->driver_data;
> > + mxs_dma->type = mtype->type;
> > + mxs_dma->dev_id = mtype->id;
> >
> > iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >
> > @@ -692,23 +767,11 @@ err_request_region:
> > return ret;
> > }
> >
> > -static struct platform_device_id mxs_dma_type[] = {
> > - {
> > - .name = "mxs-dma-apbh",
> > - .driver_data = MXS_DMA_APBH,
> > - }, {
> > - .name = "mxs-dma-apbx",
> > - .driver_data = MXS_DMA_APBX,
> > - }, {
> > - /* end of list */
> > - }
> > -};
> > -
> > static struct platform_driver mxs_dma_driver = {
> > .driver = {
> > .name = "mxs-dma",
> > },
> > - .id_table = mxs_dma_type,
> > + .id_table = mxs_dma_idt,
> > };
> >
> > static int __init mxs_dma_module_init(void)
> > diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> > index 203d7c4..55d8702 100644
> > --- a/include/linux/fsl/mxs-dma.h
> > +++ b/include/linux/fsl/mxs-dma.h
> > @@ -15,14 +15,6 @@ struct mxs_dma_data {
> > int chan_irq;
> > };
> >
> > -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> > -{
> > - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> > -}
> > -
> > -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> > -{
> > - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> > -}
> > -
> > +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> > +extern int mxs_dma_is_apbx(struct dma_chan *chan);
>
> I would expect these two calls still be inline here.
>
Ok to me.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
@ 2012-04-23 3:58 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 3:58 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 11:01:18AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:34PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng@linaro.org>
> >
> > Rewrite mxs_dma_is_apbh and mxs_dma_is_apbx in order to support
> > other SoCs like imx6q and reform the platform_device_id for the
> > better further dt support.
> >
> Nice cleanup. But I would like to ask more.
>
> > Cc: Vinod Koul <vinod.koul@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Huang Shijie <b32955@freescale.com>
> > Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> > ---
> > arch/arm/mach-mxs/clock-mx23.c | 4 +-
> > arch/arm/mach-mxs/clock-mx28.c | 4 +-
> > arch/arm/mach-mxs/devices/platform-dma.c | 14 ++--
> > drivers/dma/mxs-dma.c | 111 +++++++++++++++++++++++-------
> > include/linux/fsl/mxs-dma.h | 12 +---
> > 5 files changed, 101 insertions(+), 44 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
> > index e3ac52c..1e67b85 100644
> > --- a/arch/arm/mach-mxs/clock-mx23.c
> > +++ b/arch/arm/mach-mxs/clock-mx23.c
> > @@ -427,8 +427,8 @@ static struct clk_lookup lookups[] = {
> > _REGISTER_CLOCK("duart", NULL, uart_clk)
> > _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
> > _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> > + _REGISTER_CLOCK("imx23-dma-apbh", NULL, hbus_clk)
> > + _REGISTER_CLOCK("imx23-dma-apbx", NULL, xbus_clk)
> > _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
> > _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
> > _REGISTER_CLOCK(NULL, "usb", usb_clk)
> > diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
> > index 1867a17..cca2cf7 100644
> > --- a/arch/arm/mach-mxs/clock-mx28.c
> > +++ b/arch/arm/mach-mxs/clock-mx28.c
> > @@ -625,8 +625,8 @@ static struct clk_lookup lookups[] = {
> > _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
> > _REGISTER_CLOCK("rtc", NULL, rtc_clk)
> > _REGISTER_CLOCK("pll2", NULL, pll2_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
> > - _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
> > + _REGISTER_CLOCK("imx28-dma-apbh", NULL, hbus_clk)
> > + _REGISTER_CLOCK("imx28-dma-apbx", NULL, xbus_clk)
> > _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk)
> > _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk)
> > _REGISTER_CLOCK("mxs-mmc.2", NULL, ssp2_clk)
> > diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c
> > index 6a0202b..aff4813 100644
> > --- a/arch/arm/mach-mxs/devices/platform-dma.c
> > +++ b/arch/arm/mach-mxs/devices/platform-dma.c
> > @@ -32,17 +32,19 @@ static struct platform_device *__init mxs_add_dma(const char *devid,
> >
> > static int __init mxs_add_mxs_dma(void)
> > {
> > - char *apbh = "mxs-dma-apbh";
> > - char *apbx = "mxs-dma-apbx";
> > + char *mx23_apbh = "imx23-dma-apbh";
> > + char *mx23_apbx = "imx23-dma-apbx";
> > + char *mx28_apbh = "imx28-dma-apbh";
> > + char *mx28_apbx = "imx28-dma-apbx";
> >
> > if (cpu_is_mx23()) {
> > - mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
> > - mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
> > + mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
> > + mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
> > }
> >
> > if (cpu_is_mx28()) {
> > - mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
> > - mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
> > + mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
> > + mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
> > }
> >
> > return 0;
>
> With soc specific hook introduced, we can remove this mxs_add_mxs_dma
> call completely.
>
Yes, it's true.
A mx23/mx28_soc_init can do it well.
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > index b0051a8..51a29f9 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -50,7 +50,8 @@
> > #define HW_APBHX_CTRL2 0x020
> > #define HW_APBHX_CHANNEL_CTRL 0x030
> > #define BP_APBHX_CHANNEL_CTRL_RESET_CHANNEL 16
> > -#define HW_APBH_VERSION (cpu_is_mx23() ? 0x3f0 : 0x800)
> > +#define HW_APBH_VERSION_IMX23 0x3f0
> > +#define HW_APBH_VERSION_IMX28 0x800
>
> Since the VERSION is broken for identifying the dma type and we are
> introduce dma type field, I would suggest to remove the use of VERSION
> completely and use mxs_dma_type pbh_is_old() (mxs_dma->everywhere.
>
Remove HW_APBH_VERSION_*?
But i see the some other places in original code still need to use it.
Like:
#define apbh_is_old() (mxs_dma->version < APBH_VERSION_LATEST)
..
#define HW_APBHX_CHn_NXTCMDAR(n) \
(((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 0x70)
#define HW_APBHX_CHn_SEMA(n) \
(((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 0x70)
Do you mean apbh_is_old represents the same as SoC type and can be replaced
by mxs_dma_type?
> #define HW_APBX_VERSION 0x800
> > #define BP_APBHX_VERSION_MAJOR 24
> > #define HW_APBHX_CHn_NXTCMDAR(n) \
> > @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> > #define MXS_DMA_CHANNELS_MASK 0xffff
> >
> > struct mxs_dma_engine {
> > - int dev_id;
> > + unsigned int type;
> > + unsigned int dev_id;
> > unsigned int version;
> > void __iomem *base;
> > struct clk *clk;
> > @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> > struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> > };
> >
> > +enum mxs_dma_devtype {
> > + IMX23_DMA,
> > + IMX28_DMA,
> > +};
> > +
> > +struct mxs_dma_type {
> > + unsigned int type;
> > + unsigned int id;
> > +};
> > +
> > +static struct mxs_dma_type mxs_dma_types[] = {
> > + {
> > + .type = IMX23_DMA,
> > + .id = MXS_DMA_APBH,
>
> To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
> a type.
>
Well, i'm more like IMX23_DMA since they're different devices.
Id to me is more like a same device but different id.
And you see i already have enum mxs_dma_devtype.
> > + }, {
> > + .type = IMX23_DMA,
> > + .id = MXS_DMA_APBX,
> > + }, {
> > + .type = IMX28_DMA,
> > + .id = MXS_DMA_APBH,
> > + }, {
> > + .type = IMX28_DMA,
> > + .id = MXS_DMA_APBX,
> > + }, {
> > + /* end of list */
> > + }
>
> This end sign is not needed, I think.
>
Ok to me.
btw i always had this question before,
Can you tell what's purpose of adding a '/* end of list */'?
> > +};
> > +
> > +static struct platform_device_id mxs_dma_idt[] = {
>
> s/mxs_dma_idt/mxs_dma_ids?
>
Ok to me.
> > + {
> > + .name = "imx23-dma-apbh",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> > + }, {
> > + .name = "imx23-dma-apbx",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> > + }, {
> > + .name = "imx28-dma-apbh",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> > + }, {
> > + .name = "imx28-dma-apbx",
> > + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> > + }, {
> > + /* end of list */
> > + }
> > +};
> > +
> > +static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> > +{
> > + return container_of(chan, struct mxs_dma_chan, chan);
> > +}
> > +
> > +int mxs_dma_is_apbh(struct dma_chan *chan)
> > +{
> > + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > +
> > + return dma_is_apbh();
>
> I would expect it simply be
>
> return (mxs_dma->dev_id == MXS_DMA_APBH);
>
> And dma_is_apbh() can be removed completely now.
>
Yes, it's ture.
Basically what i did in this patch is only convert the driver to
a more generic platform_device_id, seems i need to do more...
> > +}
> > +
> > +int mxs_dma_is_apbx(struct dma_chan *chan)
> > +{
> > + struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > + struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > +
> > + return !dma_is_apbh();
>
> return (mxs_dma->dev_id == MXS_DMA_APBX);
>
> > +}
> > +
> > +
> > static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> > {
> > struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > @@ -193,11 +263,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
> > mxs_chan->status = DMA_IN_PROGRESS;
> > }
> >
> > -static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
> > -{
> > - return container_of(chan, struct mxs_dma_chan, chan);
> > -}
> > -
> > static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> > {
> > struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
> > @@ -574,11 +639,18 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
> > if (ret)
> > goto err_out;
> >
> > - /* only major version matters */
> > - mxs_dma->version = readl(mxs_dma->base +
> > + if (mxs_dma->type == IMX23_DMA) {
> > + /* only major version matters */
> > + mxs_dma->version = readl(mxs_dma->base +
> > ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> > - HW_APBX_VERSION : HW_APBH_VERSION)) >>
> > + HW_APBX_VERSION : HW_APBH_VERSION_IMX23)) >>
> > BP_APBHX_VERSION_MAJOR;
> > + } else if (mxs_dma->type == IMX28_DMA) {
> > + mxs_dma->version = readl(mxs_dma->base +
> > + ((mxs_dma->dev_id == MXS_DMA_APBX) ?
> > + HW_APBX_VERSION : HW_APBH_VERSION_IMX28)) >>
> > + BP_APBHX_VERSION_MAJOR;
> > + }
>
> Again, let's just get rid of the use of VERSION completely.
>
> >
> > /* enable apbh burst */
> > if (dma_is_apbh()) {
> > @@ -601,6 +673,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> > {
> > const struct platform_device_id *id_entry =
> > platform_get_device_id(pdev);
> > + const struct mxs_dma_type *mtype =
> > + (struct mxs_dma_type *)id_entry->driver_data;
> > struct mxs_dma_engine *mxs_dma;
> > struct resource *iores;
> > int ret, i;
> > @@ -609,7 +683,8 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> > if (!mxs_dma)
> > return -ENOMEM;
> >
> > - mxs_dma->dev_id = id_entry->driver_data;
> > + mxs_dma->type = mtype->type;
> > + mxs_dma->dev_id = mtype->id;
> >
> > iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >
> > @@ -692,23 +767,11 @@ err_request_region:
> > return ret;
> > }
> >
> > -static struct platform_device_id mxs_dma_type[] = {
> > - {
> > - .name = "mxs-dma-apbh",
> > - .driver_data = MXS_DMA_APBH,
> > - }, {
> > - .name = "mxs-dma-apbx",
> > - .driver_data = MXS_DMA_APBX,
> > - }, {
> > - /* end of list */
> > - }
> > -};
> > -
> > static struct platform_driver mxs_dma_driver = {
> > .driver = {
> > .name = "mxs-dma",
> > },
> > - .id_table = mxs_dma_type,
> > + .id_table = mxs_dma_idt,
> > };
> >
> > static int __init mxs_dma_module_init(void)
> > diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
> > index 203d7c4..55d8702 100644
> > --- a/include/linux/fsl/mxs-dma.h
> > +++ b/include/linux/fsl/mxs-dma.h
> > @@ -15,14 +15,6 @@ struct mxs_dma_data {
> > int chan_irq;
> > };
> >
> > -static inline int mxs_dma_is_apbh(struct dma_chan *chan)
> > -{
> > - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
> > -}
> > -
> > -static inline int mxs_dma_is_apbx(struct dma_chan *chan)
> > -{
> > - return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
> > -}
> > -
> > +extern int mxs_dma_is_apbh(struct dma_chan *chan);
> > +extern int mxs_dma_is_apbx(struct dma_chan *chan);
>
> I would expect these two calls still be inline here.
>
Ok to me.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-23 3:15 ` Shawn Guo
@ 2012-04-23 4:01 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 4:01 UTC (permalink / raw)
To: Shawn Guo
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 11:15:20AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:35PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> > Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> > Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> > Cc: Rob Landley <rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
> > Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > Cc: Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Cc: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > Signed-off-by: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > ---
> > .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> > drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
> > 2 files changed, 44 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> > new file mode 100644
> > index 0000000..ded0398
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> > @@ -0,0 +1,19 @@
> > +* Freescale MXS DMA
> > +
> > +Required properties:
> > +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> > +- reg : Should contain registers location and length
> > +
> > +Supported chips:
> > +imx23, imx28.
> > +
> > +Examples:
> > +dma-apbh@80004000 {
> > + compatible = "fsl,imx28-dma-apbh";
> > + reg = <0x80004000 2000>;
> > +};
> > +
> > +dma-apbx@80024000 {
> > + compatible = "fsl,imx28-dma-apbx";
> > + reg = <0x80024000 2000>;
> > +};
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > index 51a29f9..74c3275 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -22,8 +22,11 @@
> > #include <linux/platform_device.h>
> > #include <linux/dmaengine.h>
> > #include <linux/delay.h>
> > +#include <linux/module.h>
> > #include <linux/fsl/mxs-dma.h>
> > #include <linux/stmp_device.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> >
> > #include <asm/irq.h>
> >
> > @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> > }
> > };
> >
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > + { /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > +#endif
> > +
> As out goal is to convert mxs over to DT, you can remove the #ifdef
> here ...
>
But the non-dt is still exist, right?
So i think we can keep it now unless we totally removed the non-dt code.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-23 4:01 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 4:01 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 11:15:20AM +0800, Shawn Guo wrote:
> On Wed, Apr 18, 2012 at 08:46:35PM +0800, Dong Aisheng wrote:
> > From: Dong Aisheng <dong.aisheng@linaro.org>
> >
> > Cc: Grant Likely <grant.likely@secretlab.ca>
> > Cc: Rob Herring <rob.herring@calxeda.com>
> > Cc: Rob Landley <rob@landley.net>
> > Cc: Vinod Koul <vinod.koul@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Huang Shijie <b32955@freescale.com>
> > Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> > ---
> > .../devicetree/bindings/dma/fsl-mxs-dma.txt | 19 +++++++++++++
> > drivers/dma/mxs-dma.c | 29 +++++++++++++++++---
> > 2 files changed, 44 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> > new file mode 100644
> > index 0000000..ded0398
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> > @@ -0,0 +1,19 @@
> > +* Freescale MXS DMA
> > +
> > +Required properties:
> > +- compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
> > +- reg : Should contain registers location and length
> > +
> > +Supported chips:
> > +imx23, imx28.
> > +
> > +Examples:
> > +dma-apbh at 80004000 {
> > + compatible = "fsl,imx28-dma-apbh";
> > + reg = <0x80004000 2000>;
> > +};
> > +
> > +dma-apbx at 80024000 {
> > + compatible = "fsl,imx28-dma-apbx";
> > + reg = <0x80024000 2000>;
> > +};
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > index 51a29f9..74c3275 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -22,8 +22,11 @@
> > #include <linux/platform_device.h>
> > #include <linux/dmaengine.h>
> > #include <linux/delay.h>
> > +#include <linux/module.h>
> > #include <linux/fsl/mxs-dma.h>
> > #include <linux/stmp_device.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> >
> > #include <asm/irq.h>
> >
> > @@ -178,6 +181,17 @@ static struct platform_device_id mxs_dma_idt[] = {
> > }
> > };
> >
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > + { /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > +#endif
> > +
> As out goal is to convert mxs over to DT, you can remove the #ifdef
> here ...
>
But the non-dt is still exist, right?
So i think we can keep it now unless we totally removed the non-dt code.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
2012-04-23 3:58 ` Dong Aisheng
@ 2012-04-23 4:58 ` Shawn Guo
-1 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 4:58 UTC (permalink / raw)
To: Dong Aisheng
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 11:58:48AM +0800, Dong Aisheng wrote:
...
> Remove HW_APBH_VERSION_*?
> But i see the some other places in original code still need to use it.
> Like:
> #define apbh_is_old() (mxs_dma->version < APBH_VERSION_LATEST)
> ..
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> (((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 0x70)
> #define HW_APBHX_CHn_SEMA(n) \
> (((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 0x70)
>
> Do you mean apbh_is_old represents the same as SoC type and can be replaced
> by mxs_dma_type?
>
Yes.
> > #define HW_APBX_VERSION 0x800
> > > #define BP_APBHX_VERSION_MAJOR 24
> > > #define HW_APBHX_CHn_NXTCMDAR(n) \
> > > @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> > > #define MXS_DMA_CHANNELS_MASK 0xffff
> > >
> > > struct mxs_dma_engine {
> > > - int dev_id;
> > > + unsigned int type;
> > > + unsigned int dev_id;
> > > unsigned int version;
> > > void __iomem *base;
> > > struct clk *clk;
> > > @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> > > struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> > > };
> > >
> > > +enum mxs_dma_devtype {
> > > + IMX23_DMA,
> > > + IMX28_DMA,
> > > +};
> > > +
> > > +struct mxs_dma_type {
> > > + unsigned int type;
> > > + unsigned int id;
> > > +};
> > > +
> > > +static struct mxs_dma_type mxs_dma_types[] = {
> > > + {
> > > + .type = IMX23_DMA,
> > > + .id = MXS_DMA_APBH,
> >
> > To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
> > a type.
> >
> Well, i'm more like IMX23_DMA since they're different devices.
> Id to me is more like a same device but different id.
> And you see i already have enum mxs_dma_devtype.
>
Ok, let me put more comment on this. You have mxs_dma_devtype defined,
and then you should use it rather than "unsigned int" to define "type"
in struct mxs_dma_type. And for better alignment, the MXS_DMA_APBH
and MXS_DMA_APBX should be changed to some enum type from the exsiting
macro. Then, struct mxs_dma_type should probably look like the
following.
struct mxs_dma_type {
enum mxs_dma_devtype type;
enum mxs_dma_id id;
};
As you agreed below, we will have mxs_dma_ids for the platform_device_id
table, and mxs_dma_id here for another enum.
I think we really need a better semantics for "type" and "id" in this
driver.
> > > + }, {
> > > + .type = IMX23_DMA,
> > > + .id = MXS_DMA_APBX,
> > > + }, {
> > > + .type = IMX28_DMA,
> > > + .id = MXS_DMA_APBH,
> > > + }, {
> > > + .type = IMX28_DMA,
> > > + .id = MXS_DMA_APBX,
> > > + }, {
> > > + /* end of list */
> > > + }
> >
> > This end sign is not needed, I think.
> >
> Ok to me.
> btw i always had this question before,
> Can you tell what's purpose of adding a '/* end of list */'?
>
The end sign I meant is "{ }". It's needed for platform_device_id
and of_device_id table by driver core. But I do not see why we need
it for mxs_dma_type table here.
> > > +};
> > > +
> > > +static struct platform_device_id mxs_dma_idt[] = {
> >
> > s/mxs_dma_idt/mxs_dma_ids?
> >
> Ok to me.
>
> > > + {
> > > + .name = "imx23-dma-apbh",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> > > + }, {
> > > + .name = "imx23-dma-apbx",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> > > + }, {
> > > + .name = "imx28-dma-apbh",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> > > + }, {
> > > + .name = "imx28-dma-apbx",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> > > + }, {
> > > + /* end of list */
> > > + }
> > > +};
> > > +
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic
@ 2012-04-23 4:58 ` Shawn Guo
0 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 4:58 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 11:58:48AM +0800, Dong Aisheng wrote:
...
> Remove HW_APBH_VERSION_*?
> But i see the some other places in original code still need to use it.
> Like:
> #define apbh_is_old() (mxs_dma->version < APBH_VERSION_LATEST)
> ..
> #define HW_APBHX_CHn_NXTCMDAR(n) \
> (((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 0x70)
> #define HW_APBHX_CHn_SEMA(n) \
> (((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 0x70)
>
> Do you mean apbh_is_old represents the same as SoC type and can be replaced
> by mxs_dma_type?
>
Yes.
> > #define HW_APBX_VERSION 0x800
> > > #define BP_APBHX_VERSION_MAJOR 24
> > > #define HW_APBHX_CHn_NXTCMDAR(n) \
> > > @@ -121,7 +122,8 @@ struct mxs_dma_chan {
> > > #define MXS_DMA_CHANNELS_MASK 0xffff
> > >
> > > struct mxs_dma_engine {
> > > - int dev_id;
> > > + unsigned int type;
> > > + unsigned int dev_id;
> > > unsigned int version;
> > > void __iomem *base;
> > > struct clk *clk;
> > > @@ -130,6 +132,74 @@ struct mxs_dma_engine {
> > > struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> > > };
> > >
> > > +enum mxs_dma_devtype {
> > > + IMX23_DMA,
> > > + IMX28_DMA,
> > > +};
> > > +
> > > +struct mxs_dma_type {
> > > + unsigned int type;
> > > + unsigned int id;
> > > +};
> > > +
> > > +static struct mxs_dma_type mxs_dma_types[] = {
> > > + {
> > > + .type = IMX23_DMA,
> > > + .id = MXS_DMA_APBH,
> >
> > To me, IMX23_DMA is more like a id, while MXS_DMA_APBH is more like
> > a type.
> >
> Well, i'm more like IMX23_DMA since they're different devices.
> Id to me is more like a same device but different id.
> And you see i already have enum mxs_dma_devtype.
>
Ok, let me put more comment on this. You have mxs_dma_devtype defined,
and then you should use it rather than "unsigned int" to define "type"
in struct mxs_dma_type. And for better alignment, the MXS_DMA_APBH
and MXS_DMA_APBX should be changed to some enum type from the exsiting
macro. Then, struct mxs_dma_type should probably look like the
following.
struct mxs_dma_type {
enum mxs_dma_devtype type;
enum mxs_dma_id id;
};
As you agreed below, we will have mxs_dma_ids for the platform_device_id
table, and mxs_dma_id here for another enum.
I think we really need a better semantics for "type" and "id" in this
driver.
> > > + }, {
> > > + .type = IMX23_DMA,
> > > + .id = MXS_DMA_APBX,
> > > + }, {
> > > + .type = IMX28_DMA,
> > > + .id = MXS_DMA_APBH,
> > > + }, {
> > > + .type = IMX28_DMA,
> > > + .id = MXS_DMA_APBX,
> > > + }, {
> > > + /* end of list */
> > > + }
> >
> > This end sign is not needed, I think.
> >
> Ok to me.
> btw i always had this question before,
> Can you tell what's purpose of adding a '/* end of list */'?
>
The end sign I meant is "{ }". It's needed for platform_device_id
and of_device_id table by driver core. But I do not see why we need
it for mxs_dma_type table here.
> > > +};
> > > +
> > > +static struct platform_device_id mxs_dma_idt[] = {
> >
> > s/mxs_dma_idt/mxs_dma_ids?
> >
> Ok to me.
>
> > > + {
> > > + .name = "imx23-dma-apbh",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[0],
> > > + }, {
> > > + .name = "imx23-dma-apbx",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[1],
> > > + }, {
> > > + .name = "imx28-dma-apbh",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[2],
> > > + }, {
> > > + .name = "imx28-dma-apbx",
> > > + .driver_data = (kernel_ulong_t) &mxs_dma_types[3],
> > > + }, {
> > > + /* end of list */
> > > + }
> > > +};
> > > +
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-23 4:01 ` Dong Aisheng
@ 2012-04-23 5:04 ` Shawn Guo
-1 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 5:04 UTC (permalink / raw)
To: Dong Aisheng
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 12:01:29PM +0800, Dong Aisheng wrote:
> > > +#ifdef CONFIG_OF
> > > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > > + { /* sentinel */ }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > > +#endif
> > > +
> > As out goal is to convert mxs over to DT, you can remove the #ifdef
> > here ...
> >
> But the non-dt is still exist, right?
> So i think we can keep it now unless we totally removed the non-dt code.
>
The non-dt still exist during the transition. But even without the
#ifdef, the driver works for non-dt. It just saves a few bytes for
non-dt only build. We will soon enable DT build for mxs permanently.
What's the point to have it at all?
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-23 5:04 ` Shawn Guo
0 siblings, 0 replies; 42+ messages in thread
From: Shawn Guo @ 2012-04-23 5:04 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 12:01:29PM +0800, Dong Aisheng wrote:
> > > +#ifdef CONFIG_OF
> > > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > > + { /* sentinel */ }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > > +#endif
> > > +
> > As out goal is to convert mxs over to DT, you can remove the #ifdef
> > here ...
> >
> But the non-dt is still exist, right?
> So i think we can keep it now unless we totally removed the non-dt code.
>
The non-dt still exist during the transition. But even without the
#ifdef, the driver works for non-dt. It just saves a few bytes for
non-dt only build. We will soon enable DT build for mxs permanently.
What's the point to have it at all?
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/5] dma: mxs-dma: add device tree probe support
2012-04-23 5:04 ` Shawn Guo
@ 2012-04-23 8:02 ` Dong Aisheng
-1 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 8:02 UTC (permalink / raw)
To: Shawn Guo
Cc: marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Huang Shijie-B32955,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Mon, Apr 23, 2012 at 01:04:00PM +0800, Shawn Guo wrote:
> On Mon, Apr 23, 2012 at 12:01:29PM +0800, Dong Aisheng wrote:
> > > > +#ifdef CONFIG_OF
> > > > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > > > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > > > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > > > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > > > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > > > + { /* sentinel */ }
> > > > +};
> > > > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > > > +#endif
> > > > +
> > > As out goal is to convert mxs over to DT, you can remove the #ifdef
> > > here ...
> > >
> > But the non-dt is still exist, right?
> > So i think we can keep it now unless we totally removed the non-dt code.
> >
> The non-dt still exist during the transition. But even without the
> #ifdef, the driver works for non-dt. It just saves a few bytes for
> non-dt only build. We will soon enable DT build for mxs permanently.
> What's the point to have it at all?
>
Hmm, i think the point is non-dt does not need it, not relate to whether
user decide to enable dt or not.
Since you insist that, i can remove it first in my v2 patch and see people's
comment.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 3/5] dma: mxs-dma: add device tree probe support
@ 2012-04-23 8:02 ` Dong Aisheng
0 siblings, 0 replies; 42+ messages in thread
From: Dong Aisheng @ 2012-04-23 8:02 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2012 at 01:04:00PM +0800, Shawn Guo wrote:
> On Mon, Apr 23, 2012 at 12:01:29PM +0800, Dong Aisheng wrote:
> > > > +#ifdef CONFIG_OF
> > > > +static const struct of_device_id mxs_dma_dt_ids[] = {
> > > > + { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_idt[0], },
> > > > + { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_idt[1], },
> > > > + { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_idt[2], },
> > > > + { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_idt[3], },
> > > > + { /* sentinel */ }
> > > > +};
> > > > +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> > > > +#endif
> > > > +
> > > As out goal is to convert mxs over to DT, you can remove the #ifdef
> > > here ...
> > >
> > But the non-dt is still exist, right?
> > So i think we can keep it now unless we totally removed the non-dt code.
> >
> The non-dt still exist during the transition. But even without the
> #ifdef, the driver works for non-dt. It just saves a few bytes for
> non-dt only build. We will soon enable DT build for mxs permanently.
> What's the point to have it at all?
>
Hmm, i think the point is non-dt does not need it, not relate to whether
user decide to enable dt or not.
Since you insist that, i can remove it first in my v2 patch and see people's
comment.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2012-04-23 8:02 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18 12:46 [PATCH 0/5] dma: mxs-dma: make driver mach-independent and add dt support Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
[not found] ` <1334753197-12032-1-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-18 12:46 ` [PATCH 1/5] dma: mxs-dma: use global stmp_device functionality Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
[not found] ` <1334753197-12032-2-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-18 18:00 ` Marek Vasut
2012-04-18 18:00 ` Marek Vasut
2012-04-18 12:46 ` [PATCH 2/5] dma: mxs-dma: make platform_device_id more generic Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
2012-04-18 18:01 ` Marek Vasut
2012-04-18 18:01 ` Marek Vasut
[not found] ` <1334753197-12032-3-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-23 3:01 ` Shawn Guo
2012-04-23 3:01 ` Shawn Guo
[not found] ` <20120423030114.GI26306-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 3:58 ` Dong Aisheng
2012-04-23 3:58 ` Dong Aisheng
[not found] ` <20120423035846.GB24843-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 4:58 ` Shawn Guo
2012-04-23 4:58 ` Shawn Guo
2012-04-18 12:46 ` [PATCH 3/5] dma: mxs-dma: add device tree probe support Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
2012-04-18 18:02 ` Marek Vasut
2012-04-18 18:02 ` Marek Vasut
[not found] ` <1334753197-12032-4-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-23 3:15 ` Shawn Guo
2012-04-23 3:15 ` Shawn Guo
[not found] ` <20120423031518.GJ26306-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 4:01 ` Dong Aisheng
2012-04-23 4:01 ` Dong Aisheng
[not found] ` <20120423040129.GC24843-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 5:04 ` Shawn Guo
2012-04-23 5:04 ` Shawn Guo
[not found] ` <20120423050358.GL26306-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 8:02 ` Dong Aisheng
2012-04-23 8:02 ` Dong Aisheng
2012-04-18 12:46 ` [PATCH 4/5] ARM: mxs: do not add dma device by default Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
[not found] ` <1334753197-12032-5-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-18 18:03 ` Marek Vasut
2012-04-18 18:03 ` Marek Vasut
[not found] ` <201204182003.26359.marex-ynQEQJNshbs@public.gmane.org>
2012-04-20 15:11 ` [PATCH v2 " Dong Aisheng
2012-04-20 15:11 ` Dong Aisheng
2012-04-23 1:59 ` [PATCH " Shawn Guo
2012-04-23 1:59 ` Shawn Guo
[not found] ` <20120423015953.GH26306-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-04-23 3:26 ` Dong Aisheng
2012-04-23 3:26 ` Dong Aisheng
2012-04-18 12:46 ` [PATCH 5/5] ARM: mx28evk: add mxs-dma dt support Dong Aisheng
2012-04-18 12:46 ` Dong Aisheng
[not found] ` <1334753197-12032-6-git-send-email-b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-04-18 18:03 ` Marek Vasut
2012-04-18 18:03 ` Marek Vasut
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.