Skip to contentSkip to conversation

starting address of mtd device

DISCUSSION Mak Kar 4 participants 11 messages Jul 16, 2004 – Jul 22, 2004 Memory technology devices (MTD)

lore
Share & tools
lore

Mak Kar

author
#0 lore raw

"cat /proc/mtd" would give me just the size of device and erase size.
how can I get the starting address in flash of any single mtd device?

Thanks,
-Mak

__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

#1 lore raw
Quoted 4 lines · Mak Kar

"cat /proc/mtd" would give me just the size of device and erase size.
how can I get the starting address in flash of any single mtd device?

The physical addresses for flash are usually provided by the user in the form of a board map driver. If there isn't a specific map driver for your board, see physmap.c.

In other words, if you don't tell MTD where to look, it won't find anything. :)

josh

#2 lore raw
Quoted 3 lines · Josh Boyer

The physical addresses for flash are usually provided by the user in the form of a board map driver. If there isn't a specific map driver for your board, see physmap.c.

In previous MTD releases there was kernel config parameters CONFIG_MTD_PHYSMAP_START and CONFIG_MTD_PHYSMAP_LEN
and it was enough to provide these parameters at kernel' .config for physmap driver and new board worked. Now I should write my own board map driver.
Why? It is better to restore this nice feature.

#3 lore raw
Quoted 8 lines · Dmitry A. Fedorov

On Mon, 19 Jul 2004, Josh Boyer wrote:

In previous MTD releases there was kernel config parameters CONFIG_MTD_PHYSMAP_START and CONFIG_MTD_PHYSMAP_LEN
and it was enough to provide these parameters at kernel' .config for physmap driver and new board worked. Now I should write my own board map driver.
Why? It is better to restore this nice feature.

That feature hasn't been removed... that's why I said "If there isn't a specific map driver for your board, see physmap.c". So physmap is still there.

However, some people prefer to write their own map drivers for their boards for various reasons. I was simply presenting all the options. Sorry for any confusion.

josh

#4 lore raw
Quoted 9 lines · Josh Boyer
Quoted 7 lines · Dmitry A. Fedorov

In previous MTD releases there was kernel config parameters CONFIG_MTD_PHYSMAP_START and CONFIG_MTD_PHYSMAP_LEN
and it was enough to provide these parameters at kernel' .config for physmap driver and new board worked. Now I should write my own board map driver.
Why? It is better to restore this nice feature.

Quoted 6 lines

That feature hasn't been removed... that's why I said "If there isn't a specific map driver for your board, see physmap.c". So physmap is still there.

However, some people prefer to write their own map drivers for their boards for various reasons. I was simply presenting all the options.

Yes, physmap.c, but now I can't specify address/length for it from kernel .config parameters. Instead, I should create my own module and place it before physmap.o in Makefile.

Well, what about generic physmap board module?
I can make patch.

#5 lore raw
Quoted 3 lines · Dmitry A. Fedorov

Yes, physmap.c, but now I can't specify address/length for it from kernel .config parameters. Instead, I should create my own module and place it before physmap.o in Makefile.

Ah, I see now. I was only looking at the Kconfig file, which still has the options in there. Sorry, I must be especially dense today.

Quoted 3 lines

Well, what about generic physmap board module?
I can make patch.

Jun Sun removed the CONFIG option support a while ago, and then submitted a patch to the list that put it back. Not sure why that patch didn't make it into CVS... it should have.

josh

#6 lore raw
Quoted 7 lines · Josh Boyer
Quoted 3 lines

Well, what about generic physmap board module?
I can make patch.

Jun Sun removed the CONFIG option support a while ago, and then submitted a patch to the list that put it back. Not sure why that patch didn't make it into CVS... it should have.

Jun Sun's patch is in CVS now. CONFIG_MTD_PHSYMAP options are back.

josh

#7 lore raw
Quoted 5 lines · Josh Boyer
Quoted 3 lines

Jun Sun removed the CONFIG option support a while ago, and then submitted a patch to the list that put it back. Not sure why that patch didn't make it into CVS... it should have.

Jun Sun's patch is in CVS now. CONFIG_MTD_PHSYMAP options are back.

Great thanks, now it works.

#8 lore raw
In reply to Dmitry A. Fedorov

"Dmitry A. Fedorov" <[email protected]> writes:
[...]

Quoted 2 lines

Well, what about generic physmap board module?
I can make patch.

I could provide you with one, if you wanted to use it (enables configuration of arbitrarily mapped distinct flash chips via command line, a sample looks like this:

CONFIG_CMDLINE="root=/dev/mtdblock2 physmap=phys_0:0x200000@0x2800000:2,phys_1:0x800000@0x2a00000:2 mtdparts=phys_0:128k(boot),-(root);phys_1:64k(top),8064k(main),64k(bottom)"

Patch is against 2.4.26-stock, but it should be reasonably to generic to port it easily. I am actually using this with the board I am working at the moment, and, except the fact that the *amdstd-functions keep panicking my kernel (next work-step to do ;-), it seems to be working fine.

#9 lore raw
Quoted 10 lines · Rainer Weikusat
Quoted 2 lines · Dmitry A. Fedorov

Well, what about generic physmap board module?
I can make patch.

I could provide you with one, if you wanted to use it (enables configuration of arbitrarily mapped distinct flash chips via command line, a sample looks like this:

CONFIG_CMDLINE="root=/dev/mtdblock2 physmap=phys_0:0x200000@0x2800000:2,phys_1:0x800000@0x2a00000:2 mtdparts=phys_0:128k(boot),-(root);phys_1:64k(top),8064k(main),64k(bottom)"

Thanks a lot, give that to me.

author
#10 lore raw
In reply to Josh Boyer

So, basically If an application gets address as input, it needs a board map driver to figure out which mtd device this address belongs to.
So writing a board specific map driver seems a good solution....

Quoted 13 lines · --- Josh Boyer
Quoted 1 line · Mak Kar

"cat /proc/mtd" would give me just the size of

device

Quoted 3 lines

and erase size.
how can I get the starting address in flash of any single mtd device?

The physical addresses for flash are usually
provided by the user in the
form of a board map driver. If there isn't a
specific map driver for
your board, see physmap.c.

Quoted 7 lines

In other words, if you don't tell MTD where to look, it won't find
anything. :)

josh

__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/