From patchwork Tue Jul 10 14:52:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 942026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lP/uqwx3"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="TRpzSDb9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Q5216HCjz9s0W for ; Wed, 11 Jul 2018 00:59:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:From:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=SpelCzzeQPIf7CZGXumQuH2G1qRlfU27L0nl/s1q3nQ=; b=lP/uqwx3SqCXMl CeF+P1WeAM+Ve2LwHGbPx/Npk2WC14/sImgJ2EXXXN2/WW+VViVNhFZ/bJ3/ZUEpbZS0XFVkypuHU Tl8yjDdvTtDYt+OYB82jmQ+qXZ7b484/Oga1lFPye19lGpBjkEYo0DLgiZodibuaUBODGCP5mUc6B 0hm3xL0zBbeKXjkCvHIo5rfRuiMnKd9QM6OfXZBgEB/h4XePFOBsiAoWPpkkFCfsdo/h8WFGnMSvZ pGDZRVtgI6gJGOysClz4vGI8UomLmHvMycuQup5DO+ID6A4W0IefZ3t0E74VDWbPp63AqsVRNe+Ae vkhj/jr+AUrUOq7vydgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcu6S-0005li-Qy; Tue, 10 Jul 2018 14:58:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcu6O-0005NB-KY for linux-mtd@bombadil.infradead.org; Tue, 10 Jul 2018 14:58:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:From:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=y0r7nO/OF0MS1JmVKhZGc6fWY17SoKkUZC2s6vehv+A=; b=TRpzSDb9ua94oimWy77iDj8ftm IkKRJXEByrD9cx7ItPRg4trcOt7oFqsvTSGWz4L2dukMGcPmwfwW+b15HMP6c8lXbsjv+cSIYhFdu PUolDPFOFv+urxVH8knB08qDIh5+uFM/NkchFPXgxL9/XK2AGowUEPuTg/maUIsa/jDr6P74VAZWl TRQSwcqZo5YqPq/BvuWqCypijYpjEwB0XzEcMZtCP33eqYjtXf8lVZaxfaBLrAr6yBttR8bDAEAPl YZD5Zmxsswky4SerSdMWT2eIPBWdPpPhdSN4qQzI9XlELobeO3tFJC55uSICsDzWIfYSucp0acb/s 4VpDjcVw==; Received: from mail.linuxfoundation.org ([140.211.169.12]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcu0C-00048O-5D for linux-mtd@lists.infradead.org; Tue, 10 Jul 2018 14:52:30 +0000 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7FFDCE1B; Tue, 10 Jul 2018 14:52:16 +0000 (UTC) Subject: Patch "mtd: cfi_cmdset_0002: Change erase functions to check chip good only" has been added to the 4.9-stable tree To: Joakim.Tjernlund@infinera.com, boris.brezillon@bootlin.com, boris.brezillon@free-electrons.com, chris.packham@alliedtelesis.co.nz, computersforpeace@gmail.com, cyrille.pitchen@wedev4u.fr, dwmw2@infradead.org, gregkh@linuxfoundation.org, ikegami@allied-telesis.co.jp, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, richard@nod.at From: Date: Tue, 10 Jul 2018 16:52:07 +0200 Message-ID: <1531234327174175@kroah.com> MIME-Version: 1.0 X-stable: commit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180710_155228_536523_0AFDFAC8 X-CRM114-Status: GOOD ( 18.13 ) X-Spam-Score: 0.2 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [140.211.169.12 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 2.5 SORTED_RECIPS Recipient list is sorted by address X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable-commits@vger.kernel.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This is a note to let you know that I've just added the patch titled mtd: cfi_cmdset_0002: Change erase functions to check chip good only to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mtd-cfi_cmdset_0002-change-erase-functions-to-check-chip-good-only.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From 79ca484b613041ca223f74b34608bb6f5221724b Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 30 May 2018 18:32:29 +0900 Subject: mtd: cfi_cmdset_0002: Change erase functions to check chip good only From: Tokunori Ikegami commit 79ca484b613041ca223f74b34608bb6f5221724b upstream. Currently the functions use to check both chip ready and good. But the chip ready is not enough to check the operation status. So change this to check the chip good instead of this. About the retry functions to make sure the error handling remain it. Signed-off-by: Tokunori Ikegami Reviewed-by: Joakim Tjernlund Cc: Chris Packham Cc: Brian Norris Cc: David Woodhouse Cc: Boris Brezillon Cc: Marek Vasut Cc: Richard Weinberger Cc: Cyrille Pitchen Cc: linux-mtd@lists.infradead.org Cc: stable@vger.kernel.org Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/chips/cfi_cmdset_0002.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) Patches currently in stable-queue which might be from ikegami@allied-telesis.co.jp are queue-4.9/mtd-cfi_cmdset_0002-change-erase-functions-to-retry-for-error.patch queue-4.9/mtd-cfi_cmdset_0002-change-erase-functions-to-check-chip-good-only.patch queue-4.9/mtd-cfi_cmdset_0002-change-definition-naming-to-retry-write-operation.patch --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -2292,12 +2292,13 @@ static int __xipram do_erase_chip(struct chip->erase_suspended = 0; } - if (chip_ready(map, adr)) + if (chip_good(map, adr, map_word_ff(map))) break; if (time_after(jiffies, timeo)) { printk(KERN_WARNING "MTD %s(): software timeout\n", __func__ ); + ret = -EIO; break; } @@ -2305,15 +2306,15 @@ static int __xipram do_erase_chip(struct UDELAY(map, chip, adr, 1000000/HZ); } /* Did we succeed? */ - if (!chip_good(map, adr, map_word_ff(map))) { + if (ret) { /* reset on all failures. */ map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ - if (++retry_cnt <= MAX_RETRIES) + if (++retry_cnt <= MAX_RETRIES) { + ret = 0; goto retry; - - ret = -EIO; + } } chip->state = FL_READY; @@ -2387,7 +2388,7 @@ static int __xipram do_erase_oneblock(st chip->erase_suspended = 0; } - if (chip_ready(map, adr)) { + if (chip_good(map, adr, map_word_ff(map))) { xip_enable(map, chip, adr); break; } @@ -2396,6 +2397,7 @@ static int __xipram do_erase_oneblock(st xip_enable(map, chip, adr); printk(KERN_WARNING "MTD %s(): software timeout\n", __func__ ); + ret = -EIO; break; } @@ -2403,15 +2405,15 @@ static int __xipram do_erase_oneblock(st UDELAY(map, chip, adr, 1000000/HZ); } /* Did we succeed? */ - if (!chip_good(map, adr, map_word_ff(map))) { + if (ret) { /* reset on all failures. */ map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ - if (++retry_cnt <= MAX_RETRIES) + if (++retry_cnt <= MAX_RETRIES) { + ret = 0; goto retry; - - ret = -EIO; + } } chip->state = FL_READY;