The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: "Jörn Engel" <joern@logfs.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Alex Dubov <oakad@yahoo.com>,
	arnd@arndb.de, tglx@linutronix.de
Subject: Re: Plan for adding XD support in mtd layer
Date: Wed, 25 Nov 2009 18:17:46 +0200	[thread overview]
Message-ID: <1259165866.10147.35.camel@maxim-laptop> (raw)
In-Reply-To: <20091125153458.GC10944@logfs.org>

On Wed, 2009-11-25 at 16:34 +0100, Jörn Engel wrote: 
> Hello Maxim
> 
> On Wed, 25 November 2009 15:20:58 +0200, Maxim Levitsky wrote:
> >
> > Currently jmicron support is found in aspire one.
> > My acer has ricoh device I know how works.
> 
> Those are card readers built into notebooks, right?  How are they
> attached?  Via PCI or USB?
Mostly in notebooks.
External readers usually implement standard mass-storage protocol.

They are usually PCI , however some USB devices work the same, for
example
alluda device that currently has two drivers in the kernel, one mtd for
raw access, and another self-contained USB driver that does FTL and
exposes device as an SCSI device.

> 
> > Other that work of Alex Dubov, I need to write the code, but I don't
> > want to repeat his mistake and write code that isn't accepted on basis
> > of lack for fitness in existing subsystems.
> 
> 
> > > > -> I need new mtd_info member for at least for card identification, and
> > > > will be nice to have zone/block/page size
> > > > This will be used by FTL and mtdchar to be exported to user space
> > > 
> > > Block and page size already exist as mtd->erasesize and mtd->writesize
> > > respectively.  I'm not sure whether the zone size should become part of
> > > the mtd interface - it looks more like a property of the ftl.
> > You didn't understand me.
> > I can't nether write nor erase individual blocks (writing is technically
> > possible, but is disallowed by recent XD spec (this is what Alex Dubov
> > says)
> > 
> > However I can _read_ individual sectors
> > sector is 512 bytes, block is usually around 32 sectors.
> 
> It has been a while since I looked at the spec, but I believe there are
> two parts to it.  The flash hardware allows block erases, sector reads
> and sector writes.  On top of that you have the FTL that adds further
> restrictions.
if this is the case, then no problems.
Alex said something about firmware bugs though, that I belive is
connected to raw block writes.

I also know that driver for my ricoh based controller does always block
based cow writes.

when I say block I mean area that can be erased independently, and it
consists of several 512 byte sectors.
(Very old incarnation of smartmedia format had 256 byte sectors that
were tied together in pairs)

> 
> If you use you xD card without the FTL, as a raw MTD device, you can do
> almost anything you want.  Format it with JFFS2, for example.  But if
> used _with_ the FTL, that card now has a corrupt format and may be
> unusable.
> 
> Or is the FTL already implemented in the card reader hardware?
No, I have to implement it.
And yes, XD can give ready to use testing ground for flash based file
systems, like JFFS2.

> 
> > > What userspace programs would need this information?  I can imagine some
> > > sort of xd_format or mkxd in case the card has been corrupted or used
> > > raw.  Anything else?
> > 
> > I can imagine a format application, a rescue application, and an debug
> > application that will show how healthy is the card.
> 
> Format and rescue certainly make sense.  I'm not sure how a debug
> application would measure the health, but maybe that's possible as well.
I can count bad sectors, ecc corrected sectors, see how many spares
remain in each block, etc...

> 
> > There are actually two pieces of the data.
> > One is an ID, a serial number that can be used for example by udev for
> > permanent mapping.
> 
> Ok, makes sense.
> 
> > Other is the media type, and this has to be used to know the sizes of
> > sectors, zones, pages, how many spares there are etc...
> 
> That would be available when using mtdchar or mtdblock to read the
> device.  Which ought to be enough for format, rescue and debug, I
> believe.

Yes this is enough, but how I expose media type in the mtd driver, there
is a field for that I missed?

And same question for the ID.

Note that media type /ID is _not_ stored on the media (well it is but is
not accessible that way)
There is need for special command to read it from the device.

> 
> > ECC corecting will be done in the base mtd driver, but userspace
> > application will be able to determine if block is good or bad.
> > If it is good, it can use oob information to determine of ECC correction
> > was applied or not, and report overall health of the card.
> 
> With mtdchar it is possible to do ECC correction in userspace as well.
> Not that I would consider it a good idea, but the information is
> certainly available and can be controlled if a compelling reason can be
> found.
Exactly.


Best regards,
Maxim Levitsky


  reply	other threads:[~2009-11-25 16:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-21  0:25 XD/smartmedia - how to implement it right? Maxim Levitsky
2009-11-21 10:25 ` Jörn Engel
2009-11-22 12:58   ` Maxim Levitsky
2009-11-24 23:50     ` Plan for adding XD support in mtd layer Maxim Levitsky
2009-11-25 10:40       ` Jörn Engel
2009-11-25 13:20         ` Maxim Levitsky
2009-11-25 15:34           ` Jörn Engel
2009-11-25 16:17             ` Maxim Levitsky [this message]
2009-11-25 20:59               ` Jörn Engel
2009-11-25 23:22                 ` Maxim Levitsky
2009-11-26  8:27                   ` Jörn Engel
2009-11-26 13:02                     ` Maxim Levitsky
2009-11-26 13:42                       ` Jörn Engel
2009-11-26 21:38                         ` Maxim Levitsky
2009-11-28  7:22   ` XD/smartmedia - how to implement it right? Alex Dubov
2009-11-28 10:36     ` Maxim Levitsky
2009-11-30 12:35       ` Alex Dubov
2009-11-30 13:58         ` Maxim Levitsky
2009-11-30 23:04           ` Maxim Levitsky
2009-12-01  8:22             ` Jörn Engel
2009-12-01 16:10               ` Alex Dubov
2009-12-01 16:41                 ` Maxim Levitsky
2009-12-11 23:48               ` Maxim Levitsky
2009-12-05 19:09           ` Pavel Machek
2009-12-06 21:27             ` Maxim Levitsky
2009-12-07 15:13               ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259165866.10147.35.camel@maxim-laptop \
    --to=maximlevitsky@gmail.com \
    --cc=arnd@arndb.de \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oakad@yahoo.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox