The Dual/Quad modules always have twice the size of the Solo/DualLite modules. Determine the size once and multiply it if we are running on a Quad/Dual module. The only special case is the 4GB size where I've copied the value from the vendor u-boot [1]. [1] https://github.com/kontron/u-boot-smarc-samx7/blob/master/board/kontron/amx6/amx6.c Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- arch/arm/boards/kontron-samx6i/mem.c | 34 ++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/arch/arm/boards/kontron-samx6i/mem.c b/arch/arm/boards/kontron-samx6i/mem.c index 8132624e3b..08dceb55c0 100644 --- a/arch/arm/boards/kontron-samx6i/mem.c +++ b/arch/arm/boards/kontron-samx6i/mem.c @@ -49,26 +49,22 @@ resource_size_t samx6i_get_size(void) id0 = imx6_gpio_val(gpio6, 7); id1 = imx6_gpio_val(gpio6, 9); - if (cpu_type == IMX6_CPUTYPE_IMX6D || - cpu_type == IMX6_CPUTYPE_IMX6Q) { - if (id0 && id1) - size = SZ_2G; - else if (id0) - size = SZ_2G; - else if (id1) - size = SZ_1G; - else - size = SZ_512M; - } else if (cpu_type == IMX6_CPUTYPE_IMX6S || - cpu_type == IMX6_CPUTYPE_IMX6DL) { - if (id0 && id1) - size = SZ_2G; - else if (id0) - size = SZ_1G; - else if (id1) - size = SZ_512M; + /* Solo/DualLite module sizes */ + if (id0 && id1) + size = SZ_2G; + else if (id0) + size = SZ_1G; + else if (id1) + size = SZ_512M; + else + size = SZ_256M; + + /* Dual/Quad modules always have twice the size */ + if (cpu_type == IMX6_CPUTYPE_IMX6D || cpu_type == IMX6_CPUTYPE_IMX6Q) { + if (size == SZ_2G) + size = 0xf0000000; /* 4G on a 32bit system */ else - size = SZ_256M; + size *= 2; } return size; -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox