From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C0C9C433EF for ; Fri, 24 Jun 2022 18:10:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE94184398; Fri, 24 Jun 2022 20:10:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="RaPhuV/+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 63B24843E3; Fri, 24 Jun 2022 20:10:00 +0200 (CEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2C80384392 for ; Fri, 24 Jun 2022 20:09:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 431ACE0004; Fri, 24 Jun 2022 18:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1656094197; 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=Vo3Z+6Kv45o4ifbcZIrAwQW31TMrZruJa8oUslmbsE8=; b=RaPhuV/+Qnq6JDDpjJMzhNC5MS0Yhh8MEA+szkGf8U2hyuLMWBTt+JPrmcR5oGVn67+f0G XLGWUqgy7+1QY1obKvWXh2tRCcA+v2djCOGFu0INBJlHynX6rLju5VfLG4ZuYPNzKCeIod i5KHBUYV5oPuzvq8kdceXs+1htOHux3DrIS9hYbeLzunykw7Qw6wXz/IPZOX/Ze2yG//eM Ziv/WD7P/rdd1vni+SpfyAtEUIG4AG+2h/2XxSZIJhBVvAZyagBIrHxUUg4E9BEU71SOYS SOZhGcggEAzwl1XVA2oeRK/bGcwZVi+lq4bXN8sTk73sPV8RLZbkY/3/o9mlGg== Date: Fri, 24 Jun 2022 20:09:55 +0200 From: Miquel Raynal To: kory.maincent@bootlin.com Cc: u-boot@lists.denx.de, thomas.petazzoni@bootlin.com, Patrice Chotard , Wolfgang Denk , Pali =?UTF-8?B?Um9ow6Fy?= , Simon Glass , Marek =?UTF-8?B?QmVow7pu?= Subject: Re: [PATCH v2] mtd: rawnand: Add support to dedicated function to set timings Message-ID: <20220624200955.7ca7bdcf@xps-13> In-Reply-To: <20220622091145.1207923-1-kory.maincent@bootlin.com> References: <20220622091145.1207923-1-kory.maincent@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi K=C3=B6ry, kory.maincent@bootlin.com wrote on Wed, 22 Jun 2022 11:11:45 +0200: > From: Kory Maincent >=20 > With the current code if the board has an ONFI compliant NAND without > support to the get and set features, U-boot returns an ENOTSUP error when > trying to tune the timings which prevents the probe of the device. > Indeed onfi_set_features() return ENOTSUP error if set/get features is not > supported. In the case of timings we should not return ENOTSUP because we > can use the default timings. The NAND is already capable of listening at > its highest supported rate, so we assume in this case that it is fine to > skip the operation. >=20 > Fix it by adding an intermediate nand_onfi_set_timings() function which > does not error out if set/get feature is not supported. >=20 > Signed-off-by: Kory Maincent Seems legitimate. Reviewed-by: Miquel Raynal > --- >=20 > Change since v1: > - Update commit message >=20 > drivers/mtd/nand/raw/nand_base.c | 30 +++++++++++++++++++----------- > 1 file changed, 19 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand= _base.c > index 6f81257cf1..e8ece0a4a0 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -974,6 +974,22 @@ static int nand_reset_data_interface(struct nand_chi= p *chip, int chipnr) > return ret; > } > =20 > +static int nand_onfi_set_timings(struct mtd_info *mtd, struct nand_chip = *chip) > +{ > + if (!chip->onfi_version || > + !(le16_to_cpu(chip->onfi_params.opt_cmd) > + & ONFI_OPT_CMD_SET_GET_FEATURES)) > + return 0; > + > + u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] =3D { > + chip->onfi_timing_mode_default, > + }; > + > + return chip->onfi_set_features(mtd, chip, > + ONFI_FEATURE_ADDR_TIMING_MODE, > + tmode_param); > +} > + > /** > * nand_setup_data_interface - Setup the best data interface and timings > * @chip: The NAND chip > @@ -999,17 +1015,9 @@ static int nand_setup_data_interface(struct nand_ch= ip *chip, int chipnr) > * Ensure the timing mode has been changed on the chip side > * before changing timings on the controller side. > */ > - if (chip->onfi_version) { > - u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] =3D { > - chip->onfi_timing_mode_default, > - }; > - > - ret =3D chip->onfi_set_features(mtd, chip, > - ONFI_FEATURE_ADDR_TIMING_MODE, > - tmode_param); > - if (ret) > - goto err; > - } > + ret =3D nand_onfi_set_timings(mtd, chip); > + if (ret) > + goto err; > =20 > ret =3D chip->setup_data_interface(mtd, chipnr, chip->data_interface); > err: Thanks, Miqu=C3=A8l