]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ddr: imx: Save the FW loading if it hasn't changed
authorShawn Guo <shawn.guo@linaro.org>
Mon, 2 Jan 2023 12:20:34 +0000 (20:20 +0800)
committerFabio Estevam <festevam@gmail.com>
Wed, 13 Dec 2023 11:44:59 +0000 (08:44 -0300)
Function ddr_load_train_firmware() is called 4 times in a loop by
ddr_cfg_phy(). The first 3 calls are all '1D' type and just loading the
same FWs.  Let's add a type check and save 2 of them.  This helps to
reduce DDRPHY training time from 269 ms down to 212 ms, and thus speed
up boot time ~ 50 ms.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
drivers/ddr/imx/phy/helper.c

index 855a874ac1e1bacd8610549cea4eeda5a6be6d78..b9b2403012d91d6bbf1ea58e1b5dc8c2b261505d 100644 (file)
@@ -49,6 +49,13 @@ void ddr_load_train_firmware(enum fw_type type)
        unsigned long imem_start = (unsigned long)_end + fw_offset;
        unsigned long dmem_start;
        unsigned long imem_len = IMEM_LEN, dmem_len = DMEM_LEN;
+       static enum fw_type last_type = -1;
+
+       /* If FW doesn't change, we can save the loading. */
+       if (last_type == type)
+               return;
+
+       last_type = type;
 
 #ifdef CONFIG_SPL_OF_CONTROL
        if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) {