Skip to contentSkip to conversation

Serial: AT91: Support rx and tx dma

PATCH Superseded Elen Song 2 participants 7 messages Oct 29, 2012 – Nov 22, 2012

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Elen Song

author
#0 lore raw

cover Serial: AT91: Support rx and tx dma

This is a patch series for support tx and rx dma for at91sam9 boards. The patches contain the following support:
- add parameters for dma use
- request tx dma channel and enable tx
- request rx dma channel and enable rx

The rx dma part use dmaengine_tx_status to get remain bytes. The api has been updated in the following patch:
[PATCH]DMA: AT91: Get residual bytes in dma buffer

Elen Song (6):
DMA: AT91: Serial: Add parameter for serial dma use
Serial: AT91: Distinguish PDC from DMA
Serial: AT91: Request tx dma channel
Serial: AT91: Enable tx dma
Serial: AT91: Request rx dma channel
Serial: AT91: Enable rx cyclic DMA transfer

 arch/arm/mach-at91/include/mach/board.h |    2 +
 drivers/tty/serial/atmel_serial.c       |  507 +++++++++++++++++++++++++++++--
 include/linux/platform_data/dma-atmel.h |   10 +
 3 files changed, 491 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

---
 arch/arm/mach-at91/include/mach/board.h |    2 ++
 drivers/tty/serial/atmel_serial.c       |    1 +
 include/linux/platform_data/dma-atmel.h |   10 ++++++++++
 3 files changed, 13 insertions(+)
arch/arm/mach-at91/include/mach/board.h +2 -0
index c55a436..a2188a6 100644
@@ -129,6 +129,8 @@ struct atmel_uart_data {
 	short			use_dma_tx;	/* use transmit DMA? */
 	short			use_dma_rx;	/* use receive DMA? */
 	void __iomem		*regs;		/* virt. base address, if any */
+	struct at_dma_slave     *dma_tx_slave;
+	struct at_dma_slave     *dma_rx_slave;
 	struct serial_rs485	rs485;		/* rs485 settings */
 };
 extern void __init at91_add_device_serial(void);
drivers/tty/serial/atmel_serial.c +1 -0
index 3d7e1ee..1b1bd4f 100644
@@ -45,6 +45,7 @@
 
 #include <asm/mach/serial_at91.h>
 #include <mach/board.h>
+#include <linux/platform_data/dma-atmel.h>
 
 #ifdef CONFIG_ARM
 #include <mach/cpu.h>
