Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3997208ybp; Mon, 7 Oct 2019 01:15:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzbQOxDEMRVBSYnGg/OSCbnZpoBZ7EB0y30qRHRBeMvX6H+r9vcs2vdEB33DKKzBKYuGT8 X-Received: by 2002:a17:906:c47:: with SMTP id t7mr22460058ejf.133.1570436100757; Mon, 07 Oct 2019 01:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570436100; cv=none; d=google.com; s=arc-20160816; b=za1PoOozCsA7u0s9AydBj2qz/yXBsgRXQYJnrL4v2MgP2Ytqrp9a1fv5bIEVpPBHdN BnclCdqwC/9EfG7yoZov6hDhQfEbGHGQJsJW9Xth9L72DHp52F5nx4fhVcsZFPhpPReq ElvFja+s8WFh0nsyII7yMfdYCq6y+fuGb9FMTplOhBTGPt4PcGts+49KEHkgUoXlCibn sRDVA0Q54VaPRKXoioSRIxh9eDza843FVJ4SB6UkuoX5HxW+Eqy7KIIqoYnHyApQGUPS nOrbpnjVb6Xi1/QKOQxxLIC5owZMdy62iqIXXdPu6fSX5yCAQzsHo70Oc1K/VmnKD2Im lIrA== 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; bh=FIZDHE1gcTKw/GRQLimo7Bbqx5r+R4/91Ld8B1KQn1I=; b=O2ZCBd+2HM2Uu1e5v9WtJJD5UqErdIIfdSd7LIPoAS0c8Nbub2T3HE6QI4zTa+gvoB 9f3WQMnwAfBBxgIubbx2ApmkDdGZ07FDPK9lRgxDZpcyVYqU0IcxTm97EoR914Fk+U79 oXLoB94ysVFiFRCJgt3xLULRruL1vFFo46iZmNLI6lc+XagXlWK7W1798kOEy7i3o5NN OCo8+763mk61+MJ5LluTyHNO6Amx/4PpmOsdJPZ+p6dobXfc3ux8h7zP7qODDQyjk7Mk g1gHlsMGwIDtAMhf+3cyCyjYYtU30g1VSZr5lzGxPr64V25zh/FLQITLtNGXsiNqumhX oj8A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m33si8116726edc.94.2019.10.07.01.14.37; Mon, 07 Oct 2019 01:15:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727377AbfJGINn (ORCPT + 99 others); Mon, 7 Oct 2019 04:13:43 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54976 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbfJGINm (ORCPT ); Mon, 7 Oct 2019 04:13:42 -0400 Received: from dhcp-172-31-174-146.wireless.concordia.ca (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 6C49628AF35; Mon, 7 Oct 2019 09:13:40 +0100 (BST) Date: Mon, 7 Oct 2019 10:13:37 +0200 From: Boris Brezillon To: "Shivamurthy Shastri (sshivamurthy)" Cc: Miquel Raynal , Chuanhong Guo , Vignesh Raghavendra , Boris Brezillon , Marcel Ziswiler , Richard Weinberger , "linux-kernel@vger.kernel.org" , Frieder Schrempf , liaoweixiong , Marek Vasut , "linux-mtd@lists.infradead.org" , Jeff Kletsky , Brian Norris , David Woodhouse Subject: Re: [EXT] Re: [PATCH 6/8] mtd: spinand: micron: Turn driver implementation generic Message-ID: <20191007101337.647300e2@dhcp-172-31-174-146.wireless.concordia.ca> In-Reply-To: References: <20190722055621.23526-1-sshivamurthy@micron.com> <20190722055621.23526-7-sshivamurthy@micron.com> <20190807120408.031b8d1b@xps13> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 19 Aug 2019 09:03:38 +0000 "Shivamurthy Shastri (sshivamurthy)" wrote: > > > > > static int micron_spinand_detect(struct spinand_device *spinand) > > > { > > > + const struct spi_mem_op *op; > > > u8 *id = spinand->id.data; > > > - int ret; > > > > > > /* > > > * Micron SPI NAND read ID need a dummy byte, > > > @@ -114,16 +102,55 @@ static int micron_spinand_detect(struct > > spinand_device *spinand) > > > if (id[1] != SPINAND_MFR_MICRON) > > > return 0; > > > > > > - ret = spinand_match_and_init(spinand, micron_spinand_table, > > > - ARRAY_SIZE(micron_spinand_table), > > id[2]); > > > > I am not sure this is the right solution. I would keep this call and > > overwrite what you need to overwrite with the fixup hook. > > I'm definitely not comfortable with this whole "rely on ONFi param-page" thing. Vendors have proven to get it wrong from time to time, so before we do that, I'd like to make sure all currently supported Micron NANDs (looks like we only support MT29F2G01ABAGD, so that shouldn't be hard) expose the right thing there. For instance, are we sure the ECC layout is always the same, and if not, do we have a reliable way to extract that? > > Then, I will have dummy structure like below. > > static const struct spinand_info micron_spinand_table[] = { > SPINAND_INFO(NULL, 0, > NAND_MEMORG(0, 0, 0, 0, 0, 0, 0, 0, 0), > NAND_ECCREQ(0, 0), > SPINAND_INFO_OP_VARIANTS(&read_cache_variants, > &write_cache_variants, > &update_cache_variants), > 0, > SPINAND_ECCINFO(µn_ooblayout_ops, > micron_ecc_get_status)), > }; > > Let me know if you are thinking for different approach. Exposing dummy entries is useless. If you're entirely sure all Micron SPI NANDs have a valid ONFi param page, then no need to use the ID-based detection. But as I said above, I feel param-page-based detection is going to be as messy as SFDP-based detection is for SPI NORs. Vendors tend to make mistakes which we have to fix to make things work. ID-based detection is much more reliable in this regard, as long as we don't have ID collisions :P. Plus, it looks like only a few manufacturers decided to use ONFi param pages to expose SPI NAND info (AFAICT, only Micron and Macronix do that), which is not surprising since the ONFi param page has been created to describe parallel NANDs not SPI NANDs (if you look closely enough, you'll notice that some fields are meaningless for SPI NANDs).