Skip to contentSkip to conversation

ARM: dts: imx6dl: disable dma support for spi on i.mx6dl

PATCH New Robin Gong 2 participants 5 messages Oct 21, 2014

Subsystems (5)
lore
Share & tools
lore

Robin Gong

author
#0 lore raw

PATCH v2 1/1 ARM: dts: imx6dl: disable dma support for spi on i.mx6dl

There is one weird data in rxfifo after one full rx/tx transfer done sometimes. It looks a design issue and hard to workaround totally, so disable dma functhion here. And will re-enable it once the root cause found.

---
 arch/arm/boot/dts/imx6q.dtsi   | 20 ++++++++++++++++++++
 arch/arm/boot/dts/imx6qdl.dtsi |  8 --------
 2 files changed, 20 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx6q.dtsi +20 -0
index e9f3646..8d5d33b 100644
@@ -291,6 +291,26 @@
 	};
 };
 
+&ecspi1 {
+	dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
+	dma-names = "rx", "tx";
+};
+
+&ecspi2 {
+	dmas = <&sdma 5 7 1>, <&sdma 6 7 2>;
+	dma-names = "rx", "tx";
+};
+
+&ecspi3 {
+	dmas = <&sdma 7 7 1>, <&sdma 8 7 2>;
+	dma-names = "rx", "tx";
+};
+
+&ecspi4 {
+	dmas = <&sdma 9 7 1>, <&sdma 10 7 2>;
+	dma-names = "rx", "tx";
+};
+
 &mipi_dsi {
 	port@2 {
 		reg = <2>;
arch/arm/boot/dts/imx6qdl.dtsi +0 -8
index 70d7207..f696546 100644
@@ -210,8 +210,6 @@
 					clocks = <&clks IMX6QDL_CLK_ECSPI1>,
 						 <&clks IMX6QDL_CLK_ECSPI1>;
 					clock-names = "ipg", "per";
-					dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
-					dma-names = "rx", "tx";
 					status = "disabled";
 				};
 
@@ -224,8 +222,6 @@
 					clocks = <&clks IMX6QDL_CLK_ECSPI2>,
 						 <&clks IMX6QDL_CLK_ECSPI2>;
 					clock-names = "ipg", "per";
-					dmas = <&sdma 5 7 1>, <&sdma 6 7 2>;
-					dma-names = "rx", "tx";
 					status = "disabled";
 				};
 
@@ -238,8 +234,6 @@
 					clocks = <&clks IMX6QDL_CLK_ECSPI3>,
 						 <&clks IMX6QDL_CLK_ECSPI3>;
 					clock-names = "ipg", "per";
-					dmas = <&sdma 7 7 1>, <&sdma 8 7 2>;
-					dma-names = "rx", "tx";
 					status = "disabled";
 				};
 
@@ -252,8 +246,6 @@
 					clocks = <&clks IMX6QDL_CLK_ECSPI4>,
 						 <&clks IMX6QDL_CLK_ECSPI4>;
 					clock-names = "ipg", "per";
-					dmas = <&sdma 9 7 1>, <&sdma 10 7 2>;
-					dma-names = "rx", "tx";
 					status = "disabled";
 				};
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 ARM: imx6: add pm_power_off support for i.mx6 chips

All chips of i.mx6 can be powered off by programming SNVS. For example :
On i.mx6q-sabresd board, PMIC_ON_REQ connect with external pmic ON/OFF pin, that will cause the whole PMIC powered off except VSNVS. And system can restart once PMIC_ON_REQ goes high by push POWRER key.

---
 arch/arm/mach-imx/common.h      |  1 +
 arch/arm/mach-imx/mach-imx6q.c  |  2 ++
 arch/arm/mach-imx/mach-imx6sl.c |  2 ++
 arch/arm/mach-imx/mach-imx6sx.c |  2 ++
 arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
 5 files changed, 28 insertions(+), 1 deletion(-)
arch/arm/mach-imx/common.h +1 -0
index 1dabf43..baca11a 100644
@@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
 void mxc_restart(enum reboot_mode, const char *);
 void mxc_arch_reset_init(void __iomem *);
 void mxc_arch_reset_init_dt(void);
+void mxc_power_off_init(void);
 int mx51_revision(void);
 int mx53_revision(void);
 void imx_set_aips(void __iomem *);
arch/arm/mach-imx/mach-imx6q.c +2 -0
index d51c6e9..3d6610d 100644
@@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
arch/arm/mach-imx/mach-imx6sl.c +2 -0
index ed263a2..c07e6e8 100644
@@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
arch/arm/mach-imx/mach-imx6sx.c +2 -0
index 3de3b73..68ea070 100644
@@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
arch/arm/mach-imx/system.c +21 -1
index d14c33f..925fb29 100644
@@ -23,6 +23,7 @@
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pm.h>
 
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
@@ -32,7 +33,9 @@
 #include "common.h"
 #include "hardware.h"
 
