All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-05 11:47 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-05 11:47 UTC (permalink / raw)
  To: dan.j.williams, vinod.koul, michal.simek, soren.brinkmann,
	srikanth.thokala, maxime.ripard, laurent.pinchart,
	appana.durga.rao
  Cc: dmaengine, linux-kernel, linux-arm-kernel, Anurag Kumar Vulisha

This patch adds the 64 bit addressing support to the vdma driver.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
---
 drivers/dma/Kconfig              |    2 +-
 drivers/dma/xilinx/xilinx_vdma.c |   36 ++++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index bda2cb0..a7cd0a8 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -398,7 +398,7 @@ config FSL_EDMA
 
 config XILINX_VDMA
 	tristate "Xilinx AXI VDMA Engine"
-	depends on (ARCH_ZYNQ || MICROBLAZE)
+	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
 	select DMA_ENGINE
 	help
 	  Enable support for Xilinx AXI VDMA Soft IP.
diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index d8434d4..3dcbd29 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -98,7 +98,11 @@
 #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
 #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
 
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
+#else
 #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
+#endif
 
 /* HW specific definitions */
 #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
@@ -143,16 +147,16 @@
  * @next_desc: Next Descriptor Pointer @0x00
  * @pad1: Reserved @0x04
  * @buf_addr: Buffer address @0x08
- * @pad2: Reserved @0x0C
- * @vsize: Vertical Size @0x10
- * @hsize: Horizontal Size @0x14
+ * @pad2: Reserved @0x10
+ * @vsize: Vertical Size @0x14
+ * @hsize: Horizontal Size @0x18
  * @stride: Number of bytes between the first
