Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2458060ybl; Mon, 19 Aug 2019 02:20:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzTe3NFY/C6yDZK8J0WG2Rp0Q5X19haYvMvyBAI9h56ddzgmWy6+3IFZMwlwmPt9lgmIPR X-Received: by 2002:a17:902:7b85:: with SMTP id w5mr5028517pll.302.1566206441664; Mon, 19 Aug 2019 02:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566206441; cv=none; d=google.com; s=arc-20160816; b=vnI5lKpipzuAf2oNy07tVNK7RiVBNzEq8IUSrWP2ClptkdAl7WX1SvINNMuVjBBKHf Q7DsR3nslfVdU18kd1rtZtpQ/r+pZlJcUZpAggwOVoCqdXPFwLEbek8UAoq6Lcuw+ve2 An2rzMAH80Gsnq45vRBvRMpIoosa2Nltqj6zQ53xaDbS7DvNuc2F+LD3qofBr7QrvrqX b90lrYAKjn8PUlPij+0V+CIDpkHtt08UZbbm38SSg+G5BoN6r9Jg11OQHNwYTfahZWCY efCGjVzmLfufZ48TkoDf5e7jKzWh7WNfsEffihNvCfG/R1QK3YHUveW3CFH44b9xPU9V 3qGw== 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=K35IIm4qyVm/4IC9cbRz4pNU729LoLpRgV/5sI6Ngts=; b=I8wNg8bPqfYDkd8Mf3fQHB3v4xjj3mNAr6OkwrS1eTgYZUrVZdgpgyqxWKTICijnjv 86lml8L0N15E+LBWDrsKFFnjXs5TZsG01oI3jvypRy7l/h3daD8PhaSuxXRh2WjaOG0L 2jrTEUNry7fjb0qMDIkqzhes8n+CGY4PSQB9F21unxb8Tkoa9geiV/zwoBhlVfN9+0Eo g+ZrZnfFWm1u9ElG9A3Ucd+KSH1ek/W2bN7Ejln365t6wFc5obQpML8mBfkDGxoGtTw8 qtk7hfYSUbX9ZJL+kVrjnpKkJL8Kvh7HERiQMVCefiKYuSu/RWsW2mJm7T/wn2oCYjvo vpTg== 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 cm1si8460158pjb.12.2019.08.19.02.20.26; Mon, 19 Aug 2019 02:20:41 -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 S1727424AbfHSJTY convert rfc822-to-8bit (ORCPT + 99 others); Mon, 19 Aug 2019 05:19:24 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:44895 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbfHSJTY (ORCPT ); Mon, 19 Aug 2019 05:19:24 -0400 Received: from xps13 (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: miquel.raynal@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 5038F20000C; Mon, 19 Aug 2019 09:19:19 +0000 (UTC) Date: Mon, 19 Aug 2019 11:19:18 +0200 From: Miquel Raynal To: "Shivamurthy Shastri (sshivamurthy)" Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Vignesh Raghavendra , Boris Brezillon , Marcel Ziswiler , Frieder Schrempf , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Jeff Kletsky , Chuanhong Guo , liaoweixiong Subject: Re: [EXT] Re: [PATCH 6/8] mtd: spinand: micron: Turn driver implementation generic Message-ID: <20190819111918.6be79570@xps13> In-Reply-To: References: <20190722055621.23526-1-sshivamurthy@micron.com> <20190722055621.23526-7-sshivamurthy@micron.com> <20190807120408.031b8d1b@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.3 (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 Boris, I need your opinion on the question below. "Shivamurthy Shastri (sshivamurthy)" wrote on Mon, 19 Aug 2019 09:03:38 +0000: > Hi Miquel, > > > > > Hi Shiva, > > > > shiva.linuxworks@gmail.com wrote on Mon, 22 Jul 2019 07:56:19 +0200: > > > > > From: Shivamurthy Shastri > > > > > > > I am not sure the "turn implemenatation generic" title describes what > > you do. > > > > > Driver is redesigned using parameter page to support Micron SPI NAND > > > flashes. > > > > Redesigned is perhaps a bit too much. > > > > " > > > The reason why spinand_select_op_variant globalized is that the Micron > > > driver no longer calling spinand_match_and_init. > > > > > > Signed-off-by: Shivamurthy Shastri > > > --- > > > drivers/mtd/nand/spi/core.c | 2 +- > > > drivers/mtd/nand/spi/micron.c | 61 +++++++++++++++++++++++++------- > > --- > > > include/linux/mtd/spinand.h | 4 +++ > > > 3 files changed, 49 insertions(+), 18 deletions(-) > > > > > > diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c > > > index 7ae76dab9141..aae715d388b7 100644 > > > --- a/drivers/mtd/nand/spi/core.c > > > +++ b/drivers/mtd/nand/spi/core.c > > > @@ -920,7 +920,7 @@ static void spinand_manufacturer_cleanup(struct > > spinand_device *spinand) > > > return spinand->manufacturer->ops->cleanup(spinand); > > > } > > > > > > -static const struct spi_mem_op * > > > +const struct spi_mem_op * > > > spinand_select_op_variant(struct spinand_device *spinand, > > > const struct spinand_op_variants *variants) > > > { > > > diff --git a/drivers/mtd/nand/spi/micron.c > > b/drivers/mtd/nand/spi/micron.c > > > index 95bc5264ebc1..6fde93ec23a1 100644 > > > --- a/drivers/mtd/nand/spi/micron.c > > > +++ b/drivers/mtd/nand/spi/micron.c > > > @@ -90,22 +90,10 @@ static int micron_ecc_get_status(struct > > spinand_device *spinand, > > > return -EINVAL; > > > } > > > > > > -static const struct spinand_info micron_spinand_table[] = { > > > - SPINAND_INFO("MT29F2G01ABAGD", 0x24, > > > - NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), > > > - NAND_ECCREQ(8, 512), > > > - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, > > > - &write_cache_variants, > > > - &update_cache_variants), > > > - 0, > > > - SPINAND_ECCINFO(µn_ooblayout_ops, > > > - micron_ecc_get_status)), > > > -}; > > > - > > > > I don't know if it is wise to drop this structure. > > > > > 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. > > > > 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. > Thanks, Miquèl