-static void __iomem *wdog_base;
+#define SNVS_LPCR               0x04
+
+static void __iomem *wdog_base, *snvs_base;
 static struct clk *wdog_clk;
 
 /*
@@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
 		clk_prepare(wdog_clk);
 }
 
+static void power_off_snvs(void)
+{
+	 u32 value = readl(snvs_base + SNVS_LPCR);
+	/* set TOP and DP_EN bit */
+	writel(value | 0x60, snvs_base + SNVS_LPCR);
+}
+
+void __init mxc_power_off_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
+	snvs_base = of_iomap(np, 0);
+	WARN_ON(!snvs_base);
+	pm_power_off = power_off_snvs;
+}
+
 #ifdef CONFIG_CACHE_L2X0
 void __init imx_init_l2cache(void)
 {
Signature · 1 line
1.9.1
author
#2 lore raw

v4 cover dma: imx-sdma: add support for sdma memory copy

In reply to Robin Gong

Add memory copy interface to sdma driver, the patch set is based on v3:
http://www.spinics.net/lists/dmaengine/msg00850.html.

change from v3:
1.split two patches from v3 patch for Vinod's comments.

change from v2:
1.remove redundant check for bus width.

change from v1:
1. correct some printk format, such as %pad for dma_addr_t
2. split duplicated code in prep_dma_memcpy and prep_dma_sg to make code clean

Robin Gong (3):
dma: imx-sdma: add support for sdma memory copy
dma: imx-sdma: correct print format
dma: imx-sdma: reorg code to make code clean

 drivers/dma/imx-sdma.c | 247 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 190 insertions(+), 57 deletions(-)
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v6 1/1 spi: spi-imx: add DMA support

In reply to Robin Gong

Enable DMA support on i.mx6. The read speed can increase from 600KB/s to 1.2MB/s on i.mx6q. You can disable or enable dma function in dts. If not set "dma-names" in dts, spi will use PIO mode. This patch only validate on i.mx6, not i.mx5, but encourage ones to apply this patch on i.mx5 since they share the same IP.

Note:
Sometime, there is a weid data in rxfifo after one full tx/rx
transfer finish by DMA on i.mx6dl, so we disable dma functhion on i.mx6dl.

---
Change from v5:
1. Update binding doc fsl-imx-cspi.txt.
2. remove usedma flag set from can_dma interface.

Change from v4:
1. Enrich comments.
2. Remove the rxfifo workaround. The issue only exist on i.mx6dl, so disable dma function in dts.

Change from v3:
1. Use spi core framwork to handle dump tx/rx buf
2. Add one workaround for weird data in rxfifo when one full transfer done.

Change from v2:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/291722/focus=294363
1. Dma setup only for imx51-ecspi
2. Use one small dummy buffer(1 bd size) to templiy store data for meanless rx/tx, instead of malloc the actual transfer size.
3. Split spi_mx_sdma_transfer to smaller and easily to read.
4. Fix some code indent.

---
 .../devicetree/bindings/spi/fsl-imx-cspi.txt       |   5 +
 drivers/spi/spi-imx.c                              | 286 ++++++++++++++++++++-
 2 files changed, 285 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt +5 -0
index 4256a6d..aad527b 100644
@@ -7,6 +7,9 @@ Required properties:
 - interrupts : Should contain CSPI/eCSPI interrupt
 - fsl,spi-num-chipselects : Contains the number of the chipselect
 - cs-gpios : Specifies the gpio pins to be used for chipselects.
+- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
+		Documentation/devicetree/bindings/dma/dma.txt
+- dma-names: DMA request names should include "tx" and "rx" if present.
 
 Example:
 
@@ -19,4 +22,6 @@ ecspi@70010000 {
 	fsl,spi-num-chipselects = <2>;
 	cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */
 		   <&gpio3 25 0>; /* GPIO3_25 */
+	dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
+	dma-names = "rx", "tx";
 };
drivers/spi/spi-imx.c +280 -6

367 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

RE: [PATCH v6] spi: spi-imx: add DMA support

Sorry for sending the wrong patch set, please ignore...

-----Original Message-----
From: Robin Gong [mailto:[email protected]]
Sent: Tuesday, October 21, 2014 9:06 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Gong Yibin-B38343
Subject: [PATCH v6] spi: spi-imx: add DMA support

Enable DMA support on i.mx6. The read speed can increase from 600KB/s to 1.2MB/s on i.mx6q. You can disable or enable dma function in dts.
If not set "dma-names" in dts, spi will use PIO mode. This patch only validate on i.mx6, not i.mx5, but encourage ones to apply this patch on i.mx5 since they share the same IP.

Note:
Sometime, there is a weid data in rxfifo after one full tx/rx transfer finish by DMA on i.mx6dl, so we disable dma functhion on i.mx6dl.

---
Change from v5:
1. Update binding doc fsl-imx-cspi.txt.
2. remove usedma flag set from can_dma interface.

Change from v4:
1. Enrich comments.
2. Remove the rxfifo workaround. The issue only exist on i.mx6dl, so disable dma function in dts.

Change from v3:
1. Use spi core framwork to handle dump tx/rx buf 2. Add one workaround for weird data in rxfifo when one full transfer done.

Change from v2:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/291722/focus=294363
1. Dma setup only for imx51-ecspi
2. Use one small dummy buffer(1 bd size) to templiy store data for meanless rx/tx, instead of malloc the actual transfer size.
3. Split spi_mx_sdma_transfer to smaller and easily to read.
4. Fix some code indent.

---
 .../devicetree/bindings/spi/fsl-imx-cspi.txt       |   5 +
 drivers/spi/spi-imx.c                              | 286 ++++++++++++++++++++-
 2 files changed, 285 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt +5 -0
index 4256a6d..aad527b 100644
@@ -7,6 +7,9 @@ Required properties:
 - interrupts : Should contain CSPI/eCSPI interrupt
 - fsl,spi-num-chipselects : Contains the number of the chipselect
 - cs-gpios : Specifies the gpio pins to be used for chipselects.
+- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
+		Documentation/devicetree/bindings/dma/dma.txt
+- dma-names: DMA request names should include "tx" and "rx" if present.
 
 Example:
 
@@ -19,4 +22,6 @@ ecspi@70010000 {
 	fsl,spi-num-chipselects = <2>;
 	cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */
 		   <&gpio3 25 0>; /* GPIO3_25 */
+	dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
+	dma-names = "rx", "tx";
 };
drivers/spi/spi-imx.c +276 -6

360 lines not on this page · raw message

--
1.9.1