Subject: Re: Weird 5200/mtd-ram problem

From: Albrecht Dreß <[email-masked]>
Date: Mon, 25 May 2009 19:41:14 +0200

Hi Gary & Wolfram:

Thanks for youre help, and sorry for the late reply - I've been on  
vacation...

Am 20.05.09 21:59 schrieb(en) Gary Thomas:
> Try to access this without using the cache.

Unfortunately, this is not cache related - I switched the dcache off  
completely - same results.

Am 20.05.09 22:01 schrieb(en) Wolfram Sang:
> Does it work with byte, word and long accesses?

A word or long copy of 0x0055aaff with U-Boot works fine, but a byte  
copy filled the whole ram with 0x0000aaaa.  The reason is apparently  
that the chip is attached to the local bus in 16-bit mode, which is  
incompatible with byte accesses.  However, the Local Bus doesn't  
provide "low byte" or "high byte" indicators in non-muxed mode.  How is  
this supposed to work then?

For the mtd driver, I tracked down the problem via mapram_write() (in  
drivers/mtd/chips/map_ram.c) down to the call of map_copy_to() which is  
actually inline_map_copy_to(), which in turn calls memcpy_toio().  I  
*think* this is _memcpy_toio() in arch/powerpc/kernel/io.c, which  
copies all data in long (4-byte) moves, except for the last 4 bytes.  I  
guess I have to write my own copy function which respects the fact that  
byte writes actually must be a read word - modify - write word  
sequence, right?

Thanks, Albrecht.