- *	    pixels of each horizontal line @0x18
+ *	    pixels of each horizontal line @0x1C
  */
 struct xilinx_vdma_desc_hw {
 	u32 next_desc;
 	u32 pad1;
-	u32 buf_addr;
+	u64 buf_addr;
 	u32 pad2;
 	u32 vsize;
 	u32 hsize;
@@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct xilinx_vdma_chan *chan, u32 reg,
 	vdma_write(chan, chan->desc_offset + reg, value);
 }
 
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32 reg,
+				 u64 value)
+{
+	/* Write the lsb 32 bits*/
+	writel(lower_32_bits(value),
+			chan->xdev->regs + chan->desc_offset + reg);
+
+	/* Write the msb 32 bits */
+	writel(upper_32_bits(value),
+			chan->xdev->regs + chan->desc_offset + reg + 4);
+}
+#endif
+
 static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)
 {
 	return vdma_read(chan, chan->ctrl_offset + reg);
@@ -700,9 +718,15 @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan *chan)
 		int i = 0;
 
 		list_for_each_entry(segment, &desc->segments, node) {
-			vdma_desc_write(chan,
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+			vdma_desc_write_64(chan,
 					XILINX_VDMA_REG_START_ADDRESS(i++),
 					segment->hw.buf_addr);
+#else
+			vdma_desc_write(chan,
+					XILINX_VDMA_REG_START_ADDRESS(i++),
+					(u32)segment->hw.buf_addr);
+#endif
 			last = segment;
 		}
 
-- 
1.7.4


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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-05 11:47 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-05 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the 64 bit addressing support to the vdma driver.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
---
 drivers/dma/Kconfig              |    2 +-
 drivers/dma/xilinx/xilinx_vdma.c |   36 ++++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index bda2cb0..a7cd0a8 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -398,7 +398,7 @@ config FSL_EDMA
 
 config XILINX_VDMA
 	tristate "Xilinx AXI VDMA Engine"
-	depends on (ARCH_ZYNQ || MICROBLAZE)
+	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
 	select DMA_ENGINE
 	help
 	  Enable support for Xilinx AXI VDMA Soft IP.
diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index d8434d4..3dcbd29 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -98,7 +98,11 @@
 #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
 #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
 
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
+#else
 #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
+#endif
 
 /* HW specific definitions */
 #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
@@ -143,16 +147,16 @@
  * @next_desc: Next Descriptor Pointer @0x00
  * @pad1: Reserved @0x04
  * @buf_addr: Buffer address @0x08
- * @pad2: Reserved @0x0C
- * @vsize: Vertical Size @0x10
- * @hsize: Horizontal Size @0x14
+ * @pad2: Reserved @0x10
+ * @vsize: Vertical Size @0x14
+ * @hsize: Horizontal Size @0x18
  * @stride: Number of bytes between the first
- *	    pixels of each horizontal line @0x18
+ *	    pixels of each horizontal line @0x1C
  */
 struct xilinx_vdma_desc_hw {
 	u32 next_desc;
 	u32 pad1;
-	u32 buf_addr;
+	u64 buf_addr;
 	u32 pad2;
 	u32 vsize;
 	u32 hsize;
@@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct xilinx_vdma_chan *chan, u32 reg,
 	vdma_write(chan, chan->desc_offset + reg, value);
 }
 
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32 reg,
+				 u64 value)
+{
+	/* Write the lsb 32 bits*/
+	writel(lower_32_bits(value),
+			chan->xdev->regs + chan->desc_offset + reg);
+
+	/* Write the msb 32 bits */
+	writel(upper_32_bits(value),
+			chan->xdev->regs + chan->desc_offset + reg + 4);
+}
+#endif
+
 static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)
 {
 	return vdma_read(chan, chan->ctrl_offset + reg);
@@ -700,9 +718,15 @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan *chan)
 		int i = 0;
 
 		list_for_each_entry(segment, &desc->segments, node) {
-			vdma_desc_write(chan,
+#if defined(CONFIG_PHYS_ADDR_T_64BIT)
+			vdma_desc_write_64(chan,
 					XILINX_VDMA_REG_START_ADDRESS(i++),
 					segment->hw.buf_addr);
+#else
+			vdma_desc_write(chan,
+					XILINX_VDMA_REG_START_ADDRESS(i++),
+					(u32)segment->hw.buf_addr);
+#endif
 			last = segment;
 		}
 
-- 
1.7.4

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

* RE: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-05 11:47 ` Anurag Kumar Vulisha
@ 2015-08-18  6:45   ` Anurag Kumar Vulisha
  -1 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-18  6:45 UTC (permalink / raw)
  To: Anurag Kumar Vulisha, dan.j.williams, vinod.koul, Michal Simek,
	Soren Brinkmann, srikanth.thokala, maxime.ripard,
	laurent.pinchart, Appana Durga Kedareswara Rao
  Cc: dmaengine, linux-kernel, linux-arm-kernel, Srikanth Vemula,
	Anirudha Sarangi

Ping?

> -----Original Message-----
> From: Anurag Kumar Vulisha [mailto:anurag.kumar.vulisha@xilinx.com]
> Sent: Wednesday, August 05, 2015 5:18 PM
> To: dan.j.williams@intel.com; vinod.koul@intel.com; Michal Simek; Soren
> Brinkmann; srikanth.thokala@xilinx.com; maxime.ripard@free-
> electrons.com; laurent.pinchart@ideasonboard.com; Appana Durga
> Kedareswara Rao
> Cc: dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; Anurag Kumar Vulisha
> Subject: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the
> driver
> 
> This patch adds the 64 bit addressing support to the vdma driver.
> 
> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> ---
>  drivers/dma/Kconfig              |    2 +-
>  drivers/dma/xilinx/xilinx_vdma.c |   36
> ++++++++++++++++++++++++++++++------
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index
> bda2cb0..a7cd0a8 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -398,7 +398,7 @@ config FSL_EDMA
> 
>  config XILINX_VDMA
>  	tristate "Xilinx AXI VDMA Engine"
> -	depends on (ARCH_ZYNQ || MICROBLAZE)
> +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
>  	select DMA_ENGINE
>  	help
>  	  Enable support for Xilinx AXI VDMA Soft IP.
> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> b/drivers/dma/xilinx/xilinx_vdma.c
> index d8434d4..3dcbd29 100644
> --- a/drivers/dma/xilinx/xilinx_vdma.c
> +++ b/drivers/dma/xilinx/xilinx_vdma.c
> @@ -98,7 +98,11 @@
>  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
>  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> +#else
>  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> +#endif
> 
>  /* HW specific definitions */
>  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> @@ -143,16 +147,16 @@
>   * @next_desc: Next Descriptor Pointer @0x00
>   * @pad1: Reserved @0x04
>   * @buf_addr: Buffer address @0x08
> - * @pad2: Reserved @0x0C
> - * @vsize: Vertical Size @0x10
> - * @hsize: Horizontal Size @0x14
> + * @pad2: Reserved @0x10
> + * @vsize: Vertical Size @0x14
> + * @hsize: Horizontal Size @0x18
>   * @stride: Number of bytes between the first
> - *	    pixels of each horizontal line @0x18
> + *	    pixels of each horizontal line @0x1C
>   */
>  struct xilinx_vdma_desc_hw {
>  	u32 next_desc;
>  	u32 pad1;
> -	u32 buf_addr;
> +	u64 buf_addr;
>  	u32 pad2;
>  	u32 vsize;
>  	u32 hsize;
> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> xilinx_vdma_chan *chan, u32 reg,
>  	vdma_write(chan, chan->desc_offset + reg, value);  }
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> reg,
> +				 u64 value)
> +{
> +	/* Write the lsb 32 bits*/
> +	writel(lower_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg);
> +
> +	/* Write the msb 32 bits */
> +	writel(upper_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg + 4); }
> #endif
> +
>  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)  {
>  	return vdma_read(chan, chan->ctrl_offset + reg); @@ -700,9 +718,15
> @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan *chan)
>  		int i = 0;
> 
>  		list_for_each_entry(segment, &desc->segments, node) {
> -			vdma_desc_write(chan,
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +			vdma_desc_write_64(chan,
> 
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
>  					segment->hw.buf_addr);
> +#else
> +			vdma_desc_write(chan,
> +
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> +					(u32)segment->hw.buf_addr);
> +#endif
>  			last = segment;
>  		}
> 
> --
> 1.7.4


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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-18  6:45   ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-18  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

Ping?

> -----Original Message-----
> From: Anurag Kumar Vulisha [mailto:anurag.kumar.vulisha at xilinx.com]
> Sent: Wednesday, August 05, 2015 5:18 PM
> To: dan.j.williams at intel.com; vinod.koul at intel.com; Michal Simek; Soren
> Brinkmann; srikanth.thokala at xilinx.com; maxime.ripard at free-
> electrons.com; laurent.pinchart at ideasonboard.com; Appana Durga
> Kedareswara Rao
> Cc: dmaengine at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; Anurag Kumar Vulisha
> Subject: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the
> driver
> 
> This patch adds the 64 bit addressing support to the vdma driver.
> 
> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> ---
>  drivers/dma/Kconfig              |    2 +-
>  drivers/dma/xilinx/xilinx_vdma.c |   36
> ++++++++++++++++++++++++++++++------
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index
> bda2cb0..a7cd0a8 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -398,7 +398,7 @@ config FSL_EDMA
> 
>  config XILINX_VDMA
>  	tristate "Xilinx AXI VDMA Engine"
> -	depends on (ARCH_ZYNQ || MICROBLAZE)
> +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
>  	select DMA_ENGINE
>  	help
>  	  Enable support for Xilinx AXI VDMA Soft IP.
> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> b/drivers/dma/xilinx/xilinx_vdma.c
> index d8434d4..3dcbd29 100644
> --- a/drivers/dma/xilinx/xilinx_vdma.c
> +++ b/drivers/dma/xilinx/xilinx_vdma.c
> @@ -98,7 +98,11 @@
>  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
>  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> +#else
>  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> +#endif
> 
>  /* HW specific definitions */
>  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> @@ -143,16 +147,16 @@
>   * @next_desc: Next Descriptor Pointer @0x00
>   * @pad1: Reserved @0x04
>   * @buf_addr: Buffer address @0x08
> - * @pad2: Reserved @0x0C
> - * @vsize: Vertical Size @0x10
> - * @hsize: Horizontal Size @0x14
> + * @pad2: Reserved @0x10
> + * @vsize: Vertical Size @0x14
> + * @hsize: Horizontal Size @0x18
>   * @stride: Number of bytes between the first
> - *	    pixels of each horizontal line @0x18
> + *	    pixels of each horizontal line @0x1C
>   */
>  struct xilinx_vdma_desc_hw {
>  	u32 next_desc;
>  	u32 pad1;
> -	u32 buf_addr;
> +	u64 buf_addr;
>  	u32 pad2;
>  	u32 vsize;
>  	u32 hsize;
> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> xilinx_vdma_chan *chan, u32 reg,
>  	vdma_write(chan, chan->desc_offset + reg, value);  }
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> reg,
> +				 u64 value)
> +{
> +	/* Write the lsb 32 bits*/
> +	writel(lower_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg);
> +
> +	/* Write the msb 32 bits */
> +	writel(upper_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg + 4); }
> #endif
> +
>  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)  {
>  	return vdma_read(chan, chan->ctrl_offset + reg); @@ -700,9 +718,15
> @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan *chan)
>  		int i = 0;
> 
>  		list_for_each_entry(segment, &desc->segments, node) {
> -			vdma_desc_write(chan,
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +			vdma_desc_write_64(chan,
> 
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
>  					segment->hw.buf_addr);
> +#else
> +			vdma_desc_write(chan,
> +
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> +					(u32)segment->hw.buf_addr);
> +#endif
>  			last = segment;
>  		}
> 
> --
> 1.7.4

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

* Re: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-05 11:47 ` Anurag Kumar Vulisha
@ 2015-08-18 22:43   ` Laurent Pinchart
  -1 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2015-08-18 22:43 UTC (permalink / raw)
  To: Anurag Kumar Vulisha
  Cc: dan.j.williams, vinod.koul, michal.simek, soren.brinkmann,
	srikanth.thokala, maxime.ripard, appana.durga.rao, dmaengine,
	linux-kernel, linux-arm-kernel, Anurag Kumar Vulisha

Hi Anurag,

Thank you for the patch.

On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> This patch adds the 64 bit addressing support to the vdma driver.
> 
> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> ---
>  drivers/dma/Kconfig              |    2 +-
>  drivers/dma/xilinx/xilinx_vdma.c |   36 ++++++++++++++++++++++++++++------
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index bda2cb0..a7cd0a8 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -398,7 +398,7 @@ config FSL_EDMA
> 
>  config XILINX_VDMA
>  	tristate "Xilinx AXI VDMA Engine"
> -	depends on (ARCH_ZYNQ || MICROBLAZE)
> +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
>  	select DMA_ENGINE
>  	help
>  	  Enable support for Xilinx AXI VDMA Soft IP.
> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> --- a/drivers/dma/xilinx/xilinx_vdma.c
> +++ b/drivers/dma/xilinx/xilinx_vdma.c
> @@ -98,7 +98,11 @@
>  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
>  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)

