Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2557303lqo; Tue, 14 May 2024 02:18:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGA31mEkvcAkLh0pxuAkssqq36StMMp9a8bhCJzxCPdc++U4IR0mThnjlC0k+EGoWUBJ8MVBq9PkVhjvl/kE3/lR6TY7BIECkvwBlSoQ== X-Google-Smtp-Source: AGHT+IF1pIf7fmivykOY86ahpmDDaxhfrn+MvtCiXutCDc7OuqBn1pr06LSldEvHFDXtGT2DKn5y X-Received: by 2002:a05:620a:171e:b0:792:c708:601c with SMTP id af79cd13be357-792c75ffa9emr1752820385a.57.1715678304464; Tue, 14 May 2024 02:18:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715678304; cv=pass; d=google.com; s=arc-20160816; b=ErAJ/eZeR/MX2QNBRaDpS44e8EhpTVwzh3G2wbCtyQB6RHaJd2eV+S7xZd4nHsmOFQ g4UIh5FNrDNudBDNa7t5BRKzq3oWv6KaqM+FVG4zgiix/C2wb6ezvQi5dlzQ5jsNcz8Q pgWCPLBK6XbWLSFQHFET9L4Bwey0NEdaAyOWuoc5UtQhbDEX3w4tLTWM0bs1HYvB7oXa KL0xv3OURhpKucxGU+Kexas0uSF96BnWs1DhflEMKl1BasdpMxYfnQZD5RSJG5M9xqoO lhGCWkZc2ZYs/5hAmlD9mN+jhpu29ZoS8IGEvvg3HLoUZ3Bn/3gw6ZYJHIDsxzdBoqZx fjqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=yIwlWbM4ERlbWa1aiWaw2KBJZvFw6v2TnHVzXpOiw6g=; fh=J2WUQeL4Z9/Law5EDxuI4ZJklK367A/QTZaeg2R0E6Y=; b=zA8DlPaAhaNNQP2oC/AeHP53QK1g1zmTTh3JLG84EWlFeBsYVtXIArUcIiCnhDUV+d eRm1H6691n5m8Rw5HJ4ZzS7LQBG3ov1iI/crKoCSsWwAgih1AkBedOrWV9jeaW0/GctT RstGdZ+XT+FiNguRBv9EJXrMRe3jpoW0t0dAPTWtL31I27Eks/Lx+rJVgJv4XQRlvcpa WumO+BUHv/HyMNkjH2c3NVsRw3aPASuQzdxHVYdRBZ9uufWIQ084pQaG6uvsbTCVdbBu tf2rqptbV6kmaQD2a+gi7BLrBxNdREYt2cocWx54ae61mu2K2S6KsqAPAzL5nn7AX/6z ncUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-178500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178500-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf277a71si1123989685a.99.2024.05.14.02.18.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 02:18:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178500-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; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-178500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178500-linux.lists.archive=gmail.com@vger.kernel.org" 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 D15BA1C21229 for ; Tue, 14 May 2024 09:18:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99C8C548FD; Tue, 14 May 2024 09:18:18 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 AF2CA4F88C for ; Tue, 14 May 2024 09:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715678298; cv=none; b=jpn797UyfGqqZtnsMjt3qYZ0L6hPdwyEH9RboA1zu1bXDJWvhbCek8qhWzyKbRlfocnBw1l0xpeyIgmBuZrFY3OqyLKTl5457cRQq/MYNbGZZb8rDkYDL9pln5G+vJdAUsCcIHY/4SxMZM9/gcphLY0pHljT+YxNYtOon8o2/pw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715678298; c=relaxed/simple; bh=6WFupDorTnnTbujD8AQ3ipi6gdsL4EaklWex+IzeaJ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gva/rM2vsZWsXfFjV1nJte/1HqgJ8zlYnyd/J/ltrFIwr2q6/yBRlYrlbetpgvpQQn1YUBsMkJstNrg5IIolUtfKBNneGIavz9Nyd0otxL3HgPIONSzTHMaZvhyNJELpcHiYB6lSaNlPz7esRzTfnu2pB0c26oXXGRAQaw4NusM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6oIP-0000zQ-Fl; Tue, 14 May 2024 11:18:05 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6oIN-001KT6-6G; Tue, 14 May 2024 11:18:03 +0200 Received: from sha by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s6oIN-00BEFM-0K; Tue, 14 May 2024 11:18:03 +0200 Date: Tue, 14 May 2024 11:18:03 +0200 From: Sascha Hauer To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] mtd: nand: mxc_nand: implement exec_op Message-ID: References: <20240508-mtd-nand-mxc-nand-exec-op-v2-0-6b7366b7831f@pengutronix.de> <20240508-mtd-nand-mxc-nand-exec-op-v2-2-6b7366b7831f@pengutronix.de> <20240513091902.2c00d30a@xps-13> <20240513093256.363861d1@xps-13> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240513093256.363861d1@xps-13> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Mon, May 13, 2024 at 09:32:56AM +0200, Miquel Raynal wrote: > > miquel.raynal@bootlin.com wrote on Mon, 13 May 2024 09:19:02 +0200: > > > Hi Sascha, > > > > > @@ -1717,9 +1465,111 @@ static int mxcnd_setup_interface(struct nand_chip *chip, int chipnr, > > > return host->devtype_data->setup_interface(chip, chipnr, conf); > > > } > > > > > > +static int mxcnd_exec_op(struct nand_chip *chip, > > > + const struct nand_operation *op, > > > + bool check_only) > > > +{ > > > + struct mxc_nand_host *host = nand_get_controller_data(chip); > > > + struct mtd_info *mtd = nand_to_mtd(chip); > > > + int i, j, buf_len; > > > + void *buf_read = NULL; > > > + const void *buf_write = NULL; > > > + const struct nand_op_instr *instr; > > > + bool readid = false; > > > + bool statusreq = false; > > > + > > > + dev_dbg(host->dev, "%s: %d instructions\n", __func__, op->ninstrs); > > > > Maybe you want to get rid of this debug line. Ok. > > > > > + > > > + if (check_only) > > > + return 0; > > > + > > > + for (i = 0; i < op->ninstrs; i++) { > > > + instr = &op->instrs[i]; > > > + > > > + nand_op_trace(" ", instr); > > > + > > > + switch (instr->type) { > > > + case NAND_OP_WAITRDY_INSTR: > > > + /* > > > + * NFC handles R/B internally. Therefore, this function > > > + * always returns status as ready. > > > > This is no longer a standalone function, maybe: > > > > "The controller handles the R/B pin internally, therefore there is > > nothing to do here." Ok. > > And this is actually very wrong. > > You should call wait_op_done() instead. No, I don't think so. wait_op_done() is called to wait for the interrupt of the controller indicating a basic operation is done. A basic operation can be that a command is being sent or an address byte has been sent to the chip during an address cycle. With this arbitrary example: struct nand_op_instr instrs[] = { NAND_OP_CMD(NAND_CMD_READ0, 0), NAND_OP_ADDR(4, addrs, 0), NAND_OP_CMD(NAND_CMD_READSTART, NAND_COMMON_TIMING_NS(conf, tWB_max)), NAND_OP_WAIT_RDY(NAND_COMMON_TIMING_MS(conf, tR_max), NAND_COMMON_TIMING_NS(conf, tRR_min)), NAND_OP_DATA_IN(len, buf, 0), }; I'll call wait_op_done() once for NAND_CMD_READ0, four times for the NAND_OP_ADDR, then once again for the NAND_CMD_READSTART command and four times (on i.MX27, once per subpage) for the NAND_OP_DATA_IN operation. Calling wait_op_done() for the NAND_OP_WAIT_RDY operation woul only timeout because there is no operation in flight currently. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |