From 4061bf81c366ccb309e2e597c5012ca246809b3a Mon Sep 17 00:00:00 2001
From: Bobby The Builder <bob@najdan.com>
Date: Thu, 12 Jan 2023 10:23:39 -0500
Subject: [PATCH] common: expose DRAM clock speed

---
 common/board_f.c | 3 +++
 common/main.c    | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/common/board_f.c b/common/board_f.c
index e6117a7ba5..1fcfd3da86 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -251,6 +251,9 @@ static int show_dram_config(void)
 	debug("\nDRAM:  ");
 
 	print_size(gd->ram_size, "");
+#if defined(CONFIG_DRAM_CLK)
+	printf(" @ %d MHz", CONFIG_DRAM_CLK);
+#endif
 	if (!sizes_near(gd->ram_size, size)) {
 		printf(" (effective ");
 		print_size(size, ")");
diff --git a/common/main.c b/common/main.c
index 682f3359ea..877df4c858 100644
--- a/common/main.c
+++ b/common/main.c
@@ -46,6 +46,12 @@ void main_loop(void)
 	if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
 		env_set("ver", version_string);  /* set version variable */
 
+#if defined(CONFIG_DRAM_CLK)
+	char ram_clk_string[11];
+	sprintf(ram_clk_string, "%d", CONFIG_DRAM_CLK);
+	env_set("ram_freq", ram_clk_string);
+#endif
+
 	cli_init();
 
 	if (IS_ENABLED(CONFIG_USE_PREBOOT))
-- 
2.38.1

