From patchwork Tue Nov 21 17:38:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119389 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5582233qgn; Tue, 21 Nov 2017 09:53:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMbvcYheX2HT7dzLwMDZJT/cT3R5MWjKZ/uao3CvpS9yeySjFaX9gG5DDyt8mrXy3h/5aNB3 X-Received: by 10.80.172.197 with SMTP id x63mr26137192edc.3.1511286821240; Tue, 21 Nov 2017 09:53:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511286821; cv=none; d=google.com; s=arc-20160816; b=QqQtvaQIXfuaBEOJjez1xGogAZBdtrY792d7nwTtsRSy1z5MWs2u/eRhq6zyfHO7Tr w8DKoPuVL3+4N+XEgDIH5TNg3WKj40LxeVm94+1w0324+hy3xF2gSZzz2eRXvjZ9h6wO ic1Hihr5XbjYPoNdw671qLZFchBkiQB+Ga9K0BfBHHp1QWZFWhvFhmKtPvtNcORmi5Hu 4zImMtkAm746j5WzVieWZsg2gdTNjk8SUBjoEEosvnnNBNxq7ccwIN4icztPbMhAzgzX fFbrjxhgrj1y/W5Sgk3NZRTHSd42eMpIFVbr8QZl366V5EUuQmhDH0DgLGUC4hkIfoRx RlrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=dMsTDLRFG29vSJfB9dkECGWCTWzeViMHa9Mp2EmvEPE=; b=I0mptc9xMVwYfsd3M8e6cw/tlwEZfpkxm7NJlFWTRztFiF8mdbe7imN99qVoOU7d5Z vRCV6DUBWa6okaGXw9KaJ3y3zii9DTfa65K4LR8zzkI0+R9N3fQrxttEAiUBWxemKFm2 oKn7G6oxdaqyFIEzaT+cOfXso4a21O/4Zp2vYfW0YwyLH5r4d/i5KjFHjrAlvDzRHkdk rcXMI1zbrbuPyx7bYSIOFIysKrVyfTYoeFKPTMIoNBZ82aE/632GeeQZqK/nk7TN6Kvi YD6f8cx7zwLSjAVV9raAdaIEjtQhDcugBIMtYnrgtHicpJUq5AnWBk+z1bZlU60jTZ43 OVmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=gs8pV9If; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id r7si2176283edc.232.2017.11.21.09.53.40; Tue, 21 Nov 2017 09:53:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=gs8pV9If; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id BFE50C21EDC; Tue, 21 Nov 2017 17:51:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C99AEC22002; Tue, 21 Nov 2017 17:39:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 03819C21FF6; Tue, 21 Nov 2017 17:39:07 +0000 (UTC) Received: from conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by lists.denx.de (Postfix) with ESMTPS id D5FDCC21DF1 for ; Tue, 21 Nov 2017 17:39:03 +0000 (UTC) Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id vALHcbu4001225; Wed, 22 Nov 2017 02:38:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vALHcbu4001225 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511285924; bh=PSTOerSSjkpTDweyolir/TPfKFPg5EtN3A/z3nIgEsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gs8pV9IfpoEaoJ5wzvj2vyteQLws7js/rXxQ6lIK7hXFem8TOQFiMOmq8oz3Uc5Nk nVJntZeAQ9GmKsPUDaUh/IMPMr5ufnCUhYcSCfQXAa/EUExqovhVN4RO9UJMS8gfTo ENag1MXJQGSyog3S3YACptbbHaTiimVafIxK5qXIaDx86LvgTDMe0796zpA+hqrH9E Dcgr1ExcmWKXiEYRo4kmU1PGx5UOJ6OoPxe5O/Duv9DMLqYLym4vqU6wUG1El8bj78 m6uIuQzJob0LitkdXsNv6GqLggR9FdDaYKgvWVWM2gztmCIzuwBh4t3eSRBEj5hCmL Kl5IiWGpq8kGw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Wed, 22 Nov 2017 02:38:24 +0900 Message-Id: <1511285912-12452-15-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511285912-12452-1-git-send-email-yamada.masahiro@socionext.com> References: <1511285912-12452-1-git-send-email-yamada.masahiro@socionext.com> Cc: Scott Wood Subject: [U-Boot] [PATCH 14/22] mtd: nand: Drop unused cached programming support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Boris Brezillon Cached programming is always skipped, so drop the associated code until we decide to really support it. Signed-off-by: Boris Brezillon [Linux commit: 0b4773fd1649e0d418275557723a7ef54f769dc9] [masahiro: modify davinci_nand.c for U-Boot] Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/davinci_nand.c | 3 +-- drivers/mtd/nand/nand_base.c | 42 +++++++++++++---------------------------- include/linux/mtd/nand.h | 2 +- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index 2a01fd3..1e1f4b5 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c @@ -358,13 +358,12 @@ static struct nand_ecclayout nand_keystone_rbl_4bit_layout_oobfirst = { * @buf: the data to write * @oob_required: must write chip->oob_poi to OOB * @page: page number to write - * @cached: cached programming * @raw: use _raw version of write_page */ static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip, uint32_t offset, int data_len, const uint8_t *buf, int oob_required, - int page, int cached, int raw) + int page, int raw) { int status; int ret = 0; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d9f0a75..0be427f 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2409,12 +2409,11 @@ static int nand_write_page_syndrome(struct mtd_info *mtd, * @buf: the data to write * @oob_required: must write chip->oob_poi to OOB * @page: page number to write - * @cached: cached programming * @raw: use _raw version of write_page */ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, uint32_t offset, int data_len, const uint8_t *buf, - int oob_required, int page, int cached, int raw) + int oob_required, int page, int raw) { int status, subpage; @@ -2440,31 +2439,19 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, if (status < 0) return status; + if (nand_standard_page_accessors(&chip->ecc)) + chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); + status = chip->waitfunc(mtd, chip); /* - * Cached progamming disabled for now. Not sure if it's worth the - * trouble. The speed gain is not very impressive. (2.3->2.6Mib/s). + * See if operation failed and additional status checks are + * available. */ - cached = 0; - - if (!cached || !NAND_HAS_CACHEPROG(chip)) { - - if (nand_standard_page_accessors(&chip->ecc)) - chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); - status = chip->waitfunc(mtd, chip); - /* - * See if operation failed and additional status checks are - * available. - */ - if ((status & NAND_STATUS_FAIL) && (chip->errstat)) - status = chip->errstat(mtd, chip, FL_WRITING, status, - page); + if ((status & NAND_STATUS_FAIL) && (chip->errstat)) + status = chip->errstat(mtd, chip, FL_WRITING, status, + page); - if (status & NAND_STATUS_FAIL) - return -EIO; - } else { - chip->cmdfunc(mtd, NAND_CMD_CACHEDPROG, -1, -1); - status = chip->waitfunc(mtd, chip); - } + if (status & NAND_STATUS_FAIL) + return -EIO; return 0; } @@ -2538,7 +2525,7 @@ static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len, static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) { - int chipnr, realpage, page, blockmask, column; + int chipnr, realpage, page, column; struct nand_chip *chip = mtd_to_nand(mtd); uint32_t writelen = ops->len; @@ -2574,7 +2561,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, realpage = (int)(to >> chip->page_shift); page = realpage & chip->pagemask; - blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1; /* Invalidate the page cache, when we write to the cached page */ if (to <= ((loff_t)chip->pagebuf << chip->page_shift) && @@ -2589,7 +2575,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, while (1) { int bytes = mtd->writesize; - int cached = writelen > bytes && page != blockmask; uint8_t *wbuf = buf; int use_bufpoi; int part_pagewr = (column || writelen < mtd->writesize); @@ -2604,7 +2589,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, if (use_bufpoi) { pr_debug("%s: using write bounce buffer for buf@%p\n", __func__, buf); - cached = 0; if (part_pagewr) bytes = min_t(int, bytes - column, writelen); chip->pagebuf = -1; @@ -2622,7 +2606,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, memset(chip->oob_poi, 0xff, mtd->oobsize); } ret = chip->write_page(mtd, chip, column, bytes, wbuf, - oob_required, page, cached, + oob_required, page, (ops->mode == MTD_OPS_RAW)); if (ret) break; diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 72b2328..c4363cc 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -849,7 +849,7 @@ struct nand_chip { int status, int page); int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, uint32_t offset, int data_len, const uint8_t *buf, - int oob_required, int page, int cached, int raw); + int oob_required, int page, int raw); int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, int feature_addr, uint8_t *subfeature_para); int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,