* Problem writing to flash with writeb()
@ 2002-11-12 16:18 Gettert, Wolfram
0 siblings, 0 replies; 4+ messages in thread
From: Gettert, Wolfram @ 2002-11-12 16:18 UTC (permalink / raw)
To: 'linux-mtd@lists.infradead.org'
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem writing to flash with writeb()
@ 2002-11-12 19:02 J B
2002-11-12 19:26 ` David Woodhouse
0 siblings, 1 reply; 4+ messages in thread
From: J B @ 2002-11-12 19:02 UTC (permalink / raw)
To: Wolfram.Gettert, linux-mtd
> 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);
Are you sure you want to pass physmap_map.map_priv_1 as the address? That
would imply that the address you are writing 0x90 to is (2 *
physmap_map.map_priv_1) because physmap_writeX will add map->map_priv_1 to
whatever address you pass it. If that is bigger than WINDOW_SIZE, I don't
think the command will actually reach the flash chip because the address
isn't mapped to a flash chip. I am assuming you are using a cfi compliant
flash chip and 0x90 is putting it into "Read Identifier Codes". Try using 0
for the address instead, which is what you did below.
>If I do it like this:
>
> p = physmap_map.map_priv_1;
> p[0] = 0x90;
Looks like this is the equivalent of:
physmap_write8(&physmap_map,0x90,0);
I could be very wrong however. I still consider myself a newbie, so sorry
if this doesn't make any sense. Hope it helps though.
Josh
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem writing to flash with writeb()
2002-11-12 19:02 Problem writing to flash with writeb() J B
@ 2002-11-12 19:26 ` David Woodhouse
0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2002-11-12 19:26 UTC (permalink / raw)
To: J B; +Cc: Wolfram.Gettert, linux-mtd
mad_flasher@hotmail.com said:
> Looks like this is the equivalent of: physmap_write8(&physmap_map,0x90
> ,0);
It does. Show disassembly of each version.
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Problem writing to flash with writeb()
@ 2002-11-13 8:12 Gettert, Wolfram
0 siblings, 0 replies; 4+ messages in thread
From: Gettert, Wolfram @ 2002-11-13 8:12 UTC (permalink / raw)
To: 'linux-mtd@lists.infradead.org'
Thanks for the hint.
I was really blind.
Wolfram
> -----Original Message-----
> From: J B [mailto:mad_flasher@hotmail.com]
> Sent: Dienstag, 12. November 2002 20:02
> To: Wolfram.Gettert@fci.com; linux-mtd@lists.infradead.org
> Subject: Re: Problem writing to flash with writeb()
>
>
>
> > 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);
>
> Are you sure you want to pass physmap_map.map_priv_1 as the
> address? That
> would imply that the address you are writing 0x90 to is (2 *
> physmap_map.map_priv_1) because physmap_writeX will add
> map->map_priv_1 to
> whatever address you pass it. If that is bigger than
> WINDOW_SIZE, I don't
> think the command will actually reach the flash chip because
> the address
> isn't mapped to a flash chip. I am assuming you are using a
> cfi compliant
> flash chip and 0x90 is putting it into "Read Identifier
> Codes". Try using 0
> for the address instead, which is what you did below.
>
> >If I do it like this:
> >
> > p = physmap_map.map_priv_1;
> > p[0] = 0x90;
>
> Looks like this is the equivalent of:
> physmap_write8(&physmap_map,0x90,0);
>
>
> I could be very wrong however. I still consider myself a
> newbie, so sorry
> if this doesn't make any sense. Hope it helps though.
>
>
> Josh
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-11-13 7:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-12 19:02 Problem writing to flash with writeb() J B
2002-11-12 19:26 ` David Woodhouse
-- strict thread matches above, loose matches on Subject: below --
2002-11-13 8:12 Gettert, Wolfram
2002-11-12 16:18 Gettert, Wolfram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox