aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2023-01-02 20:20:34 +0800
committerFabio Estevam <festevam@gmail.com>2023-12-13 08:44:59 -0300
commitb614ddb5d33556cfeefa874811484b98e05bc461 (patch)
tree1eb3b8f75280e3c66f8d2b2d3bc2d4316dc8171e /drivers
parentbe4a5f7c35685d228b3abc398a8d86c434274de5 (diff)
downloadu-boot-b614ddb5d33556cfeefa874811484b98e05bc461.zip
u-boot-b614ddb5d33556cfeefa874811484b98e05bc461.tar.gz
u-boot-b614ddb5d33556cfeefa874811484b98e05bc461.tar.bz2
ddr: imx: Save the FW loading if it hasn't changed
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ddr/imx/phy/helper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/ddr/imx/phy/helper.c b/drivers/ddr/imx/phy/helper.c
index 855a874..b9b2403 100644
--- a/drivers/ddr/imx/phy/helper.c
+++ b/drivers/ddr/imx/phy/helper.c
@@ -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)) {