/* imx_ddr_size - return size in bytes of DRAM according MMDC config The MMDC MDCTL register holds the number of bits for row, col, and data width and the MMDC MDMISC register holds the number of banks. Combine all these bits to determine the meme size the MMDC has been configured for  */
unsigned int imx_ddr_size(void)
/* imx_ddr_size - return size in bytes of DRAM according MMDC config The MMDC MDCTL register holds the number of bits for row, col, and data width and the MMDC MDMISC register holds the number of banks. Combine all these bits to determine the meme size the MMDC has been configured for  */
unsigned int imx_ddr_size(void)
{
	struct esd_mmdc_regs *mem = (struct esd_mmdc_regs *)MEMCTL_BASE;
	unsigned int ctl = readl(&mem->ctl);
	unsigned int misc = readl(&mem->misc);
	int bits = 11 + 0 + 0 + 1;
	bits += ESD_MMDC_CTL_GET_ROW(ctl);
	bits += col_lookup[ESD_MMDC_CTL_GET_COLUMN(ctl)];
	bits += bank_lookup[ESD_MMDC_MISC_GET_BANK(misc)];
	bits += ESD_MMDC_CTL_GET_WIDTH(ctl);
	bits += ESD_MMDC_CTL_GET_CS1(ctl);
	if (bits == 32)
		return 0xf0000000;
	return 1 << bits;
}