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: "gregkh@linuxfoundation.org" X-Patchwork-Id: 942066 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="B6ogtcoL"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="g474WRzn"; 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 41Q6Hp33hMz9s00 for ; Wed, 11 Jul 2018 01:56:06 +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=H7pjFvhyYdzMnRXkvh8CR6qmuhE10rSr5dpSYIHEW5A=; b=B6ogtcoL4x+c93 dFxbB4k4dN55ycZ7BKRUmchrU13Mk/n681OZ4XEP3/o04GaL4SxrKoJB9kA2Za7SjF6lDkFFm0/DI ZTM7AmEZmQX19AgN8RtM33Fp22J0FM4kamzxxktQEP6hejKN1Xqf3wcrXBKYA+YbnMZI/b1yN6Rcj 8mqmJ+xIUQI73jNWExId/glaXDihIz6fmidwyMeJS8CzpXmHlY+X901XDooejtTgzm8/5+JqjPSgK 7VsxACqKnm4kbHt4tp36s8DTZefvJt5Y5vIH8W4yYV/tLmWlOOxbEDtEhWb8tKGQjrp+5w4IHaMY5 FsLo5bYLT5A6aqTpSdTA==; 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 1fcuzi-0006ML-6G; Tue, 10 Jul 2018 15:56:02 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcuup-0002i5-KJ for linux-mtd@bombadil.infradead.org; Tue, 10 Jul 2018 15:50:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=N9/lv80tkWAwKQDDc3QOKt6bVo7VyMuqeUtakat6WJI=; b=g474WRznx/NgT/pZrPmw/i11gI PDh3kN23mcuBITTMkb3N83thhS1GJwOKyUIX+eGsiiqYhTKeQrMTTktMcaoWbL8MdQH8iHEeHgAoF GjNGG7hmjdIWywhbE6TV1FCIVkibk4U1HLjYtq9AbaA4TWiMD6NWEUM7tFVoMvqWqEzMo6brH0Lh/ KAMSe3a0uPf3Zc0KfU6cGXwMFIWWcGjyE70dyWsSlRVmCCvlnvSde39G/hUjOld4+EazoIi2J+vJz YLtX+jQ4pSJrfYVGG2fL21AOWSmO8azA/LbLBg4SNVv6AlaHpevaiDqGM6mCpA/N/WLMyl7x6uRP5 sTpE9NsQ==; Received: from mail.linuxfoundation.org ([140.211.169.12]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcu0E-00060M-A9 for linux-mtd@lists.infradead.org; Tue, 10 Jul 2018 14:52:31 +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 42CE0DD9; Tue, 10 Jul 2018 14:52:19 +0000 (UTC) Subject: Patch "mtd: cfi_cmdset_0002: Change erase functions to retry for error" 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: <153123432722025@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_105230_551972_B3C37E63 X-CRM114-Status: GOOD ( 15.92 ) X-Spam-Score: 0.2 (/) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (0.2 points) 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 2.5 SORTED_RECIPS Recipient list is sorted by address -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 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 retry for error 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-retry-for-error.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 45f75b8a919a4255f52df454f1ffdee0e42443b2 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 30 May 2018 18:32:28 +0900 Subject: mtd: cfi_cmdset_0002: Change erase functions to retry for error From: Tokunori Ikegami commit 45f75b8a919a4255f52df454f1ffdee0e42443b2 upstream. For the word write functions it is retried for error. But it is not implemented to retry for the erase functions. To make sure for the erase functions change to retry as same. This is needed to prevent the flash erase error caused only once. It was caused by the error case of chip_good() in the do_erase_oneblock(). Also it was confirmed on the MACRONIX flash device MX29GL512FHT2I-11G. But the error issue behavior is not able to reproduce at this moment. The flash controller is parallel Flash interface integrated on BCM53003. 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 @@ -2237,6 +2237,7 @@ static int __xipram do_erase_chip(struct unsigned long int adr; DECLARE_WAITQUEUE(wait, current); int ret = 0; + int retry_cnt = 0; adr = cfi->addr_unlock1; @@ -2254,6 +2255,7 @@ static int __xipram do_erase_chip(struct ENABLE_VPP(map); xip_disable(map, chip, adr); + retry: cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); @@ -2308,6 +2310,9 @@ static int __xipram do_erase_chip(struct map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ + if (++retry_cnt <= MAX_RETRIES) + goto retry; + ret = -EIO; } @@ -2327,6 +2332,7 @@ static int __xipram do_erase_oneblock(st unsigned long timeo = jiffies + HZ; DECLARE_WAITQUEUE(wait, current); int ret = 0; + int retry_cnt = 0; adr += chip->start; @@ -2344,6 +2350,7 @@ static int __xipram do_erase_oneblock(st ENABLE_VPP(map); xip_disable(map, chip, adr); + retry: cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); @@ -2401,6 +2408,9 @@ static int __xipram do_erase_oneblock(st map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ + if (++retry_cnt <= MAX_RETRIES) + goto retry; + ret = -EIO; }