Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606567

[PATCH v2 14/53] mtd: nand: denali: support 64bit capable DMA engine

From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject [PATCH v2 14/53] mtd: nand: denali: support 64bit capable DMA engine
Date 2017-03-22 15:20 +0100
Message-ID <tnPhi-3Fu-79@gated-at.bofh.it> (permalink)
References <tnPhf-3Fu-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The current driver only supports the DMA engine up to 32 bit
physical address, but there also exists 64 bit capable DMA engine
for this IP.

The data DMA setup sequence is completely different, so I added the
64 bit DMA code as a new function denali_setup_dma64().  The 32 bit
one has been renamed to denali_setup_dma32().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v2:
  - Change the capability prefix DENALI_CAPS_ -> DENALI_CAP_

 drivers/mtd/nand/denali.c | 39 +++++++++++++++++++++++++++++++++++----
 drivers/mtd/nand/denali.h |  1 +
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 91f0def..513292f 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -999,8 +999,30 @@ static void denali_enable_dma(struct denali_nand_info *denali, bool en)
 	ioread32(denali->flash_reg + DMA_ENABLE);
 }
 
-/* setups the HW to perform the data DMA */
-static void denali_setup_dma(struct denali_nand_info *denali, int op)
+static void denali_setup_dma64(struct denali_nand_info *denali, int op)
+{
+	uint32_t mode;
+	const int page_count = 1;
+	uint64_t addr = denali->buf.dma_buf;
+
+	mode = MODE_10 | BANK(denali->flash_bank) | denali->page;
+
+	/* DMA is a three step process */
+
+	/*
+	 * 1. setup transfer type, interrupt when complete,
+	 *    burst len = 64 bytes, the number of pages
+	 */
+	index_addr(denali, mode, 0x01002000 | (64 << 16) | op | page_count);
+
+	/* 2. set memory low address */
+	index_addr(denali, mode, addr);
+
+	/* 3. set memory high address */
+	index_addr(denali, mode, addr >> 32);
+}
+
+static void denali_setup_dma32(struct denali_nand_info *denali, int op)
 {
 	uint32_t mode;
 	const int page_count = 1;
@@ -1023,6 +1045,14 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op)
 	index_addr(denali, mode | 0x14000, 0x2400);
 }
 
+static void denali_setup_dma(struct denali_nand_info *denali, int op)
+{
+	if (denali->caps & DENALI_CAP_DMA_64BIT)
+		denali_setup_dma64(denali, op);
+	else
+		denali_setup_dma32(denali, op);
+}
+
 /*
  * writes a page. user specifies type, and this function handles the
  * configuration details.
@@ -1492,8 +1522,9 @@ int denali_init(struct denali_nand_info *denali)
 		goto failed_req_irq;
 	}
 
-	/* Is 32-bit DMA supported? */
-	ret = dma_set_mask(denali->dev, DMA_BIT_MASK(32));
+	ret = dma_set_mask(denali->dev,
+			   DMA_BIT_MASK(denali->caps & DENALI_CAP_DMA_64BIT ?
+					64 : 32));
 	if (ret) {
 		dev_err(denali->dev, "No usable DMA configuration\n");
 		goto failed_req_irq;
diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h
index ed42b16..a8e8d68 100644
--- a/drivers/mtd/nand/denali.h
+++ b/drivers/mtd/nand/denali.h
@@ -353,6 +353,7 @@ struct denali_nand_info {
 	int max_banks;
 	unsigned int caps;
 #define DENALI_CAP_HW_ECC_FIXUP			BIT(0)
+#define DENALI_CAP_DMA_64BIT			BIT(1)
 };
 
 extern int denali_init(struct denali_nand_info *denali);
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/53] mtd: nand: denali: 2nd round of Denali NAND IP patch bomb Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
  [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
    Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-22 21:40 +0100
      Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-23 08:40 +0100
        Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-23 09:10 +0100
    Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-22 22:00 +0100
      Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-23 08:40 +0100
        Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-23 09:00 +0100
          Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-24 03:50 +0100
            Re: [PATCH v2 10/53] mtd: nand: denali: fix erased page checking Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-24 09:10 +0100
  [PATCH v2 20/53] mtd: nand: denali: do not set mtd->name Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
    Re: [PATCH v2 20/53] mtd: nand: denali: do not set mtd->name Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-27 17:40 +0200
  [PATCH v2 18/53] mtd: nand: denali: use nand_chip to hold frequently accessed data Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
  [PATCH v2 07/53] mtd: nand: denali: consolidate INTR_STATUS__* and INTR_EN__* macros Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
  [PATCH v2 14/53] mtd: nand: denali: support 64bit capable DMA engine Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:20 +0100
  [PATCH v2 02/53] mtd: nand: use read_oob() instead of cmdfunc() for bad block check Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 06/53] mtd: nand: denali: fix comment of denali_nand_info::flash_mem Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 19/53] mtd: nand: denali: call nand_set_flash_node() to set DT node Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 24/53] mtd: nand: denali: remove meaningless writes to read-only registers Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 03/53] mtd: nand: denali: remove unused CONFIG option and macros Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 01/53] mtd: nand: allow to set only one of ECC size and ECC strength from DT Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 21/53] mtd: nand: denali: move multi device fixup code to a helper function Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 11/53] mtd: nand: denali: fix bitflips calculation in handle_ecc() Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
    Re: [PATCH v2 11/53] mtd: nand: denali: fix bitflips calculation in  handle_ecc() Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-22 22:00 +0100
      Re: [PATCH v2 11/53] mtd: nand: denali: fix bitflips calculation in handle_ecc() Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-23 08:40 +0100
        Re: [PATCH v2 11/53] mtd: nand: denali: fix bitflips calculation in  handle_ecc() Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-23 09:20 +0100
  [PATCH v2 15/53] mtd: nand: denali_dt: remove dma-mask DT property Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
  [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP capability Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 15:30 +0100
    Re: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP  capability Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-22 22:10 +0100
      Re: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP capability Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-23 08:40 +0100
        Re: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP  capability Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-23 09:30 +0100
    Re: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP  capability Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-22 22:20 +0100
      Re: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP capability Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-23 08:40 +0100

csiph-web