include/linux/platform_data/dma-atmel.h +10 -0
index cab0997..bb05302 100644
@@ -26,11 +26,21 @@ struct at_dma_platform_data {
 /**
  * struct at_dma_slave - Controller-specific information about a slave
  * @dma_dev: required DMA master device
+ * @tx_reg: physical address of data register used for
+ *      memory-to-peripheral transfers
+ * @rx_reg: physical address of data register used for
+ *      peripheral-to-memory transfers
+ * @reg_width: peripheral register width
  * @cfg: Platform-specific initializer for the CFG register
+ * @ctrla: Platform-specific initializer for the CTRLA register
  */
 struct at_dma_slave {
 	struct device		*dma_dev;
+	dma_addr_t              tx_reg;
+	dma_addr_t              rx_reg;
+	u32			reg_width;
 	u32			cfg;
+	u32                     ctrla;
 };
 
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

Quoted 6 lines · Elen Song
---
 arch/arm/mach-at91/include/mach/board.h |    2 ++
 drivers/tty/serial/atmel_serial.c       |    1 +
 include/linux/platform_data/dma-atmel.h |   10 ++++++++++
 3 files changed, 13 insertions(+)

you will have to rebase this over a clean if the platofrm_data I'll send today or tomorrow that will move all the platform_data to inclide/linux

btw your patch broke the avr32

Best Regards.
J.

Quoted 55 lines
arch/arm/mach-at91/include/mach/board.h +2 -0
index c55a436..a2188a6 100644
@@ -129,6 +129,8 @@ struct atmel_uart_data {
 	short			use_dma_tx;	/* use transmit DMA? */
 	short			use_dma_rx;	/* use receive DMA? */
 	void __iomem		*regs;		/* virt. base address, if any */
+	struct at_dma_slave     *dma_tx_slave;
+	struct at_dma_slave     *dma_rx_slave;
 	struct serial_rs485	rs485;		/* rs485 settings */
 };
 extern void __init at91_add_device_serial(void);
drivers/tty/serial/atmel_serial.c +1 -0
index 3d7e1ee..1b1bd4f 100644
@@ -45,6 +45,7 @@
 
 #include <asm/mach/serial_at91.h>
 #include <mach/board.h>
+#include <linux/platform_data/dma-atmel.h>
 
 #ifdef CONFIG_ARM
 #include <mach/cpu.h>
include/linux/platform_data/dma-atmel.h +10 -0
index cab0997..bb05302 100644
@@ -26,11 +26,21 @@ struct at_dma_platform_data {
 /**
  * struct at_dma_slave - Controller-specific information about a slave
  * @dma_dev: required DMA master device
+ * @tx_reg: physical address of data register used for
+ *      memory-to-peripheral transfers
+ * @rx_reg: physical address of data register used for
+ *      peripheral-to-memory transfers
+ * @reg_width: peripheral register width
  * @cfg: Platform-specific initializer for the CFG register
+ * @ctrla: Platform-specific initializer for the CTRLA register
  */
 struct at_dma_slave {
 	struct device		*dma_dev;
+	dma_addr_t              tx_reg;
+	dma_addr_t              rx_reg;
+	u32			reg_width;
 	u32			cfg;
+	u32                     ctrla;
 };
 
 
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Elen Song
---
  arch/arm/mach-at91/include/mach/board.h |    2 ++
  drivers/tty/serial/atmel_serial.c       |    1 +
  include/linux/platform_data/dma-atmel.h |   10 ++++++++++
  3 files changed, 13 insertions(+)

you will have to rebase this over a clean if the platofrm_data I'll send today or tomorrow that will move all the platform_data to inclide/linux

ok, please cc me in the mail list.

Quoted 2 lines

btw your patch broke the avr32

You mean compile error, driver crash, or I need a macro to distinguish avr32 to at91sam9 ?
I only add a few variables that avr32 will not use, it seems no affection to avr32, you think?

Quoted 54 lines

Best Regards.
J.

Quoted 51 lines
arch/arm/mach-at91/include/mach/board.h +2 -0
index c55a436..a2188a6 100644
@@ -129,6 +129,8 @@ struct atmel_uart_data {
  	short			use_dma_tx;	/* use transmit DMA? */
  	short			use_dma_rx;	/* use receive DMA? */
  	void __iomem		*regs;		/* virt. base address, if any */
+	struct at_dma_slave     *dma_tx_slave;
+	struct at_dma_slave     *dma_rx_slave;
  	struct serial_rs485	rs485;		/* rs485 settings */
  };
  extern void __init at91_add_device_serial(void);
drivers/tty/serial/atmel_serial.c +1 -0
index 3d7e1ee..1b1bd4f 100644
@@ -45,6 +45,7 @@
 
  #include <asm/mach/serial_at91.h>
  #include <mach/board.h>
+#include <linux/platform_data/dma-atmel.h>
 
  #ifdef CONFIG_ARM
  #include <mach/cpu.h>
include/linux/platform_data/dma-atmel.h +10 -0
index cab0997..bb05302 100644
@@ -26,11 +26,21 @@ struct at_dma_platform_data {
  /**
   * struct at_dma_slave - Controller-specific information about a slave
   * @dma_dev: required DMA master device
+ * @tx_reg: physical address of data register used for
+ *      memory-to-peripheral transfers
+ * @rx_reg: physical address of data register used for
+ *      peripheral-to-memory transfers
+ * @reg_width: peripheral register width
   * @cfg: Platform-specific initializer for the CFG register
+ * @ctrla: Platform-specific initializer for the CTRLA register
   */
  struct at_dma_slave {
  	struct device		*dma_dev;
+	dma_addr_t              tx_reg;
+	dma_addr_t              rx_reg;
+	u32			reg_width;
  	u32			cfg;
+	u32                     ctrla;
  };
 
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
1.7.9.5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121030/3743f6ff/attachment-0001.html>

author
#4 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Elen Song
---
  arch/arm/mach-at91/include/mach/board.h |    2 ++
  drivers/tty/serial/atmel_serial.c       |    1 +
  include/linux/platform_data/dma-atmel.h |   10 ++++++++++
  3 files changed, 13 insertions(+)

you will have to rebase this over a clean if the platofrm_data I'll send today or tomorrow that will move all the platform_data to inclide/linux

ok, please cc me in the mail list.

Quoted 2 lines

btw your patch broke the avr32

You mean compile error, driver crash, or I need a macro to distinguish avr32 to at91sam9 ?
I only add a few variables that avr32 will not use, it seems no affection to avr32, you think?

Quoted 57 lines

Best Regards.
J.

Quoted 54 lines
arch/arm/mach-at91/include/mach/board.h +2 -0
index c55a436..a2188a6 100644
@@ -129,6 +129,8 @@ struct atmel_uart_data {
  	short			use_dma_tx;	/* use transmit DMA? */
  	short			use_dma_rx;	/* use receive DMA? */
  	void __iomem		*regs;		/* virt. base address, if any */
+	struct at_dma_slave     *dma_tx_slave;
+	struct at_dma_slave     *dma_rx_slave;
  	struct serial_rs485	rs485;		/* rs485 settings */
  };
  extern void __init at91_add_device_serial(void);
drivers/tty/serial/atmel_serial.c +1 -0
index 3d7e1ee..1b1bd4f 100644
@@ -45,6 +45,7 @@
 
  #include <asm/mach/serial_at91.h>
  #include <mach/board.h>
+#include <linux/platform_data/dma-atmel.h>
 
  #ifdef CONFIG_ARM
  #include <mach/cpu.h>
include/linux/platform_data/dma-atmel.h +10 -0
index cab0997..bb05302 100644
@@ -26,11 +26,21 @@ struct at_dma_platform_data {
  /**
   * struct at_dma_slave - Controller-specific information about a slave
   * @dma_dev: required DMA master device
+ * @tx_reg: physical address of data register used for
+ *      memory-to-peripheral transfers
+ * @rx_reg: physical address of data register used for
+ *      peripheral-to-memory transfers
+ * @reg_width: peripheral register width
   * @cfg: Platform-specific initializer for the CFG register
+ * @ctrla: Platform-specific initializer for the CTRLA register
   */
  struct at_dma_slave {
  	struct device		*dma_dev;
+	dma_addr_t              tx_reg;
+	dma_addr_t              rx_reg;
+	u32			reg_width;
  	u32			cfg;
+	u32                     ctrla;
  };
 
 
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

Quoted 8 lines · Elen Song
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Elen Song
---
  arch/arm/mach-at91/include/mach/board.h |    2 ++
  drivers/tty/serial/atmel_serial.c       |    1 +
  include/linux/platform_data/dma-atmel.h |   10 ++++++++++
  3 files changed, 13 insertions(+)
Quoted 5 lines
Quoted 3 lines

you will have to rebase this over a clean if the platofrm_data I'll send today
or tomorrow that will move all the platform_data to inclide/linux

ok, please cc me in the mail list.

Hi JC:

any more feedback ?

Quoted 71 lines
Quoted 2 lines

btw your patch broke the avr32

You mean compile error, driver crash, or I need a macro to distinguish avr32 to at91sam9 ?
I only add a few variables that avr32 will not use, it seems no affection to avr32, you think?

Quoted 50 lines

Best Regards.
J.

Quoted 47 lines
arch/arm/mach-at91/include/mach/board.h +0 -0
index c55a436..a2188a6 100644
@@ -129,6 +129,8 @@ struct atmel_uart_data {
      short            use_dma_tx;    /* use transmit DMA? */
      short            use_dma_rx;    /* use receive DMA? */
      void __iomem        *regs;        /* virt. base address, if 

any */

arch/arm/mach-at91/include/mach/board.h +2 -0
+    struct at_dma_slave     *dma_tx_slave;
+    struct at_dma_slave     *dma_rx_slave;
      struct serial_rs485    rs485;        /* rs485 settings */
  };
  extern void __init at91_add_device_serial(void);
drivers/tty/serial/atmel_serial.c +1 -0
index 3d7e1ee..1b1bd4f 100644
@@ -45,6 +45,7 @@
    #include <asm/mach/serial_at91.h>
  #include <mach/board.h>
+#include <linux/platform_data/dma-atmel.h>
    #ifdef CONFIG_ARM
  #include <mach/cpu.h>
include/linux/platform_data/dma-atmel.h +0 -0
index cab0997..bb05302 100644
@@ -26,11 +26,21 @@ struct at_dma_platform_data {
  /**
   * struct at_dma_slave - Controller-specific information about a 

slave
* @dma_dev: required DMA master device
+ * @tx_reg: physical address of data register used for
+ * memory-to-peripheral transfers
+ * @rx_reg: physical address of data register used for
+ * peripheral-to-memory transfers
+ * @reg_width: peripheral register width
* @cfg: Platform-specific initializer for the CFG register
+ * @ctrla: Platform-specific initializer for the CTRLA register */

  struct at_dma_slave {
      struct device        *dma_dev;

+ dma_addr_t tx_reg;

Quoted 8 lines
Quoted 8 lines
include/linux/platform_data/dma-atmel.h +3 -0
+    dma_addr_t              rx_reg;
+    u32            reg_width;
      u32            cfg;
+    u32                     ctrla;
  };
    --

1.7.9.5

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

PATCH 1/6 DMA: AT91: Serial: Add parameter for serial dma use

Quoted 9 lines · Elen Song
Quoted 8 lines · Elen Song
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Elen Song
---
 arch/arm/mach-at91/include/mach/board.h |    2 ++
 drivers/tty/serial/atmel_serial.c       |    1 +
 include/linux/platform_data/dma-atmel.h |   10 ++++++++++
 3 files changed, 13 insertions(+)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

you will have to rebase this over a clean if the platofrm_data I'll send today
or tomorrow that will move all the platform_data to inclide/linux

ok, please cc me in the mail list.

Hi JC:

any more feedback ?

no time finish to prepare the 3.8 will have to wait after

Best Regards,
J.