linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Shivamurthy Shastri (sshivamurthy)" <sshivamurthy@micron.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Lucas Stach <dev@lynxeye.de>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Richard Weinberger <richard@nod.at>,
	Yixun Lan <yixun.lan@amlogic.com>,
	Chuanhong Guo <gch981213@gmail.com>,
	Stefan Agner <stefan@agner.ch>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Paul Cercueil <paul@crapouillou.net>,
	Marek Vasut <marek.vasut@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Anders Roxell <anders.roxell@linaro.org>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	"Bean Huo \(beanhuo\)" <beanhuo@micron.com>
Subject: RE: [EXT] Re: [PATCH v3 04/12] mtd: rawnand: introduce struct onfi_helper
Date: Tue, 4 Jun 2019 12:02:28 +0000	[thread overview]
Message-ID: <MN2PR08MB595131826D34BFD773DF1251B8150@MN2PR08MB5951.namprd08.prod.outlook.com> (raw)
In-Reply-To: <20190603150537.3ca5ca8a@collabora.com>

Hi Boris,

> > Create onfi_helper object. This is base to turn ONFI code to generic.
> >
> > Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
> > ---
> >  include/linux/mtd/nand.h | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> > index 3cdf06cae8b6..645dde4c5797 100644
> > --- a/include/linux/mtd/nand.h
> > +++ b/include/linux/mtd/nand.h
> > @@ -11,6 +11,7 @@
> >  #define __LINUX_MTD_NAND_H
> >
> >  #include <linux/mtd/mtd.h>
> > +#include <linux/mtd/onfi.h>
> >
> >  /**
> >   * struct nand_memory_organization - Memory organization structure
> > @@ -157,6 +158,24 @@ struct nand_ops {
> >  	bool (*isbad)(struct nand_device *nand, const struct nand_pos
> *pos);
> >  };
> >
> > +/**
> > + * struct onfi_helper - ONFI helper functions that should be implemented
> by
> > + * specialized layers (raw NAND, SPI NAND, etc.)
> > + * @page: Page number for ONFI parameter table
> > + * @check_revision: Check ONFI revision number
> > + * @parameter_page_read: Function to read parameter pages
> > + * @init_intf_data: Initialize interface specific data or fixups
> > + */
> > +struct onfi_helper {
> > +	u8 page;
> > +	int (*check_revision)(struct nand_device *base,
> > +			      struct nand_onfi_params *p, int *onfi_version);
> > +	int (*parameter_page_read)(struct nand_device *base, u8 page,
> > +				   void *buf, unsigned int len);
> > +	int (*init_intf_data)(struct nand_device *base,
> > +			      struct nand_onfi_params *p);
> > +};
> > +
> >  /**
> >   * struct nand_device - NAND device
> >   * @mtd: MTD instance attached to the NAND device
> > @@ -165,6 +184,7 @@ struct nand_ops {
> >   * @rowconv: position to row address converter
> >   * @bbt: bad block table info
> >   * @ops: NAND operations attached to the NAND device
> > + * @helper: Helper functions to detect and initialize ONFI NAND
> >   *
> >   * Generic NAND object. Specialized NAND layers (raw NAND, SPI NAND,
> OneNAND)
> >   * should declare their own NAND object embedding a nand_device struct
> (that's
> > @@ -183,6 +203,7 @@ struct nand_device {
> >  	struct nand_row_converter rowconv;
> >  	struct nand_bbt bbt;
> >  	const struct nand_ops *ops;
> > +	struct onfi_helper helper;
> 
> Sorry, but I don't think that's the right solution. When I said we
> should have ONFI code shared I was thinking about the code that parses
> the ONFI struct/data to extract nand_memory_organization bits or other
> generic info, not something that would abstract how to retrieve the
> ONFI param page. Clearly, the generic NAND layer is not supposed to
> handle such protocol/low-level details.
> 

In that case, I am thinking to design as follows, which splits into generic independent code.
Let me know, if you have any concerns or inputs.

I will parsing code from nand_onfi_detect function and move it to mtd/nand/onfi.c.
Also, I will move functions like sanitize_string, nand_bit_wise_majority, onfi_crc16, and 
any other generic info to mtd/nand/onfi.c.

Thanks,
Shiva

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-06-04 12:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 12:43 [PATCH v3 04/12] mtd: rawnand: introduce struct onfi_helper Shivamurthy Shastri (sshivamurthy)
2019-06-03 13:05 ` Boris Brezillon
2019-06-04 12:02   ` Shivamurthy Shastri (sshivamurthy) [this message]
2019-06-04 13:00     ` [EXT] " Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR08MB595131826D34BFD773DF1251B8150@MN2PR08MB5951.namprd08.prod.outlook.com \
    --to=sshivamurthy@micron.com \
    --cc=anders.roxell@linaro.org \
    --cc=bbrezillon@kernel.org \
    --cc=beanhuo@micron.com \
    --cc=boris.brezillon@collabora.com \
    --cc=computersforpeace@gmail.com \
    --cc=dev@lynxeye.de \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=gch981213@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marcel.ziswiler@toradex.com \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=paul@crapouillou.net \
    --cc=richard@nod.at \
    --cc=stefan@agner.ch \
    --cc=vigneshr@ti.com \
    --cc=yixun.lan@amlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).