Skip to contentSkip to conversation

Finding flash type...

DISCUSSION Siddharth Choudhuri 4 participants 8 messages Nov 29, 2006 – Dec 6, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

Is it possible to know what kind of flash (NOR type or NAND type) is installed on a system ? (may be using lsmod -or- cat /proc/ksyms | grep ? )

thanks,
-siddharth

____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

#1 lore raw
Quoted 3 lines · Siddharth Choudhuri

Is it possible to know what kind of flash (NOR type or NAND type) is installed on a system ? (may be using lsmod -or- cat /proc/ksyms | grep ? )

There is an ioctl (MEMGETINFO) that provides information on the type of flash memory among other info about the device. It is used by the mtd_debug utility which is part of the mtd-utils package, which dumps the information in human-readable form.

You can otherwise guess by checking the erasesize provided by
cat /proc/mtd, comparing the erasesize against expected erase sizes for the devices you expect to find. As a general solution this doesn't work well though.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

#2 lore raw
In reply to Siddharth Choudhuri
Quoted 5 lines · Siddharth Choudhuri

Hi,

Is it possible to know what kind of flash (NOR type or NAND type) is installed on a system ? (may be using lsmod -or- cat /proc/ksyms | grep ? )

It would be ideal if somebody added sysfs support to MTD. Then you could just look at sysfs and find it out. Now you should use ioctl's.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#3 lore raw
Quoted 5 lines · --- Artem Bityutskiy

It would be ideal if somebody added sysfs support to MTD. Then you could
just look at sysfs and find it out. Now you should use ioctl's.

I could start adding the sysfs support to reflect flash type. I have the following questions though:

1. Should the information be exported in the /sys/block/mtd* directory ? The other place would be /sys/class/mtd*.

2. Should any other information be also exported ? The mtd_info_user structure [include/mtd-abi.h] has additional fields that might be useful - size, erasesize, oobblock(if present) ?

Any suggestions, pointers would be great.

thanks,
-siddharth

____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

#4 lore raw
Quoted 6 lines · Siddharth Choudhuri
Quoted 5 lines · --- Artem Bityutskiy

It would be ideal if somebody added sysfs support to MTD. Then you could
just look at sysfs and find it out. Now you should use ioctl's.

Quoted 6 lines

I could start adding the sysfs support to reflect flash type. I have the following questions though:

1. Should the information be exported in the /sys/block/mtd* directory ? The other place would be /sys/class/mtd*.

/sys/class/mtd would be preferable. MTD isn't a block driver, so it doesn't really belong under block.

Quoted 4 lines

2. Should any other information be also exported ? The mtd_info_user structure [include/mtd-abi.h] has additional fields that might be useful - size, erasesize, oobblock(if present) ?

Yes, most of mtd_info_user would be good to export.

josh

#5 lore raw
Quoted 6 lines · Josh Boyer
Quoted 4 lines

2. Should any other information be also exported ? The mtd_info_user structure [include/mtd-abi.h] has additional fields that might be useful - size, erasesize, oobblock(if present) ?

Yes, most of mtd_info_user would be good to export.

For NAND flash chips I think it would also be nice to get a list of bad blocks. This can be most useful when debugging.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

#6 lore raw
Quoted 2 lines · Ricard Wanderlof

For NAND flash chips I think it would also be nice to get a list of bad blocks. This can be most useful when debugging.

Yeah. Once sysfs support is there we could export many useful information without need to call these syscalls.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#7 lore raw
In reply to Josh Boyer
Quoted 4 lines · Josh Boyer
Quoted 3 lines

1. Should the information be exported in the /sys/block/mtd* directory ? The other place would be /sys/class/mtd*.

I am unsure it is /sys/class/. For MTD devices we should probably have full device/driver/bus support so it'll go
at /sys/devices, /sys/drivers/, /sys/bus. In case of MTD the bus is so called "platform" bus. Please, refer to linux device drivers v3.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)