1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-13 20:01:55 +00:00
openmptcprouter/root/target/linux/bcm27xx/patches-5.15/0124-firmware-raspberrypi-Report-the-fw-variant-during-pr.patch

109 lines
3.5 KiB
Diff
Raw Normal View History

2021-11-24 17:32:01 +00:00
From f75c4eeea9177ea1d83382807c261ddf7ef630c6 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Thu, 10 Jan 2019 17:58:06 +0000
Subject: [PATCH 124/634] firmware: raspberrypi: Report the fw variant during
probe
The driver already reported the firmware build date during probe.
The mailbox calls have been extended to also report the variant
1 = standard start.elf
2 = start_x.elf (includes camera stack)
3 = start_db.elf (includes assert logging)
4 = start_cd.elf (cutdown version for smallest memory footprint).
Log the variant during probe.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
firmware: raspberrypi: Report the fw git hash during probe
The firmware can now report the git hash from which it was built
via the mailbox, so report it during probe.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/firmware/raspberrypi.c | 40 +++++++++++++++++++++-
include/soc/bcm2835/raspberrypi-firmware.h | 2 ++
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 2a9edea7f0f1..2a7a0a9933d7 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -233,6 +233,15 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
{
time64_t date_and_time;
u32 packet;
+ static const char * const variant_strs[] = {
+ "unknown",
+ "start",
+ "start_x",
+ "start_db",
+ "start_cd",
+ };
+ const char *variant_str = "cmd unsupported";
+ u32 variant;
int ret = rpi_firmware_property(fw,
RPI_FIRMWARE_GET_FIRMWARE_REVISION,
&packet, sizeof(packet));
@@ -242,7 +251,35 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
/* This is not compatible with y2038 */
date_and_time = packet;
- dev_info(fw->cl.dev, "Attached to firmware from %ptT\n", &date_and_time);
+
+ ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_VARIANT,
+ &variant, sizeof(variant));
+
+ if (!ret) {
+ if (variant >= ARRAY_SIZE(variant_strs))
+ variant = 0;
+ variant_str = variant_strs[variant];
+ }
+
+ dev_info(fw->cl.dev,
+ "Attached to firmware from %ptT, variant %s\n",
+ &date_and_time, variant_str);
+}
+
+static void
+rpi_firmware_print_firmware_hash(struct rpi_firmware *fw)
+{
+ u32 hash[5];
+ int ret = rpi_firmware_property(fw,
+ RPI_FIRMWARE_GET_FIRMWARE_HASH,
+ hash, sizeof(hash));
+
+ if (ret)
+ return;
+
+ dev_info(fw->cl.dev,
+ "Firmware hash is %08x%08x%08x%08x%08x\n",
+ hash[0], hash[1], hash[2], hash[3], hash[4]);
}
static void
@@ -338,6 +375,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
g_pdev = pdev;
rpi_firmware_print_firmware_revision(fw);
+ rpi_firmware_print_firmware_hash(fw);
rpi_register_hwmon_driver(dev, fw);
rpi_register_clk_driver(dev);
diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h
index a8cff19aea83..5ccd6dd0b74e 100644
--- a/include/soc/bcm2835/raspberrypi-firmware.h
+++ b/include/soc/bcm2835/raspberrypi-firmware.h
@@ -36,6 +36,8 @@ struct rpi_firmware_property_tag_header {
enum rpi_firmware_property_tag {
RPI_FIRMWARE_PROPERTY_END = 0,
RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
+ RPI_FIRMWARE_GET_FIRMWARE_VARIANT = 0x00000002,
+ RPI_FIRMWARE_GET_FIRMWARE_HASH = 0x00000003,
RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,
--
2.33.1