Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp290015rdb; Thu, 25 Jan 2024 15:57:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHm3naalDKxGqiMC6yX8fd6UTMgTbXaH2Tb8sDhkf3qRvxDYSfi3qa6Ib5oHpY14nSSxppq X-Received: by 2002:a17:903:1d0:b0:1d7:7d43:a4cf with SMTP id e16-20020a17090301d000b001d77d43a4cfmr1039375plh.106.1706227054898; Thu, 25 Jan 2024 15:57:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706227054; cv=pass; d=google.com; s=arc-20160816; b=tp5zTO2SDDnJ7zuJNhYfOsne5v2cJ2ch9FZ/wymyfbfyqs+SI4F99IthhWPxg+cCgr i66MvEeF1YluEn82ajSv894lXH6s4A0AqGY4SaH4QYkOQDAV4XMoIB3+W2VQ7Wqs4VoS fDSCilrdOPLHZCxZZO5qXgSQjiF0T+Spp1zoY3LXlKRn/m7AE1Q4KrxDy7Pk4SPnsvmi 5QMVypxwJs7Yz9ggYhXYRtNFIpAo1KXjw6rCi8K44cgmKB7KUpkpTBnmN4jWcCEryrmE VkPBc710zp3Iw+2sHGcH4Ay+H5QKWYWDOHI6fHQJzKjgZncS4C/LNkXMbXKiLo28MVIM bXjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=hyIWFQ1vFWoo45M1BlWLEeXRVeP9Nt7FD+B+f6FiY+w=; fh=QaV8auTA6WjPKAFix3ws6UyE1Tl3/hl2yMqsO6GnSxc=; b=E/db6iCWcZB0pkPc0I//jVj6ksCYXcdI+3ZDICGTaJvMLz8WuaM98yksfCQkDeSX7A Rrm+Jd9Dg2bw2BJDTYo+qmNuJI/muznViIBEyLHDp6DYeF+3eM877o5YucFACzmMfEv8 qKX7CFFHhbtcQj39st4qWkTcwSXATRkdlz/bB45Inn+cc20vXb4JKGm6pHgRsG6xzxnv BpDOvXdB/aytHvDkYmznDenz8i9MYTv1sgLouNhTo1ts3dr6u0F7p/2cb6IRc2GXCL7S ahSdbF27tLqCcRZ0aifARY9NybF7pFd4IcaFPx2XWxaHBgGXFnPA3b4B9UATLp4FXMu2 KluA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BrFkc3Ux; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-39210-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b2-20020a170902a9c200b001d75054db45si96225plr.98.2024.01.25.15.57.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 15:57:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39210-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BrFkc3Ux; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-39210-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 15FAC2956E6 for ; Thu, 25 Jan 2024 19:48:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E7541353F5; Thu, 25 Jan 2024 19:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="BrFkc3Ux" Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C69A963407 for ; Thu, 25 Jan 2024 19:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706212080; cv=none; b=qxea6OdbnZejdFB2/v2WqoUccQDFBXimQqE64hxudnn8khnIO3EPQ8lkAAMVwwKvBu30IR2+0N5H9i5ecz/xniM+DEgo8GGfOcc928opvlV/1kCbpfFkisreeQ+rQoY9OZqzYPKDJKI0LRRH8k3HalO7yweYbmrDRjNgCebhaew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706212080; c=relaxed/simple; bh=9bbfXQdHeX85Eu9CetucjpRjjTfXD9PsAZtUPaED0GE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KCUZRx1XfOzVxfKbJWKPP4sK5Llhh1M2Rke6NBrv2gsuxo6LiIxL34GOoquBG0446xfEBygScGV+xN2ZHP6QagS9+D803dHbsYfvrlvGiy7BQ9cWa8CYfQSmhvoQTtyl3AnuJZYi0u84APoX4c4iZRS/aYlbbjuq4oEv8+Pd0/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=BrFkc3Ux; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6dddb927d02so4209918a34.2 for ; Thu, 25 Jan 2024 11:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1706212077; x=1706816877; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hyIWFQ1vFWoo45M1BlWLEeXRVeP9Nt7FD+B+f6FiY+w=; b=BrFkc3UxC0+vEyeUqbL3ItUFfEKVP07R+fhogoYwnmfvqIk9DecZzdVyV6drx7WEZ6 +Re7kCx033wYNJanapQVMCGYi9rjyOfn6YqHPnHsrFj7QyKky2vOJqKfiDMHrWLDFzlW tqE52AMOjwwVzOtkPhAvTaloo3RjTzHYVB2aw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706212077; x=1706816877; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hyIWFQ1vFWoo45M1BlWLEeXRVeP9Nt7FD+B+f6FiY+w=; b=QbH6JoieKZ4dw4ZsMYf5M+4QtIu0cts7PqHl4f15qSPj0JLyJVbYTCXl1qza54A96r cYLLfGPJD8yITqRxCZWxDzCX+U68wQJE+AS4J1+Oa0gQGrtVxfBDz7vS6p5fJt5Gonw2 V0UjPMm11VpHuef6onMoJuH1ozNjlC7mmpWd/cwy4bUNyOakTds1VpnISjnckb64cz8X GjRq4M0HP2Y96WtmwDQoaYwKJESqPxp5KH1jCxhTGPfSjik3RZevFYkVJ0I2SsoYx0Hi lNMMCm5iWKFb2x/5vWwzmTywe7O7OjVWZZ3pr2k0kjImFPVohfJL8NVIjXrFwaS/3svW 9rFA== X-Gm-Message-State: AOJu0YxCRkYztNnmZADSpN5zLhJ239sW3oxyPAdVVwWLXOqx32o47/DG xyCIGkiFCKa5xDonmpd1lAvt7e5c2M/4pO+20rv0HwGxE0+w7c7zr4wAOQQfeXIB7qKq5fj/pMP 9UVGqkAz9IP6SBIHTqYBH591gLOjAxQJnR9s6 X-Received: by 2002:a9d:7495:0:b0:6db:fa81:564a with SMTP id t21-20020a9d7495000000b006dbfa81564amr488303otk.3.1706212076800; Thu, 25 Jan 2024 11:47:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240124030458.98408-1-dregan@broadcom.com> <20240124030458.98408-11-dregan@broadcom.com> <20240124184027.712b1e47@xps-13> In-Reply-To: <20240124184027.712b1e47@xps-13> From: David Regan Date: Thu, 25 Jan 2024 11:47:46 -0800 Message-ID: Subject: Re: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc To: Miquel Raynal Cc: David Regan , dregan@mail.com, Richard Weinberger , Vignesh Raghavendra , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, computersforpeace@gmail.com, kdasu.kdev@gmail.com, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, Linux Kernel Mailing List , Joel Peshkin , Tomer Yacoby , Dan Beygelman , William Zhang , Anand Gore , Kursad Oney , Florian Fainelli , rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com, andre.przywara@arm.com, baruch@tkos.co.il, linux-arm-kernel@lists.infradead.org, Dan Carpenter Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Miqu=C3=A8l, On Wed, Jan 24, 2024 at 9:40=E2=80=AFAM Miquel Raynal wrote: > > Hi David, > > dregan@broadcom.com wrote on Tue, 23 Jan 2024 19:04:58 -0800: > > > Allow settings for on-die ecc such that if on-die ECC is selected > > don't error out but require ECC strap setting of zero > > > > Signed-off-by: David Regan > > Reviewed-by: William Zhang > > --- > > Changes in v3: None > > --- > > Changes in v2: > > - Added to patch series > > --- > > drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- > > 1 file changed, 10 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nan= d/raw/brcmnand/brcmnand.c > > index a4e311b6798c..42526f3250c9 100644 > > --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c > > +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c > > @@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_ho= st *host) > > cfg->blk_adr_bytes =3D get_blk_adr_bytes(mtd->size, mtd->writesiz= e); > > > > if (chip->ecc.engine_type !=3D NAND_ECC_ENGINE_TYPE_ON_HOST) { > > - dev_err(ctrl->dev, "only HW ECC supported; selected: %d\n= ", > > - chip->ecc.engine_type); > > - return -EINVAL; > > + if (chip->ecc.strength) { > > + dev_err(ctrl->dev, "ERROR!!! HW ECC must be set t= o zero for non-hardware ECC; selected: %d\n", > > + chip->ecc.strength); > > Can you use a more formal string? Also clarify it because I don't > really understand what it leads to. How about: dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n", > > > + return -EINVAL; > > + } > > } > > > > if (chip->ecc.algo =3D=3D NAND_ECC_ALGO_UNKNOWN) { > > @@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_ho= st *host) > > if (ret) > > return ret; > > > > - brcmnand_set_ecc_enabled(host, 1); > > + if (chip->ecc.engine_type =3D=3D NAND_ECC_ENGINE_TYPE_ON_DIE) { > > + dev_dbg(ctrl->dev, "Disable HW ECC for on-die ECC\n"); > > Not needed. Will remove. > > > + brcmnand_set_ecc_enabled(host, 0); > > + } else > > + brcmnand_set_ecc_enabled(host, 1); > > Style is wrong, but otherwise I think ECC should be kept disabled while > not in active use, so I am a bit surprised by this line. This is a double check to turn on/off our hardware ECC. > > > > > brcmnand_print_cfg(host, msg, cfg); > > dev_info(ctrl->dev, "detected %s\n", msg); > > > Thanks, > Miqu=C3=A8l Thanks! -Dave