Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4784535imm; Tue, 21 Aug 2018 00:33:22 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz/wv37kTR+yORlfs3pXY7GGHELVQn+LT38IiO39guL9Srh/H3Yx8/0+DloZsctEX2Ej1BP X-Received: by 2002:a62:1016:: with SMTP id y22-v6mr51768753pfi.109.1534836802433; Tue, 21 Aug 2018 00:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534836802; cv=none; d=google.com; s=arc-20160816; b=0CRfr0l5Y8BMkAr1og8hGimnepgxGKvEst6Stxm0v6FVH4lXgBHcNeOFDga8YtiSP0 ZwD8Tgi/kB6nY06W19Qr7ji3e3ktN68KxQBVwzi6v2oLRsB+TbrurEUVrnyPNKn5fIUb AnvpuDSSI7P/DM3SgAve9mOjqg7LkBC71aBC8ENjgvx5gcZaGD1Q3nPC3ox3tEiFoPKk y4XIa37NeNEQDsCh9DNZWW/AXGe1fdu+UWVjcMkDbNbxou+FEDK5FCPsYlNhWSaoI4Af OeRZIcPdH0TEg26+6sOaWZnKvLgPpXrxDacCm/JeWLJX4PCXHxufjaaNwOoXoM5u4eLn hMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=IJAWP286gBG2BodkA3S70ynJcjPXIYdWoXtO0PCKTmE=; b=fc7GPc8suAzrgeqi7Wb6MNb8wxN815cORZy/9gTV6vzSOHwQkTtZtHkX99V1r7UfCb e24vkO6TjD/q/d6sGd3MA+YZnbGNRqqRvuQXoSDaMBfZbbvuco38WsQPtyyc/S7E4ofv Krf0blnoQdo9IAV8f4uZWQaOzydhCmcPXrN2A4HnYtL8yh4UoW62maSFFlllhgpA57Z6 ZHDEkCN/V/v3R8GVEj54gW2mHTQLIE3KH2ti/nJvVhZvbep7Mn1p1EirDoOnazTAe3F/ KaSrtHH0UaBSvfyeme9Y2QfxbIz8ivNN8xN3cODAmkSc22ytisyX2RecXTsGfTylLaEN q30w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62-v6si7229025pgd.30.2018.08.21.00.33.06; Tue, 21 Aug 2018 00:33:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbeHUKu2 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 21 Aug 2018 06:50:28 -0400 Received: from mail.bootlin.com ([62.4.15.54]:34161 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbeHUKu1 (ORCPT ); Tue, 21 Aug 2018 06:50:27 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 3505E20787; Tue, 21 Aug 2018 09:31:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (AAubervilliers-681-1-85-9.w90-88.abo.wanadoo.fr [90.88.27.9]) by mail.bootlin.com (Postfix) with ESMTPSA id A5907204AE; Tue, 21 Aug 2018 09:31:24 +0200 (CEST) Date: Tue, 21 Aug 2018 09:31:25 +0200 From: Miquel Raynal To: Naga Sureshkumar Relli Cc: Boris Brezillon , "richard@nod.at" , "dwmw2@infradead.org" , "computersforpeace@gmail.com" , "marek.vasut@gmail.com" , "kyungmin.park@samsung.com" , "absahu@codeaurora.org" , "peterpandong@micron.com" , "frieder.schrempf@exceet.de" , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Michal Simek , "nagasureshkumarrelli@gmail.com" Subject: Re: [LINUX PATCH v10 2/2] mtd: rawnand: arasan: Add support for Arasan NAND Flash Controller Message-ID: <20180821093125.05fb46a4@xps13> In-Reply-To: References: <1534511964-20342-1-git-send-email-naga.sureshkumar.relli@xilinx.com> <1534511964-20342-3-git-send-email-naga.sureshkumar.relli@xilinx.com> <20180820184013.57fd7b5c@bbrezillon> Organization: Bootlin X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Naga, > > And why is it an s32 and not a u32? > To monitor NAND_CMD_STATUS. > Sometimes core will just send status command without reading back the status data and later > It will try to read one byte using ->exec_op(). > So Arasan has FLASH_STS register and whenever we initiate a status command, the controller > Will update this register with the value returned by the flash device. > So we need to return this value when core is asking about 1 byte status value without issuing the command. > And in driver we are using memset(nfc_op, 0, sizeof(struct anfc_op)), this will make cmnds[4] to zeros but 0x0 is also > NAND_CMD_READ0, so inorder to differentiate whether to give status data or not, I just assigned > nfc_op->cmnds[0] = NAND_CMD_NONE; > > May be this case we can now eliminate as per your suggestion(defining a separate hook for each pattern) and thanks for that. > > > > > + u32 type; > > > + u32 len; > > > + u32 naddrs; > > > + u32 col; > > > + u32 row; > > > + unsigned int data_instr_idx; > > > + unsigned int rdy_timeout_ms; > > > + unsigned int rdy_delay_ns; > > > + const struct nand_op_instr *data_instr; }; > > > > Please make sure you actually need to redefine all these fields. Looks like some them could be > > extracted directly from the nand_op_instr objects. > Ok, all these values are getting updated in anfc_parse_instructions() In anfc_parse_instructions(): + nfc_op->data_instr = instr; + nfc_op->type = NAND_OP_DATA_IN_INSTR; This looks pointless. + nfc_op->data_instr_idx = op_id; + break; + case NAND_OP_DATA_OUT_INSTR: + nfc_op->data_instr = instr; + nfc_op->type = NAND_OP_DATA_IN_INSTR; + nfc_op->data_instr_idx = op_id; + break; + case NAND_OP_WAITRDY_INSTR: + nfc_op->rdy_timeout_ms = instr->ctx.waitrdy.timeout_ms; This one also. + nfc_op->rdy_delay_ns = instr->delay_ns; And this one too. Once you'll have a per pattern callback, I suppose you won't need it anymore. > > > > > + > > > +/** > > > + * struct anfc_nand_chip - Defines the nand chip related information > > > + * @node: used to store NAND chips into a list. > > > + * @chip: NAND chip information structure. > > > + * @bch: Bch / Hamming mode enable/disable. > > > + * @bchmode: Bch mode. > > > > What's the difference between bch and bchmode? > @bch -> to select error correction method(either BCH or Hamming) > @bchmode -> to select ECC correctability (4/8/12/24 bit ECC) Then something like "strength" or "ecc_strength" would be more meaningful. Thanks, Miquèl