Strictly speaking that should be CONFIG_ARCH_DMA_ADDR_T_64BIT.

> +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> +#else
>  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> +#endif
> 
>  /* HW specific definitions */
>  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> @@ -143,16 +147,16 @@
>   * @next_desc: Next Descriptor Pointer @0x00
>   * @pad1: Reserved @0x04
>   * @buf_addr: Buffer address @0x08
> - * @pad2: Reserved @0x0C
> - * @vsize: Vertical Size @0x10
> - * @hsize: Horizontal Size @0x14
> + * @pad2: Reserved @0x10
> + * @vsize: Vertical Size @0x14
> + * @hsize: Horizontal Size @0x18
>   * @stride: Number of bytes between the first
> - *	    pixels of each horizontal line @0x18
> + *	    pixels of each horizontal line @0x1C
>   */
>  struct xilinx_vdma_desc_hw {
>  	u32 next_desc;
>  	u32 pad1;
> -	u32 buf_addr;
> +	u64 buf_addr;

This will change the descriptor layout for 32-bit VDMA, I don't think that's 
right.

>  	u32 pad2;
>  	u32 vsize;
>  	u32 hsize;
> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset + reg,
> value);
>  }
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> reg,
> +				 u64 value)
> +{
> +	/* Write the lsb 32 bits*/
> +	writel(lower_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg);
> +
> +	/* Write the msb 32 bits */
> +	writel(upper_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg + 4);

So the CPU can't perform 64-bit register access ?

How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on a 32-
bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit platform ? 
Given that VDMA is an IP core you can instantiate in the programmable logic I 
expect some level of flexibility to be possible, but this patch doesn't seem 
to support it. Please provide more context to allow a proper review (and 
please include it in the commit message of v2).

> +}
> +#endif
> +
>  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)
>  {
>  	return vdma_read(chan, chan->ctrl_offset + reg);
> @@ -700,9 +718,15 @@ static void xilinx_vdma_start_transfer(struct
> xilinx_vdma_chan *chan) int i = 0;
> 
>  		list_for_each_entry(segment, &desc->segments, node) {
> -			vdma_desc_write(chan,
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +			vdma_desc_write_64(chan,
>  					XILINX_VDMA_REG_START_ADDRESS(i++),
>  					segment->hw.buf_addr);
> +#else
> +			vdma_desc_write(chan,
> +					XILINX_VDMA_REG_START_ADDRESS(i++),
> +					(u32)segment->hw.buf_addr);
> +#endif
>  			last = segment;
>  		}

-- 
Regards,

Laurent Pinchart


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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-18 22:43   ` Laurent Pinchart
  0 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2015-08-18 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Anurag,

Thank you for the patch.

On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> This patch adds the 64 bit addressing support to the vdma driver.
> 
> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> ---
>  drivers/dma/Kconfig              |    2 +-
>  drivers/dma/xilinx/xilinx_vdma.c |   36 ++++++++++++++++++++++++++++------
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index bda2cb0..a7cd0a8 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -398,7 +398,7 @@ config FSL_EDMA
> 
>  config XILINX_VDMA
>  	tristate "Xilinx AXI VDMA Engine"
> -	depends on (ARCH_ZYNQ || MICROBLAZE)
> +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
>  	select DMA_ENGINE
>  	help
>  	  Enable support for Xilinx AXI VDMA Soft IP.
> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> --- a/drivers/dma/xilinx/xilinx_vdma.c
> +++ b/drivers/dma/xilinx/xilinx_vdma.c
> @@ -98,7 +98,11 @@
>  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
>  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)

Strictly speaking that should be CONFIG_ARCH_DMA_ADDR_T_64BIT.

> +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> +#else
>  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> +#endif
> 
>  /* HW specific definitions */
>  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> @@ -143,16 +147,16 @@
>   * @next_desc: Next Descriptor Pointer @0x00
>   * @pad1: Reserved @0x04
>   * @buf_addr: Buffer address @0x08
> - * @pad2: Reserved @0x0C
> - * @vsize: Vertical Size @0x10
> - * @hsize: Horizontal Size @0x14
> + * @pad2: Reserved @0x10
> + * @vsize: Vertical Size @0x14
> + * @hsize: Horizontal Size @0x18
>   * @stride: Number of bytes between the first
> - *	    pixels of each horizontal line @0x18
> + *	    pixels of each horizontal line @0x1C
>   */
>  struct xilinx_vdma_desc_hw {
>  	u32 next_desc;
>  	u32 pad1;
> -	u32 buf_addr;
> +	u64 buf_addr;

This will change the descriptor layout for 32-bit VDMA, I don't think that's 
right.

>  	u32 pad2;
>  	u32 vsize;
>  	u32 hsize;
> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset + reg,
> value);
>  }
> 
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +static inline void vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> reg,
> +				 u64 value)
> +{
> +	/* Write the lsb 32 bits*/
> +	writel(lower_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg);
> +
> +	/* Write the msb 32 bits */
> +	writel(upper_32_bits(value),
> +			chan->xdev->regs + chan->desc_offset + reg + 4);

So the CPU can't perform 64-bit register access ?

How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on a 32-
bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit platform ? 
Given that VDMA is an IP core you can instantiate in the programmable logic I 
expect some level of flexibility to be possible, but this patch doesn't seem 
to support it. Please provide more context to allow a proper review (and 
please include it in the commit message of v2).

> +}
> +#endif
> +
>  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32 reg)
>  {
>  	return vdma_read(chan, chan->ctrl_offset + reg);
> @@ -700,9 +718,15 @@ static void xilinx_vdma_start_transfer(struct
> xilinx_vdma_chan *chan) int i = 0;
> 
>  		list_for_each_entry(segment, &desc->segments, node) {
> -			vdma_desc_write(chan,
> +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> +			vdma_desc_write_64(chan,
>  					XILINX_VDMA_REG_START_ADDRESS(i++),
>  					segment->hw.buf_addr);
> +#else
> +			vdma_desc_write(chan,
> +					XILINX_VDMA_REG_START_ADDRESS(i++),
> +					(u32)segment->hw.buf_addr);
> +#endif
>  			last = segment;
>  		}

-- 
Regards,

Laurent Pinchart

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

* RE: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-18 22:43   ` Laurent Pinchart
@ 2015-08-20 10:47     ` Anurag Kumar Vulisha
  -1 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-20 10:47 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: dan.j.williams, vinod.koul, Michal Simek, Soren Brinkmann,
	srikanth.thokala, maxime.ripard, Appana Durga Kedareswara Rao,
	dmaengine, linux-kernel, linux-arm-kernel, Anirudha Sarangi,
	Srikanth Vemula

Hi Laurent,

> -----Original Message-----
> From: Anurag Kumar Vulisha
> Sent: Thursday, August 20, 2015 2:41 PM
> To: Anurag Kumar Vulisha
> Subject: RE:[PATCH] dmaengine: vdma: Add 64 bit addressing support to the
> driver
> 
> 
> Hi Anurag,
> 
> Thank you for the patch.
> 
> On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> > This patch adds the 64 bit addressing support to the vdma driver.
> >
> > Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> > ---
> >  drivers/dma/Kconfig              |    2 +-
> >  drivers/dma/xilinx/xilinx_vdma.c |   36
> ++++++++++++++++++++++++++++------
> >  2 files changed, 31 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index
> > bda2cb0..a7cd0a8 100644
> > --- a/drivers/dma/Kconfig
> > +++ b/drivers/dma/Kconfig
> > @@ -398,7 +398,7 @@ config FSL_EDMA
> >
> >  config XILINX_VDMA
> >  	tristate "Xilinx AXI VDMA Engine"
> > -	depends on (ARCH_ZYNQ || MICROBLAZE)
> > +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
> >  	select DMA_ENGINE
> >  	help
> >  	  Enable support for Xilinx AXI VDMA Soft IP.
> > diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> > b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> > --- a/drivers/dma/xilinx/xilinx_vdma.c
> > +++ b/drivers/dma/xilinx/xilinx_vdma.c
> > @@ -98,7 +98,11 @@
> >  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
> >  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> >
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> 
> Strictly speaking that should be CONFIG_ARCH_DMA_ADDR_T_64BIT.
> 

Will change this in v2

> > +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> > +#else
> >  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> > +#endif
> >
> >  /* HW specific definitions */
> >  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> > @@ -143,16 +147,16 @@
> >   * @next_desc: Next Descriptor Pointer @0x00
> >   * @pad1: Reserved @0x04
> >   * @buf_addr: Buffer address @0x08
> > - * @pad2: Reserved @0x0C
> > - * @vsize: Vertical Size @0x10
> > - * @hsize: Horizontal Size @0x14
> > + * @pad2: Reserved @0x10
> > + * @vsize: Vertical Size @0x14
> > + * @hsize: Horizontal Size @0x18
> >   * @stride: Number of bytes between the first
> > - *	    pixels of each horizontal line @0x18
> > + *	    pixels of each horizontal line @0x1C
> >   */
> >  struct xilinx_vdma_desc_hw {
> >  	u32 next_desc;
> >  	u32 pad1;
> > -	u32 buf_addr;
> > +	u64 buf_addr;
> 
> This will change the descriptor layout for 32-bit VDMA, I don't think that's
> right.
> 

Will change this in v2

> >  	u32 pad2;
> >  	u32 vsize;
> >  	u32 hsize;
> > @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> > xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset +
> > reg, value);  }
> >
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT) static inline void
> > +vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> > reg,
> > +				 u64 value)
> > +{
> > +	/* Write the lsb 32 bits*/
> > +	writel(lower_32_bits(value),
> > +			chan->xdev->regs + chan->desc_offset + reg);
> > +
> > +	/* Write the msb 32 bits */
> > +	writel(upper_32_bits(value),
> > +			chan->xdev->regs + chan->desc_offset + reg + 4);
> 
> So the CPU can't perform 64-bit register access ?
>

We are trying to write at a register address(0x5c) which is not aligned on
8 bytes boundary.So if I try to use 64 bit write on it, unalignment fault will
be generated. Because of this we are using two separate 32  bit writes. 
 
> How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit platform
> ?
> Given that VDMA is an IP core you can instantiate in the programmable logic I
> expect some level of flexibility to be possible, but this patch doesn't seem to
> support it. Please provide more context to allow a proper review (and please
> include it in the commit message of v2).
>

The VDMA core is a soft ip, which can be programmed to support both 32 bit and
64 bit addressing.When the VDMA core is configured for 32 bit address space ,
transfer start address is specified by a single register.

When the  VDMA core is configured for an address space greater than 32, each
start address is specified by a combination of two registers.The first register
specifies the LSB 32 bits of address, while the next register specifies the MSB
32 bits of address.For example,5Ch will specify the LSB bits while 60h will
specify the MSB bits of the first start address. So we need to program two
registers at a time.

Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be used
on 64 bit platform.As far as i know , there is no use case where 64 bit dma can
be used on 32 bit platform.Please correct me if i am wrong.

> > +}
> > +#endif
> > +
> >  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32
> > reg)  {
> >  	return vdma_read(chan, chan->ctrl_offset + reg); @@ -700,9 +718,15
> > @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan
> > *chan) int i = 0;
> >
> >  		list_for_each_entry(segment, &desc->segments, node) {
> > -			vdma_desc_write(chan,
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> > +			vdma_desc_write_64(chan,
> >
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> >  					segment->hw.buf_addr);
> > +#else
> > +			vdma_desc_write(chan,
> > +
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> > +					(u32)segment->hw.buf_addr);
> > +#endif
> >  			last = segment;
> >  		}
> 
> --

Thanks,
Anurag Kumar V


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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-20 10:47     ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 14+ messages in thread
From: Anurag Kumar Vulisha @ 2015-08-20 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Laurent,

> -----Original Message-----
> From: Anurag Kumar Vulisha
> Sent: Thursday, August 20, 2015 2:41 PM
> To: Anurag Kumar Vulisha
> Subject: RE:[PATCH] dmaengine: vdma: Add 64 bit addressing support to the
> driver
> 
> 
> Hi Anurag,
> 
> Thank you for the patch.
> 
> On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> > This patch adds the 64 bit addressing support to the vdma driver.
> >
> > Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> > ---
> >  drivers/dma/Kconfig              |    2 +-
> >  drivers/dma/xilinx/xilinx_vdma.c |   36
> ++++++++++++++++++++++++++++------
> >  2 files changed, 31 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index
> > bda2cb0..a7cd0a8 100644
> > --- a/drivers/dma/Kconfig
> > +++ b/drivers/dma/Kconfig
> > @@ -398,7 +398,7 @@ config FSL_EDMA
> >
> >  config XILINX_VDMA
> >  	tristate "Xilinx AXI VDMA Engine"
> > -	depends on (ARCH_ZYNQ || MICROBLAZE)
> > +	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
> >  	select DMA_ENGINE
> >  	help
> >  	  Enable support for Xilinx AXI VDMA Soft IP.
> > diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> > b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> > --- a/drivers/dma/xilinx/xilinx_vdma.c
> > +++ b/drivers/dma/xilinx/xilinx_vdma.c
> > @@ -98,7 +98,11 @@
> >  #define XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT	24
> >  #define XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT	0
> >
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> 
> Strictly speaking that should be CONFIG_ARCH_DMA_ADDR_T_64BIT.
> 

Will change this in v2

> > +#define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 8 * (n))
> > +#else
> >  #define XILINX_VDMA_REG_START_ADDRESS(n)	(0x000c + 4 * (n))
> > +#endif
> >
> >  /* HW specific definitions */
> >  #define XILINX_VDMA_MAX_CHANS_PER_DEVICE	0x2
> > @@ -143,16 +147,16 @@
> >   * @next_desc: Next Descriptor Pointer @0x00
> >   * @pad1: Reserved @0x04
> >   * @buf_addr: Buffer address @0x08
> > - * @pad2: Reserved @0x0C
> > - * @vsize: Vertical Size @0x10
> > - * @hsize: Horizontal Size @0x14
> > + * @pad2: Reserved @0x10
> > + * @vsize: Vertical Size @0x14
> > + * @hsize: Horizontal Size @0x18
> >   * @stride: Number of bytes between the first
> > - *	    pixels of each horizontal line @0x18
> > + *	    pixels of each horizontal line @0x1C
> >   */
> >  struct xilinx_vdma_desc_hw {
> >  	u32 next_desc;
> >  	u32 pad1;
> > -	u32 buf_addr;
> > +	u64 buf_addr;
> 
> This will change the descriptor layout for 32-bit VDMA, I don't think that's
> right.
> 

Will change this in v2

> >  	u32 pad2;
> >  	u32 vsize;
> >  	u32 hsize;
> > @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> > xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset +
> > reg, value);  }
> >
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT) static inline void
> > +vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> > reg,
> > +				 u64 value)
> > +{
> > +	/* Write the lsb 32 bits*/
> > +	writel(lower_32_bits(value),
> > +			chan->xdev->regs + chan->desc_offset + reg);
> > +
> > +	/* Write the msb 32 bits */
> > +	writel(upper_32_bits(value),
> > +			chan->xdev->regs + chan->desc_offset + reg + 4);
> 
> So the CPU can't perform 64-bit register access ?
>

We are trying to write at a register address(0x5c) which is not aligned on
8 bytes boundary.So if I try to use 64 bit write on it, unalignment fault will
be generated. Because of this we are using two separate 32  bit writes. 
 
> How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit platform
> ?
> Given that VDMA is an IP core you can instantiate in the programmable logic I
> expect some level of flexibility to be possible, but this patch doesn't seem to
> support it. Please provide more context to allow a proper review (and please
> include it in the commit message of v2).
>

The VDMA core is a soft ip, which can be programmed to support both 32 bit and
64 bit addressing.When the VDMA core is configured for 32 bit address space ,
transfer start address is specified by a single register.

When the  VDMA core is configured for an address space greater than 32, each
start address is specified by a combination of two registers.The first register
specifies the LSB 32 bits of address, while the next register specifies the MSB
32 bits of address.For example,5Ch will specify the LSB bits while 60h will
specify the MSB bits of the first start address. So we need to program two
registers at a time.

Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be used
on 64 bit platform.As far as i know , there is no use case where 64 bit dma can
be used on 32 bit platform.Please correct me if i am wrong.

> > +}
> > +#endif
> > +
> >  static inline u32 vdma_ctrl_read(struct xilinx_vdma_chan *chan, u32
> > reg)  {
> >  	return vdma_read(chan, chan->ctrl_offset + reg); @@ -700,9 +718,15
> > @@ static void xilinx_vdma_start_transfer(struct xilinx_vdma_chan
> > *chan) int i = 0;
> >
> >  		list_for_each_entry(segment, &desc->segments, node) {
> > -			vdma_desc_write(chan,
> > +#if defined(CONFIG_PHYS_ADDR_T_64BIT)
> > +			vdma_desc_write_64(chan,
> >
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> >  					segment->hw.buf_addr);
> > +#else
> > +			vdma_desc_write(chan,
> > +
> 	XILINX_VDMA_REG_START_ADDRESS(i++),
> > +					(u32)segment->hw.buf_addr);
> > +#endif
> >  			last = segment;
> >  		}
> 
> --

Thanks,
Anurag Kumar V

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

* Re: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-20 10:47     ` Anurag Kumar Vulisha
@ 2015-08-20 23:01       ` Laurent Pinchart
  -1 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2015-08-20 23:01 UTC (permalink / raw)
  To: Anurag Kumar Vulisha
  Cc: dan.j.williams, vinod.koul, Michal Simek, Soren Brinkmann,
	srikanth.thokala, maxime.ripard, Appana Durga Kedareswara Rao,
	dmaengine, linux-kernel, linux-arm-kernel, Anirudha Sarangi,
	Srikanth Vemula

Hi Anurag,

On Thursday 20 August 2015 10:47:48 Anurag Kumar Vulisha wrote:
> On Thursday, August 20, 2015 2:41 PM Anurag Kumar Vulisha wrote:
> > On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> >> This patch adds the 64 bit addressing support to the vdma driver.
> >> 
> >> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> >> ---
> >> 
> >> drivers/dma/Kconfig              |    2 +-
> >> drivers/dma/xilinx/xilinx_vdma.c |   36 +++++++++++++++++++++++++------
> >>
> >> 2 files changed, 31 insertions(+), 7 deletions(-)

[snip]

> >> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> >> b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> >> --- a/drivers/dma/xilinx/xilinx_vdma.c
> >> +++ b/drivers/dma/xilinx/xilinx_vdma.c

[snip]

> >> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> >> xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset +
> >> reg, value);  }
> >> 
> >> +#if defined(CONFIG_PHYS_ADDR_T_64BIT) static inline void
> >> +vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> >> reg,
> >> +				 u64 value)
> >> +{
> >> +	/* Write the lsb 32 bits*/
> >> +	writel(lower_32_bits(value),
> >> +			chan->xdev->regs + chan->desc_offset + reg);
> >> +
> >> +	/* Write the msb 32 bits */
> >> +	writel(upper_32_bits(value),
> >> +			chan->xdev->regs + chan->desc_offset + reg + 4);
> > 
> > So the CPU can't perform 64-bit register access ?
> 
> We are trying to write at a register address(0x5c) which is not aligned on
> 8 bytes boundary.So if I try to use 64 bit write on it, unalignment fault
> will be generated. Because of this we are using two separate 32  bit
> writes.

Broken hardware design. Fair enough :-)

> > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > platform ? Given that VDMA is an IP core you can instantiate in the
> > programmable logic I expect some level of flexibility to be possible, but
> > this patch doesn't seem to support it. Please provide more context to
> > allow a proper review (and please include it in the commit message of v2).
> 
> The VDMA core is a soft ip, which can be programmed to support both 32 bit
> and 64 bit addressing.When the VDMA core is configured for 32 bit address
> space , transfer start address is specified by a single register.
> 
> When the  VDMA core is configured for an address space greater than 32, each
> start address is specified by a combination of two registers.The first
> register specifies the LSB 32 bits of address, while the next register
> specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> bits while 60h will specify the MSB bits of the first start address. So we
> need to program two registers at a time.
> 
> Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> used on 64 bit platform.As far as i know , there is no use case where 64
> bit dma can be used on 32 bit platform.Please correct me if i am wrong.

I'm not sure what the use cases would be, but it makes me feel uncomfortable 
to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.

As the VDMA flavour is selected at synthesis time, how about specifying it in 
DT instead ? You could just add an address-width property.

-- 
Regards,

Laurent Pinchart


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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-20 23:01       ` Laurent Pinchart
  0 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2015-08-20 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Anurag,

On Thursday 20 August 2015 10:47:48 Anurag Kumar Vulisha wrote:
> On Thursday, August 20, 2015 2:41 PM Anurag Kumar Vulisha wrote:
> > On Wednesday 05 August 2015 17:17:37 Anurag Kumar Vulisha wrote:
> >> This patch adds the 64 bit addressing support to the vdma driver.
> >> 
> >> Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
> >> ---
> >> 
> >> drivers/dma/Kconfig              |    2 +-
> >> drivers/dma/xilinx/xilinx_vdma.c |   36 +++++++++++++++++++++++++------
> >>
> >> 2 files changed, 31 insertions(+), 7 deletions(-)

[snip]

> >> diff --git a/drivers/dma/xilinx/xilinx_vdma.c
> >> b/drivers/dma/xilinx/xilinx_vdma.c index d8434d4..3dcbd29 100644
> >> --- a/drivers/dma/xilinx/xilinx_vdma.c
> >> +++ b/drivers/dma/xilinx/xilinx_vdma.c

[snip]

> >> @@ -272,6 +276,20 @@ static inline void vdma_desc_write(struct
> >> xilinx_vdma_chan *chan, u32 reg, vdma_write(chan, chan->desc_offset +
> >> reg, value);  }
> >> 
> >> +#if defined(CONFIG_PHYS_ADDR_T_64BIT) static inline void
> >> +vdma_desc_write_64(struct xilinx_vdma_chan *chan, u32
> >> reg,
> >> +				 u64 value)
> >> +{
> >> +	/* Write the lsb 32 bits*/
> >> +	writel(lower_32_bits(value),
> >> +			chan->xdev->regs + chan->desc_offset + reg);
> >> +
> >> +	/* Write the msb 32 bits */
> >> +	writel(upper_32_bits(value),
> >> +			chan->xdev->regs + chan->desc_offset + reg + 4);
> > 
> > So the CPU can't perform 64-bit register access ?
> 
> We are trying to write at a register address(0x5c) which is not aligned on
> 8 bytes boundary.So if I try to use 64 bit write on it, unalignment fault
> will be generated. Because of this we are using two separate 32  bit
> writes.

Broken hardware design. Fair enough :-)

> > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > platform ? Given that VDMA is an IP core you can instantiate in the
> > programmable logic I expect some level of flexibility to be possible, but
> > this patch doesn't seem to support it. Please provide more context to
> > allow a proper review (and please include it in the commit message of v2).
> 
> The VDMA core is a soft ip, which can be programmed to support both 32 bit
> and 64 bit addressing.When the VDMA core is configured for 32 bit address
> space , transfer start address is specified by a single register.
> 
> When the  VDMA core is configured for an address space greater than 32, each
> start address is specified by a combination of two registers.The first
> register specifies the LSB 32 bits of address, while the next register
> specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> bits while 60h will specify the MSB bits of the first start address. So we
> need to program two registers at a time.
> 
> Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> used on 64 bit platform.As far as i know , there is no use case where 64
> bit dma can be used on 32 bit platform.Please correct me if i am wrong.

I'm not sure what the use cases would be, but it makes me feel uncomfortable 
to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.

As the VDMA flavour is selected at synthesis time, how about specifying it in 
DT instead ? You could just add an address-width property.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-20 23:01       ` Laurent Pinchart
@ 2015-08-23 13:39         ` Vinod Koul
  -1 siblings, 0 replies; 14+ messages in thread
From: Vinod Koul @ 2015-08-23 13:39 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Anurag Kumar Vulisha, dan.j.williams, Michal Simek,
	Soren Brinkmann, srikanth.thokala, maxime.ripard,
	Appana Durga Kedareswara Rao, dmaengine, linux-kernel,
	linux-arm-kernel, Anirudha Sarangi, Srikanth Vemula

On Fri, Aug 21, 2015 at 02:01:59AM +0300, Laurent Pinchart wrote:
> > > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > > platform ? Given that VDMA is an IP core you can instantiate in the
> > > programmable logic I expect some level of flexibility to be possible, but
> > > this patch doesn't seem to support it. Please provide more context to
> > > allow a proper review (and please include it in the commit message of v2).
> > 
> > The VDMA core is a soft ip, which can be programmed to support both 32 bit
> > and 64 bit addressing.When the VDMA core is configured for 32 bit address
> > space , transfer start address is specified by a single register.
> > 
> > When the  VDMA core is configured for an address space greater than 32, each
> > start address is specified by a combination of two registers.The first
> > register specifies the LSB 32 bits of address, while the next register
> > specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> > bits while 60h will specify the MSB bits of the first start address. So we
> > need to program two registers at a time.
> > 
> > Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> > used on 64 bit platform.As far as i know , there is no use case where 64
> > bit dma can be used on 32 bit platform.Please correct me if i am wrong.
> 
> I'm not sure what the use cases would be, but it makes me feel uncomfortable 
> to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.
> 
> As the VDMA flavour is selected at synthesis time, how about specifying it in 
> DT instead ? You could just add an address-width property.
That would be saner thing to do. People wont check which IP and will mix and
match. So you may have a 64 bit system with your 32 bit IP...

-- 
~Vinod

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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-23 13:39         ` Vinod Koul
  0 siblings, 0 replies; 14+ messages in thread
From: Vinod Koul @ 2015-08-23 13:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 21, 2015 at 02:01:59AM +0300, Laurent Pinchart wrote:
> > > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > > platform ? Given that VDMA is an IP core you can instantiate in the
> > > programmable logic I expect some level of flexibility to be possible, but
> > > this patch doesn't seem to support it. Please provide more context to
> > > allow a proper review (and please include it in the commit message of v2).
> > 
> > The VDMA core is a soft ip, which can be programmed to support both 32 bit
> > and 64 bit addressing.When the VDMA core is configured for 32 bit address
> > space , transfer start address is specified by a single register.
> > 
> > When the  VDMA core is configured for an address space greater than 32, each
> > start address is specified by a combination of two registers.The first
> > register specifies the LSB 32 bits of address, while the next register
> > specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> > bits while 60h will specify the MSB bits of the first start address. So we
> > need to program two registers at a time.
> > 
> > Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> > used on 64 bit platform.As far as i know , there is no use case where 64
> > bit dma can be used on 32 bit platform.Please correct me if i am wrong.
> 
> I'm not sure what the use cases would be, but it makes me feel uncomfortable 
> to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.
> 
> As the VDMA flavour is selected at synthesis time, how about specifying it in 
> DT instead ? You could just add an address-width property.
That would be saner thing to do. People wont check which IP and will mix and
match. So you may have a 64 bit system with your 32 bit IP...

-- 
~Vinod

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

* Re: [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
  2015-08-23 13:39         ` Vinod Koul
@ 2015-08-23 13:59           ` Arnd Bergmann
  -1 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2015-08-23 13:59 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Vinod Koul, Laurent Pinchart, srikanth.thokala,
	Anurag Kumar Vulisha, Srikanth Vemula, linux-kernel,
	Michal Simek, Soren Brinkmann, Anirudha Sarangi, dmaengine,
	dan.j.williams, Appana Durga Kedareswara Rao, maxime.ripard

On Sunday 23 August 2015 19:09:33 Vinod Koul wrote:
> On Fri, Aug 21, 2015 at 02:01:59AM +0300, Laurent Pinchart wrote:
> > > > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > > > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > > > platform ? Given that VDMA is an IP core you can instantiate in the
> > > > programmable logic I expect some level of flexibility to be possible, but
> > > > this patch doesn't seem to support it. Please provide more context to
> > > > allow a proper review (and please include it in the commit message of v2).
> > > 
> > > The VDMA core is a soft ip, which can be programmed to support both 32 bit
> > > and 64 bit addressing.When the VDMA core is configured for 32 bit address
> > > space , transfer start address is specified by a single register.
> > > 
> > > When the  VDMA core is configured for an address space greater than 32, each
> > > start address is specified by a combination of two registers.The first
> > > register specifies the LSB 32 bits of address, while the next register
> > > specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> > > bits while 60h will specify the MSB bits of the first start address. So we
> > > need to program two registers at a time.
> > > 
> > > Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> > > used on 64 bit platform.As far as i know , there is no use case where 64
> > > bit dma can be used on 32 bit platform.Please correct me if i am wrong.
> > 
> > I'm not sure what the use cases would be, but it makes me feel uncomfortable 
> > to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.
> > 
> > As the VDMA flavour is selected at synthesis time, how about specifying it in 
> > DT instead ? You could just add an address-width property.
> That would be saner thing to do. People wont check which IP and will mix and
> match. So you may have a 64 bit system with your 32 bit IP...

Note that you need two things here: an identification of whether the IP block
itself is configured as 64-bit or 32-bit (either using the compatible string,
or a separate property), and a dma-ranges property of the parent bus that
describes what the bus can do and how the address range of the device maps to
the address range of the parent bus.

The DT probe code will set the dma offset according to the dma-ranges, and
will prevent the device from setting a mask that does not get translated
properly, e.g. if you have a 64-bit capable device on a 32-bit bus.

	Arnd

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

* [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver
@ 2015-08-23 13:59           ` Arnd Bergmann
  0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2015-08-23 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Sunday 23 August 2015 19:09:33 Vinod Koul wrote:
> On Fri, Aug 21, 2015 at 02:01:59AM +0300, Laurent Pinchart wrote:
> > > > How is 64 bit DMA addressing implemented ? Can you use a 64-bit VDMA on
> > > > a 32- bit platform with LPAE ? Can you use a 32-bit VDMA on a 64-bit
> > > > platform ? Given that VDMA is an IP core you can instantiate in the
> > > > programmable logic I expect some level of flexibility to be possible, but
> > > > this patch doesn't seem to support it. Please provide more context to
> > > > allow a proper review (and please include it in the commit message of v2).
> > > 
> > > The VDMA core is a soft ip, which can be programmed to support both 32 bit
> > > and 64 bit addressing.When the VDMA core is configured for 32 bit address
> > > space , transfer start address is specified by a single register.
> > > 
> > > When the  VDMA core is configured for an address space greater than 32, each
> > > start address is specified by a combination of two registers.The first
> > > register specifies the LSB 32 bits of address, while the next register
> > > specifies the MSB 32 bits of address.For example,5Ch will specify the LSB
> > > bits while 60h will specify the MSB bits of the first start address. So we
> > > need to program two registers at a time.
> > > 
> > > Yes,64 bit vdma can be used on 32 bit platform and 32 bit vdma can also be
> > > used on 64 bit platform.As far as i know , there is no use case where 64
> > > bit dma can be used on 32 bit platform.Please correct me if i am wrong.
> > 
> > I'm not sure what the use cases would be, but it makes me feel uncomfortable 
> > to decide on whether the VDMA is 32 or 64 bits based on the type of CPU.
> > 
> > As the VDMA flavour is selected at synthesis time, how about specifying it in 
> > DT instead ? You could just add an address-width property.
> That would be saner thing to do. People wont check which IP and will mix and
> match. So you may have a 64 bit system with your 32 bit IP...

Note that you need two things here: an identification of whether the IP block
itself is configured as 64-bit or 32-bit (either using the compatible string,
or a separate property), and a dma-ranges property of the parent bus that
describes what the bus can do and how the address range of the device maps to
the address range of the parent bus.

The DT probe code will set the dma offset according to the dma-ranges, and
will prevent the device from setting a mask that does not get translated
properly, e.g. if you have a 64-bit capable device on a 32-bit bus.

	Arnd

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

end of thread, other threads:[~2015-08-23 13:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-05 11:47 [PATCH] dmaengine: vdma: Add 64 bit addressing support to the driver Anurag Kumar Vulisha
2015-08-05 11:47 ` Anurag Kumar Vulisha
2015-08-18  6:45 ` Anurag Kumar Vulisha
2015-08-18  6:45   ` Anurag Kumar Vulisha
2015-08-18 22:43 ` Laurent Pinchart
2015-08-18 22:43   ` Laurent Pinchart
2015-08-20 10:47   ` Anurag Kumar Vulisha
2015-08-20 10:47     ` Anurag Kumar Vulisha
2015-08-20 23:01     ` Laurent Pinchart
2015-08-20 23:01       ` Laurent Pinchart
2015-08-23 13:39       ` Vinod Koul
2015-08-23 13:39         ` Vinod Koul
2015-08-23 13:59         ` Arnd Bergmann
2015-08-23 13:59           ` Arnd Bergmann

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.