Received: by 10.223.176.5 with SMTP id f5csp296388wra; Fri, 26 Jan 2018 23:43:29 -0800 (PST) X-Google-Smtp-Source: AH8x22408neSaP5BdD6JiJi60VOi3zJ7I/UoxQ6ZJ/4ntVpyULpyhW58XUofnML21Tdu3AOi88O5 X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr16675007plb.425.1517039009248; Fri, 26 Jan 2018 23:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517039009; cv=none; d=google.com; s=arc-20160816; b=uZofcmtQ3T+biTxkY7Qy8rM6FHiL6mH/NcqBkEWUdfBgR+2tJtVk95KW1OJNAgCUXs ABmGeKUUi1NHuKIyGw5znQ0sW7PqoQFdnrk4OQLAFSnzLt+VxQMOxBqMr/OIYUOklZZA xkcF3Wk536udriGvdR2yJuFc/RkWbgXhMbpNo2vF2jxe5MKY6xGZGc7XC1hsot8KdSQ2 EOHPB+v3z4eVwN6xzRIFkGCkS84B0YZduHwtKfK9pm/+f81dP8nyP9i6nm5rYKi4krJv GgN7jO03tU6y01KQY2ZVKrgaKT0/Gak+wmXY2bIhLYlopnI/gkE1qVaULySScwpRWAu9 lE3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=4ChpP4FxbbhbyBaaA+vtIJNkKG0kF0ZeJifgcI5enZc=; b=akhqMWkqjSGilBMSKnsRoqWyNA/WFT1BevDQhWhWH+1g5z7Ecdb/Plway5YY+9/L9Z rwX1Taie1UvuFjDMFPU7sX6G6viLD1dtgE+WWKljJPIHKJUOa8UIWlx7rOTxIvBrea7G +/xMGlfzvZf78cyLjxVm6NdpAReNvKT/Vvz7rSwblCrIfQvXHhuo9TffZgJ7JtQGbDNJ pVK02rAaHhFuZHbYz46VengKXurwerbCi0V9qE5yAeFmyBGLPvgtdv0cHNRinmb1VsVf 0froZvgY2hdLDjTz+RyXaUxa5tAuGvdLgDIViobT8f1bEorGC0xWHxiEGf4iM/c9lIMM vbug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cRxcQhCk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si4091459pgr.525.2018.01.26.23.43.14; Fri, 26 Jan 2018 23:43:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cRxcQhCk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbeA0Hmu (ORCPT + 99 others); Sat, 27 Jan 2018 02:42:50 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:44562 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267AbeA0Hms (ORCPT ); Sat, 27 Jan 2018 02:42:48 -0500 Received: by mail-io0-f194.google.com with SMTP id z6so2713351iob.11 for ; Fri, 26 Jan 2018 23:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4ChpP4FxbbhbyBaaA+vtIJNkKG0kF0ZeJifgcI5enZc=; b=cRxcQhCkCeTiG7Bi9Ph9tDFOyutn3bj6egnho4ytvSqSMJ+sp6NABeNMQL82s/KKHH n0h7uaAsjCNOKgWNzfKI+6RoaI0XgLtp6BuFTjw1IRF2xbdh17tMOq9M98S0Samncsg4 HSUWAsQL475PByVW/3FQl4ss9t3wD+7aZrg3vcQloGWFNHaZIixZKJgkIR1V2YTjUm5O b1m83kSqEryc6MhHZKyq4vclAnf3yq0ICQJ3RrJDg4AKlOjBxM1G/hu9UcnyPKaJqhW9 G5bRaNGI3tPnKIV8qkCwZJs7FQ13WKmvTcC/LL22pVxyixT0BzPLtvH2TkxsgCovngXr 01pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4ChpP4FxbbhbyBaaA+vtIJNkKG0kF0ZeJifgcI5enZc=; b=RVVGHqYEbANceLBqCFJop1evEIS3FapTfI7g0W9WeCYP/wA6xQDdYNs6/UmTAcpv0r KSV9NB6/0SjFbNkflkeTKGwgRvfsvBl0gPULtI4YhwGB8JiArz4ZST84KhYyR0DadT8m jBngyHHjAY/PoLp23V6UgyzFX9ZlchZ4jCKuZE+ZVb+ndE/le9vTOphGLKzRTFwrzJu4 M8an7Z9wzZxu2HD3ZGGsFqrij8Wm9skUBtOrQ/sVTyP4r1c04N+PbxvbhXOxlqJL6E77 6FddfJjMxj2Bmk8l0zT4nJN28YzGXVzcjWfuev5kKEM+9ZCJ5kQ573qyCE4DP+5eKKMo i5vg== X-Gm-Message-State: AKwxytdcWCnHS6kpX9ukDxclof4txkVFOxp4whNe/nAyMz8lpK5ftf1y rkuh3nYegOYlGbLjh0iwiR9Vd5uQbn50yxC4hCtwVF8ZCn8= X-Received: by 10.107.128.159 with SMTP id k31mr18437234ioi.168.1517038968176; Fri, 26 Jan 2018 23:42:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.165.9 with HTTP; Fri, 26 Jan 2018 23:42:47 -0800 (PST) In-Reply-To: <20171030093426.30827ef5@bbrezillon> References: <20171028074351.13118-1-prasannatsmkumar@gmail.com> <20171030093426.30827ef5@bbrezillon> From: PrasannaKumar Muralidharan Date: Sat, 27 Jan 2018 13:12:47 +0530 Message-ID: Subject: Re: [RFC] NAND: Optimize NAND_ECC_HW_OOB_FIRST read To: Boris Brezillon Cc: David Woodhouse , Brian Norris , =?UTF-8?B?TWFyZWsgVmHFoXV0?= , cyrille.pitchen@wedev4u.fr, linux-mtd@lists.infradead.org, open list , Lars-Peter Clausen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, On 30 October 2017 at 14:04, Boris Brezillon wrote: > Hi PrasannaKumar, > > On Sat, 28 Oct 2017 13:13:51 +0530 > PrasannaKumar Muralidharan wrote: > >> From: Lars-Peter Clausen >> >> Avoid sending unnecessary READ commands to the chip. >> >> Signed-off-by: Lars-Peter Clausen >> Signed-off-by: PrasannaKumar Muralidharan >> --- >> This patch is taken from git://projects.qi-hardware.com/qi-kernel.git >> branch jz-3.16. From [1] and [2] it can be seen that the patch author >> thinks this can be sent upstream but it never happened so far. This >> patch is used in OpenWRT as seen from [3]. > > Sounds reasonable, but it's likely to conflict with something I'd like > to queue for 4.16 [1]. I'll rebase this patch on nand/next once the > ->exec_op() series is merged. Don't hesitate to ping me if I forget. > > Regards, > > Boris > > [1]http://patchwork.ozlabs.org/project/linux-mtd/list/?series=8923 > >> >> I have only compile tested the patch. >> >> 1. https://www.mail-archive.com/discussion@lists.en.qi-hardware.com/msg04635.html >> 2. https://www.mail-archive.com/discussion@lists.en.qi-hardware.com/msg04639.html >> 3. https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch;h=046da51912de3cd4444779df5de13d2c1999719a;hb=c03d4317a6bc891cb4a5e89cbdd77f37c23aff86 >> >> drivers/mtd/nand/nand_base.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c >> index 12edaae..4bf3bdb 100644 >> --- a/drivers/mtd/nand/nand_base.c >> +++ b/drivers/mtd/nand/nand_base.c >> @@ -1680,9 +1680,15 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd, >> unsigned int max_bitflips = 0; >> >> /* Read the OOB area first */ >> - chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); >> - chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); >> - chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); >> + if (mtd->writesize > 512) { >> + chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); >> + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); >> + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1); >> + } else { >> + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); >> + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); >> + chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); >> + } >> >> ret = mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0, >> chip->ecc.total); >> @@ -1902,8 +1908,10 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, >> __func__, buf); >> >> read_retry: >> - if (nand_standard_page_accessors(&chip->ecc)) >> + if (nand_standard_page_accessors(&chip->ecc) && >> + chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) { >> chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); >> + } >> >> /* >> * Now read the page into the buffer. Absent an error, > Can you please revisit this? Thanks, PrasannaKumar