Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp140256lqo; Thu, 16 May 2024 01:33:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXs43ZJVr0DR/eefqdZn/aK3Zq8g2bRiZPSrw7Yv5K58inBxLgcdiHIWldmLWcRiUhsBspZwqqT0Mjsz4zGuDDoEmN+We13PK3N74BYyA== X-Google-Smtp-Source: AGHT+IEaLHGeijERNLkt+CSK4gi4SMPVrEVKJhJ80dMIKN3JDynFAmOxEc4+5fb4ClF8NntwFTgI X-Received: by 2002:a05:6808:15a8:b0:3c9:bdfb:d358 with SMTP id 5614622812f47-3c9bdfbd461mr4915875b6e.26.1715848420759; Thu, 16 May 2024 01:33:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715848420; cv=pass; d=google.com; s=arc-20160816; b=i/jZMiftpcxL1N7vNj0D/0l19jN7D3g6GEaxytPB6aF2KoZq4Q5pIN8u520sT/ZGXM XPg87BZA0hbqF2sB/D/R8B+1kHYvDJJPujV9SDq2YYJEZ1PzjP+bPH1ht3+4L8o9ppTO yp6exkTQ1d2Jq98QsBVjk4/jkj4LXmcR7T80ImQE5x2u3eVGiIR8o6eE5sSA5mw15QDn N2ayDNam5kJYcAH59pnf4GgA2dsFw4GjaJt5SrEK/fOFXWDjwx+l4uH1ZlJi5VI6Xl1X RReJN1sscuDa7lRfvIMqPjLNugecOSKxjpkO603Qg5nZvpFYd35mGev070EukYUw8FO4 OLSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=OlCEWWB6cFyweBKAuWpYX1M2Skf3YxIZvcOY5o0N+rQ=; fh=RsD2Wu/PkL4LmNZy/9z1j6mcj+O7Tm7PbiyQTKBxpww=; b=J9LdJel0e84OTvyMXrSp64DelEY6iGYJk29R70qTLs9Dwjc9Bg5N8saALSZ47Hxwrl i3rgkZ/8gljezgCM6bwUOM/wlyi3Jsra9FdtXYRc8LVw5xu+JjC89w9E66RGbPRgLef0 wsOAmAhoOLJHJIjky43Ei+BA6gYDjFc0/ZpkDlr4v4lroZIEhMZdE7Y6vH1o+OFxuhZO 7m3K0s6K3qmCjxU1s48HN14GL2sEl1PtoXZg9SyF4wgfimCUTPAFame4bGM+Jr+2nFSt HxfVOZZ82naMw9GZdWt33fHPLxuG5iB4hI8YCIX6LDnuSamc1TDRsVg5C4VwLhX4SyFl VRKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pboRvf7p; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-180773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf38e897si1514055885a.747.2024.05.16.01.33.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pboRvf7p; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-180773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 61D6F1C20DFD for ; Thu, 16 May 2024 08:33:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 930051411D8; Thu, 16 May 2024 08:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pboRvf7p" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6888FEAD7 for ; Thu, 16 May 2024 08:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848414; cv=none; b=Rv8FliWbJ4so0ci3Yx8P4qxkwDSR5TeDeXNzC4V2vmZeiiTdhcy/es1TiuJ5fTpHrUo7MBUuaHB6ZXAhUBUJSyFuHfJeJVqRb5unJmwy8F39/HSzPIGQQYYXqb1UkhfKVDOa35fLy3YRdCydsNU/m3PnYBEYK2A2q068Zq5aGiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848414; c=relaxed/simple; bh=ODLQOu/zyz06Cszyocvh1VE4KNZojV2wsikA0IFDyTE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H4FFwicR8naILVTMsKx1aCyFilvaHoKWULNt37g1M34woKTUI2lVHr89N6AHMDwU4d0a9bBWtDZ0cA8kDil8ADgcPD/5t7QyS9FG1nW9PiE612i7VtRbl7djFsjtNuNmgXJ0y2FMM6We9O0ZOmA3BFVh/80JaQph9bqUbtAwGps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pboRvf7p; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 67DA62000A; Thu, 16 May 2024 08:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715848405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OlCEWWB6cFyweBKAuWpYX1M2Skf3YxIZvcOY5o0N+rQ=; b=pboRvf7pkvdGdjXae92hHGo9tJTRMHWN9xy3c+Cz2JPV4eki+saN8Qs7fe92e4GhLWe7Ml s8DFAd3QtBYQC7V3WKAYSdHABuyXqD68XCtX02GulT0t2g4oIWL2JYbCrH7TjsVKALc9SE Lcdk3eJBSuVSAqFJmM1T+quTxBEJxBE8VfZG0T+gKhIWFbPkSnfwIZJx739gBV48xZd1oe YxrJPOjsgSrjncNRiXYS18WHiZeRCABkqz/Xso74kb3RJnDQg0GBQ1ZFKmHGbdymtksFDN 4j5k/15QSBUvOWgKsWN7H9t/cHslvk0WStO4TROagBjHIB/ayPHf+ygcSopprA== Date: Thu, 16 May 2024 10:33:21 +0200 From: Miquel Raynal To: Sascha Hauer Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 3/3] mtd: nand: mxc_nand: support software ECC Message-ID: <20240516103321.25b49576@xps-13> In-Reply-To: References: <20240514-mtd-nand-mxc-nand-exec-op-v3-0-3e6f45fd3d82@pengutronix.de> <20240514-mtd-nand-mxc-nand-exec-op-v3-3-3e6f45fd3d82@pengutronix.de> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com Hi Sascha, > > + /* > > + * During a page write the i.MX NAND controller will read 512b from > > + * main_area0 SRAM, then oob_per_subpage bytes from spare0 SRAM, then > > + * 512b from main_area1 SRAM and so on until the full page is written. > > + * For software ECC we want to have a 1:1 mapping between the raw page > > + * data on the NAND chip and the view of the NAND core. This is > > + * necessary to make the NAND_CMD_RNDOUT read the data it expects. > > + * To accomplish this we have to write the data in the order the cont= roller > > + * reads it. This is reversed in copy_page_from_sram() below. > > + */ > > + for (i =3D 0; i < no_subpages; i++) { > > + memcpy16_toio(host->main_area0 + i * 512, buf, 512); > > + buf +=3D 512; > > + > > + memcpy16_toio(host->spare0 + i * host->devtype_data->spare_len, buf, > > + oob_per_subpage); > > + buf +=3D oob_per_subpage; > > + } > > +} =20 >=20 > I noticed the nandbiterr test won't work with this. It needs the following > fixup. The problem is that the core wants to write only user data > without OOB, so we have to make sure the remaining SRAM is filled up > with 0xff. Yes. I looked rapidly at the diff, looks ok. Thanks, Miqu=C3=A8l