]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
apalis-imx6: use dynamic DDR calibration
authorFrancesco Dolcini <francesco.dolcini@toradex.com>
Tue, 31 Aug 2021 09:46:06 +0000 (11:46 +0200)
committerStefano Babic <sbabic@denx.de>
Tue, 19 Oct 2021 08:51:39 +0000 (10:51 +0200)
Enable dynamic DDR calibration to have a reliable behavior on edge
temperatures conditions.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
board/toradex/apalis_imx6/apalis_imx6.c
configs/apalis_imx6_defconfig

index f4cd28d49f91890bfe3e70763866b74f81496ff7..25a4cd9f38bbd15b850a63ed4a3de2027accb445 100644 (file)
@@ -1076,6 +1076,24 @@ static void ddr_init(int *table, int size)
                writel(table[2 * i + 1], table[2 * i]);
 }
 
+/* Perform DDR DRAM calibration */
+static void spl_dram_perform_cal(void)
+{
+#ifdef CONFIG_MX6_DDRCAL
+       int err;
+       struct mx6_ddr_sysinfo ddr_sysinfo = {
+               .dsize = 2,
+       };
+
+       err = mmdc_do_write_level_calibration(&ddr_sysinfo);
+       if (err)
+               printf("error %d from write level calibration\n", err);
+       err = mmdc_do_dqs_calibration(&ddr_sysinfo);
+       if (err)
+               printf("error %d from dqs calibration\n", err);
+#endif
+}
+
 static void spl_dram_init(void)
 {
        int minc, maxc;
@@ -1094,6 +1112,7 @@ static void spl_dram_init(void)
                break;
        };
        udelay(100);
+       spl_dram_perform_cal();
 }
 
 void board_init_f(ulong dummy)
index 52f2539f111acfd0303796e9129d65d13a0301bb..329f38d1e42c9653fec4137a420ac0c6b772d6ad 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_SYS_MEMTEST_END=0x10010000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xFFFFDE00
 CONFIG_MX6Q=y
+CONFIG_MX6_DDRCAL=y
 CONFIG_TARGET_APALIS_IMX6=y
 CONFIG_SYS_I2C_MXC_I2C1=y
 CONFIG_SYS_I2C_MXC_I2C2=y