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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4402CDB47E for ; Thu, 12 Oct 2023 07:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343622AbjJLHGr (ORCPT ); Thu, 12 Oct 2023 03:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343567AbjJLHGp (ORCPT ); Thu, 12 Oct 2023 03:06:45 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3336090 for ; Thu, 12 Oct 2023 00:06:43 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 371E2C0006; Thu, 12 Oct 2023 07:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697094401; 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=PH/KaqunIddnQRtT02HmdgMfQves6qwGIOzjnE0JjkQ=; b=FY+XPJB0L80Aagv0MN6fhAmApIxZB8hFxLsalUUhwZSX/+eYco92ieOuldtUV5uBd03oSR tL2UOTYRO0TTOCM/KBUoZila36yX4DLoyyzU49IPzaWdJmzlsET1kugCv3bqPM/jV4OHZB f9dMF2zZnzmbLQKefKbOHf2EJ+aOBD+5DOKRFbDW9WVbjvKEWVJ/iKYro6+Y2i8O7CcNI0 L+WSyWpKICsf/EC1S1EisvmDGEM5PmI7gT5Mk1FVKl298Dzx+zTbUBqmD9hHVWtcNHuhCg fGPy1fnVBOkFzV88YoHU+ggrvfyVuli+1kkvZdgGqgZglUpxGTD8aHotui5MPA== Date: Thu, 12 Oct 2023 09:06:38 +0200 From: Miquel Raynal To: dregan@mail.com Cc: bcm-kernel-feedback-list@broadcom.com, linux-mtd@lists.infradead.org, f.fainelli@gmail.com, rafal@milecki.pl, joel.peshkin@broadcom.com, computersforpeace@gmail.com, dan.beygelman@broadcom.com, william.zhang@broadcom.com, frieder.schrempf@kontron.de, linux-kernel@vger.kernel.org, vigneshr@ti.com, richard@nod.at, bbrezillon@kernel.org, kdasu.kdev@gmail.com, JaimeLiao , Arseniy Krasnov , Adam Borowski Subject: Re: [PATCH v2 1/4] mtd: rawnand: Add destructive operation Message-ID: <20231012090638.1e093fe6@xps-13> In-Reply-To: References: 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-GND-Sasl: miquel.raynal@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, dregan@mail.com wrote on Thu, 12 Oct 2023 02:40:35 +0200: The author should be Boris as well (git commit --amend --author=3D...) > Erase and program operations need the write protect (wp) pin to be > de-asserted to take effect. Add the concept of destructive > operation and pass the information to exec_op() so controllers know > when they should de-assert this pin without having to decode > the command opcode. >=20 > Created by Boris Brezillon. This can go away. >=20 > https://github.com/bbrezillon/linux/commit/e612e1f2c69a33ac5f2c91d13669f0= f172d58717 This as well. > Signed-off-by: Boris Brezillon Please use Boris' kernel.org e-mail for the authorship and SoB > Signed-off-by: David Regan >=20 > --- >=20 > Changes in v2: gave credit to Boris Brezillon > --- > drivers/mtd/nand/raw/nand_base.c | 6 ++++-- > include/linux/mtd/rawnand.h | 9 +++++++++ > 2 files changed, 13 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand= _base.c > index d4b55155aeae..47cc2c35153b 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -1494,7 +1494,8 @@ static int nand_exec_prog_page_op(struct nand_chip = *chip, unsigned int page, > NAND_COMMON_TIMING_NS(conf, tWB_max)), > NAND_OP_WAIT_RDY(NAND_COMMON_TIMING_MS(conf, tPROG_max), 0), > }; > - struct nand_operation op =3D NAND_OPERATION(chip->cur_cs, instrs); > + struct nand_operation op =3D NAND_DESTRUCTIVE_OPERATION(chip->cur_cs, > + instrs); > int naddrs =3D nand_fill_column_cycles(chip, addrs, offset_in_page); >=20 > if (naddrs < 0) > @@ -1917,7 +1918,8 @@ int nand_erase_op(struct nand_chip *chip, unsigned = int eraseblock) > NAND_OP_WAIT_RDY(NAND_COMMON_TIMING_MS(conf, tBERS_max), > 0), > }; > - struct nand_operation op =3D NAND_OPERATION(chip->cur_cs, instrs); > + struct nand_operation op =3D NAND_DESTRUCTIVE_OPERATION(chip->cur_cs, > + instrs); >=20 > if (chip->options & NAND_ROW_ADDR_3) > instrs[1].ctx.addr.naddrs++; > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h > index 90a141ba2a5a..31aceda8616c 100644 > --- a/include/linux/mtd/rawnand.h > +++ b/include/linux/mtd/rawnand.h > @@ -1008,6 +1008,7 @@ struct nand_op_parser { > */ > struct nand_operation { > unsigned int cs; > + bool deassert_wp; > const struct nand_op_instr *instrs; > unsigned int ninstrs; > }; > @@ -1019,6 +1020,14 @@ struct nand_operation { > .ninstrs =3D ARRAY_SIZE(_instrs), \ > } >=20 > +#define NAND_DESTRUCTIVE_OPERATION(_cs, _instrs) \ > + { \ > + .cs =3D _cs, \ > + .deassert_wp =3D true, \ > + .instrs =3D _instrs, \ > + .ninstrs =3D ARRAY_SIZE(_instrs), \ > + } > + > int nand_op_parser_exec_op(struct nand_chip *chip, > const struct nand_op_parser *parser, > const struct nand_operation *op, bool check_only); > -- > 2.37.3 >=20 >=20 Thanks, Miqu=C3=A8l