mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: Alex Dubov <oakad@yahoo.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] MEMSTICK: Add driver for Ricoh R5C592 Card reader.
Date: Sun, 08 Aug 2010 18:07:24 +0300	[thread overview]
Message-ID: <1281280044.10030.27.camel@maxim-laptop> (raw)
In-Reply-To: <518887.35250.qm@web37604.mail.mud.yahoo.com>

On Sun, 2010-08-08 at 07:26 -0700, Alex Dubov wrote: 
> > Hi,
> > 
> > I have few more questions about memsticks.
> > 
> > First of all, I need an explanation of overwrite flag.
> > You already explained it to me once, but I still not sure
> > about few
> > things.
> 
> Overwrite register can be accessed either as part of extra data access
> or separately (CP_OVERWRITE access mode).
> 
> > 
> > #define MEMSTICK_OVERWRITE_UDST  0x10
> > This one I understand, thinking about xD again, I think it
> > is very
> > handy.
> > 
> > My idea (from xD of course) is that copyonwrite is done
> > this way:
> > 
> > 1. read old sector
> > 2. allocate new sector
> > 2. write what was just read to new sector.
> > 3. erase old sector.
> 
> This is correct.
> 
> > 
> > Could you explain when I need to set and reset the
> > MEMSTICK_OVERWRITE_UDST?
> 
> UDST flag should be set when you're marking the block for
> reallocation during the read/modify/write cycle. You read the existing
> physical block, mark it with UDST flag (setting it to zero), then write
> different physical block on behalf of the same logical one, then erase the
> original block. The UDST flag is supposed to guard against a situation,
> whereupon power fails during the write cycle and you're left with two
> physical blocks mapped to the same logical one (so the one marked with
> zero UDST value is supposedly "known good").

> 
> 
> > 
> > 
> > #define MEMSTICK_OVERWRITE_PGST1 0x20
> > #define MEMSTICK_OVERWRITE_PGST0 0x40
> > I suppose these indicate that page(sector) contains
> > incorrect data, just
> > like in xD there is page status?
> > Again, better explanation is welcome.
> > Also, should I touch that flag when I update sector?
> > 
> > 
> > 
> > #define MEMSTICK_OVERWRITE_BKST  0x80
> > This marks bad blocks?
> 
> BKST set to zero indicates that the whole block is bad and shouldn't be
> used.
> 
> PGST1:0 has several values:
> 11:  default, r/w page
> 10: reserved value, shouldn't be used
> 01: page is read-only (soft write-protect)
> 00: page is accessible, but the value is not guaranteed (faulty page that
> sort-of works)
> 
> That's what the spec says.

Thank you very much. 
> 
> > 
> > 
> > 
> > Another question is about write of oob data.
> > When I write it, overwrite flag is updated, or I need to
> > use
> > MEMSTICK_CP_OVERWRITE to update it?
> > I think former is true.
> 
> As I mentioned above, it can be accessed either as part of extra data
> or separately.
> 
> > 
> > When I write a sector, I just write 0 to management flag,
> > right?
> 
> You shouldn't touch management_flag at all, as far as I can tell.
> It's only used to indicate special purpose blocks, such as factory
> written boot blocks, volatile look-up table blocks (for systems with
> tight RAM requirements) and DRM marked blocks which I has no info about.
> 
> > 
> > 
> > And last question,
> > If I use MEMSTICK_CP_BLOCK, can I start reading a block
> > from non-zero
> > page offset?
> 
> Yes, it starts from the user specified page address and auto increments it
> until the current block end is hit.
> 
> > 
> > 
> > And surely last question, what is 'MS_CMD_BLOCK_END'
> 
> This command is used to terminate the currently ongoing block operation.
> If you are using one of the auto-increment modes (with CP_BLOCK set) but
> do not want to access all the pages until the block end, you must issue
> this command after the desired number of pages is transferred to return
> the media's state machine to the initial state. This command never hurts,
> as you can guess.
That what I expected, thanks! 
> 
> > 
> > 
> > Thanks again for all help so far,
> > 
> 
> You're welcome.

Thank you very much!

Best regards,
Maxim Levitsky


  reply	other threads:[~2010-08-08 15:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05  8:30 Alex Dubov
2010-08-05 11:20 ` Maxim Levitsky
2010-08-05 11:48   ` Alex Dubov
2010-08-05 12:30     ` Maxim Levitsky
2010-08-05 17:47       ` Maxim Levitsky
2010-08-06  7:43         ` Alex Dubov
2010-08-06 10:56           ` Maxim Levitsky
2010-08-07 13:15             ` Alex Dubov
2010-08-07 15:58               ` Maxim Levitsky
2010-08-08 13:31                 ` Alex Dubov
2010-08-06  8:01       ` Alex Dubov
2010-08-05 12:46 ` Maxim Levitsky
2010-08-06  7:59   ` Alex Dubov
2010-08-06 10:59     ` Maxim Levitsky
2010-08-07 13:12       ` Alex Dubov
2010-08-07 16:03         ` Maxim Levitsky
2010-08-08 13:33           ` Alex Dubov
2010-08-07 20:22 ` Maxim Levitsky
2010-08-08 14:26   ` Alex Dubov
2010-08-08 15:07     ` Maxim Levitsky [this message]
2010-08-08 20:08       ` Maxim Levitsky
2010-08-09  6:31         ` Alex Dubov
2010-08-09  6:56           ` Maxim Levitsky
2010-08-09 15:30           ` Maxim Levitsky
2010-08-10  8:12             ` Alex Dubov
2010-08-10  9:47               ` Maxim Levitsky
2010-08-11  8:08                 ` Alex Dubov
2010-08-11  8:32                   ` Maxim Levitsky
2010-08-12  7:22                     ` Alex Dubov
2010-08-12  7:58                       ` Maxim Levitsky
2010-08-12  7:27                     ` JMicron chipset update Alex Dubov
2010-08-09 19:19           ` [PATCH 2/2] MEMSTICK: Add driver for Ricoh R5C592 Card reader Maxim Levitsky
2010-08-10  7:53             ` Alex Dubov
2010-08-10  9:50               ` Maxim Levitsky
2010-08-11  8:16                 ` Alex Dubov
  -- strict thread matches above, loose matches on Subject: below --
2010-12-09  2:39 MEMSTICK: Add my 2 drivers Maxim Levitsky
2010-12-09  2:42 ` [PATCH 2/2] memstick: Add driver for Ricoh R5C592 card reader Maxim Levitsky
2010-08-03 14:53 [PATCH 0/2] Driver for Ricoh cardreader Maxim Levitsky
2010-08-03 14:53 ` [PATCH 2/2] MEMSTICK: Add driver for Ricoh R5C592 Card reader Maxim Levitsky
2010-08-04  7:57   ` Alex Dubov
2010-08-04 16:48     ` Maxim Levitsky
2010-08-04 19:31       ` Maxim Levitsky

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=1281280044.10030.27.camel@maxim-laptop \
    --to=maximlevitsky@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oakad@yahoo.com \
    /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

all inboxes | Powered by JetHome®