armbian-build/patch/kernel/archive/meson-6.12/0033-soc-amlogic-meson-mx-socinfo-Add-support-for-the-Tru.patch
Dominik Wójt 5b29f4dd4b
meson: kernel update: legacy -> 6.6, current -> 6.12 (#7801)
* Add MXQ target. Copy HDMI fix from odroid-c1.
* meson8, MXQ: add boot from usb support, configurable dtb
* MXQ: remove boot logo
Built-in U-BOOT is used, so the logo will not be displayed anyway.
* meson: kernel update: legacy -> 6.6, current -> 6.12
* Change Odroid C1 and Onecloud to community supported as build now passes
---------
Co-authored-by: Igor Pecovnik <igor@armbian.com>
2025-02-08 23:08:34 +01:00

69 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: Sun, 16 May 2021 19:48:54 +0200
Subject: soc: amlogic: meson-mx-socinfo: Add support for the TrustZone
firmware
When the TrustZone firmware is enabled the SoC is configured so the boot
ROM cannot be read from the (untrusted) Linux kernel. Instead a firmware
call needs to be used to get the SoC's "misc" version.
Add support for the firmware call to retrieve the SoC's misc version if
the TrustZone firmware is loaded.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/soc/amlogic/meson-mx-socinfo.c | 23 ++++++----
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c b/drivers/soc/amlogic/meson-mx-socinfo.c
index 111111111111..222222222222 100644
--- a/drivers/soc/amlogic/meson-mx-socinfo.c
+++ b/drivers/soc/amlogic/meson-mx-socinfo.c
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
+#include <linux/firmware/meson/meson_mx_trustzone.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -118,10 +119,12 @@ static int __init meson_mx_socinfo_init(void)
if (IS_ERR(assist_regmap))
return PTR_ERR(assist_regmap);
- bootrom_regmap =
- syscon_regmap_lookup_by_compatible("amlogic,meson-mx-bootrom");
- if (IS_ERR(bootrom_regmap))
- return PTR_ERR(bootrom_regmap);
+ if (!meson_mx_trustzone_firmware_available()) {
+ bootrom_regmap =
+ syscon_regmap_lookup_by_compatible("amlogic,meson-mx-bootrom");
+ if (IS_ERR(bootrom_regmap))
+ return PTR_ERR(bootrom_regmap);
+ }
np = of_find_matching_node(NULL, meson_mx_socinfo_analog_top_ids);
if (np) {
@@ -141,10 +144,14 @@ static int __init meson_mx_socinfo_init(void)
if (ret < 0)
return ret;
- ret = regmap_read(bootrom_regmap, MESON_MX_BOOTROM_MISC_VER,
- &misc_ver);
- if (ret < 0)
- return ret;
+ if (meson_mx_trustzone_firmware_available()) {
+ misc_ver = meson_mx_trustzone_read_soc_rev1();
+ } else {
+ ret = regmap_read(bootrom_regmap, MESON_MX_BOOTROM_MISC_VER,
+ &misc_ver);
+ if (ret < 0)
+ return ret;
+ }
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
--
Armbian