From patchwork Mon Jul 2 02:50:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: IKEGAMI Tokunori X-Patchwork-Id: 937644 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=allied-telesis.co.jp Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EXINxbrY"; 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 41JsJp5M7nz9s1b for ; Mon, 2 Jul 2018 12:53:46 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=b6QUyZp5JCb3bmawzDgGiKmW3fUoyqmiuiI9lNu1GkU=; b=EXINxbrY813kOlE9PAo9XLUDjK 9bhMzYeIiRj4jgc7HGYiKF2NJN5pEwVdg9AF3BggyJncvrPhIbg34m5he+T3VDxXOmXRtG5SJBIZ9 IbvErK77htl5ERPln7UVDEJ6cCAVZFSw3aFkhq86QNyencYXpz/Pv9S0s/g3Y380Cy7PAr6EDbgYP CPhQcyzPfIfpITALrkhHJPhjocQDho17ABS5+MVqWYQDNPhi/SWxjX/EbQbDPRlJ5U6bJOFo2xFJN dG4K6uHZp7MVKdz0YclQR5wGjTO0gpOqmu9uwkgOoP3pEupmQjggP2ejADpG16DVUZaemxddXP/4j oLd2eH/g==; 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 1fZoy5-0003tL-QR; Mon, 02 Jul 2018 02:53:33 +0000 Received: from mail1.bemta23.messagelabs.com ([67.219.246.114]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZox1-00034C-6J for linux-mtd@lists.infradead.org; Mon, 02 Jul 2018 02:52:42 +0000 Received: from [67.219.246.196] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-c.us-east-1.aws.symcld.net id 6B/D4-01625-063993B5; Mon, 02 Jul 2018 02:52:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeJIrShJLcpLzFFi42KZFv5DRDd+smW 0weGNRha7m5axOzB6bF5SH8AYxZqZl5RfkcCa8f31b7aCBqmKKZ/esTQwLhXrYuTiEBKYwyjx dOZPdgjnJ6PE141ngRxODjYBU4nprxYygtgiAsYS/WdngRUxC1xnlnj6aC8LSEJYIERi+q7lz CA2i4CqxNaHH8GaeQUcJZbeOwZmSwjISxx+08QKYnMKOEncuDgXbKgQUM2Mg0+gbE2J5z3fGS HqgyXWPu5km8DIu4CRYRWjaVJRZnpGSW5iZo6uoYGBrqGhka6JrpmBXmKVbrJeabFuamJxia6 hXmJ5sV5xZW5yTopeXmrJJkZgqDAAwQ7GltmphxglOZiURHkPi5lFC/El5adUZiQWZ8QXleak Fh9ilOHgUJLgXT/JMlpIsCg1PbUiLTMHGLQwaQkOHiURXi2QNG9xQWJucWY6ROoUoy7Hn/dTJ zELseTl56VKifMeBykSACnKKM2DGwGLoEuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5j0FMo UnM68EbtMroCOYgI6oPm4KckRJIkJKqoExy3vpDdUJBsYHvydazss4odfxstf7revZYqu/eXN nWWhsNplu8fjPdv8/Jl43lb5s/9Lxhu/SBP3kv8U6dqeWSj9e8k3GKPX+BKf478vEl68TCPp3 OOz3xLNvJZazqywKr1x+7dItuTMMn+f9vFKz9nxvcPL7iP7C/oYvVz0KTRvKJt6d1qNUp8RSn JFoqMVcVJwIAIw/kd+bAgAA X-Env-Sender: ikegami@allied-telesis.co.jp X-Msg-Ref: server-27.tower-404.messagelabs.com!1530499934!537344!1 X-Originating-IP: [150.87.248.20] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.9.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 596 invoked from network); 2 Jul 2018 02:52:15 -0000 Received: from abricot-inet.allied-telesis.co.jp (HELO TKY-DS01.at.lc) (150.87.248.20) by server-27.tower-404.messagelabs.com with SMTP; 2 Jul 2018 02:52:15 -0000 Received: from swim-manx.rd.allied-telesis.co.jp ([150.87.21.50]) by TKY-DS01.at.lc with Microsoft SMTPSVC(8.0.9200.16384); Mon, 2 Jul 2018 11:52:14 +0900 Received: from ikegami-pc.rd.allied-telesis.co.jp by swim-manx.rd.allied-telesis.co.jp (AlliedTelesis SMTPRS 1.3 pl 1 ++E6B86F8C687C6288D9B5559052954DC9) with ESMTP id ; Mon, 2 Jul 2018 11:52:14 +0900 From: Tokunori Ikegami To: Greg Kroah-Hartman Subject: [PATCH 3/4] mtd: cfi_cmdset_0002: Change erase functions to retry for error Date: Mon, 2 Jul 2018 11:50:44 +0900 Message-Id: <20180702025045.29896-4-ikegami@allied-telesis.co.jp> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180702025045.29896-1-ikegami@allied-telesis.co.jp> References: <20180702025045.29896-1-ikegami@allied-telesis.co.jp> X-OriginalArrivalTime: 02 Jul 2018 02:52:14.0308 (UTC) FILETIME=[AE604240:01D411AF] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180701_195227_715635_42B58690 X-CRM114-Status: GOOD ( 18.10 ) X-Spam-Score: 1.7 (+) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (1.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 1.7 URIBL_BLACK Contains an URL listed in the URIBL blacklist [URIs: wedev4u.fr] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [67.219.246.114 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [67.219.246.114 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender 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: Boris Brezillon , Boris Brezillon , Tokunori Ikegami , Richard Weinberger , stable@vger.kernel.org, Marek Vasut , Chris Packham , linux-mtd@lists.infradead.org, Cyrille Pitchen , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- drivers/mtd/chips/cfi_cmdset_0002.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 29913eeac5fb..13ce64362db8 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -2241,6 +2241,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) unsigned long int adr; DECLARE_WAITQUEUE(wait, current); int ret = 0; + int retry_cnt = 0; adr = cfi->addr_unlock1; @@ -2258,6 +2259,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) 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); @@ -2312,6 +2314,9 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ + if (++retry_cnt <= MAX_RETRIES) + goto retry; + ret = -EIO; } @@ -2331,6 +2336,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long timeo = jiffies + HZ; DECLARE_WAITQUEUE(wait, current); int ret = 0; + int retry_cnt = 0; adr += chip->start; @@ -2348,6 +2354,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, 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); @@ -2405,6 +2412,9 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, map_write( map, CMD(0xF0), chip->start ); /* FIXME - should have reset delay before continuing */ + if (++retry_cnt <= MAX_RETRIES) + goto retry; + ret = -EIO; }