Skip to contentSkip to conversation

memory probe

U-Boot-Users Sumit Chauhan 4 participants 9 messages May 10, 2005 – May 12, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

We are planning to use uboot on our system and wanted to know if u-boot can probe the memory installed on the system automatically and pass the correct mem size to linux kernel ?

Way I could understand it was that the mem size and offset had to be compile time #define'ed ..

what if we want same image to work on 2 different memory configuration hardware ?

how does the memory probe work on PC etc ? bootloaders use BIOS Calls ? how can I do this on my ixdp425 plattform ?

Cheers,
Sumit

#1 lore raw

Hi

Quoted 2 lines

what if we want same image to work on 2 different memory configuration hardware ?

We had such board. One with 32MB and other with 64MB of SDRAM. We used DIP switches, which were read early in a U-Boot, in memsetup.S. On the position of this DIP switch we then decided which path in the mesetup.S to take.
Then, in out dram_init function for our board, we again read the DIP switch and decide what to report as DRAM size.

BR,
Matej

#2 lore raw
Quoted 7 lines · In message <[email protected]> you wrote:

We had such board. One with 32MB and other with 64MB of SDRAM. We used DIP switches, which were read early in a U-Boot, in memsetup.S. On the position of this DIP switch we then decided which path in the mesetup.S to take.
Then, in out dram_init function for our board, we again read the DIP switch and decide what to report as DRAM size.

No need to do this. If implemented correctly, U-Boot will auto- matically find out how big your RAM. This is what the RAM size detection code in common/memsize.c was made for. Just use it.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Nobody trips over mountains. It is the small pebble that  causes  you
to  stumble.  Pass all the pebbles in your path and you will find you
have crossed the mountain.
#3 lore raw

Hi

Quoted 6 lines
Quoted 2 lines

Then, in out dram_init function for our board, we again read the DIP switch and decide what to report as DRAM size.

No need to do this. If implemented correctly, U-Boot will auto- matically find out how big your RAM. This is what the RAM size detection code in common/memsize.c was made for. Just use it.

Yes, but you still need to read the DIP switch in the memsetup.S to properly initialise SDRAM. You can use this code only to report the memory size to U-Boot and the Linux.

BR,
Matej

#4 lore raw
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines

No need to do this. If implemented correctly, U-Boot will auto- matically find out how big your RAM. This is what the RAM size detection code in common/memsize.c was made for. Just use it.

Yes, but you still need to read the DIP switch in the memsetup.S

No, this is NOT necessary.

Quoted 2 lines

to properly initialise SDRAM. You can use this code only to report the memory size to U-Boot and the Linux.

No, this code is used to ADJUST the memory controller to the actual sizes found on the board - you start with a preliminary configuration of the memory controller which assumes that all possible banks are fitted with the maximum amountof memory; then you run get_ram_size() on all of these banks, disable those where a size of 0 is reported, and adjust controller settings according to the sizes reported for the others.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Panic, n.: The second time you can't do it the first time.
#5 lore raw

Hi

Quoted 10 lines
Quoted 2 lines

to properly initialise SDRAM. You can use this code only to report the memory size to U-Boot and the Linux.

No, this code is used to ADJUST the memory controller to the actual sizes found on the board - you start with a preliminary configuration of the memory controller which assumes that all possible banks are fitted with the maximum amountof memory; then you run get_ram_size() on all of these banks, disable those where a size of 0 is reported, and adjust controller settings according to the sizes reported for the others.

I see.
But how can you determine the number of Column/Row address bits and the number of internal SDRAM banks?
Those are the values for the registers MDCNFG for PXA255, for example.

BR,
Matej

#6 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

But how can you determine the number of Column/Row address bits and the number of internal SDRAM banks?

Just try it out :-)

See for example function initdram() in "board/tqm8xx/tqm8xx.c" - here we assume to have a maximum of 2 banks of SRAM, and try out both banks both with 8, 9 and 10 columns each.

Of course we assume that you know which chips and how many banks are theoretically possible on your board.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Where there's no emotion, there's no motive for violence.
	-- Spock, "Dagger of the Mind", stardate 2715.1
#7 lore raw
In reply to Sumit Chauhan
Quoted 5 lines · Sumit Chauhan

Hi,

We are planning to use uboot on our system and wanted to know if u-boot can probe the memory installed on the system automatically and pass the correct mem size to linux kernel ?

Did you read any of the code for your board? BTW, what is your board?

Chances are that it will determine the correct size of your memory dynamically.

Quoted 2 lines

Way I could understand it was that the mem size and offset had to be compile time #define'ed ..

Maybe. Maybe not.

Quoted 2 lines

what if we want same image to work on 2 different memory configuration hardware ?

It might work. What does the code say?

Quoted 1 line

how does the memory probe work on PC etc ?

No idea.

Quoted 2 lines

bootloaders use BIOS Calls ?
how can I do this on my ixdp425 plattform ?

Um, there might be some confusion going on here... What are you wanting to use U-Boot for?

jdl

#8 lore raw
In reply to Sumit Chauhan
Quoted 4 lines · In message <[email protected]> you wrote:

We are planning to use uboot on our system and wanted to know if u-boot can probe the memory installed on the system automatically and pass the correct mem size to linux kernel ?

Yes, it can. Actually this is the default behaviour.

Ummm... why didn't you have a look at the mailing list arcive instead of posting?

Quoted 2 lines

Way I could understand it was that the mem size and offset had to be compile time #define'ed ..

Wrong.

Quoted 2 lines

what if we want same image to work on 2 different memory configuration hardware ?

Just do it. It is up to you how you implement support for your board.

Quoted 1 line

how does the memory probe work on PC etc ? bootloaders use BIOS Calls ?

BIOS? That's a different world. Wrong list.

Quoted 1 line

how can I do this on my ixdp425 plattform ?

Have a look at common/memsize.c and how it's used on other boards.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I mean, I . . . think to understand you, I just don't know  what  you
are saying ...                        - Terry Pratchett, _Soul Music_