]> code.ossystems Code Review - bsp/u-boot.git/commit
ARM: mx6: Prevent overflow in DRAM size detection
authorMarek Vasut <marex@denx.de>
Sun, 3 Aug 2014 23:47:09 +0000 (01:47 +0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Wed, 20 Aug 2014 15:21:19 +0000 (12:21 -0300)
commitb141ef747268ad8ed27a4b59ad479d558235f18c
tree190d9f1d5f670c6d52e92d3f778aee19654dee12
parentc065fdddb60933217f25b42da9c6d28f60613080
ARM: mx6: Prevent overflow in DRAM size detection

The MX6 DRAM controller can be configured to handle 4GiB of DRAM, but
only 3840 MiB of that can be really used. In case the controller is
configured to operate a 4GiB module, the imx_ddr_size() function will
correctly compute that there is 4GiB of DRAM in the system. Firstly,
the return value is 32-bit, so the function will effectively return
zero. Secondly, the MX6 cannot address the full 4GiB, but only 3840MiB
of all that. Thus, clamp the returned size to 3840MiB in such case.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>
arch/arm/imx-common/cpu.c