From 836807a2ae98ad311e042d44b1e7a0e398b89eb5 Mon Sep 17 00:00:00 2001
From: Keerthy <j-keerthy@ti.com>
Date: Wed, 6 Oct 2021 07:12:09 +0530
Subject: [PATCH] Remove prints to optimize U-Boot time

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/mach-k3/common.c | 16 +---------------
 board/ti/j721e/evm.c      |  8 ++++----
 common/board_f.c          |  2 +-
 common/board_info.c       |  2 --
 common/board_r.c          |  1 -
 common/console.c          |  6 +++---
 env/env.c                 |  4 ++--
 net/eth-uclass.c          |  2 +-
 8 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 180e7f023e..78eef49740 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -77,10 +77,6 @@ void k3_sysfw_print_ver(void)
 	strncpy(fw_desc, ti_sci->version.firmware_description,
 		sizeof(ti_sci->version.firmware_description));
 	fw_desc[sizeof(fw_desc) - 1] = '\0';
-
-	printf("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
-	       ti_sci->version.abi_major, ti_sci->version.abi_minor,
-	       ti_sci->version.firmware_revision, fw_desc);
 }
 
 void mmr_unlock(phys_addr_t base, u32 partition)
@@ -206,7 +202,7 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 	if (ret)
 		panic("rproc failed to be initialized (%d)\n", ret);
 
-	init_env();
+	//init_env();
 	if (!fit_image_info[IMAGE_ID_DM_FW].image_start) {
 		size = load_firmware("name_mcur5f0_0fw", "addr_mcur5f0_0load",
 				     &loadaddr);
@@ -224,9 +220,6 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 	if (ret)
 		panic("%s: ATF failed to load on rproc (%d)\n", __func__, ret);
 
-	/* Add an extra newline to differentiate the ATF logs from SPL */
-	printf("Starting ATF on ARM64 core...\n\n");
-
 	ret = rproc_start(1);
 	if (ret)
 		panic("%s: ATF failed to start on rproc (%d)\n", __func__, ret);
@@ -394,7 +387,6 @@ int print_cpuinfo(void)
 	char name[64];
 	int ret;
 
-	printf("SoC:   ");
 
 	ret = soc_get(&soc);
 	if (ret) {
@@ -403,14 +395,8 @@ int print_cpuinfo(void)
 	}
 
 	ret = soc_get_family(soc, name, 64);
-	if (!ret) {
-		printf("%s ", name);
-	}
 
 	ret = soc_get_revision(soc, name, 64);
-	if (!ret) {
-		printf("%s\n", name);
-	}
 
 	return 0;
 }
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 2f277d3344..2b103c9de3 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -155,7 +155,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
 					 "sram@70000000");
 	if (ret)
-		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
+		debug("%s: fixing up msmc ram failed %d\n", __func__, ret);
 
 	detect_enable_hyperflash(blob);
 
@@ -192,9 +192,9 @@ int checkboard(void)
 
 	if (do_board_detect())
 		/* EEPROM not populated */
-		printf("Board: %s rev %s\n", "J721EX-PM1-SOM", "E2");
+		debug("Board: %s rev %s\n", "J721EX-PM1-SOM", "E2");
 	else
-		printf("Board: %s rev %s\n", ep->name, ep->version);
+		debug("Board: %s rev %s\n", ep->name, ep->version);
 
 	return 0;
 }
@@ -364,7 +364,7 @@ static int probe_daughtercards(void)
 		if (strncmp(ep.name, ext_cards[i].card_name, sizeof(ep.name)))
 			continue;
 
-		printf("Detected: %s rev %s\n", ep.name, ep.version);
+		debug("Detected: %s rev %s\n", ep.name, ep.version);
 		daughter_card_detect_flags[i] = true;
 
 #ifndef CONFIG_SPL_BUILD
diff --git a/common/board_f.c b/common/board_f.c
index 9f441c44f1..aa58f85dde 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -208,7 +208,7 @@ static int print_cpuinfo(void)
 
 static int announce_dram_init(void)
 {
-	puts("DRAM:  ");
+	//puts("DRAM:  ");
 	return 0;
 }
 
diff --git a/common/board_info.c b/common/board_info.c
index a6db087f96..a57f7e8b68 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -22,8 +22,6 @@ int __weak show_board_info(void)
 
 	model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
 
-	if (model)
-		printf("Model: %s\n", model);
 #endif
 
 	return checkboard();
diff --git a/common/board_r.c b/common/board_r.c
index 29dd7d26d9..a7810b3d13 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -625,7 +625,6 @@ static int initr_bbmii(void)
 #ifdef CONFIG_CMD_NET
 static int initr_net(void)
 {
-	puts("Net:   ");
 	eth_initialize();
 #if defined(CONFIG_RESET_PHY_R)
 	debug("Reset Ethernet PHY\n");
diff --git a/common/console.c b/common/console.c
index 3348436da6..7252447b4c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -815,21 +815,21 @@ int console_init_f(void)
 void stdio_print_current_devices(void)
 {
 	/* Print information */
-	puts("In:    ");
+	//puts("In:    ");
 	if (stdio_devices[stdin] == NULL) {
 		puts("No input devices available!\n");
 	} else {
 		printf ("%s\n", stdio_devices[stdin]->name);
 	}
 
-	puts("Out:   ");
+	//puts("Out:   ");
 	if (stdio_devices[stdout] == NULL) {
 		puts("No output devices available!\n");
 	} else {
 		printf ("%s\n", stdio_devices[stdout]->name);
 	}
 
-	puts("Err:   ");
+	//puts("Err:   ");
 	if (stdio_devices[stderr] == NULL) {
 		puts("No error devices available!\n");
 	} else {
diff --git a/env/env.c b/env/env.c
index 37b4b54cb7..4c9e162390 100644
--- a/env/env.c
+++ b/env/env.c
@@ -190,7 +190,7 @@ int env_load(void)
 		if (!env_has_inited(drv->location))
 			continue;
 
-		printf("Loading Environment from %s... ", drv->name);
+		//printf("Loading Environment from %s... ", drv->name);
 		/*
 		 * In error case, the error message must be printed during
 		 * drv->load() in some underlying API, and it must be exactly
@@ -198,7 +198,7 @@ int env_load(void)
 		 */
 		ret = drv->load();
 		if (!ret) {
-			printf("OK\n");
+			//printf("OK\n");
 			gd->env_load_prio = prio;
 
 #if !CONFIG_IS_ENABLED(ENV_APPEND)
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index bb4c362ede..acbef34369 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -443,7 +443,7 @@ int eth_initialize(void)
 				if (num_devices)
 					printf(", ");
 
-				printf("eth%d: %s", dev->seq, dev->name);
+				//printf("eth%d: %s", dev->seq, dev->name);
 
 				if (ethprime && dev == prime_dev)
 					printf(" [PRIME]");
-- 
2.17.1

