[PATCH v1] mtd: core: add sysfs nodes for querying the flash name and id

Boris Brezillon boris.brezillon at collabora.com
Tue Apr 2 05:01:41 PDT 2019


On Tue, 2 Apr 2019 19:06:37 +0800
Zhuohao Lee <zhuohao at chromium.org> wrote:

> On Tue, Apr 2, 2019 at 4:26 PM Vignesh Raghavendra <vigneshr at ti.com> wrote:
> >
> >
> >
> > On 02/04/19 1:26 PM, Boris Brezillon wrote:  
> > > On Tue, 2 Apr 2019 15:39:54 +0800
> > > Zhuohao Lee <zhuohao at chromium.org> wrote:
> > >  
> > >> Thanks Boris for the comment. Please take a look the reply at below.
> > >>
> > >> On Mon, Apr 1, 2019 at 5:27 PM Boris Brezillon
> > >> <boris.brezillon at collabora.com> wrote:  
> > >>>
> > >>> On Thu, 28 Mar 2019 12:59:10 +0800
> > >>> Zhuohao Lee <zhuohao at chromium.org> wrote:
> > >>>  
> > >>>> Currently, we don't have sysfs nodes for querying the underlying flash
> > >>>> name and flash id. This information is important especially when we
> > >>>> want to know the flash detail of the defective system. In order to
> > >>>> support the query, we add two pointers (*flashname, *id) into the
> > >>>> mtd_info structure and create two sysfs nodes (flashname, id). This
> > >>>> patch is modified based on the SPI-NOR flash system as we only have
> > >>>> that system now. But the idea should be applied to the other flash
> > >>>> driver like NAND flash.
> > >>>>
> > >>>> The output of new sysfs nodes on my device are:
> > >>>> cat /sys/devices/platform/soc/11010000.spi/spi_master/spi1/spi1.0/mtd/mtd0/flashname
> > >>>> w25q64dw
> > >>>> cat /sys/devices/platform/soc/11010000.spi/spi_master/spi1/spi1.0/mtd/mtd0/id
> > >>>> ef6017  
> > >>>
> > >>> I'm not sure I like the idea of exposing this kind of info through
> > >>> sysfs as it then makes part of the ABI. Did you consider exposing that
> > >>> through debugfs?  
> > >>
> > >> Yes, i did consider the debugfs. I think the debugfs is depended on
> > >> CONFIG_DEBUG_FS.
> > >> If removing that config, the partname and partid will be lost. So, i
> > >> proposed to use
> > >> sysfs.  
> > >
> > > Then just enable debugfs if you need this information :P.  
> My original intention is adding the new sysfs nodes (i.e partname and
> partid) into the common place like mtdcore.c
> so that the userspace program can just read the common sysfs nodes.
> So far, what i can contribute is for the spi-nor but if the other
> flash drivers, like nand-flash, can also support
> the partname and partid query, then, we can have common sysfs nodes to
> query the underlying device info.
> Compare to the debugfs, i think different drivers may have different
> name for the partname and partid.

We've recently unified how MTD related stuff are exposed through
debugfs and you can now have generic MTD fields exposed there.



More information about the linux-mtd mailing list