linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Accessing mtd partitions from driver/i2c
@ 2018-06-06  5:02 Prabhakar Kushwaha
  2018-06-06  7:22 ` Boris Brezillon
  0 siblings, 1 reply; 6+ messages in thread
From: Prabhakar Kushwaha @ 2018-06-06  5:02 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org, boris.brezillon@bootlin.com,
	marek.vasut@gmail.com
  Cc: Poonam Aggrwal, Ashish Kumar, Ying Zhang

Hi All,

We have a requirement of using(read/write) one mtd partition from driver/i2c. 

As per my googling  mtd->_read, mtd->_write APIs has not been used anywhere other than driver/mtd layer.
Do we have any such framework/use case available in Linux which can be referred.

Any pointer/clue will be helpful

--pk

 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing mtd partitions from driver/i2c
  2018-06-06  5:02 Accessing mtd partitions from driver/i2c Prabhakar Kushwaha
@ 2018-06-06  7:22 ` Boris Brezillon
  2018-06-06 13:44   ` Prabhakar Kushwaha
  0 siblings, 1 reply; 6+ messages in thread
From: Boris Brezillon @ 2018-06-06  7:22 UTC (permalink / raw)
  To: Prabhakar Kushwaha
  Cc: linux-mtd@lists.infradead.org, marek.vasut@gmail.com,
	Poonam Aggrwal, Ashish Kumar, Ying Zhang

Hi Prabhakar,

On Wed, 6 Jun 2018 05:02:47 +0000
Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:

> Hi All,
> 
> We have a requirement of using(read/write) one mtd partition from driver/i2c. 
> 
> As per my googling  mtd->_read, mtd->_write APIs has not been used anywhere other than driver/mtd layer.

It's used by at least one filesystem (JFFS2). And you should not look
for mtd->_xxx() users but mtd_xxx() users. You should never access the
mtd hooks directly but the wrappers that are exposed by the MTD API
(mtd_read(), mtd_write(), mtd_erase(), ...).

BTW, what's your use case? If it's about reading a piece of information
from a RO partition, then the work initiated by Alban [1] and exposing
some MTD parts are NVMEM providers should be a better match.

> Do we have any such framework/use case available in Linux which can be referred.
> 
> Any pointer/clue will be helpful

I don't know what you want to do with the MTD device exactly, so it's
hard to tell.

Regards,

Boris

[1]https://patchwork.ozlabs.org/project/linux-mtd/list/?series=35728

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Accessing mtd partitions from driver/i2c
  2018-06-06  7:22 ` Boris Brezillon
@ 2018-06-06 13:44   ` Prabhakar Kushwaha
  2018-06-06 13:56     ` Boris Brezillon
  0 siblings, 1 reply; 6+ messages in thread
From: Prabhakar Kushwaha @ 2018-06-06 13:44 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: linux-mtd@lists.infradead.org, marek.vasut@gmail.com,
	Poonam Aggrwal, Ashish Kumar, Ying Zhang

Dear Borris,

> -----Original Message-----
> From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> Sent: Wednesday, June 6, 2018 12:53 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam Aggrwal
> <poonam.aggrwal@nxp.com>; Ashish Kumar <ashish.kumar@nxp.com>; Ying
> Zhang <ying.zhang22455@nxp.com>
> Subject: Re: Accessing mtd partitions from driver/i2c
> 
> Hi Prabhakar,
> 
> On Wed, 6 Jun 2018 05:02:47 +0000
> Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> 
> > Hi All,
> >
> > We have a requirement of using(read/write) one mtd partition from driver/i2c.
> >
> > As per my googling  mtd->_read, mtd->_write APIs has not been used
> anywhere other than driver/mtd layer.
> 
> It's used by at least one filesystem (JFFS2). And you should not look for mtd-
> >_xxx() users but mtd_xxx() users. You should never access the mtd hooks
> directly but the wrappers that are exposed by the MTD API (mtd_read(),
> mtd_write(), mtd_erase(), ...).
> 

I can find it's usage in driver/firmware/ folder. Looks like it is using nvram.

> BTW, what's your use case? If it's about reading a piece of information from a
> RO partition, then the work initiated by Alban [1] and exposing some MTD parts
> are NVMEM providers should be a better match.
> 

Currently, Linux has i2c slave framework. It is reading/writing to DDR emulated as EEPROM (drivers/i2c/i2c-slave-eeprom.c).
We want something similar, where DDR will be replaced by MTD partitions for read/write. 

