jffs2+mtd+big endian problem

David Woodhouse dwmw2 at infradead.org
Tue Jan 20 02:32:49 EST 2004


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?

-- 
dwmw2





More information about the linux-mtd mailing list