temp/u-boot-pinephone: expose ram_freq in device tree (MR 1998)

Query the ram clock:
cat /proc/device-tree/memory/ram_freq
This commit is contained in:
Bobby The Builder 2021-03-29 18:07:22 -04:00 committed by Oliver Smith
parent 5322350898
commit ba84cd8d49
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 59 additions and 0 deletions

View file

@ -28,6 +28,11 @@ echo Resizing FDT
fdt addr ${fdt_addr_r}
fdt resize
echo Adding FTD RAM clock
fdt mknode / memory
fdt set /memory ram_freq ${ram_freq}
fdt list /memory
echo Booting kernel
gpio set 116
gpio clear 98

View file

@ -0,0 +1,52 @@
From b94ee51a5d818e55b3288d2fa3cbc27837981307 Mon Sep 17 00:00:00 2001
From: Bobby The Builder <bob@najdan.com>
Date: Mon, 29 Mar 2021 16:42:07 -0400
Subject: [PATCH] expose DRAM clock speed
---
common/board_f.c | 6 ++++--
common/main.c | 7 +++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 9f441c44f1..8e005337e6 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -226,12 +226,14 @@ static int show_dram_config(void)
print_size(gd->bd->bi_dram[i].size, "\n");
#endif
}
- debug("\nDRAM: ");
+ debug("\nDRAM Size: ");
print_size(size, "");
board_add_ram_info(0);
putc('\n');
-
+#if defined(CONFIG_DRAM_CLK)
+ printf("DRAM Clock: %d MHz\n", CONFIG_DRAM_CLK);
+#endif
return 0;
}
diff --git a/common/main.c b/common/main.c
index 4b3cd302c3..1dbb44060d 100644
--- a/common/main.c
+++ b/common/main.c
@@ -45,6 +45,13 @@ 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);
+ int ret = env_set("ram_freq", ram_clk_string);
+ printf("Set ram_freq : %s\n", ram_clk_string);
+#endif
+
cli_init();
if (IS_ENABLED(CONFIG_USE_PREBOOT))
--
2.30.2

View file

@ -13,6 +13,7 @@ license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
makedepends="$depends_dev bc dtc python3-dev py3-setuptools swig bison flex openssl-dev arm-trusted-firmware-sun50i crust"
options="!check"
source="https://gitlab.com/pine64-org/u-boot/-/archive/$_commit/u-boot-$_commit.tar.gz
0001-expose-DRAM-clock-speed.patch
update-u-boot
"
builddir="$srcdir/u-boot-$_commit"
@ -46,4 +47,5 @@ package() {
}
sha512sums="73b132cdc26113a83d060f0d243320ca989b4efa98fe95a2205526a42f615ced7046bb9d4878c67a9a550b04c2519d90be3c2272be97c878d759bf5d027cf536 u-boot-7492749fec31b1086bc8933bf113a766aea021aa.tar.gz
3cba8a0e899be8cb0b9260b7a86d4115f74c279a1bac8c1403ee669adf91dca8215d8d2d6395ebb3cd67ce000f37a51d6e033b62a8d616b346a9072fa58a4b70 0001-expose-DRAM-clock-speed.patch
f45b86839992472f2264d3651b28ef7ebe84c77c00fb557db1b381e48350f9687eac1555be8f0c6b1dc5a62299f06010208c73daa9422d58c344ba6bb8c7e22a update-u-boot"