Received: by 10.223.164.202 with SMTP id h10csp659314wrb; Thu, 30 Nov 2017 05:32:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMZtXcPxswOERj4Mjf+i0zGBXLf1gL6OJa/BtYiecvFmpkLxNoE8bD5AwsSUQuGkeARWGi6O X-Received: by 10.84.168.227 with SMTP id f90mr2617882plb.320.1512048758085; Thu, 30 Nov 2017 05:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512048758; cv=none; d=google.com; s=arc-20160816; b=aD6FSx/gevGMPkAWJExjGPkxcVoJ6oLOT3+9BUtyCRsevFtXvrwxcdLYVOvdljS0xF dgSzqaic98X1vfySM5khspFrwCAfQCTbCEbs6IROo7p3DvO4dIRbXuLQ8lfqvy3pI0PP ySyZKJ5IObrZ6Oz1fBItZd/2eLZ1ily/rNbETGLlCG4slipCfZWfaz6DX3sguZ4dyT6G jxGHcoVyqbBuqTXdprLkgz6evVG6FUzzMHG8R/aAzUTfsMGrfwHq/N0c82hDXegr0aEH cGVaPYbrn3GnWvIx7AcO96sg9uwbIn4g4d5UOfTiAJXEvPZmiopzvMwGM5cj8lmVNWzw gRmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=MdXvxUH01cYkuxKBWi4yihXe/3WQB/bss5yqYxRuMDQ=; b=HbHQwyiKNjhFwWhoGLrPHleDm6A86fuuHMF6ZLM227U6EOGDZ4kHxpWx4kf71+j+Iz 2g0hFH6CfLpJGuUzf/85Lh0iJOFWnUY28NPuh+WJ2B82tDzIh8J5c8Darbx77On0xuNR jZdNyTMiiE/tS6NSqgO6hIzrDoTeE4NF20vmPZWNAVPAzNpzp8Z4qQhc2KdVMCs/JCfE uyNulwOVzzsIyIxrZbPPskypYce+Ug+Xg3uTrvcopJGumIYh1hvD3e4/tRwFMMkyR5uW gx1Oubl5A3c7zqrY/5KWH9jqXz2473P4Uj3ZYu6qjr7DkuoYDiT6x9tVsg/SLARi9q99 YeVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si3103931plk.773.2017.11.30.05.32.24; Thu, 30 Nov 2017 05:32:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752925AbdK3NbV (ORCPT + 99 others); Thu, 30 Nov 2017 08:31:21 -0500 Received: from smtp3-g21.free.fr ([212.27.42.3]:17696 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752500AbdK3NbU (ORCPT ); Thu, 30 Nov 2017 08:31:20 -0500 Received: from mountainer.wedev4u.int (unknown [82.232.94.13]) by smtp3-g21.free.fr (Postfix) with ESMTP id E658B13F81D; Thu, 30 Nov 2017 14:31:17 +0100 (CET) Subject: Re: [PATCH V1] drivers:mtd:spi-nor:checkup FSR error bits To: "Bean Huo (beanhuo)" , "marek.vasut@gmail.com" Cc: "linux-mtd@lists.infradead.org" , "computersforpeace@gmail.com" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" References: <825c7a1bb1034369b9d592a7b358030c@SIWEX5A.sing.micron.com> From: Cyrille Pitchen Message-ID: <13355c72-6dd2-6431-2d0b-9b2975a8c1a4@wedev4u.fr> Date: Thu, 30 Nov 2017 14:31:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <825c7a1bb1034369b9d592a7b358030c@SIWEX5A.sing.micron.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bean, Le 11/11/2017 à 21:49, Bean Huo (beanhuo) a écrit : > For the Micron SPI NOR, when the erase/program operation fails, especially, To be verified but I think you'd rather remove "the" words in this case: "For Micron SPI NOR memories, when erase/program operation fails, especially ..." Maybe no comma after "especially". > for the failure results from intending to modify protected space, spi-nor > upper layers still get the return which shows the operation succeeds. > this because spi_nor_fsr_ready() only uses bit.7 to device whether ready. "This": missing capital letter and maybe a verb too. > For the most cases, even the error of erase/program occurs, SPI NOR device > is still ready. The device ready and the error are two different cases. I don't really understand what you mean here. > This patch is to fixup this issue and adding FSR (flag status register) This patch fixes the issue by checking relevant bits in the FSR. > error bits checkup. > The FSR(flag status register) is a powerful tool to investigate the staus "The FSR (flag status register)": please insert a space ' '. s/staus/status/ > of device,checking information regarding what is actually doing the memory "of device, checking": missing space > and detecting possible error conditions. > Globally, I think you need to reword your commit message. IMHO, it is not clear though I think I've mostly understood what you meant reading the actual source code. > Signed-off-by: beanhuo > --- > drivers/mtd/spi-nor/spi-nor.c | 19 +++++++++++++++++-- > include/linux/mtd/spi-nor.h | 6 +++++- > 2 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > index bc266f7..200e814 100644 > --- a/drivers/mtd/spi-nor/spi-nor.c > +++ b/drivers/mtd/spi-nor/spi-nor.c > @@ -330,8 +330,23 @@ static inline int spi_nor_fsr_ready(struct spi_nor *nor) > int fsr = read_fsr(nor); > if (fsr < 0) > return fsr; > - else > - return fsr & FSR_READY; > + > + if (fsr & (FSR_E_ERR | FSR_P_ERR)) { > + if (fsr & FSR_E_ERR) > + dev_err(nor->dev, "Erase operation failed.\n"); > + else > + dev_err(nor->dev, "Program operation failed.\n"); > + > + if (fsr & FSR_PT_ERR) > + dev_err(nor->dev, > + "The operation has attempted to modify the protected" A space ' ' is missing after "protected". Also please verify next version passes the checkpatch test because this version doesn't. I think you should check the verb tense consistency: [...] operation failed. The operation attempted [...] Also maybe you should write "a protected sector" or "some protected sector": "the protected sector" sounds like there is only one protected sector. > + "sector or the locked OPT space.\n"); You meant OTP (One Time Programmable), didn't you ? s/OPT/OTP/ > + > + nor->write_reg(nor, SPINOR_OP_CLFSR, NULL, 0); > + return -EIO; > + } > + > + return fsr & FSR_READY; > } > > static int spi_nor_ready(struct spi_nor *nor) > diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h > index d0c66a0..46b5608 100644 > --- a/include/linux/mtd/spi-nor.h > +++ b/include/linux/mtd/spi-nor.h > @@ -61,6 +61,7 @@ > #define SPINOR_OP_RDSFDP 0x5a /* Read SFDP */ > #define SPINOR_OP_RDCR 0x35 /* Read configuration register */ > #define SPINOR_OP_RDFSR 0x70 /* Read flag status register */ > +#define SPINOR_OP_CLFSR 0x50 /* Clear flag status register */ > > /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ > #define SPINOR_OP_READ_4B 0x13 /* Read data bytes (low frequency) */ > @@ -130,7 +131,10 @@ > #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ > > /* Flag Status Register bits */ > -#define FSR_READY BIT(7) > +#define FSR_READY BIT(7) /* Device status, 0 = Busy,1 = Ready */ You may insert a space ' ' between "Busy," and "1 = " Best regards, Cyrille > +#define FSR_E_ERR BIT(5) /* Erase operation status */ > +#define FSR_P_ERR BIT(4) /* Program operation status */ > +#define FSR_PT_ERR BIT(1) /* Protection error bit */ > > /* Configuration Register bits. */ > #define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ > From 1585218857648082316@xxx Mon Nov 27 11:35:10 +0000 2017 X-GM-THRID: 1583804295384667632 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread