Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4862461pxb; Mon, 15 Feb 2021 03:20:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJywRoaIWX1IXToAwbWR+X3Lmih9kISqYL9jdHAZ/4ZGovQHCh8Ri2m434UqSnfB1D/Zjwj6 X-Received: by 2002:a17:906:296a:: with SMTP id x10mr14905353ejd.240.1613388027664; Mon, 15 Feb 2021 03:20:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613388027; cv=none; d=google.com; s=arc-20160816; b=t/Xm9hT6pw5kQ1gGu5IX9sxCGWWcRxaxZ3mC3BVr8RRbDurx5Pbq5B24c+nm7ccPGU n/BNz0XoouAqF9xyGnv8OOQTU52HVCKwpjoxSkTGvybUbhWVgNNl7eRfNCvY8TIcfnx0 hnUuzxHEDEj6GAesNP6bfAO1Uvsf7KYuA+EVylvFFploS8bu5gBgyW3tjRZR+P+iC4a3 XD6wLBdju1FInHLIJh/hiuFxWzxf2AslAfCr/dLbI8ulCzgqWaiArWP42uHwIca0qff+ TBvNmM7AhgkJ1o8hFcNsEoOFl2fz3dD/tnvBnq19gq8hTHF/9ceEgcUIyHKPSiK2A0qq T0pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=e+lD2xxbTgta4AmUyG1bJBTIc9gXvUyEKWodBI4ASts=; b=fu7bcVd+8PIoLXWDf1KhWrNP7ZqL2T+5p6wlxW5hRBKlKH5n3uAwGsb8EEBOAD5BYL yIbLE5O6vruk36GGpxlfb+XBrLCILH9ar2rGnLIdV8x6/vHrYcoWMgN04xrl03LH5Qx+ H98SvmCH6zJZ406o/3QWvS4WuwRwNr07Sfb8CV9kFGA1LOA4jGCw4bsVZ+EEUitzrBsn Byr26ql1Ub/N59bsjqz97iV84jgRsLPeySv8TAQUOQYC286Sr4YOGHbj4TI/ZdjTxFhm sukR8hdqSMdz/y9G5zNwV7WpZZprQU9+NWoFevIAJUC9og0PZIkth+dfFd5JxLKBB3+Y Ga6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t30si12128713edc.150.2021.02.15.03.20.04; Mon, 15 Feb 2021 03:20:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbhBOLRj convert rfc822-to-8bit (ORCPT + 99 others); Mon, 15 Feb 2021 06:17:39 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:40755 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbhBOLRi (ORCPT ); Mon, 15 Feb 2021 06:17:38 -0500 X-Originating-IP: 92.184.108.178 Received: from xps13 (pop.92-184-108-178.mobile.abo.orange.fr [92.184.108.178]) (Authenticated sender: miquel.raynal@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 17D241C000C; Mon, 15 Feb 2021 11:16:54 +0000 (UTC) Date: Mon, 15 Feb 2021 12:16:53 +0100 From: Miquel Raynal To: Daniel Palmer Cc: linux-mtd@lists.infradead.org, Linux Kernel Mailing List Subject: Re: [PATCH v2] mtd: spinand: add support for Foresee FS35ND01G-S1Y2 Message-ID: <20210215121653.4edd86c4@xps13> In-Reply-To: References: <20210213095724.3411058-1-daniel@0x0f.com> <20210215112409.1a755bf0@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, Daniel Palmer wrote on Mon, 15 Feb 2021 19:53:13 +0900: > Hi Miquel, > > On Mon, 15 Feb 2021 at 19:24, Miquel Raynal wrote: > > > > Can you please add a changelog here when you send a new version of a > > patch? > > Sorry, I was going to add a cover letter but elsewhere got told that > one isn't needed for a single patch.. A cover letter is useful when there are many patches, or when there is some context that is important to remember. But a changelog should always be added when you change something between two versions. And the changelog can be located below the three dashes ("---") without being part of the final commit message, it does not need to be in a separate cover letter. > Basically I changed FS35ND01G to FS35ND01G-S1Y2 as that's the proper > part number for the chip I have and there seem to be a few variations > of this. > Aside from that I fixed up the hex numbers to be uppercase and added > the oob layout callbacks. > > > > +static int fs35nd01g_s1y2_ooblayout_free(struct mtd_info *mtd, int section, > > > + struct mtd_oob_region *region) > > > +{ > > > + if (section > 3) > > > + return -ERANGE; > > > + > > > + /* > > > + * No ECC data is stored in the accessible OOB so the full 16 bytes > > > + * of each spare region is available to the user. Apparently also > > > + * covered by the internal ECC. > > > > How is this even possible? ECC must be stored somewhere, maybe it is > > not possible to retrieve it but I guess you cannot use the 32 bytes of > > OOB for user data. Can you please verify that? > > This worried me too as I could not find the OOB layout anywhere. > They simply list there being 4 512 byte main areas and then 4 16 byte > spare areas. The only other note is that the first byte of spare0 is > used for the bad block marker. > > I contacted Longsys but they didn't get back to me. > So what I did here was I started googling strings within the datasheet > to find other chips that are probably the same IP inside and I found > the FM25G01. > It's datasheet shares a lot of the same text and the flash layout > diagrams etc are the same. > It has the same table for the flash layout. 4 512 byte areas and 4 16 > byte spare areas. It has the same note for the bad block marker and > then one additional note: > > "2. Spare area 800H to 83FH is all available for user. > ECC parity codes are programmed in > additional space and not user accessible." > > It would seem that the pages are actually bigger than 2K + 64 or there > is some other place they keep the ECC. > Or both datasheets are lying. Somewhere else in the datasheets it says > that writes to the ECC area will be ignored but that doesn't make a > lot of sense if the ECC area isn't user accessible in the first place. > > I didn't think about it at the time but I can take a dump of the OOB > area of my FS35ND01G-S1Y2 to confirm it's all 0xff except for any > factory marked bad blocks. I see. Can you please try the following: nandwrite -o /dev/mtdx /dev/zero nanddump -ol1 /dev/mtdx If the entire area is effectively free to be used, you should see 0's everywhere. Otherwise you should have ff's somewhere. Thanks, Miquèl