Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755206AbbHYCgX (ORCPT ); Mon, 24 Aug 2015 22:36:23 -0400 Received: from mail-bl2on0145.outbound.protection.outlook.com ([65.55.169.145]:17960 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751681AbbHYCgV (ORCPT ); Mon, 24 Aug 2015 22:36:21 -0400 From: Hou Zhiqiang To: Jagan Teki CC: "linux-mtd@lists.infradead.org" , "Hu Vincent" , Brian Norris , David Woodhouse , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 3/3] mtd: spi-nor: sf: Add clear flag status register support Thread-Topic: [PATCH 3/3] mtd: spi-nor: sf: Add clear flag status register support Thread-Index: AQHQ2mVu+Ryhtelg0kmPXBqow87Pvp4TOZMAgABgXoCAAJVXIIAB3VMAgAXyaNA= Date: Tue, 25 Aug 2015 02:22:10 +0000 Message-ID: References: <1439978205-6092-1-git-send-email-jteki@openedev.com> <1439978205-6092-3-git-send-email-jteki@openedev.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=B48286@freescale.com; x-originating-ip: [123.151.195.51] x-microsoft-exchange-diagnostics: 1;CY1PR0301MB1258;5:WbAGsPkouYSefjjWybmFjD47kBbyOatMe90DuzL/esM9KRyv9a2Otpc0KkuBpgqEy40KHT8PmTpikfNALoLm72Cydy8lnxyTS55F8yMWiGTIaq4SoLCv1XgbuXTzDk5kPdROCF2WZs4Am98ie2X5FQ==;24:OrVBm8fcxL6jHE17CgKXeGHKtXD/6SUI5k40oVZE09E3Ryc7BJkS+UZnut5OD5J9h4bfXUlZQIPzoPDBADUUDKMbE5do106YpZJzabbtORg=;20:L6Gw/JnonNg7IrSkykeTBpkHj/6QkgLkv71JHrk4WG/NcmmX9hlKQQyhu0frwbdreOgkOx+q7QmLJ20rytntzg== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1258; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:CY1PR0301MB1258;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1258; x-forefront-prvs: 06793E740F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(13464003)(24454002)(189002)(199003)(86362001)(2656002)(87936001)(64706001)(33656002)(76176999)(54356999)(101416001)(66066001)(74316001)(122556002)(46102003)(50986999)(93886004)(40100003)(10400500002)(77156002)(92566002)(62966003)(5007970100001)(102836002)(2900100001)(68736005)(77096005)(5003600100002)(5004730100002)(5001860100001)(5001830100001)(15975445007)(81156007)(19580405001)(105586002)(106356001)(99286002)(5001960100002)(106116001)(189998001)(2950100001)(110136002)(97736004)(4001540100001)(19580395003)(76576001)(5002640100001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB1258;H:CY1PR0301MB0780.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Aug 2015 02:22:10.5195 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1258 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t7P2aSKC015007 Content-Length: 5460 Lines: 134 Hi Jagan, > -----Original Message----- > From: Jagan Teki [mailto:jteki@openedev.com] > Sent: 2015年8月21日 15:12 > To: Hou Zhiqiang-B48286 > Cc: linux-mtd@lists.infradead.org; Hu Mingkai-B21284; Brian Norris; David > Woodhouse; linux-kernel@vger.kernel.org > Subject: Re: [PATCH 3/3] mtd: spi-nor: sf: Add clear flag status register > support > > Hi Zhiqiang, > > On 20 August 2015 at 08:36, Hou Zhiqiang wrote: > > Hello Jagan, > > > >> -----Original Message----- > >> From: Jagan Teki [mailto:jteki@openedev.com] > >> Sent: 2015年8月20日 1:49 > >> To: Hou Zhiqiang-B48286 > >> Cc: linux-mtd@lists.infradead.org; Hu Mingkai-B21284; Brian Norris; > >> David Woodhouse; linux-kernel@vger.kernel.org > >> Subject: Re: [PATCH 3/3] mtd: spi-nor: sf: Add clear flag status > >> register support > >> > >> Hi Zhiqiang, > >> > >> On 19 August 2015 at 17:42, Hou Zhiqiang wrote: > >> > Hi Jagan, > >> > > >> >> -----Original Message----- > >> >> From: Jagan Teki [mailto:jteki@openedev.com] > >> >> Sent: 2015年8月19日 17:57 > >> >> To: linux-mtd@lists.infradead.org > >> >> Cc: linux-kernel@vger.kernel.org; Jagan Teki; Hou Zhiqiang-B48286; > >> >> Hu Mingkai-B21284; David Woodhouse; Brian Norris > >> >> Subject: [PATCH 3/3] mtd: spi-nor: sf: Add clear flag status > >> >> register support > >> >> > >> >> The clear flag status register operation was required by Micron > >> >> SPI-NOR chips, which support FSR. And if an error bit of FSR have > >> >> been set like protection, voltage, erase, and program, it must be > >> >> cleared by the clear FSR operation. > >> >> > >> >> Signed-off-by: Jagan Teki > >> >> Cc: Hou Zhiqiang > >> >> Cc: Mingkai.Hu > >> >> Cc: David Woodhouse > >> >> Cc: Brian Norris > >> >> --- > >> >> drivers/mtd/spi-nor/spi-nor.c | 35 > >> >> +++++++++++++++++++++++++++++++--- > >> - > >> >> include/linux/mtd/spi-nor.h | 9 +++++++++ > >> >> 2 files changed, 40 insertions(+), 4 deletions(-) > >> >> > >> >> diff --git a/drivers/mtd/spi-nor/spi-nor.c > >> >> b/drivers/mtd/spi-nor/spi- nor.c index f954d03..c5c472d5 100644 > >> >> --- a/drivers/mtd/spi-nor/spi-nor.c > >> >> +++ b/drivers/mtd/spi-nor/spi-nor.c > >> >> @@ -100,6 +100,28 @@ static int read_fsr(struct spi_nor *nor) } > >> >> > >> >> /* > >> >> + * Read the clear flag status register. > >> >> + * The clear flag status register operation was required by > >> >> +Micron > >> >> + * SPI-NOR chips, which support FSR. And if an error bit of FSR > >> >> + * have been set like protection, voltage, erase, and program, > >> >> + * it must be cleared by the clear FSR operation. > >> >> + * Returns zero for FSR bits cleared and negative if error > occurred. > >> >> + */ > >> >> +static int read_cfsr(struct spi_nor *nor) { > >> >> + int ret; > >> >> + u8 val; > >> >> + > >> >> + ret = nor->read_reg(nor, SPINOR_OP_RDCFSR, &val, 1); > >> > > >> > There should be a write_reg instead of read_reg. > >> > There isn’t a register named CFSR, and the command SPINOR_OP_RDCFSR > >> > is used to clear the FSR, another words reset FSR to default value. > >> > >> Yes, SPINOR_OP_RDCFSR is clear flag status register, for clearing > >> errors bits on fsr we need to read cfsr once. > >> > > > > Sorry, I'm not clear for this operation. Please correct me if I'm wrong. > > As far as I understand, this command is used to reset the FSR. Does a > > value Will be read back? And there is not the register CFSR, so I > > don't know which register will be read by SPINOR_OP_RDCFSR? > > Sorry for the confusion in previous email. > > If there is any error bits set during FSR operation, those will reset > back to original values by reading CFSR ie means the bits on flag status > register revert back to original state, so-that the flag status register > is ready for next FSR operation. > > I have defined this, SPINOR_OP_RDCFSR on the patch > > diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h > index c5a58c4..36c1681 100644 > --- a/include/linux/mtd/spi-nor.h > +++ b/include/linux/mtd/spi-nor.h > @@ -35,6 +35,7 @@ > #define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */ > #define SPINOR_OP_RDCR 0x35 /* Read configuration register */ > #define SPINOR_OP_RDFSR 0x70 /* Read flag status > register */ > +#define SPINOR_OP_RDCFSR 0x50 /* Read clear flag status > register */ > > For more information pls- refer flash datasheet[1] > > Page, 29: about fsr > Page, 41: about cfsr Upon page 41, I think, it is a CMD which is used to clear the FSR instead of a CFSR Register. This section is to expound the "CLEAR FLAG STATUS REGISTER Command", and it says execute this CMD to clear the error bits, rather than read the CFSR to clear those bits. > > [1] > https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja > &uact=8&ved=0CCIQFjABahUKEwjTwY3zzbnHAhXVj44KHdiWDVU&url=https%3A%2F%2Fww > w.micron.com%2F~%2Fmedia%2Fdocuments%2Fproducts%2Fdata-sheet%2Fnor- > flash%2Fserial- > nor%2Fn25q%2Fn25q_512mb_1ce_3v_65nm.pdf&ei=Uc3WVZPVCNWfugTYrbaoBQ&usg=AFQ > jCNEN4dLie4U9OTSbNxN-h9jyN9InDQ&sig2=vRQTvlkbgsgJw1Fy9z1K8A > Thanks! Zhiqiang ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?