We have board polulated with different RAM size, 2 and 4 GB. As far as I can see the RAM size needs to be set up in bootloader by a (as for instance EVK board in /include/configs ...):
/* Totally 6GB DDR */
#define CFG_SYS_SDRAM_BASE 0x40000000
#define PHYS_SDRAM 0x40000000
#define PHYS_SDRAM_SIZE 0xC0000000 /* 3 GB */
#define PHYS_SDRAM_2 0x100000000
#define PHYS_SDRAM_2_SIZE 0xC0000000 /* 3 GB */
Is there any way to have a single Bootloader (so one for both boards) recognise and support different RAM sizes?
Or is it possible to start with smallest subset and "declare" a bigger RAM while booting the kernel?
You can use simple i2c eeprom to store board info, and read it at the beginning of SPL as the SPL has enabled the i2c function at this time, just like pmic_reg_write function.
Yeah, that is what happens in PCs, to have some storage node for this data. But the board is already produced, just the DDR memory is replaced with no other change in design. That is why I can't check GPIOs or some tiny I2C flash.
So the environment is my best (only) option (if this is possible at all). Otherwise I have to deal with two different hard coded uboots, which is a pain in handling too.
Was really surprised to see that neither devicetree in uboot (which wouldn't help here) nor that one in kernel is really used.