Problem writing to flash with writeb()
Gettert, Wolfram
Wolfram.Gettert at fci.com
Tue Nov 12 11:18:46 EST 2002
Hallo,
I try to identify my flash with manufacturer id and device id.
Because I am using the 2.2.18 kernel and I want to be portable I
use the physmap_read/writeX() functions. They are defined as followed.
void physmap_writeX(struct map_info *map, __u8 d, unsigned long adr)
{
__raw_writeX(d, map->map_priv_1 + adr);
mb();
}
In the 2.2.18 __rawreadb is not defined so I have done this.
#define __raw_readX readX
#define __raw_writeX writeX
Now I want to identify the flash doing this
volatile char *p;
u32 manufacturer, device;
physmap_map.map_priv_1 = (unsigned long)ioremap_nocache(WINDOW_ADDR,
WINDOW_SIZE);
...
//Read Manufacturer and Device code
physmap_write8(&physmap_map,0x90,physmap_map.map_priv_1);
manufacturer = physmap_read8(&physmap_map,0);
device = physmap_read8(&physmap_map,2);
printk("Manufacturer Code: 0x%x\n",manufacturer);
printk("Device Code: 0x%x\n",device);
The result in log is:
Manufacturer Code: 0xff
Device Code: 0xff
If I do it like this:
p = physmap_map.map_priv_1;
p[0] = 0x90;
printk("Manufacturer Code: 0x%x\n",p[0]);
printk("Device Code: 0x%x\n",p[2]);
The result in log is:
Manufacturer Code: 0xffffff98
Device Code: 0xffffff9c
That's what I expect. *p needs to declared as volatile to let this work.
But I want to use readb ... Any ideas?
Thanks
Wolfram
--
Wolfram Gettert
Software Engineer
Force Computers GmbH
- A Solectron Company -
Lilienthalstr. 15
D-85579 Neubiberg/München
Wolfram.Gettert_at_fci.com
www.forcecomputers.com
More information about the linux-mtd
mailing list