Skip to contentSkip to conversation

Please help, nftl question

DISCUSSION Luca Contini 2 participants 11 messages Jun 17, 2003 – Jun 30, 2003 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi all,
does anybody know wich is the role of the nftl in the nand flash driver stack?
I konw there ere for layers:
1. File system layer (e.g. JFFS2 or DOS-FAT)
2. MTD
3. Nand generic driver
4. Hardware specific driver

where can the nftl be located in the stack?
is nftl a filesystem or a low level driver?

thanx

Luca Contini
-------------------------------------------------------
Mediatech s.r.l.
System Engineer
Office: (+39) 070 2466 5503
Mobile: (+39) 328 911 6656
Fax: (+39) 070 2466 5111
[email protected]
URL: http://www.mediaenabling.com
--------------------------------------------------------

#1 lore raw
Quoted 10 lines · Luca Contini

Hi all,
does anybody know wich is the role of the nftl in the nand flash driver stack?
I konw there ere for layers:
1. File system layer (e.g. JFFS2 or DOS-FAT)
2. MTD
3. Nand generic driver
4. Hardware specific driver

where can the nftl be located in the stack?

You are confused about the file system layer.

See http://www.linux-mtd.infradead.org/tech/mtd-upper-layers.fig
(there's a JPEG for the xfig-challenged at
http://www.linux-mtd.infradead.org/~dwmw2/mtd-upper-layers.jpeg )

Atop the MTD layer there is _either_ a real file system such as JFFS2 or YAFFS, which uses MTD devices directly and presents itself as a file system to the operating system, or there can be a 'translation layer' which is a kind of pseudo-filesystem which pretends to be a standard disk drive. The translation layer could be FTL, NFTL, INFTL or the very simplistic 'mtdblock'. The translation layer registers a block device with the Linux block layer, and on top of that you can mount 'normal' file systems such as cramfs, ext3 and FAT (and all the others).

Also, you can access the 'translated' block devices through their device nodes (/dev/ftl*, /dev/nftl*, /dev/mtdblock*), and you can access the MTD devices directly to issue read/write/erase commands via the /dev/mtdX character device nodes.

See http://www.linux-mtd.infradead.org/tech/mtd-upper-layers.fig
(there's a JPEG for the xfig-challenged at
http://www.linux-mtd.infradead.org/~dwmw2/mtd-upper-layers.jpeg )

I've omitted the lower layers. The whole point of the MTD code is that you shouldn't need to consider the devices and the 'users' of those devices in the same breath. If you have a question about what's _below_ the 'Linux MTD layer' level, ask it separately. It's actually a little messier and more fluid.

Quoted 1 line

is nftl a filesystem or a low level driver?

No. :)

Signature · 1 line
dwmw2
#2 lore raw

Thank you David.
One more question: I want to put a vfat filesystem on top of nftl (actually i'd like to read from a smartmedia formatted with fat12 by a digital camera).
Should I create a dev node (e.g. nftla) using major number 93 (the one corresponding to nftl driver) and format this device befor mounting it? thank you very much again

Luca

----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Luca Contini" <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Tuesday, June 17, 2003 10:51 AM
Subject: Re: Please help, nftl question

Quoted 51 lines · Luca Contini
Quoted 10 lines

Hi all,
does anybody know wich is the role of the nftl in the nand flash driver stack?
I konw there ere for layers:
1. File system layer (e.g. JFFS2 or DOS-FAT)
2. MTD
3. Nand generic driver
4. Hardware specific driver

where can the nftl be located in the stack?

You are confused about the file system layer.

See http://www.linux-mtd.infradead.org/tech/mtd-upper-layers.fig
(there's a JPEG for the xfig-challenged at
http://www.linux-mtd.infradead.org/~dwmw2/mtd-upper-layers.jpeg )

Atop the MTD layer there is _either_ a real file system such as JFFS2 or YAFFS, which uses MTD devices directly and presents itself as a file system to the operating system, or there can be a 'translation layer' which is a kind of pseudo-filesystem which pretends to be a standard disk drive. The translation layer could be FTL, NFTL, INFTL or the very simplistic 'mtdblock'. The translation layer registers a block device with the Linux block layer, and on top of that you can mount 'normal' file systems such as cramfs, ext3 and FAT (and all the others).

Also, you can access the 'translated' block devices through their device nodes (/dev/ftl*, /dev/nftl*, /dev/mtdblock*), and you can access the MTD devices directly to issue read/write/erase commands via the /dev/mtdX character device nodes.

See http://www.linux-mtd.infradead.org/tech/mtd-upper-layers.fig
(there's a JPEG for the xfig-challenged at
http://www.linux-mtd.infradead.org/~dwmw2/mtd-upper-layers.jpeg )

I've omitted the lower layers. The whole point of the MTD code is that you shouldn't need to consider the devices and the 'users' of those devices in the same breath. If you have a question about what's _below_ the 'Linux MTD layer' level, ask it separately. It's actually a little messier and more fluid.

Quoted 1 line

is nftl a filesystem or a low level driver?

No. :)

--
dwmw2

#3 lore raw
Quoted 4 lines · Luca Contini

Thank you David.
One more question: I want to put a vfat filesystem on top of nftl (actually i'd like to read from a smartmedia formatted with fat12 by a digital camera).

A digital camera will not be using NFTL. NFTL is only used on the M-Systems DiskOnChip, and outside the Free World patents enforce that restriction.

You want the SmartMedia translation layer, which isn't yet implemented and merged, although I do believe I recall seeing code for it at one point. It would fit into the diagram I showed you alongside mtdblock, FTL, NFTL etc.

Signature · 1 line
dwmw2
#4 lore raw

Thanx,
so I have to modify the NFTL to comply with smartmedia fat format. I thought NFTL was a translation layer from smartmedia to CHS hdd like structure.

regards

----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Luca Contini" <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Wednesday, June 18, 2003 1:59 PM
Subject: Re: Please help, nftl question

Quoted 3 lines · Luca Contini
Quoted 2 lines

Thank you David.
One more question: I want to put a vfat filesystem on top of nftl

(actually

Quoted 19 lines
Quoted 2 lines

i'd like to read from a smartmedia formatted with fat12 by a digital camera).

A digital camera will not be using NFTL. NFTL is only used on the M-Systems DiskOnChip, and outside the Free World patents enforce that restriction.

You want the SmartMedia translation layer, which isn't yet implemented and merged, although I do believe I recall seeing code for it at one point. It would fit into the diagram I showed you alongside mtdblock, FTL, NFTL etc.

--
dwmw2

#5 lore raw
Quoted 4 lines · Luca Contini

Thanx,
so I have to modify the NFTL to comply with smartmedia fat format. I thought NFTL was a translation layer from smartmedia to CHS hdd like structure.

NFTL is a pseudo-filesystem used to emulate HDD-like structure on a DiskOnChip. You need to implement an _entirely_ separate pseudo-filesystem to emulate HDD-like structure on SmartMedia. The layout on the flash and all the data-structures are _entirely_ different.

Signature · 1 line
dwmw2
#6 lore raw

Hi,
can You please check whether my diagram is correct or not? Can you please suggest me some paper to read about fat on smartmedia and linux?
I would really appreciate that
thanx

Luca

----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Luca Contini" <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Friday, June 20, 2003 11:42 AM
Subject: Re: Please help, nftl question

Quoted 17 lines · Luca Contini
Quoted 4 lines

Thanx,
so I have to modify the NFTL to comply with smartmedia fat format. I thought NFTL was a translation layer from smartmedia to CHS hdd like structure.

NFTL is a pseudo-filesystem used to emulate HDD-like structure on a DiskOnChip. You need to implement an _entirely_ separate pseudo-filesystem to emulate HDD-like structure on SmartMedia. The layout on the flash and all the data-structures are _entirely_ different.

--
dwmw2

#8 lore raw
In reply to a message not in the archive

Hi,
which is difference between nftlcore and nftlmount ?
What kind of functions should SFTL export so that a filesystem can be put on?

regards

Luca

----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Luca Contini" <[email protected]>
Cc: "Barone Tonino" <[email protected]>
Sent: Thursday, June 26, 2003 11:15 AM
Subject: Re: Please help, nftl question

Quoted 26 lines · Luca Contini
Quoted 2 lines

Hi,
can You please check whether my diagram is correct or not?

Your diagram looks correct except that you've drawn arrows on it.

Those arrows represent only _one_ of the many ways in which it can be used. If writing the SmartMedia 'SFTL' code, please don't do it while thinking about FAT or about any specific hardware driver. It should work with _any_ file system or hardware.

Quoted 2 lines

Can you please suggest me some paper to read about fat on smartmedia and linux?

Ignore FAT for the moment; it's not relevant.

See http://www.ssfdc.or.jp/english/common/f_spec_down.htm

Ignore the 'Logical Format Specifications' and look at the 'Physical Format Specifications'.

--
dwmw2

#9 lore raw
Quoted 2 lines · Luca Contini

Hi,
which is difference between nftlcore and nftlmount ?

nftlmount is the code which does and examines a flash device, looking for signs of the NFTL format on it, and then builds up all the relevant data structures for the NFTL code.

nftlcore is the code which actually handles read/write access to the translation layer.

You don't really need to worry about this -- it just seemed slightly nicer to split it NFTL two files. FTL and mtdblock are not split.

Quoted 2 lines

What kind of functions should SFTL export so that a filesystem can be put on?

You need to provide a 'struct mtd_blktrans_ops', as defined in include/mtd/blktrans.h and implemented in mtdblock.c

Don't look at NFTL, it'll just confuse you. Look at mtdblock.c instead.

Take a copy of it, make the read and write functions just return errors. Add code to your 'add_mtd' routine to go and check for a valid SmartMedia TL on any device which is added. Then make the read function work properly -- finding the appropriate part of the flash containing whichever 'logical' block number is requested, and reading it.

Then move on to writing...

Signature · 1 line
dwmw2
#10 lore raw

Hi David,
thank you very much for your help.
Things are definitely much clear now.
I'v been looking for 'struct mtd_blktrans_ops' but with no result. Also for "include/mtd/blktrans.h" that I suppose is "include/linux/mtd/blktrans.h", but I can't find any "blktrans.h". Right now I'm trying to understand the code for mtdblock.

Regards

Luca

----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Luca Contini" <[email protected]>
Cc: "[email protected]" <[email protected]>; "Barone Tonino" <[email protected]>
Sent: Friday, June 27, 2003 10:16 AM
Subject: Re: Please help, nftl question

Quoted 8 lines · Luca Contini
Quoted 2 lines

Hi,
which is difference between nftlcore and nftlmount ?

nftlmount is the code which does and examines a flash device, looking for signs of the NFTL format on it, and then builds up all the relevant data structures for the NFTL code.

Quoted 7 lines

nftlcore is the code which actually handles read/write access to the translation layer.

You don't really need to worry about this -- it just seemed slightly nicer to split it NFTL two files. FTL and mtdblock are not split.

Quoted 1 line

What kind of functions should SFTL export so that a filesystem can be

put

Quoted 21 lines
Quoted 1 line

on?

You need to provide a 'struct mtd_blktrans_ops', as defined in include/mtd/blktrans.h and implemented in mtdblock.c

Don't look at NFTL, it'll just confuse you. Look at mtdblock.c instead.

Take a copy of it, make the read and write functions just return errors. Add code to your 'add_mtd' routine to go and check for a valid SmartMedia TL on any device which is added. Then make the read function work properly -- finding the appropriate part of the flash containing whichever 'logical' block number is requested, and reading it.

Then move on to writing...

--
dwmw2

#11 lore raw

it.
stop
Please

understand.
to
difficult
hence
and
top-posting
are
You

CVS.
in
is
want
you
file
The

Signature · 1 line
dwmw2