[PATCH V2 0/4] mtd: gpmi: support two nand chips at most

Gupta, Pekon pekon at ti.com
Mon Oct 21 02:02:59 PDT 2013


Hi,

> From: Huang Shijie [mailto:b32955 at freescale.com]
> 于 2013年10月21日 14:01, Gupta, Pekon 写道:
> > Hi Shijie,
> >
> >> From: Huang Shijie
> >>
> >> I am too busy too, i am starting to code the Qspi driver now.
> >>
> > (1)
> > Your controller uses LUT based approach, So in case, you are planning to
> > follow DT based approach of populating flash information in your QSPI
> > controller then I can help you to put that as part of generic framework
> > so that both ti-qspi and fsl-qspi can re-use it.
> it's very good.
> > (2)
> > Also, would you be interested in deriving generic framework for serial
> > NOR something like mtd/spinor/.. where m25p80 can plug-in ?
> 
> yes.
> 
> Do you have any solution about the generic framework for spi nor?
> 
> i want to chage the m25p80.c, and make it not only work for SPI drivers,
> but also can work for SPI-NOR(QSPI) driver.
> 
Thanks, but in that case, please do not add generic code in m25p80.c.
Let it live as driver for NOR devices, because it supports too many other
devices. Rather I was thinking on following ways:

* Step-1: define an interface between SPI-NOR and MTD *
+ create include/linux/mtd/spinor.h
struct spinor {
	/* modes */
	enum modes { MM_MODE, SPI_MODE };
	/* erase operation */	
	uint32 erase_opcode;
	uint32 erase_dummy_cycles;
	int (* erase_done) (...);
	/* read operation */
	uint32 read_opcode;
	uint32 read_dummy_cycles;
	int (*read_done) (...);
	/* write operation */
	[...]
}
This is similar to struct nand_chip in include/linux/mtd/nand.h
But specific to SPI NOR device attributes.


* Step-2:  spawn out generic code from m25p80 into generic framework *
_(maintaining original authorship)_
+ create /driver/mtd/spinor/spinor.c
m25p80_erase() -> spinor_erase(mtd, ...)
m25p80_read() -> spinor_read( mtd, from, len, *buf, ... )
m25p80_write() -> spinor_write (mtd, to, len, *buf, ... )

If you already have done some work on m25p80.c then please see if
you can convert on above thoughts and post it. I'll review them and
add more stuff and cleanups. 
Else, I plan to do that from scratch but need sometime, as I'm bit stuck
in some omap2-nand driver clean-up activities.
Let me know what suits you, as per your QSPI-FSL driver timelines..


with regards, pekon


More information about the linux-mtd mailing list