#include <asm/arch-imx/cpu.h>
#include <asm/mach-imx/s400_api.h>
#include <fuse.h>
+#include <asm/arch/ddr.h>
DECLARE_GLOBAL_DATA_PTR;
__weak int board_phys_sdram_size(phys_size_t *size)
{
+ phys_size_t start, end;
+ phys_size_t val;
+
if (!size)
return -EINVAL;
- *size = PHYS_SDRAM_SIZE;
+ val = readl(REG_DDR_CS0_BNDS);
+ start = (val >> 16) << 24;
+ end = (val & 0xFFFF);
+ end = end ? end + 1 : 0;
+ end = end << 24;
+ *size = end - start;
+
+ val = readl(REG_DDR_CS1_BNDS);
+ start = (val >> 16) << 24;
+ end = (val & 0xFFFF);
+ end = end ? end + 1 : 0;
+ end = end << 24;
+ *size += end - start;
-#ifdef PHYS_SDRAM_2_SIZE
- *size += PHYS_SDRAM_2_SIZE;
-#endif
return 0;
}