Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3655116pxf; Mon, 22 Mar 2021 11:34:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgIQRarfYeusCJRZSqHgXCbMSqaGITdOGAdHu73vNpLUJuTOBaG8c7ZSXlt+gShCtTsEcG X-Received: by 2002:a50:ee10:: with SMTP id g16mr929827eds.215.1616438048190; Mon, 22 Mar 2021 11:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616438048; cv=none; d=google.com; s=arc-20160816; b=yZnaRSp4hjFMxwQcNvoUYcaVCRMi/YoFcnFPJdog0oweYn4zoHOdu+qIktyCr+XkfJ Q3w9NcS5UzhELo5gmKg8IGAc0TGw776BbdCjH5Xe4+iGACPcLIPowVxBD1zsKTefc4XR v5+79Wr6EkQF35Vp5i9cVmssyHnWJ1zDYoW8y6HhoUXYmJlHaiD6fQpoqF+w7OluDbw0 LlEq3jgN911eOzZBfsbJDPi1gmbkAKIjxJ56LjaRpYmPstX5Hz+O1w8tq86+1IP+gZ8h Xzm4otDfXN9h+GkI/Gou1ROkPnSeNne3VSf3v5Ey5EzVVcYBnbeG+oG1VIG2BlNpfrG3 V5oQ== 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=D8UQsYu1xiR2Q45ms8EYTwP1SwWrIkEIkpkIJfr3SjQ=; b=AN1v3DfLHXH8S3zyKaIiJ9XMnp8uMm2ykEKNAdSITsN3a3k2S4TaP0W0LCV4GOZYRG +xoEGrX7oq1SG2wSLJqkxy7aQc0kG0HV2a/WOL+i7QDYTh7jqaHIDgeRlC7OUuzxgyN1 /ZPRKGlYVM4buqMIpLmr3j5U9CHqGZavk3R1GX47aWfxMSDHjtUsYhK4FLpQwgv/Figx IcHuCnNyrzez9+QtBRnvoXS7Rq8cAfF1Jqf7ENFV+Pr7wyHliw+dIR+TVZGxGCakWfWf VVx6doTCVWB13XDTeNmoooOMnx9+10zTJBSASFFFEBZJZHvJNZSc52TQHXXsLVutoMOV I0Vw== 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 b8si12392551edz.99.2021.03.22.11.33.45; Mon, 22 Mar 2021 11:34:08 -0700 (PDT) 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 S229840AbhCVSco convert rfc822-to-8bit (ORCPT + 99 others); Mon, 22 Mar 2021 14:32:44 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:50021 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbhCVScR (ORCPT ); Mon, 22 Mar 2021 14:32:17 -0400 X-Originating-IP: 90.89.138.59 Received: from xps13 (lfbn-tou-1-1325-59.w90-89.abo.wanadoo.fr [90.89.138.59]) (Authenticated sender: miquel.raynal@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 52ABA60004; Mon, 22 Mar 2021 18:32:13 +0000 (UTC) Date: Mon, 22 Mar 2021 19:32:13 +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: <20210322193213.18520b9a@xps13> In-Reply-To: References: <20210213095724.3411058-1-daniel@0x0f.com> <20210215112409.1a755bf0@xps13> <20210215121653.4edd86c4@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (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, 22 Mar 2021 21:44:40 +0900: > Hi Miquel, > > Sorry for the resend. Gmail randomly switched to HTML email so the > original version seems to have bounced. > > On Mon, 15 Feb 2021 at 20:16, Miquel Raynal wrote: > > > "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. > > Sorry I didn't follow up sooner on this. I needed to order another of > this flash chip to test with as I couldn't destroy the data on the one > I have. > > Anyhow: > > Erased the page with flash erase (I'm forcing it to erase bad blocks > here as I mess up the marker, I have a hack to allow erasing bad > blocks..) > Everything is 0xFF for that page. > > # flash_erase -N /dev/mtd1 0 1 > Erasing 128 Kibyte @ 0 -- 100 % complete > # nanddump --bb=dumpbad -n -l2048 -o -c -s 0x0 /dev/mtd1 > Block size 131072, page size 2048, OOB size 64 > Dumping data starting at 0x00000000 and ending at 0x00000800... > 0x00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > .... > 0x000007f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > > Write zeros into the page and OOB. > Get all zeros back including the OOB. > > # nandwrite -o /dev/mtd1 /dev/zero > Writing data to block 0 at offset 0x0 > Bad block at 0, 1 block(s) will be skipped > Writing data to block 1 at offset 0x20000 > # nandwrite -N -o /dev/mtd1 /dev/zero > Writing data to block 0 at offset 0x0 > # nanddump --bb=dumpbad -n -l2048 -o -c -s 0x0 /dev/mtd1 > Block size 131072, page size 2048, OOB size 64 > Dumping data starting at 0x00000000 and ending at 0x00000800... > 0x00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > ... > 0x000007f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > |................| > > Erase the page again and writing random junk into it. > Seeing random junk everywhere including the OOB. > > # flash_erase -N /dev/mtd1 0 1 > Erasing 128 Kibyte @ 0 -- 100 % complete > # nandwrite -N -o /dev/mtd1 /dev/urandom > Writing data to [ 230.506260] random: nandwrite: uninitialized > urandom read (2048 bytes read) > block 0 at offse[ 230.514705] random: nandwrite: uninitialized > urandom read (64 bytes read) > t 0x0 > # nanddump --bb=dumpbad -n -l2048 -o -c -s 0x0 /dev/mtd1 > Block size 131072, page size 2048, OOB size 64 > Dumping data starting at 0x00000000 and ending at 0x00000800... > 0x00000000: 5e 24 bd 5f d9 c6 ce c5 b1 85 52 4d 27 94 c9 98 |^$._......RM'...| > ... > 0x000007f0: fa 9f 7f 7d ce 99 33 88 d6 9f 99 7d 84 e7 0c 4d |...}..3....}...M| > OOB Data: b1 81 07 6a 8d 47 8b ed 89 88 ac 62 e8 ae 48 54 |...j.G.....b..HT| > OOB Data: 7d b2 ea 73 f3 29 ba 65 e6 45 cb 8b 1a c6 5b dc |}..s.).e.E....[.| > OOB Data: b2 2e 77 56 e0 e1 04 59 86 31 7a e5 bd 43 f9 48 |..wV...Y.1z..C.H| > OOB Data: 52 05 b2 f1 65 64 59 22 79 50 ec 89 55 6b 6e 23 |R...edY"yP..Ukn#| > > I think this shows that the datasheet is right in that the complete 64 > bytes of "spare area" is usable. > I have no idea where it puts the ECC though. :) Argh, I don't like when hardware tries to be smart. Ok then let's declare no ECC bytes in the OOB layout, I guess it's the best thing to do... Thanks for checking btw! I don't recall the state of the patch which triggered this discussion, so I guess it's a good time to respin. Cheers, Miquèl