[#5790] Cannot read flash under Linux
Submitted By: Jie Zhang
Open Date
2009-12-23 22:59:44 Close Date
2009-12-24 03:34:06
Priority:
Medium Assignee:
Barry Song
Status:
Closed Fixed In Release:
N/A
Found In Release:
snaps Release:
Category:
N/A Board:
STAMP
Processor:
BF533 Silicon Revision:
0.3
Is this bug repeatable?:
Yes Resolution:
Rejected
Uboot version or rev.:
Latest trunk Toolchain version or rev.:
Latest trunk
App binary format:
N/A
Summary: Cannot read flash under Linux
Details:
$ cat t.c
#include <stdio.h>
int main ()
{
unsigned char *p = (unsigned char *) 0x20000000;
printf ("0x20000000: %02x %02x %02x %02x\n", p[0], p[1], p[2], p[3]);
return 0;
}
$ bfin-uclinux-gcc -o t t.c
Then run t under Linux on bf533-stamp, the output is not expected. Just random values.
The expected result, as on bf537-stamp, is
root:/> ./t
0x20000000: 0e e1 ec 0f
root:/>
Follow-ups
--- Barry Song 2009-12-24 01:47:21
not a bug for 533 nor flash. 533 is sharing flash with network card. When kernel
access it, it need
static void switch_to_flash(struct async_state *state)
{
local_irq_save(state->irq_flags);
gpio_set_value(state->enet_flash_pin, 0);
state->save_ambctl0 = bfin_read_EBIU_AMBCTL0();
state->save_ambctl1 = bfin_read_EBIU_AMBCTL1();
bfin_write_EBIU_AMBCTL0(state->flash_ambctl0);
bfin_write_EBIU_AMBCTL1(state->flash_ambctl1);
SSYNC();
}
After accessing, it will release:
static void switch_back(struct async_state *state)
{
bfin_write_EBIU_AMBCTL0(state->save_ambctl0);
bfin_write_EBIU_AMBCTL1(state->save_ambctl1);
SSYNC();
gpio_set_value(state->enet_flash_pin, 1);
local_irq_restore(state->irq_flags);
}
Then you are accessing network card.
--- Jie Zhang 2009-12-24 02:23:24
Barry, Thanks. Is there a config option in linux kernel, so I can access flash
instead of network?
--- Barry Song 2009-12-24 03:13:35
No special option for it. But deleting "smc91x" and "mtd" in
kernel config will help you. That just keeps the gpio status unchanged.
1.
Ethernet (10 or 100Mbit)
< > SMC 91C9x/91C1xxx support
2.
< > Memory Technology Device (MTD) support
--- Jie Zhang 2009-12-24 03:33:52
Thanks!
--- Mike Frysinger 2009-12-24 07:50:08
why dont you read flash via the /dev/mtd* devices like normal ?
--- Jie Zhang 2009-12-24 08:30:55
I found gdbproxy could not read flash. So I wrote this test case to mimic what
gdbproxy does.
--- Mike Frysinger 2009-12-24 08:40:22
then gdbproxy is behaving correctly and doesnt need changing. it's up to the
user to make sure the board state is how they need it to be.
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
No Files Were Found