All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Yang <leoli@motorola.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Subject: Re: jffs2+mtd+big endian problem
Date: 04 Feb 2004 16:11:23 +0800	[thread overview]
Message-ID: <1075882281.14564.108.camel@Gundam> (raw)
In-Reply-To: <1074583969.14499.100.camel@imladris.demon.co.uk>

On Tue, 2004-01-20 at 15:32, David Woodhouse wrote:
> On Tue, 2004-01-20 at 12:20 +0800, Li Yang wrote:
> > > This sounds like you're using byte-swapping operations in your map
> > > driver. You should be using __raw_write*() not write*(). You said you
> > > were 'at the very beginning'... are you still doing that now?
> > 
> > I have verified my maps/ file.  I'm using __raw_write*() now.  Here is
> > part of my maps file, I don't know if the memcpy_toio() matters.
> 
> It doesn't -- it'll never get used. All you need are read32, write32 and
> copy_from. Try this...
>                                                                       
> __u32 ads_read32(struct map_info *map, unsigned long ofs)
> {
>         return *(volatile __u32 *)(map->map_priv_1 + ofs);
> }
>                                                                                                        
> void ads_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
> {
>         memcpy(to, (void *)(map->map_priv_1 + from), len);
> }
>                                                                                                        
> void ads_write32(struct map_info *map, __u32 d, unsigned long adr)
> {
>         *(volatile __u32 *)(map->map_priv_1 + adr) = d;
>         mb();
> }
>  
> 
> Did you try reading and writing chunks of 1, 2 and 4 bytes directly
> to/from /dev/mtd0?

It's very strange even when I use the complex mapping as you given above
the write is still 32bit swapped.  And I tried writing 1, 2 and 4 bytes
using cp.  For block device, write is successful but still swapped.  For
char device, the following error message is given.

# cp u16 /dev/mtd1
MTD_open
MTD_ioctl
Invalid ioctl 402c7413 (MEMGETINFO = 40204d01)
MTD_write
MTD_close
# cp u16 /dev/mtdblock1
mtdblock_open
ok
mtdblock: read on "JFFS" at 0x0, size 0x200
mtdblock: write on "JFFS" at 0x0, size 0x200
mtdblock_release
mtdblock: writing cached data for "JFFS" at 0x0, size 0x40000
ok
#


-- 
Li Yang <leoli@motorola.com>
Metrowerks

  reply	other threads:[~2004-02-04  8:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-19  8:43 jffs2+mtd+big endian problem Li Yang-r58472
2004-01-19  9:17 ` David Woodhouse
2004-01-19  9:48   ` Joakim Tjernlund
2004-01-19 10:58   ` Li Yang
2004-01-19 11:04     ` David Woodhouse
2004-01-20  4:20       ` Li Yang
2004-01-20  7:32         ` David Woodhouse
2004-02-04  8:11           ` Li Yang [this message]
2004-02-05  3:07           ` Li Yang
2004-02-05  7:00             ` David Woodhouse
2004-02-05  9:02               ` Li Yang
2004-02-05  9:27                 ` David Woodhouse
2004-02-05  9:59                   ` Li Yang

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=1075882281.14564.108.camel@Gundam \
    --to=leoli@motorola.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.