linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] MTK NAND driver improvements and fixes
@ 2019-05-07 10:25 Xiaolei Li
  2019-05-07 10:25 ` [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle Xiaolei Li
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Xiaolei Li @ 2019-05-07 10:25 UTC (permalink / raw)
  To: miquel.raynal, richard
  Cc: linux-mediatek, xiaolei.li, linux-mtd, srv_heupstream

The following patch set mainly contains:
* Fix low level time calculation of read/write cycle to meet tRC_min
  and tWC_min requirements.
* Refine RE# pulse width calculation and data sampling to improve read
  performance.
* Add CS validity check.
* Fix oob buffer pointer wrongly setting.

Changes on v3 relative to:
--------------------

tree    : https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/
branch  : nand/next
commit  :
        'commit 1c14fe2167ef ("mtd: nandsim: switch to exec_op interface")

Patch v3:
---------
- Fix some comment style.
- Format patch base branch: nand/next
- Pend to sent patch "mtd: rawnand: mtk: Setup empty page threshold
  correctly", because it seems that we should confirm this change has no
  side effect and need more test.

Patch v2:
---------
- Fix type
- Reference correct faulty patch
- Refine code to do calculation and condition in separate steps
- Fix empty threshold calculation

Tests:
------

* ubifs and jffs2 are validated on NAND device MT29F16G08ADBCA by
  'dd' command.
* all drivers/mtd/tests/* pass.
* speed test:
  eraseblock write speed is 11087 KiB/s
  eraseblock read speed is 19986 KiB/s
  page write speed is 10689 KiB/s
  page read speed is 18724 KiB/s
  2 page write speed is 10611 KiB/s
  2 page read speed is 18713 KiB/s
  erase speed is 103696 KiB/s
  2x multi-block erase speed is 354248 KiB/s
  4x multi-block erase speed is 350459 KiB/s
  8x multi-block erase speed is 356173 KiB/s
  16x multi-block erase speed is 356173 KiB/s
  32x multi-block erase speed is 358120 KiB/s
  64x multi-block erase speed is 356173 KiB/s

Xiaolei Li (4):
  mtd: rawnand: mtk: Correct low level time calculation of r/w cycle
  mtd: rawnand: mtk: Improve data sampling timing for read cycle
  mtd: rawnand: mtk: Add validity check for CE# pin setting
  mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue

 drivers/mtd/nand/raw/mtk_nand.c | 84 +++++++++++++++++++++++++++------
 1 file changed, 70 insertions(+), 14 deletions(-)

-- 
2.18.0



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle
  2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
@ 2019-05-07 10:25 ` Xiaolei Li
  2019-06-03  8:04   ` Miquel Raynal
  2019-05-07 10:25 ` [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle Xiaolei Li
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Xiaolei Li @ 2019-05-07 10:25 UTC (permalink / raw)
  To: miquel.raynal, richard
  Cc: linux-mediatek, xiaolei.li, linux-mtd, stable, srv_heupstream

At present, the flow of calculating AC timing of read/write cycle in SDR
mode is that:
At first, calculate high hold time which is valid for both read and write
cycle using the max value between tREH_min and tWH_min.
Secondly, calculate WE# pulse width using tWP_min.
Thridly, calculate RE# pulse width using the bigger one between tREA_max
and tRP_min.

But NAND SPEC shows that Controller should also meet write/read cycle time.
That is write cycle time should be more than tWC_min and read cycle should
be more than tRC_min. Obviously, we do not achieve that now.

This patch corrects the low level time calculation to meet minimum
read/write cycle time required. After getting the high hold time, WE# low
level time will be promised to meet tWP_min and tWC_min requirement,
and RE# low level time will be promised to meet tREA_max, tRP_min and
tRC_min requirement.

Fixes: edfee3619c49 ("mtd: nand: mtk: add ->setup_data_interface() hook")
Cc: stable@vger.kernel.org # v4.17+
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index b17619f30b1b..717f17bcffb4 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -508,7 +508,8 @@ static int mtk_nfc_setup_data_interface(struct nand_chip *chip, int csline,
 {
 	struct mtk_nfc *nfc = nand_get_controller_data(chip);
 	const struct nand_sdr_timings *timings;
-	u32 rate, tpoecs, tprecs, tc2r, tw2r, twh, twst, trlt;
+	u32 rate, tpoecs, tprecs, tc2r, tw2r, twh, twst = 0, trlt = 0;
+	u32 thold;
 
 	timings = nand_get_sdr_timings(conf);
 	if (IS_ERR(timings))
@@ -544,11 +545,28 @@ static int mtk_nfc_setup_data_interface(struct nand_chip *chip, int csline,
 	twh = DIV_ROUND_UP(twh * rate, 1000000) - 1;
 	twh &= 0xf;
 
-	twst = timings->tWP_min / 1000;
+	/* Calculate real WE#/RE# hold time in nanosecond */
+	thold = (twh + 1) * 1000000 / rate;
+	/* nanosecond to picosecond */
+	thold *= 1000;
+
+	/*
+	 * WE# low level time should be expaned to meet WE# pulse time
+	 * and WE# cycle time at the same time.
+	 */
+	if (thold < timings->tWC_min)
+		twst = timings->tWC_min - thold;
+	twst = max(timings->tWP_min, twst) / 1000;
 	twst = DIV_ROUND_UP(twst * rate, 1000000) - 1;
 	twst &= 0xf;
 
-	trlt = max(timings->tREA_max, timings->tRP_min) / 1000;
+	/*
+	 * RE# low level time should be expaned to meet RE# pulse time,
+	 * RE# access time and RE# cycle time at the same time.
+	 */
+	if (thold < timings->tRC_min)
+		trlt = timings->tRC_min - thold;
+	trlt = max3(trlt, timings->tREA_max, timings->tRP_min) / 1000;
 	trlt = DIV_ROUND_UP(trlt * rate, 1000000) - 1;
 	trlt &= 0xf;
 
-- 
2.18.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle
  2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
  2019-05-07 10:25 ` [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle Xiaolei Li
@ 2019-05-07 10:25 ` Xiaolei Li
  2019-06-03  8:04   ` Miquel Raynal
  2019-05-07 10:25 ` [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting Xiaolei Li
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Xiaolei Li @ 2019-05-07 10:25 UTC (permalink / raw)
  To: miquel.raynal, richard
  Cc: linux-mediatek, xiaolei.li, linux-mtd, srv_heupstream

Currently, we expand RE# low level time by choosing the max value
between RE# pulse width and RE# access time, and sample data at the
rising edge of RE#.

Then, if RE# access time is bigger than RE# pulse width, the real
read cycle time may be more than NAND SPEC required. This makes
read performance be worse than that expected.

This patch improves data sampling timing by calculating RE# low level
time according to RE# pulse width. If RE# access time is bigger than
RE# pulse width, then delay sampling data timing.

The result of contrast test base on MT2712 evaluat board is as follow.

nand: Micron MT29F16G08ADBCAH4
nand: 2048 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 224
NFI 2x clock rate: 124800000 HZ.

Read speed without this patch:
mtd_speedtest: page read speed is 14012 KiB/s
mtd_speedtest: 2 page read speed is 14860 KiB/s

Read speed with this patch:
mtd_speedtest: page read speed is 18724 KiB/s
mtd_speedtest: 2 page read speed is 18713 KiB/s

Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 46 ++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index 717f17bcffb4..6b79a0f9aef8 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -87,6 +87,10 @@
 #define NFI_FDMM(x)		(0xA4 + (x) * sizeof(u32) * 2)
 #define NFI_FDM_MAX_SIZE	(8)
 #define NFI_FDM_MIN_SIZE	(1)
+#define NFI_DEBUG_CON1		(0x220)
+#define		STROBE_MASK		GENMASK(4, 3)
+#define		STROBE_SHIFT		(3)
+#define		MAX_STROBE_DLY		(3)
 #define NFI_MASTER_STA		(0x224)
 #define		MASTER_STA_MASK		(0x0FFF)
 #define NFI_EMPTY_THRESH	(0x23C)
@@ -509,7 +513,7 @@ static int mtk_nfc_setup_data_interface(struct nand_chip *chip, int csline,
 	struct mtk_nfc *nfc = nand_get_controller_data(chip);
 	const struct nand_sdr_timings *timings;
 	u32 rate, tpoecs, tprecs, tc2r, tw2r, twh, twst = 0, trlt = 0;
-	u32 thold;
+	u32 temp, tsel = 0;
 
 	timings = nand_get_sdr_timings(conf);
 	if (IS_ERR(timings))
@@ -546,30 +550,52 @@ static int mtk_nfc_setup_data_interface(struct nand_chip *chip, int csline,
 	twh &= 0xf;
 
 	/* Calculate real WE#/RE# hold time in nanosecond */
-	thold = (twh + 1) * 1000000 / rate;
+	temp = (twh + 1) * 1000000 / rate;
 	/* nanosecond to picosecond */
-	thold *= 1000;
+	temp *= 1000;
 
 	/*
 	 * WE# low level time should be expaned to meet WE# pulse time
 	 * and WE# cycle time at the same time.
 	 */
-	if (thold < timings->tWC_min)
-		twst = timings->tWC_min - thold;
+	if (temp < timings->tWC_min)
+		twst = timings->tWC_min - temp;
 	twst = max(timings->tWP_min, twst) / 1000;
 	twst = DIV_ROUND_UP(twst * rate, 1000000) - 1;
 	twst &= 0xf;
 
 	/*
-	 * RE# low level time should be expaned to meet RE# pulse time,
-	 * RE# access time and RE# cycle time at the same time.
+	 * RE# low level time should be expaned to meet RE# pulse time
+	 * and RE# cycle time at the same time.
 	 */
-	if (thold < timings->tRC_min)
-		trlt = timings->tRC_min - thold;
-	trlt = max3(trlt, timings->tREA_max, timings->tRP_min) / 1000;
+	if (temp < timings->tRC_min)
+		trlt = timings->tRC_min - temp;
+	trlt = max(trlt, timings->tRP_min) / 1000;
 	trlt = DIV_ROUND_UP(trlt * rate, 1000000) - 1;
 	trlt &= 0xf;
 
+	/* Calculate RE# pulse time in nanosecond. */
+	temp = (trlt + 1) * 1000000 / rate;
+	/* nanosecond to picosecond */
+	temp *= 1000;
+	/*
+	 * If RE# access time is bigger than RE# pulse time,
+	 * delay sampling data timing.
+	 */
+	if (temp < timings->tREA_max) {
+		tsel = timings->tREA_max / 1000;
+		tsel = DIV_ROUND_UP(tsel * rate, 1000000);
+		tsel -= (trlt + 1);
+		if (tsel > MAX_STROBE_DLY) {
+			trlt += tsel - MAX_STROBE_DLY;
+			tsel = MAX_STROBE_DLY;
+		}
+	}
+	temp = nfi_readl(nfc, NFI_DEBUG_CON1);
+	temp &= ~STROBE_MASK;
+	temp |= tsel << STROBE_SHIFT;
+	nfi_writel(nfc, temp, NFI_DEBUG_CON1);
+
 	/*
 	 * ACCON: access timing control register
 	 * -------------------------------------
-- 
2.18.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting
  2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
  2019-05-07 10:25 ` [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle Xiaolei Li
  2019-05-07 10:25 ` [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle Xiaolei Li
@ 2019-05-07 10:25 ` Xiaolei Li
  2019-06-03  8:04   ` Miquel Raynal
  2019-05-07 10:25 ` [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue Xiaolei Li
  2019-05-17  1:32 ` [PATCH v3 0/4] MTK NAND driver improvements and fixes xiaolei li
  4 siblings, 1 reply; 12+ messages in thread
From: Xiaolei Li @ 2019-05-07 10:25 UTC (permalink / raw)
  To: miquel.raynal, richard
  Cc: linux-mediatek, xiaolei.li, linux-mtd, srv_heupstream

Currently, we only check how many CE# pins are set in device tree.
But it should be necessary to check whether CE# pin setting is
duplicated or if CE# pin index exceeds the maximum CE# number that
controller supports.

So, add validity check to avoid these invalid settings.

Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index 6b79a0f9aef8..14a9b8c2a8db 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -162,6 +162,8 @@ struct mtk_nfc {
 	struct list_head chips;
 
 	u8 *buffer;
+
+	unsigned long assigned_cs;
 };
 
 /*
@@ -1367,6 +1369,17 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 			dev_err(dev, "reg property failure : %d\n", ret);
 			return ret;
 		}
+
+		if (tmp >= MTK_NAND_MAX_NSELS) {
+			dev_err(dev, "invalid CS: %u\n", tmp);
+			return -EINVAL;
+		}
+
+		if (test_and_set_bit(tmp, &nfc->assigned_cs)) {
+			dev_err(dev, "CS %u already assigned\n", tmp);
+			return -EINVAL;
+		}
+
 		chip->sels[i] = tmp;
 	}
 
-- 
2.18.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue
  2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
                   ` (2 preceding siblings ...)
  2019-05-07 10:25 ` [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting Xiaolei Li
@ 2019-05-07 10:25 ` Xiaolei Li
  2019-06-03  8:04   ` Miquel Raynal
  2019-05-17  1:32 ` [PATCH v3 0/4] MTK NAND driver improvements and fixes xiaolei li
  4 siblings, 1 reply; 12+ messages in thread
From: Xiaolei Li @ 2019-05-07 10:25 UTC (permalink / raw)
  To: miquel.raynal, richard
  Cc: linux-mediatek, xiaolei.li, linux-mtd, srv_heupstream

One main goal of the function mtk_nfc_update_ecc_stats is to check
whether sectors are all empty. If they are empty, set these sectors's
data buffer and OOB buffer as 0xff.

But now, the sector OOB buffer pointer is wrongly assigned. We always
do memset from sector 0.

To fix this issue, pass start sector number to make OOB buffer pointer
be properly assigned.

Fixes: 1d6b1e464950 ("mtd: mediatek: driver for MTK Smart Device")
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index 14a9b8c2a8db..617f9656a045 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -889,19 +889,21 @@ static int mtk_nfc_write_oob_std(struct nand_chip *chip, int page)
 	return mtk_nfc_write_page_raw(chip, NULL, 1, page);
 }
 
-static int mtk_nfc_update_ecc_stats(struct mtd_info *mtd, u8 *buf, u32 sectors)
+static int mtk_nfc_update_ecc_stats(struct mtd_info *mtd, u8 *buf, u32 start,
+				    u32 sectors)
 {
 	struct nand_chip *chip = mtd_to_nand(mtd);
 	struct mtk_nfc *nfc = nand_get_controller_data(chip);
 	struct mtk_nfc_nand_chip *mtk_nand = to_mtk_nand(chip);
 	struct mtk_ecc_stats stats;
+	u32 reg_size = mtk_nand->fdm.reg_size;
 	int rc, i;
 
 	rc = nfi_readl(nfc, NFI_STA) & STA_EMP_PAGE;
 	if (rc) {
 		memset(buf, 0xff, sectors * chip->ecc.size);
 		for (i = 0; i < sectors; i++)
-			memset(oob_ptr(chip, i), 0xff, mtk_nand->fdm.reg_size);
+			memset(oob_ptr(chip, start + i), 0xff, reg_size);
 		return 0;
 	}
 
@@ -921,7 +923,7 @@ static int mtk_nfc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
 	u32 spare = mtk_nand->spare_per_sector;
 	u32 column, sectors, start, end, reg;
 	dma_addr_t addr;
-	int bitflips;
+	int bitflips = 0;
 	size_t len;
 	u8 *buf;
 	int rc;
@@ -988,14 +990,11 @@ static int mtk_nfc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
 	if (rc < 0) {
 		dev_err(nfc->dev, "subpage done timeout\n");
 		bitflips = -EIO;
-	} else {
-		bitflips = 0;
-		if (!raw) {
-			rc = mtk_ecc_wait_done(nfc->ecc, ECC_DECODE);
-			bitflips = rc < 0 ? -ETIMEDOUT :
-				mtk_nfc_update_ecc_stats(mtd, buf, sectors);
-			mtk_nfc_read_fdm(chip, start, sectors);
-		}
+	} else if (!raw) {
+		rc = mtk_ecc_wait_done(nfc->ecc, ECC_DECODE);
+		bitflips = rc < 0 ? -ETIMEDOUT :
+			mtk_nfc_update_ecc_stats(mtd, buf, start, sectors);
+		mtk_nfc_read_fdm(chip, start, sectors);
 	}
 
 	dma_unmap_single(nfc->dev, addr, len, DMA_FROM_DEVICE);
-- 
2.18.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 0/4] MTK NAND driver improvements and fixes
  2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
                   ` (3 preceding siblings ...)
  2019-05-07 10:25 ` [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue Xiaolei Li
@ 2019-05-17  1:32 ` xiaolei li
  2019-05-17  8:12   ` Miquel Raynal
  4 siblings, 1 reply; 12+ messages in thread
From: xiaolei li @ 2019-05-17  1:32 UTC (permalink / raw)
  To: miquel.raynal; +Cc: richard, linux-mediatek, linux-mtd, srv_heupstream

Hi Miquel,

Sorry to bother you, but may I ask if it is fine to accept this patch
set now, patches all with your review.

Thanks,
Xiaolei

On Tue, 2019-05-07 at 18:25 +0800, Xiaolei Li wrote:
> The following patch set mainly contains:
> * Fix low level time calculation of read/write cycle to meet tRC_min
>   and tWC_min requirements.
> * Refine RE# pulse width calculation and data sampling to improve read
>   performance.
> * Add CS validity check.
> * Fix oob buffer pointer wrongly setting.
> 
> Changes on v3 relative to:
> --------------------
> 
> tree    : https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/
> branch  : nand/next
> commit  :
>         'commit 1c14fe2167ef ("mtd: nandsim: switch to exec_op interface")
> 
> Patch v3:
> ---------
> - Fix some comment style.
> - Format patch base branch: nand/next
> - Pend to sent patch "mtd: rawnand: mtk: Setup empty page threshold
>   correctly", because it seems that we should confirm this change has no
>   side effect and need more test.
> 
> Patch v2:
> ---------
> - Fix type
> - Reference correct faulty patch
> - Refine code to do calculation and condition in separate steps
> - Fix empty threshold calculation
> 
> Tests:
> ------
> 
> * ubifs and jffs2 are validated on NAND device MT29F16G08ADBCA by
>   'dd' command.
> * all drivers/mtd/tests/* pass.
> * speed test:
>   eraseblock write speed is 11087 KiB/s
>   eraseblock read speed is 19986 KiB/s
>   page write speed is 10689 KiB/s
>   page read speed is 18724 KiB/s
>   2 page write speed is 10611 KiB/s
>   2 page read speed is 18713 KiB/s
>   erase speed is 103696 KiB/s
>   2x multi-block erase speed is 354248 KiB/s
>   4x multi-block erase speed is 350459 KiB/s
>   8x multi-block erase speed is 356173 KiB/s
>   16x multi-block erase speed is 356173 KiB/s
>   32x multi-block erase speed is 358120 KiB/s
>   64x multi-block erase speed is 356173 KiB/s
> 
> Xiaolei Li (4):
>   mtd: rawnand: mtk: Correct low level time calculation of r/w cycle
>   mtd: rawnand: mtk: Improve data sampling timing for read cycle
>   mtd: rawnand: mtk: Add validity check for CE# pin setting
>   mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue
> 
>  drivers/mtd/nand/raw/mtk_nand.c | 84 +++++++++++++++++++++++++++------
>  1 file changed, 70 insertions(+), 14 deletions(-)
> 



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 0/4] MTK NAND driver improvements and fixes
  2019-05-17  1:32 ` [PATCH v3 0/4] MTK NAND driver improvements and fixes xiaolei li
@ 2019-05-17  8:12   ` Miquel Raynal
  2019-05-17  9:21     ` xiaolei li
  0 siblings, 1 reply; 12+ messages in thread
From: Miquel Raynal @ 2019-05-17  8:12 UTC (permalink / raw)
  To: xiaolei li; +Cc: richard, linux-mediatek, linux-mtd, srv_heupstream

Hi xiaolei,

xiaolei li <xiaolei.li@mediatek.com> wrote on Fri, 17 May 2019 09:32:47
+0800:

> Hi Miquel,
> 
> Sorry to bother you, but may I ask if it is fine to accept this patch
> set now, patches all with your review.

We are in the middle of the merge window, so yes, I will take your
patches, but not now.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 0/4] MTK NAND driver improvements and fixes
  2019-05-17  8:12   ` Miquel Raynal
@ 2019-05-17  9:21     ` xiaolei li
  0 siblings, 0 replies; 12+ messages in thread
From: xiaolei li @ 2019-05-17  9:21 UTC (permalink / raw)
  To: Miquel Raynal; +Cc: richard, linux-mediatek, linux-mtd, srv_heupstream

On Fri, 2019-05-17 at 10:12 +0200, Miquel Raynal wrote:
> Hi xiaolei,
> 
> xiaolei li <xiaolei.li@mediatek.com> wrote on Fri, 17 May 2019 09:32:47
> +0800:
> 
> > Hi Miquel,
> > 
> > Sorry to bother you, but may I ask if it is fine to accept this patch
> > set now, patches all with your review.
> 
> We are in the middle of the merge window, so yes, I will take your
> patches, but not now.

Got it. Thanks Miquel.

> 
> Thanks,
> Miquèl



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue
  2019-05-07 10:25 ` [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue Xiaolei Li
@ 2019-06-03  8:04   ` Miquel Raynal
  0 siblings, 0 replies; 12+ messages in thread
From: Miquel Raynal @ 2019-06-03  8:04 UTC (permalink / raw)
  To: Xiaolei Li, miquel.raynal, richard
  Cc: linux-mtd, linux-mediatek, srv_heupstream

On Tue, 2019-05-07 at 10:25:41 UTC, Xiaolei Li wrote:
> One main goal of the function mtk_nfc_update_ecc_stats is to check
> whether sectors are all empty. If they are empty, set these sectors's
> data buffer and OOB buffer as 0xff.
> 
> But now, the sector OOB buffer pointer is wrongly assigned. We always
> do memset from sector 0.
> 
> To fix this issue, pass start sector number to make OOB buffer pointer
> be properly assigned.
> 
> Fixes: 1d6b1e464950 ("mtd: mediatek: driver for MTK Smart Device")
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting
  2019-05-07 10:25 ` [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting Xiaolei Li
@ 2019-06-03  8:04   ` Miquel Raynal
  0 siblings, 0 replies; 12+ messages in thread
From: Miquel Raynal @ 2019-06-03  8:04 UTC (permalink / raw)
  To: Xiaolei Li, miquel.raynal, richard
  Cc: linux-mtd, linux-mediatek, srv_heupstream

On Tue, 2019-05-07 at 10:25:40 UTC, Xiaolei Li wrote:
> Currently, we only check how many CE# pins are set in device tree.
> But it should be necessary to check whether CE# pin setting is
> duplicated or if CE# pin index exceeds the maximum CE# number that
> controller supports.
> 
> So, add validity check to avoid these invalid settings.
> 
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle
  2019-05-07 10:25 ` [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle Xiaolei Li
@ 2019-06-03  8:04   ` Miquel Raynal
  0 siblings, 0 replies; 12+ messages in thread
From: Miquel Raynal @ 2019-06-03  8:04 UTC (permalink / raw)
  To: Xiaolei Li, miquel.raynal, richard
  Cc: linux-mtd, linux-mediatek, srv_heupstream

On Tue, 2019-05-07 at 10:25:39 UTC, Xiaolei Li wrote:
> Currently, we expand RE# low level time by choosing the max value
> between RE# pulse width and RE# access time, and sample data at the
> rising edge of RE#.
> 
> Then, if RE# access time is bigger than RE# pulse width, the real
> read cycle time may be more than NAND SPEC required. This makes
> read performance be worse than that expected.
> 
> This patch improves data sampling timing by calculating RE# low level
> time according to RE# pulse width. If RE# access time is bigger than
> RE# pulse width, then delay sampling data timing.
> 
> The result of contrast test base on MT2712 evaluat board is as follow.
> 
> nand: Micron MT29F16G08ADBCAH4
> nand: 2048 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 224
> NFI 2x clock rate: 124800000 HZ.
> 
> Read speed without this patch:
> mtd_speedtest: page read speed is 14012 KiB/s
> mtd_speedtest: 2 page read speed is 14860 KiB/s
> 
> Read speed with this patch:
> mtd_speedtest: page read speed is 18724 KiB/s
> mtd_speedtest: 2 page read speed is 18713 KiB/s
> 
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle
  2019-05-07 10:25 ` [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle Xiaolei Li
@ 2019-06-03  8:04   ` Miquel Raynal
  0 siblings, 0 replies; 12+ messages in thread
From: Miquel Raynal @ 2019-06-03  8:04 UTC (permalink / raw)
  To: Xiaolei Li, miquel.raynal, richard
  Cc: linux-mtd, linux-mediatek, srv_heupstream, stable

On Tue, 2019-05-07 at 10:25:38 UTC, Xiaolei Li wrote:
> At present, the flow of calculating AC timing of read/write cycle in SDR
> mode is that:
> At first, calculate high hold time which is valid for both read and write
> cycle using the max value between tREH_min and tWH_min.
> Secondly, calculate WE# pulse width using tWP_min.
> Thridly, calculate RE# pulse width using the bigger one between tREA_max
> and tRP_min.
> 
> But NAND SPEC shows that Controller should also meet write/read cycle time.
> That is write cycle time should be more than tWC_min and read cycle should
> be more than tRC_min. Obviously, we do not achieve that now.
> 
> This patch corrects the low level time calculation to meet minimum
> read/write cycle time required. After getting the high hold time, WE# low
> level time will be promised to meet tWP_min and tWC_min requirement,
> and RE# low level time will be promised to meet tREA_max, tRP_min and
> tRC_min requirement.
> 
> Fixes: edfee3619c49 ("mtd: nand: mtk: add ->setup_data_interface() hook")
> Cc: stable@vger.kernel.org # v4.17+
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2019-06-03  8:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 10:25 [PATCH v3 0/4] MTK NAND driver improvements and fixes Xiaolei Li
2019-05-07 10:25 ` [PATCH v3 1/4] mtd: rawnand: mtk: Correct low level time calculation of r/w cycle Xiaolei Li
2019-06-03  8:04   ` Miquel Raynal
2019-05-07 10:25 ` [PATCH v3 2/4] mtd: rawnand: mtk: Improve data sampling timing for read cycle Xiaolei Li
2019-06-03  8:04   ` Miquel Raynal
2019-05-07 10:25 ` [PATCH v3 3/4] mtd: rawnand: mtk: Add validity check for CE# pin setting Xiaolei Li
2019-06-03  8:04   ` Miquel Raynal
2019-05-07 10:25 ` [PATCH v3 4/4] mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue Xiaolei Li
2019-06-03  8:04   ` Miquel Raynal
2019-05-17  1:32 ` [PATCH v3 0/4] MTK NAND driver improvements and fixes xiaolei li
2019-05-17  8:12   ` Miquel Raynal
2019-05-17  9:21     ` xiaolei li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).