[PATCH] mtd: Add partition device node to mtd partition devices

Boris Brezillon boris.brezillon at free-electrons.com
Thu Feb 9 12:41:38 PST 2017


On Thu, 9 Feb 2017 21:14:04 +0100
Uwe Kleine-König <u.kleine-koenig at pengutronix.de> wrote:

> Hello Boris,
> 
> On Thu, Feb 09, 2017 at 08:59:22PM +0100, Boris Brezillon wrote:
> > On Thu, 9 Feb 2017 20:39:40 +0100
> > Uwe Kleine-König <u.kleine-koenig at pengutronix.de> wrote:
> >   
> > > On Thu, Feb 09, 2017 at 04:34:58PM +0100, Boris Brezillon wrote:  
> > > > +Moritz
> > > > 
> > > > On Thu,  9 Feb 2017 11:50:24 +0100
> > > > Uwe Kleine-König <u.kleine-koenig at pengutronix.de> wrote:
> > > >     
> > > > > From: Sascha Hauer <s.hauer at pengutronix.de>
> > > > > 
> > > > > The user visible change here is that mtd partitions get an of_node link
> > > > > in sysfs.    
> > > > 
> > > > The same patch has already been posted last year [1].
> > > > Brian, can we take one of these?
> > > > 
> > > > [1]https://patchwork.ozlabs.org/patch/625978/    
> > > 
> > > Moritz' patch is more lame, it even updates the documentation (ok, one
> > > point for Moriz :-) Other than that the only difference is "node" vs.
> > > "of_node" (half a point for Sascha) and the position of the assignment
> > > in mtdpart.c has a different position (another half point for Sascha).
> > > 
> > > If that would be liked to be seen I can volunteer to create a patch
> > > picking the best from both sources.  
> > 
> > Sure, you can also add my ack (which I already put on Moritz patch).
> > BTW, is the of_node link in sysfs the only motivation for this change?
> > I know Moritz had bigger plans (nvmem blocks on top of MTD devices), and
> > I also considered advanced stuff (like per-partition ECC config) which
> > required having a valid ->of_node on slave MTD devices.  
> 
> The motivation for Sascha to create this patch and now me to mainline
> it, is that we specify some non-volatile state space in dts (to store
> for example hardware revision, serial number and mac addresses). See
> http://barebox.org/doc/latest/devicetree/bindings/barebox/barebox,state.html
> for some details.
> 
> For the userspace part we read the dtb, something like
> 
> 	state {
> 		compatible = "barebox,state";
> 		backend = &mtdstatepartition;
> 		...
> 	}
> 
> , and with the symlink introduced by the patch under discussion it gets
> much simpler to find the device file (in /dev) that contains our state
> data.

Okay. Looks like an advanced nvmem [1] implementation. Anyway, having
the of_node populated for MTD partition devs sounds reasonable, no
matter the reason you need that for.

[1]http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/nvmem/nvmem.txt



More information about the linux-mtd mailing list