public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC] sysfs support for mtd
@ 2007-07-18 18:45 Siddharth Choudhuri
  2007-07-19  7:02 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Siddharth Choudhuri @ 2007-07-18 18:45 UTC (permalink / raw)
  To: linux-mtd

Hi,

I have added a sysfs support for mtd. There was an
earlier discussion some time back
(http://lists.infradead.org/pipermail/linux-mtd/2006-December/016952.html)
about adding sysfs support for mtd.

Here's the design:
o Each mtd partition appears as a directory under 
/sys/devices/mtd/ 
o The following fields from struct mtd_info are
exported as files - eccsize, ecctype, erasesize,
numeraseregions, oobsize, size, type, writesize. 

--------------
Eg: 
# ls -l /sys/devices/mtd
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd0
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd1
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd2
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd3
# ls -l /sys/devices/mtd/mtd0/
-r--r--r--    1 root     root         4096 Jan  1
00:00 bbt
-r--r--r--    1 root     root         4096 Jan  1
00:00 eccsize
-r--r--r--    1 root     root         4096 Jan  1
00:00 ecctype
-r--r--r--    1 root     root         4096 Jan  1
00:00 erasesize
-r--r--r--    1 root     root         4096 Jan  1
00:00 numeraseregions
-r--r--r--    1 root     root         4096 Jan  1
00:00 oobsize
-r--r--r--    1 root     root         4096 Jan  1
00:00 size
-r--r--r--    1 root     root         4096 Jan  1
00:00 type
-r--r--r--    1 root     root         4096 Jan  1
00:00  writesize
# cat /sys/devices/mtd/mtd0/oobsize 
64
-----------

I would like to get some suggestions from the group
before sending out a patch:
o Currently the fields type, ecctype are integers.
Should these be converted into appropriate strings as
per #defines from mtd-abi.h
Eg: cat /sys/devices/mtd/mtd0/type 
shows 4. Should this show MTD_NANDFLASH instead ? 

o I am not sure where an additional link from bus to
mtd should be added in the sysfs hierarchy. Should it
be /sys/bus/platform/devices -> ../../../devices/mtd
-OR-
/sys/bus/platform/ -> ../../devices/mtd 

o Any other comments/suggestions. 

thanks,
-sid












       
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

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

* Re: [RFC] sysfs support for mtd
  2007-07-18 18:45 [RFC] sysfs support for mtd Siddharth Choudhuri
@ 2007-07-19  7:02 ` Artem Bityutskiy
  2007-07-20  0:17   ` Siddharth Choudhuri
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2007-07-19  7:02 UTC (permalink / raw)
  To: Siddharth Choudhuri; +Cc: linux-mtd

On Wed, 2007-07-18 at 11:45 -0700, Siddharth Choudhuri wrote:
> Here's the design:
> o Each mtd partition appears as a directory under 
> /sys/devices/mtd/ 
> o The following fields from struct mtd_info are
> exported as files - eccsize, ecctype, erasesize,
> numeraseregions, oobsize, size, type, writesize.
I doubt OOB-related stuff has to be exposed. We see many new flash
controllers which do not let you access OOB. It is better to avoid OOB
usage altogether, so I would not even exposed that stuff in sysfs.


> I would like to get some suggestions from the group
> before sending out a patch:
> o Currently the fields type, ecctype are integers.
> Should these be converted into appropriate strings as
> per #defines from mtd-abi.h
> Eg: cat /sys/devices/mtd/mtd0/type 
> shows 4. Should this show MTD_NANDFLASH instead ?
I think yes, it should be something like "NAND", "OneNAND", "NOR",
"DataFlash", etc.

> o I am not sure where an additional link from bus to
> mtd should be added in the sysfs hierarchy. Should it
> be /sys/bus/platform/devices -> ../../../devices/mtd
> -OR-
> /sys/bus/platform/ -> ../../devices/mtd 
No idea, but I've always thought sysfs core automatically puts these
links. All you have to do is to define your bus object which is
"platform" bus, and the stuff will appear. Although I am not sure.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [RFC] sysfs support for mtd
  2007-07-19  7:02 ` Artem Bityutskiy
@ 2007-07-20  0:17   ` Siddharth Choudhuri
  0 siblings, 0 replies; 3+ messages in thread
From: Siddharth Choudhuri @ 2007-07-20  0:17 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd


> > o I am not sure where an additional link from bus
> to
> > mtd should be added in the sysfs hierarchy. Should
> it
> > be /sys/bus/platform/devices ->
> ../../../devices/mtd
> > -OR-
> > /sys/bus/platform/ -> ../../devices/mtd 
> No idea, but I've always thought sysfs core
> automatically puts these
> links. All you have to do is to define your bus
> object which is
> "platform" bus, and the stuff will appear. Although
> I am not sure.
>  
Thanks for the suggestions. I added a link from
/sys/bus/platform/devices/mtd -> /sys/devices/mtd.
Link can be created in sysfs using a call to
sysfs_create_link() function.

I will send a patch after coding the suggestions and
running a few more tests. 

-sid



       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/

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

end of thread, other threads:[~2007-07-20  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 18:45 [RFC] sysfs support for mtd Siddharth Choudhuri
2007-07-19  7:02 ` Artem Bityutskiy
2007-07-20  0:17   ` Siddharth Choudhuri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox