From: "Jörn Engel" <joern@logfs.org>
To: Maxim Levitsky <maximlevitsky@gmail.com>
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 21:59:43 +0100 [thread overview]
Message-ID: <20091125205942.GF10944@logfs.org> (raw)
In-Reply-To: <1259165866.10147.35.camel@maxim-laptop>
On Wed, 25 November 2009 18:17:46 +0200, Maxim Levitsky wrote:
> On Wed, 2009-11-25 at 16:34 +0100, Jörn Engel wrote:
> >
> > 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.
Ok. I guess I won't buy a new notebook just to test a driver then.
> 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.
Yes. I've written the mtd driver for that one.
> > 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.
If you only ever want to use the device with the FTL on top, that is
perfectly acceptable. But it is an FTL restriction, not part of the
hardware. Apart from firmware bugs, of course.
> 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)
Some also had 256 or 512 blocks per zone. These days everything seems
to have 512+16 Byte sectors, 16 sectors per block, 1024 physical (1000
logical) blocks per zone and as many zones as the device can fit. Or at
least that was the case two years ago.
> > 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...
Iirc the number of bad blocks never changes. Either a block is
factory-marked or it will stay in use forever. A smart FTL could try to
store the erase count or the number of correctable/uncorrectable errors
for each block somewhere, but I don't believe it is done - or could be
done while staying compatible with the xD spec.
So that pretty much leaves the number of correctable/uncorrectable
errors currently on the device.
> > 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.
Right. I forgot about that one. In fact, I tried fairly hard to
forget. ;)
According to FMTP140E.PDF, CIS and IDI are stored in sector 0 or the
first non-defective block. In other words, it can be read and written
normally, without any magic. Certainly not the atrocities I tried not
to remember.
And even if there are some atrocities hidden, we can abtract them out in
the driver. When reading/writing block 0, just do the magic
transparently.
Jörn
--
There are two ways of constructing a software design: one way is to make
it so simple that there are obviously no deficiencies, and the other is
to make it so complicated that there are no obvious deficiencies.
-- C. A. R. Hoare
next prev parent reply other threads:[~2009-11-25 20:59 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
2009-11-25 20:59 ` Jörn Engel [this message]
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=20091125205942.GF10944@logfs.org \
--to=joern@logfs.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--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