From: Piotr Dymacz Date: Tue, 13 Jun 2017 18:25:20 +0000 (+0200) Subject: Fix DRAM type detection on Dragino 2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6d2cdc98fe37c29ec02fb75c0c495329c138e4cc;p=oweals%2Fu-boot_mod.git Fix DRAM type detection on Dragino 2 Dragino 2 needs custom DRAM type detection as it doesn't follow general convention. MEM_TYPE value in BOOT_STRAP register isn't set correctly on this board because only GPIO28 is used for DRAM type detection. This fixes DRAM type detection on new Dragino 2 version which is based on Dragino HE module, with DDR2 memory. --- diff --git a/u-boot/cpu/mips/ar7240/qca_dram.c b/u-boot/cpu/mips/ar7240/qca_dram.c index 86fc3f1..dd4f702 100644 --- a/u-boot/cpu/mips/ar7240/qca_dram.c +++ b/u-boot/cpu/mips/ar7240/qca_dram.c @@ -82,6 +82,23 @@ u32 qca_dram_type(void) & QCA_RST_BOOTSTRAP_MEM_TYPE_MASK) >> QCA_RST_BOOTSTRAP_MEM_TYPE_SHIFT); +/* + * There are two major different versions of Dragino 2. Initial one uses DDR1 + * and a custom PCB. The new one is based on Dragino HE module which has DDR2. + * + * Both versions have a "bug" in DRAM type detection. They don't use both GPIOs + * (12 and 28) for setting DRAM type during bootstrap - only GPIO28 is used. + * + * Therefore, use a custom DRAM type detection here (ignore LSB bit) + */ +#if defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) + dram_type = dram_type >> 1; + + if (dram_type) + dram_type = RAM_MEMORY_TYPE_DDR2; + else + dram_type = RAM_MEMORY_TYPE_DDR1; +#else switch (dram_type) { case QCA_RST_BOOTSTRAP_MEM_TYPE_SDR_VAL: dram_type = RAM_MEMORY_TYPE_SDR; @@ -96,6 +113,7 @@ u32 qca_dram_type(void) dram_type = RAM_MEMORY_TYPE_UNKNOWN; break; } +#endif return dram_type; #endif