--pk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing mtd partitions from driver/i2c
  2018-06-06 13:44   ` Prabhakar Kushwaha
@ 2018-06-06 13:56     ` Boris Brezillon
  2018-06-07 11:50       ` Prabhakar Kushwaha
  0 siblings, 1 reply; 6+ messages in thread
From: Boris Brezillon @ 2018-06-06 13:56 UTC (permalink / raw)
  To: Prabhakar Kushwaha
  Cc: linux-mtd@lists.infradead.org, marek.vasut@gmail.com,
	Poonam Aggrwal, Ashish Kumar, Ying Zhang, Alban Bedel,
	Srinivas Kandagatla

+Alban and Srinivas

On Wed, 6 Jun 2018 13:44:32 +0000
Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:

> Dear Borris,
> 
> > -----Original Message-----
> > From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> > Sent: Wednesday, June 6, 2018 12:53 PM
> > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> > Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam
> > Aggrwal <poonam.aggrwal@nxp.com>; Ashish Kumar
> > <ashish.kumar@nxp.com>; Ying Zhang <ying.zhang22455@nxp.com>
> > Subject: Re: Accessing mtd partitions from driver/i2c
> > 
> > Hi Prabhakar,
> > 
> > On Wed, 6 Jun 2018 05:02:47 +0000
> > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> >   
> > > Hi All,
> > >
> > > We have a requirement of using(read/write) one mtd partition from
> > > driver/i2c.
> > >
> > > As per my googling  mtd->_read, mtd->_write APIs has not been
> > > used  
> > anywhere other than driver/mtd layer.
> > 
> > It's used by at least one filesystem (JFFS2). And you should not
> > look for mtd-  
> > >_xxx() users but mtd_xxx() users. You should never access the mtd
> > >hooks  
> > directly but the wrappers that are exposed by the MTD API
> > (mtd_read(), mtd_write(), mtd_erase(), ...).
> >   
> 
> I can find it's usage in driver/firmware/ folder. Looks like it is
> using nvram.
> 
> > BTW, what's your use case? If it's about reading a piece of
> > information from a RO partition, then the work initiated by Alban
> > [1] and exposing some MTD parts are NVMEM providers should be a
> > better match. 
> 
> Currently, Linux has i2c slave framework. It is reading/writing to
> DDR emulated as EEPROM (drivers/i2c/i2c-slave-eeprom.c). We want
> something similar, where DDR will be replaced by MTD partitions for
> read/write. 

Then NVMEM is the solution you're looking for. Alban, Srinivas, can you
agree on something regarding the DT bindings so that we can finally get
this feature merged?

Thanks,

Boris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Accessing mtd partitions from driver/i2c
  2018-06-06 13:56     ` Boris Brezillon
@ 2018-06-07 11:50       ` Prabhakar Kushwaha
  2018-06-07 11:59         ` Boris Brezillon
  0 siblings, 1 reply; 6+ messages in thread
From: Prabhakar Kushwaha @ 2018-06-07 11:50 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: linux-mtd@lists.infradead.org, marek.vasut@gmail.com,
	Poonam Aggrwal, Ashish Kumar, Ying Zhang, Alban Bedel,
	Srinivas Kandagatla

Hi Boris,

> -----Original Message-----
> From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> Sent: Wednesday, June 6, 2018 7:26 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam Aggrwal
> <poonam.aggrwal@nxp.com>; Ashish Kumar <ashish.kumar@nxp.com>; Ying
> Zhang <ying.zhang22455@nxp.com>; Alban Bedel <albeu@free.fr>; Srinivas
> Kandagatla <srinivas.kandagatla@linaro.org>
> Subject: Re: Accessing mtd partitions from driver/i2c
> 
> +Alban and Srinivas
> 
> On Wed, 6 Jun 2018 13:44:32 +0000
> Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> 
> > Dear Borris,
> >
> > > -----Original Message-----
> > > From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> > > Sent: Wednesday, June 6, 2018 12:53 PM
> > > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> > > Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam
> > > Aggrwal <poonam.aggrwal@nxp.com>; Ashish Kumar
> > > <ashish.kumar@nxp.com>; Ying Zhang <ying.zhang22455@nxp.com>
> > > Subject: Re: Accessing mtd partitions from driver/i2c
> > >
> > > Hi Prabhakar,
> > >
> > > On Wed, 6 Jun 2018 05:02:47 +0000
> > > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> > >
> > > > Hi All,
> > > >
> > > > We have a requirement of using(read/write) one mtd partition from
> > > > driver/i2c.
> > > >
> > > > As per my googling  mtd->_read, mtd->_write APIs has not been used
> > > anywhere other than driver/mtd layer.
> > >
> > > It's used by at least one filesystem (JFFS2). And you should not
> > > look for mtd-
> > > >_xxx() users but mtd_xxx() users. You should never access the mtd
> > > >hooks
> > > directly but the wrappers that are exposed by the MTD API
> > > (mtd_read(), mtd_write(), mtd_erase(), ...).
> > >
> >
> > I can find it's usage in driver/firmware/ folder. Looks like it is
> > using nvram.
> >
> > > BTW, what's your use case? If it's about reading a piece of
> > > information from a RO partition, then the work initiated by Alban
> > > [1] and exposing some MTD parts are NVMEM providers should be a
> > > better match.
> >
> > Currently, Linux has i2c slave framework. It is reading/writing to DDR
> > emulated as EEPROM (drivers/i2c/i2c-slave-eeprom.c). We want something
> > similar, where DDR will be replaced by MTD partitions for read/write.
> 
> Then NVMEM is the solution you're looking for. Alban, Srinivas, can you agree
> on something regarding the DT bindings so that we can finally get this feature
> merged?
> 

Patch set[1] shared by you, only supports read. 
Can this framework also support write?

--pk

[1] https://patchwork.ozlabs.org/project/linux-mtd/list/?series=35728

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing mtd partitions from driver/i2c
  2018-06-07 11:50       ` Prabhakar Kushwaha
@ 2018-06-07 11:59         ` Boris Brezillon
  0 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2018-06-07 11:59 UTC (permalink / raw)
  To: Prabhakar Kushwaha
  Cc: linux-mtd@lists.infradead.org, marek.vasut@gmail.com,
	Poonam Aggrwal, Ashish Kumar, Ying Zhang, Alban Bedel,
	Srinivas Kandagatla

On Thu, 7 Jun 2018 11:50:51 +0000
Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:

> Hi Boris,
> 
> > -----Original Message-----
> > From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> > Sent: Wednesday, June 6, 2018 7:26 PM
> > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> > Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam Aggrwal
> > <poonam.aggrwal@nxp.com>; Ashish Kumar <ashish.kumar@nxp.com>; Ying
> > Zhang <ying.zhang22455@nxp.com>; Alban Bedel <albeu@free.fr>; Srinivas
> > Kandagatla <srinivas.kandagatla@linaro.org>
> > Subject: Re: Accessing mtd partitions from driver/i2c
> > 
> > +Alban and Srinivas
> > 
> > On Wed, 6 Jun 2018 13:44:32 +0000
> > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> >   
> > > Dear Borris,
> > >  
> > > > -----Original Message-----
> > > > From: Boris Brezillon [mailto:boris.brezillon@bootlin.com]
> > > > Sent: Wednesday, June 6, 2018 12:53 PM
> > > > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> > > > Cc: linux-mtd@lists.infradead.org; marek.vasut@gmail.com; Poonam
> > > > Aggrwal <poonam.aggrwal@nxp.com>; Ashish Kumar
> > > > <ashish.kumar@nxp.com>; Ying Zhang <ying.zhang22455@nxp.com>
> > > > Subject: Re: Accessing mtd partitions from driver/i2c
> > > >
> > > > Hi Prabhakar,
> > > >
> > > > On Wed, 6 Jun 2018 05:02:47 +0000
> > > > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> wrote:
> > > >  
> > > > > Hi All,
> > > > >
> > > > > We have a requirement of using(read/write) one mtd partition from
> > > > > driver/i2c.
> > > > >
> > > > > As per my googling  mtd->_read, mtd->_write APIs has not been used  
> > > > anywhere other than driver/mtd layer.
> > > >
> > > > It's used by at least one filesystem (JFFS2). And you should not
> > > > look for mtd-  
> > > > >_xxx() users but mtd_xxx() users. You should never access the mtd
> > > > >hooks  
> > > > directly but the wrappers that are exposed by the MTD API
> > > > (mtd_read(), mtd_write(), mtd_erase(), ...).
> > > >  
> > >
> > > I can find it's usage in driver/firmware/ folder. Looks like it is
> > > using nvram.
> > >  
> > > > BTW, what's your use case? If it's about reading a piece of
> > > > information from a RO partition, then the work initiated by Alban
> > > > [1] and exposing some MTD parts are NVMEM providers should be a
> > > > better match.  
> > >
> > > Currently, Linux has i2c slave framework. It is reading/writing to DDR
> > > emulated as EEPROM (drivers/i2c/i2c-slave-eeprom.c). We want something
> > > similar, where DDR will be replaced by MTD partitions for read/write.  
> > 
> > Then NVMEM is the solution you're looking for. Alban, Srinivas, can you agree
> > on something regarding the DT bindings so that we can finally get this feature
> > merged?
> >   
> 
> Patch set[1] shared by you, only supports read. 
> Can this framework also support write?

The NVMEM framework already supports write, you just need to add write
support to the nvmem -> MTD implementation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-07 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-06  5:02 Accessing mtd partitions from driver/i2c Prabhakar Kushwaha
2018-06-06  7:22 ` Boris Brezillon
2018-06-06 13:44   ` Prabhakar Kushwaha
2018-06-06 13:56     ` Boris Brezillon
2018-06-07 11:50       ` Prabhakar Kushwaha
2018-06-07 11:59         ` Boris Brezillon

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).